Home | History | Annotate | only in /src/sys/arch/sparc
History log of /src/sys/arch/sparc
RevisionDateAuthorComments
 1.11 30-May-2013  macallan install sxreg.h to /usr/include/sparc/
 1.10 04-Apr-2011  dyoung branches: 1.10.4; 1.10.14;
Fix target 'tags'.
 1.9 25-Oct-2008  apb branches: 1.9.16; 1.9.22;
Use ${TOOL_SED} instead if plain sed in Makefiles.
 1.8 06-Jan-2003  lukem branches: 1.8.104; 1.8.108; 1.8.114;
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 12-Jun-1998  cgd branches: 1.7.32;
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.6 11-Oct-1997  mycroft Make these closer to working.
 1.5 24-May-1996  pk branches: 1.5.10;
sync with reality.
 1.4 25-Mar-1996  mrg install stand tools.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 06-Feb-1994  deraadt cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.32.1 07-Jan-2003  thorpej Sync with HEAD.
 1.8.114.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.108.1 04-May-2009  yamt sync with head.
 1.8.104.1 17-Jan-2009  mjf Sync with HEAD.
 1.9.22.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.16.1 21-Apr-2011  rmind sync with head
 1.10.14.1 23-Jun-2013  tls resync from head
 1.10.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2 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.1 19-Apr-1993  cgd branches: 1.1.56;
compile needs to be kept in the distribution
 1.1.56.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:21:21 +0000
 1.54 13-Mar-2013  uwe HE WAS OBEDIANT
 1.53 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.52 11-Mar-2012  nakayama branches: 1.52.2;
Remove stray comments for LKM.
 1.51 22-Nov-2011  tls branches: 1.51.2; 1.51.4; 1.51.8; 1.51.10;

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.50 06-Mar-2011  bouyer branches: 1.50.4;
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.49 23-Nov-2010  hannken branches: 1.49.2; 1.49.4;
Remove unused count from pseudo-device md.
 1.48 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.47 05-Dec-2009  pooka branches: 1.47.2; 1.47.4;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.46 27-Sep-2009  tsutsui Remove commented out and nonexistent cgthree at obio stuff.

SPARCclassic has onboard CG3 but it's internally connected via SBus,
and there is no info about sun4m machines which actually require
cgthree at obio attachment. Info from jdc@.
 1.45 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.44 08-Feb-2009  jdc branches: 1.44.2;
Cosmetic clean up:
options<space><tab>
 1.43 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.42 17-Oct-2007  garbled branches: 1.42.16; 1.42.20; 1.42.26; 1.42.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.41 02-Jun-2007  uwe branches: 1.41.10;
Add COMPAT_40. While here, make COMPAT_30 comment match other COMPAT_*.
 1.40 27-Sep-2006  manu branches: 1.40.8; 1.40.10; 1.40.16;
- Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.39 26-Aug-2006  christos branches: 1.39.2; 1.39.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.38 05-Feb-2006  cube branches: 1.38.2;
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;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.35 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.34 19-Aug-2005  christos 64 bit inode changes.
 1.33 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.32 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.31 25-Feb-2005  simonb branches: 1.31.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.30 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.29 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.28 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.27 10-Nov-2004  christos branches: 1.27.4; 1.27.6;
Add COMPAT_BSDPTY to the rest of the config files.
 1.26 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.25 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.24 07-Oct-2003  tron branches: 1.24.2;
Add COMPAT_16.
 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 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.20 14-May-2002  lukem branches: 1.20.2; 1.20.4;
- Enable NFS_BOOT_DHCP (as well as the existing NFS_BOOT_BOOTPARAM).
DHCP/Bootp is tried before bootparams in the MI nfs mountroot code.
- Change the order in boot.net from "bootparams then bootp" to
"bootp then bootparams", to be consistent with the MI nfs mountroot code.

(Consistency with other NetBSD ports is good, and things still work
for sites that run bootparams but not dhcp/bootp, although I'd argue that
dhcp/bootp is much easier to setup and manage and is easier to debug
than our rpc.bootparamd...)

Per discussion with Paul Kranenburg and Matt Green.
 1.19 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.18 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.17 10-Feb-2002  wiz Update description for icsphy.
 1.16 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.15 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.14 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.13 08-Jul-2001  abs branches: 1.13.2; 1.13.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.12 01-Nov-2000  pk Update comment accompanying the SUN4_MMU3L option.
 1.11 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.10 27-Jul-2000  mrg remove COMPAT_AOUT option.
 1.9 07-Nov-1999  mycroft branches: 1.9.2;
Make this more current.
 1.8 29-Jul-1999  augustss branches: 1.8.2; 1.8.4; 1.8.6;
It's time to be COMPAT_14.
 1.7 28-Jul-1999  drochner update comments for mi VME
 1.6 06-Jun-1999  mrg update this to GENERIC rev. 1.84.
 1.5 19-May-1999  ad SPARC console is black on white, and is centered by default.
 1.4 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.3 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.2 31-Mar-1999  mycroft branches: 1.2.4;
Enable rnd.
 1.1 21-Jan-1999  mycroft Vanity config files.
 1.2.4.2 02-Aug-1999  thorpej Update from trunk.
 1.2.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.4.1 15-Nov-1999  fvdl Sync with -current
 1.8.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.2.2 07-Nov-1999  mycroft Make this more current.
 1.9.2.1 07-Nov-1999  mycroft file BILL-THE-CAT was added on branch comdex-fall-1999 on 1999-11-07 01:09:13 +0000
 1.13.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.13.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.13.8.4 17-Apr-2002  nathanw Catch up to -current.
 1.13.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.13.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.13.8.1 08-Jul-2001  nathanw file BILL-THE-CAT was added on branch nathanw_sa on 2002-01-08 00:27:32 +0000
 1.13.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.13.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.13.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.13.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.13.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.4.1 01-Aug-2002  lukem Pull up revision 1.21 (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.20.2.1 15-Jul-2002  gehenna catch up with -current.
 1.23.2.9 11-Dec-2005  christos Sync with head.
 1.23.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.23.2.6 15-Feb-2005  skrll Sync with HEAD.
 1.23.2.5 04-Feb-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.24.2.1 15-Jul-2004  he Pull up revision 1.25 (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.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.27.6.1 12-Feb-2005  yamt sync with head.
 1.27.4.1 29-Apr-2005  kent sync with -current
 1.31.4.3 03-Sep-2007  yamt sync with head.
 1.31.4.2 30-Dec-2006  yamt sync with head.
 1.31.4.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.2.1 03-Sep-2006  yamt sync with head.
 1.39.4.1 22-Oct-2006  yamt sync with head
 1.39.2.1 18-Nov-2006  ad Sync with head.
 1.40.16.1 26-Jun-2007  garbled Sync with HEAD.
 1.40.10.1 11-Jul-2007  mjf Sync with head.
 1.40.8.1 09-Jun-2007  ad Sync with head.
 1.41.10.1 06-Nov-2007  matt sync with HEAD
 1.42.28.3 28-Apr-2009  skrll Sync with HEAD.
 1.42.28.2 03-Mar-2009  skrll Sync with HEAD.
 1.42.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.42.26.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.42.20.3 11-Aug-2010  yamt sync with head.
 1.42.20.2 11-Mar-2010  yamt sync with head
 1.42.20.1 04-May-2009  yamt sync with head.
 1.42.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.44.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.47.4.3 21-Apr-2011  rmind sync with head
 1.47.4.2 05-Mar-2011  rmind sync with head
 1.47.4.1 30-May-2010  rmind sync with head
 1.47.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.49.4.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.49.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.50.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.50.4.1 17-Apr-2012  yamt sync with head
 1.51.10.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.51.8.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.51.4.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.51.2.1 05-Apr-2012  mrg sync to latest -current.
 1.52.2.1 23-Jun-2013  tls resync from head
 1.2 20-Jun-1998  mrg rename FLOPPY INSTALL, as it is used for cdroms also
 1.1 06-Jun-1998  mrg install floppy kernel
 1.275 01-May-2025  mrg enable apc(4) by default.

it seems that the original commit left it disabled as the linux
driver has a comment about it hanging on prototype systems (that
i don't recall ever hearing about with netbsd), but it's enabled
by default there, so let's enable it by default.

the real benefit here is that qemu-system-sparc detects this and
it idles on the host properly.
 1.274 24-Feb-2025  andvar s/architecure/architecture/ and few other typos in comments.
 1.273 12-Feb-2023  abs branches: 1.273.6;
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.272 29-Sep-2022  riastradh branches: 1.272.4;
swwdog(4): Add to GENERIC kernels.

Plus a handful of others that I'm familiar with. Lots of special-
purpose kernels should probably have this too but I'm not going
through all the arm, mips, and ppc evaluation board kernels to see
which ones are relevant.

Omitted from systems I know to be very small:
- sun2/GENERIC
- dreamcast/GENERIC
Feel free to remove it from others that need to be kept smaller.

Compile-tested a few of these just in case:
- alpha/GENERIC
- amd64/GENERIC
- evbmips/OCTEON
- i386/GENERIC
- riscv/GENERIC

PR kern/29702
 1.271 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.270 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.269 01-Aug-2020  maxv Remove references to BRIDGE_IPF, it is now compiled in by default.
 1.268 19-Jan-2020  thorpej Remove the strip(4) - Starmode Radio IP - pseudo-device driver. It is
long since obsolete.
 1.267 08-May-2019  isaki branches: 1.267.2; 1.267.4;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.266 26-Apr-2019  sevan 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.265 13-Apr-2019  isaki branches: 1.265.2;
Add drvctl to kernel which has audio device.
audiocfg(1) requires drvctl(4).
 1.264 12-Feb-2019  mrg add commented QUOTA2 line.
 1.263 14-Jan-2019  mrg normalise comment for fileassoc(8). from PR#44873.
 1.262 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.261 06-Sep-2018  maxv Retire the 'midway' driver. Discussed on tech-net@ recently and also three
years ago, part of removing the network ATM code.
 1.260 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.259 05-Feb-2018  maxv branches: 1.259.2; 1.259.4;
Nuke DIRECTED_BROADCAST, it is not documented and not enabled anywhere. It
probably wouldn't have built correctly anyway, since there is no associated
defflag.

These ten lines of code in ip_input.c already look a lot better.
 1.258 23-Jan-2018  sevan 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.257 15-Jan-2018  martin Enable DIAGNOSTIC
 1.256 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.255 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.254 30-Jul-2017  maxv Disable svr4 and svr4_32 on sparc, sparc64 and amiga - the only places
where they were still enabled.
 1.253 10-Dec-2016  mrg branches: 1.253.8;
revert the previous. sparc has no spkr.
 1.252 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.251 26-Nov-2016  christos mention PAX_SEGVGUARD dependency on FILEASSOC
 1.250 13-Apr-2016  macallan branches: 1.250.2;
- purge long obsolete RASTERCONSOLE
- add mgx
 1.249 26-Sep-2015  maxv Remove KMEMSTATS. Normally it's ok now.
 1.248 16-Nov-2014  manu branches: 1.248.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.247 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.246 24-Aug-2014  jnemeth Create an "options MODULAR_DEFAULT_AUTOLOAD" config option and add
it to all kernel configs that contain "options MODULAR". This
option turns on module autoloading by default (which is the current
default). This allows people who don't want module autoloading on
by default to disable it by simply removing/commentting this line.
 1.245 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.244 16-Aug-2014  apb Add "options COMPAT_70" to all kernel configuration files that
already had "options COMPAT_60".
 1.243 24-Mar-2014  szptvlfn branches: 1.243.4;
fix manual section numbering of sysctl.
thanks wiz@
 1.242 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.241 05-Jun-2013  christos branches: 1.241.2;
remove obsolete networking options
 1.240 27-Apr-2013  christos the bogus number police
 1.239 27-Apr-2013  christos remove confusing numeric locators where they are unused.
 1.238 02-Mar-2013  christos Under FAST_IPSEC, IPSEC_ESP is mandatory; GC it.
 1.237 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.236 07-Feb-2013  macallan add sx at mainbus
 1.235 17-Oct-2012  apb Add "options COMPAT_60" to all kernel configuration files
that already had "options COMPAT_50".
 1.234 17-Aug-2012  abs branches: 1.234.2;
Ensure all WSDISPLAY_COMPAT_USL entries have same comment
 1.233 26-Jun-2012  macallan switch to WSEMUL_VT100 to reduce differences with sparc64 and other wscons
and fb console using ports
WSEMUL_SUN is left in but commented out so whoever wants it back can have it
with minimal effort
 1.232 11-Mar-2012  nakayama Remove stray comments for LKM.
 1.231 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.230 11-Jan-2012  macallan branches: 1.230.2; 1.230.6; 1.230.8;
include a small font
 1.229 18-Dec-2011  dholland WABPL is no longer considered experimental (has not been for some time)
so update its comment in config files.
 1.228 22-Nov-2011  tls branches: 1.228.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.227 12-Jun-2011  mrg branches: 1.227.2;
enable options MODULAR, now that it is tested to work.
 1.226 17-Jan-2011  jdc branches: 1.226.4;
Add (commented out) LOCKDEBUG and SYSCALL_DEBUG options.
 1.225 23-Nov-2010  hannken branches: 1.225.2;
Remove unused count from pseudo-device md.
 1.224 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.223 29-Apr-2010  chs enable TMPFS in all GENERICs that have MFS enabled.
 1.222 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.221 24-Mar-2010  macallan enable CG12 support
 1.220 01-Mar-2010  macallan branches: 1.220.2;
enable PNOZZ_USE_LATCH in case we run into some hardware which needs it
 1.219 15-Jan-2010  bouyer branches: 1.219.2;
Add apc(4), a driver for the Aurora Personality Chip (APC) found
on SPARCstation-4/5, and emulated by qemu to idle the simulator
when the CPU is idle. Infos about the registers from the linux driver.
Not enabled by default because it can cause some Sparc systems to
hang (so says the linux driver).
Only the CPU idle part implemented at this time; fan speed and
Convenience power outlet management to be added.
Tested on qemu.
 1.218 05-Dec-2009  pooka Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.217 27-Nov-2009  tsutsui Move some devices where they should belong to.
 1.216 27-Sep-2009  tsutsui Remove commented out and nonexistent cgthree at obio stuff.

SPARCclassic has onboard CG3 but it's internally connected via SBus,
and there is no info about sun4m machines which actually require
cgthree at obio attachment. Info from jdc@.
 1.215 06-Aug-2009  macallan enable the tcx driver
 1.214 22-Jun-2009  tsutsui Enable ddb(4) for sparc GENERIC-like kernels.
Discussed on port-sparc@.
 1.213 05-May-2009  macallan enable ZX/Leo since we now support wscons on it
 1.212 24-Mar-2009  tsutsui Put back zstty0 and zstty1 lines for onboard zs(4) serial ports
so that they are properly assinged to ttya and ttyb as pre-wscons kernels.
Ok'ed by macallan@.
 1.211 08-Feb-2009  jdc branches: 1.211.2;
Cosmetic clean up:
options<space><tab>
 1.210 27-Jan-2009  mrg normalise a comment.
 1.209 24-Jan-2009  mrg add COMPAT_50 to all the configs with COMPAT_40.
 1.208 14-Dec-2008  macallan wscons here we come!
(finally)
 1.207 24-Nov-2008  ad Remove softdep, pass 1. We are focused on improving journalling.

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

Proposed on tech-kern@.
 1.205 10-Aug-2008  tls branches: 1.205.2; 1.205.4; 1.205.8;
Add accept filters to GENERIC kernels where they exist.
 1.204 31-Jul-2008  simonb Add "options WAPBL" to standard GENERIC/INSTALL type configs.
 1.203 31-Dec-2007  ad branches: 1.203.6; 1.203.10; 1.203.12; 1.203.16;
Remove systrace. Ok core@.
 1.202 04-Nov-2007  xtraeme branches: 1.202.2; 1.202.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.201 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.200 06-Aug-2007  adrianp branches: 1.200.2; 1.200.6;
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.199 04-Jun-2007  martin branches: 1.199.2; 1.199.4; 1.199.8;
Add pseudo-device agr to all GENERIC kernels where it might make sense
(commented out in some).
 1.198 02-Jun-2007  uwe Add COMPAT_40. While here, make COMPAT_30 comment match other COMPAT_*.
 1.197 04-Dec-2006  elad branches: 1.197.6; 1.197.8; 1.197.14;
sparc64: don't enable PaX MPROTECT by default for now.
sparc: add commented out 'FILEASSOC'.
 1.196 11-Nov-2006  jmmv branches: 1.196.2;
Remove tmpfs's experimental status. OK'ed by core@.
 1.195 27-Sep-2006  manu - Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.194 26-Sep-2006  elad Oops! forgot "options" in previous commit. Pointed out by freza@, thanks!
 1.193 26-Sep-2006  elad Make PaX mprotect(2) restrictions more accessible.

On amd64, sparc64, i386, and alpha, they will be compiled in and disabled
by default. That means that to use them you either enable the "global"
knob with sysctl, or use paxctl(1) to enable it on a per-program basis.

On sparc and macppc just include a commentd out line in the GENERIC kernel.
 1.192 26-Aug-2006  christos branches: 1.192.2; 1.192.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.191 26-Aug-2006  tsutsui Remove obsolete #options VERIFIED_EXEC, found by grep(1).
 1.190 12-Aug-2006  christos Disable SYSTRACE by default on all kernels (discussed with core)
 1.189 31-Jul-2006  hubertf branches: 1.189.2;
spc(4) can also attach to pcmcia(4), as was already in hpcmips/GENERIC
for quite some time. Add it to all systems that have pcmcia SCSI.

Pointed out by Bj�rn Johannesson <rherdware@yahoo.com> in private mail,
OK'd by matt@
 1.188 28-Jun-2006  liamjfoy Add CARP to GENERIC kernel configs. CARP is not enabled by default.

ok: christos
 1.187 28-Mar-2006  pavel branches: 1.187.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.186 09-Mar-2006  macallan branches: 1.186.2;
add commented out DBRI_* options
 1.185 05-Feb-2006  cube branches: 1.185.2; 1.185.4;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.184 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.183 02-Feb-2006  reinoud branches: 1.183.2;
Add commented out UDF file-system entry in all GENERIC configurations.
 1.182 09-Dec-2005  elad branches: 1.182.2; 1.182.4;
Add (commented out) Veriexec options and pseudo-device to GENERIC kernels,
and remove the i386 GENERIC_VERIEXEC config.
 1.181 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.180 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.179 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.178 19-Aug-2005  christos 64 bit inode changes.
 1.177 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.176 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.175 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.174 16-Jul-2005  macallan add dbri audio driver
 1.173 10-Jul-2005  macallan added Tadpole TS102 SBus-PCMCIA bridge driver (tslot)
 1.172 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.171 25-Jun-2005  rpaulo branches: 1.171.2;
Add file-system PTYFS (commented out) so that people know its existence.

Ok'ed by Christos Zoulas and Hubert Feyrer.
 1.170 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.169 18-Feb-2005  dsl branches: 1.169.4;
Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.168 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.167 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.166 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.165 17-Jan-2005  cube branches: 1.165.2;
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.164 10-Nov-2004  christos branches: 1.164.4;
Add COMPAT_BSDPTY to the rest of the config files.
 1.163 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.162 01-Aug-2004  mrg add entries for spif/stty/sbpp. final part of PR#26061.
 1.161 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.160 10-Jul-2004  uwe options<space> police.
 1.159 05-Jul-2004  pk Enable the `nell' pcmcia bridge.
 1.158 05-Jul-2004  martin Options FULL_SPARC_BUS_SPACE is gone.
 1.157 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.156 26-Jun-2004  abs Add (commented out) ALTQ options to all GENERIC-like files
 1.155 22-Jun-2004  itojun have pf and pflog pseudo-device (commented out).
reviewed by matt, perry, christos
 1.154 18-Jun-2004  christos ptm is now mandatory, depends on pty, and can be disabled with -DNO_DEV_PTM
 1.153 16-Jun-2004  christos Add pseudo-device ptm on all the generic flavored kernels.
 1.152 02-May-2004  christos add COMPAT_20
 1.151 10-Apr-2004  fair Add comment to indicate that the SunSwift Sbus HME/FAS366 SCSI
combination board attaches esp* at sbus*; it's not just "older proms"
 1.150 03-Apr-2004  chs add some SUN4D stuff.
zs and zstty no longer need "needs-count" or "needs-flag",
so get rid of those and wild-card the extra zs devices on SUN4D.
 1.149 17-Dec-2003  martin branches: 1.149.2;
Fix commented out pcmcia entries: adjust comments, add FULL_SPARC_BUS_SPACE,
adapt wd* at pcmcia to new atabus attachment, and add wi* at pcmcia.
Noticed by Michael Wolfson.
 1.148 07-Oct-2003  tron Add COMPAT_16.
 1.147 26-Apr-2003  ragge branches: 1.147.2;
Add pseudo-device ksyms.
 1.146 10-Apr-2003  christos Bye Bye UCONSOLE
 1.145 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.144 22-Nov-2002  wiz Fix typo (responsiness -> responsiveness).
 1.143 18-Oct-2002  junyoung Add NEW_BUFQ_STRATEGY (disabled by default).
 1.142 15-Oct-2002  jdc Uncomment audioamd0 at obio0.
 1.141 14-Oct-2002  elric Added commented out cgd(4)s to GENERIC configs.
 1.140 06-Oct-2002  provos add SYSTRACE; approved perry.
 1.139 25-Sep-2002  martti Add one space between "#option" and "<tab>IPFILTER_DEFAULT_BLOCK"
 1.138 20-Sep-2002  martti Added (commented out) IPFILTER_DEFAULT_BLOCK.
 1.137 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.136 13-Sep-2002  ad Driver for the Sun ZX/Leo framebuffer. This would be called leo, but the
amiga port already has a driver by that name.
 1.135 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.134 14-May-2002  lukem branches: 1.134.2; 1.134.4;
- Enable NFS_BOOT_DHCP (as well as the existing NFS_BOOT_BOOTPARAM).
DHCP/Bootp is tried before bootparams in the MI nfs mountroot code.
- Change the order in boot.net from "bootparams then bootp" to
"bootp then bootparams", to be consistent with the MI nfs mountroot code.

(Consistency with other NetBSD ports is good, and things still work
for sites that run bootparams but not dhcp/bootp, although I'd argue that
dhcp/bootp is much easier to setup and manage and is easier to debug
than our rpc.bootparamd...)

Per discussion with Paul Kranenburg and Matt Green.
 1.133 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.132 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.131 10-Feb-2002  wiz Update description for icsphy.
 1.130 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.129 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.128 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.127 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.126 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.125 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.124 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.123 01-Sep-2001  atatat branches: 1.123.6;
Comment out bridge pseudo devices from ports that don't
__HAVE_GENERIC_SOFT_INTERRUPTS. bridge(4) doesn't compile there.
 1.122 01-Sep-2001  atatat Add bridge pseudo devices to GENERIC configs
 1.121 30-Jun-2001  darcy branches: 1.121.2;
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.120 05-May-2001  hubertf vlan does not belong to the IPv6 devices (gif, stf, ...), so seperate it
visually.
 1.119 19-Dec-2000  bouyer branches: 1.119.2;
Add pseudo-device vlan
 1.118 16-Oct-2000  mjacob Hmm- probably really ought to put ses into sparc GENERIC, since sparc
machines are one is very likely to run into SES units (what with all
the D1000's && A1000s out there now). I'll do it in sparc64 as soon
as I get that running for myself.
 1.117 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.116 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.115 27-Jul-2000  mason Moving to a default of 64 PTYs.
 1.114 27-Jul-2000  mrg remove COMPAT_AOUT option.
 1.113 15-Jul-2000  matt Add com* at obio0. (Tadpole & JavaStation)
 1.112 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.111 30-Jun-2000  itojun add PULLDOWN_TEST for all the platforms.
XXX should be moved to somewhere else when stabilized
 1.110 22-Jun-2000  fvdl Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.109 21-Jun-2000  pk Enable SUN4_MMU3L (sun4/400 3-level MMU support)
 1.108 20-Jun-2000  pk Update entries for VME devices ie[1-4].
 1.107 14-Jun-2000  veego branches: 1.107.2;
Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.106 27-May-2000  matt Add tadpole specific devices.
 1.105 08-May-2000  augustss branches: 1.105.2;
Add (sometimes commented out) MIIVERBOSE option.
 1.104 19-Apr-2000  itojun add stf pseudo interface (commented out due to possible security risks)
 1.103 17-Apr-2000  pk Comment-out the RASTERCONSOLE_{BG,FG} color settings; they represent
the default initialization.
 1.102 29-Feb-2000  simonb Do the "<space><tab>" thing with the RAID_AUTOCONFIG option.
 1.101 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.100 14-Feb-2000  pk remove `flags' from sun4 zs declarations; the driver doesn't use it.
 1.99 12-Feb-2000  pk Correct comments on KGDB_* entries.
 1.98 07-Feb-2000  pk Enable the hme ethernet driver.
 1.97 28-Jan-2000  cjs Add bpp (parallel port) device.
 1.96 23-Jan-2000  hubertf Add commented out "ident"-command
 1.95 20-Jan-2000  wrstuden Add overlay to kernel configs.
 1.94 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.93 15-Nov-1999  fvdl Add commented out option SOFTDEP to all GENERIC kernels.
 1.92 13-Nov-1999  matt Nuke TCP_COMPAT_42. Use sysctl to enable it if required.
 1.91 14-Oct-1999  phil branches: 1.91.2; 1.91.4;
Add in the Coda file system and pseudo device.
 1.90 04-Oct-1999  hubertf branches: 1.90.2;
Document what qec, be and qe is.
Thanks to Jason Thorpe for explaining!
 1.89 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.88 28-Jul-1999  drochner adapt to mi VME attachment (sorry for being late)
 1.87 28-Jul-1999  christos make the vme stuff compile again; I am not sure this is correct as I don't
have the hardware to test, but it has been broken for 3+ weeks now. Hi
Mr. Drochner!
 1.86 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.85 28-Jun-1999  pk Prepare entry for `hme at sbus'; commented out until driver is finished.
 1.84 06-Jun-1999  mrg EXEC_ELF32 is now default. enable "rnd"
 1.83 06-Jun-1999  pk Add COMPAT_AOUT.
 1.82 19-May-1999  ad SPARC console is black on white, and is centered by default.
 1.81 01-May-1999  pk No need to disable MII devices in previous.
 1.80 30-Apr-1999  abs Comment out nell and pcmcia children until audioamd panic resolved
 1.79 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.78 14-Apr-1999  pk Fix TAB-jump lossage in previous.
 1.77 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.76 17-Jan-1999  pk branches: 1.76.2;
Add `qe'.
 1.75 16-Jan-1999  pk Add `be' + MII devices.
Add PCMCIA devices that are known to compile at the moment.
 1.74 13-Jan-1999  pk Add `eccmemctl' entry.
 1.73 25-Nov-1998  hwr Add (commented out) 'gre' pseudo device line. Feedback is welcome.
Inspired by Klaus Klein.
 1.72 22-Nov-1998  pk Connect the PCMCIA bus.
 1.71 16-Nov-1998  oster Added a (commented out) configuration line for the RAIDframe device driver.
 1.70 27-Aug-1998  pk Add `audiocs' ("SUNW,CS4231") and `en' ("ENI-155s").
 1.69 23-Jul-1998  pk Option DDB_ONPANIC needs a value.
 1.68 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.67 20-May-1998  pk Enable NTP.
 1.66 20-May-1998  pk Add entries for the magma SBus serial/parallel port driver.
 1.65 05-May-1998  mrg make UVM the default on the sparc
 1.64 18-Apr-1998  pk Define `xbox'.
 1.63 21-Mar-1998  pk We can't currently attach `audioamd' at `obio'.
 1.62 18-Mar-1998  bouyer Add commented out "options FFS_EI"
 1.61 08-Feb-1998  thorpej Remove the pager options; they're in std.sparc, and will stay there
until UVM is no longer optional.
 1.60 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.59 04-Feb-1998  pk * Correct vme addresses in `xd' and `xy' declarations.
* Renamed option: MMU_3L => SUN4_MMU3L
* Enter NFS_BOOT_PARAM option.
 1.58 25-Jan-1998  pk VME device declaration changes:
- `vmes,vmel' => `vme'
- interrupt locator is the VME interrupt priority (`pri')
 1.57 23-Jan-1998  pk Add a couple of options I forgot in last commit.
 1.56 20-Jan-1998  pk Put back `le0 at lebuffer0' for backwards compatibility.
 1.55 11-Jan-1998  pk More comments and general re-organization (group by device class) provided
by Todd Vierling.
 1.54 30-Nov-1997  mjacob add missing COMPAT_13 that kleink putzed
 1.53 20-Nov-1997  fair add pseudo-device rnd, commented out
 1.52 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.51 20-Oct-1997  pk branches: 1.51.2;
Enable `reselect' and `synch negotiation' by default.
 1.50 17-Oct-1997  gwr Use common zs code.
 1.49 27-Sep-1997  mrg add (commented) options BLINK, per PR#4075.
 1.48 23-Aug-1997  mjacob add a before tab to SCSIVERBOSE
 1.47 20-Aug-1997  mjacob add commented out reference SCSIVERBOSE option
 1.46 19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.45 07-Jul-1997  pk branches: 1.45.2;
Add `maxusers' line and set it to 32.
 1.44 10-Jun-1997  pk ie2,ie3 and ie4 are 32-bit.
 1.43 07-May-1997  lukem clean up use of whitespace
 1.42 13-Mar-1997  cgd add in the 'isp' device, for Qlogic ISP 1020-based Sbus SCSI board support
 1.41 04-Feb-1997  pk typo.
 1.40 31-Jan-1997  thorpej Adopt for new file system and root spec grammar.
 1.39 17-Jan-1997  mrg add MSDOSFS.
 1.38 07-Jan-1997  mrg branches: 1.38.2;
use pseudo-device ipfilter, not ipl.
 1.37 06-Jan-1997  mrg add PFIL_HOOK and ipl, both commented.
 1.36 06-Dec-1996  pk Uncomment lebuffer devices
 1.35 18-Nov-1996  pk Move *PAGER options and `machine sparc' to std.sparc.
 1.34 03-Nov-1996  pk Declare device `audio' at sbus.
 1.33 03-Oct-1996  abrown Add cgfourteen framebuffer to generic configs
 1.32 02-Oct-1996  mrg update for exec changes.
 1.31 26-Aug-1996  mrg add COMPAT_12.
 1.30 20-Jun-1996  pk Turn on disconnect/reselect by default on targets 4-7 on the premise that
tape devices normally are set to one of these targets. Tape devices should
be allowed to disconnect for the SCSI bus to operate acceptably.
 1.29 19-Jun-1996  pk add tcx
 1.28 21-May-1996  pk branches: 1.28.2;
Remove the `espdma' special case; all `esp' related dma channels are now
called `dma' on all architectures. Note: `ledma' remains in place.

Also delete a couple of unneeded `needs-flag's in files.sparc.
 1.27 17-May-1996  abrown Add Sun4m power0 power status/control register to GENERIC configuration
 1.26 16-May-1996  pk Add `flags' to the esp entries: disable disconnect & synch negotiation
by default until further notice.
 1.25 16-May-1996  pk Change attributes of `dma', `espdma' and `ledma' (the attributes on the latter
two didn't seem to make much sense anyway..) to allow `esp' devices to be
attached to one of `sbus', `dma' and `espdma'.

Remove the wildcarded `espdma?' and `ledma?' attachments of `esp' and `le'
respectively, in favour of `dma?' and `lebuffer?' (but the latter is not
yet implemented), which seems to better match reality: additional SBus
SCSI/Lance boards call themselves `dma' and `lebuffer'.
 1.24 16-May-1996  thorpej Document the "flags" for the si and sw controllers. While I'm here,
do some re-arrangement (cleanup), and document which devices exist on
which machines, so that people can be better informed when they trim
down their kernels. There are a LOT of comments in this file now!
 1.23 01-Apr-1996  pk Update device list.
 1.22 31-Mar-1996  pk Updates for sun4m.
 1.21 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.20 01-Jan-1996  thorpej "si" and "sw" actually interrupt at level 3 (which I quickly discovered
when porting the driver).
 1.19 08-Oct-1995  pk Add forgotten `eeprom' configuration.
 1.18 04-Oct-1995  pk RCONSOLE => RASTERCONSOLE
 1.17 25-Sep-1995  pk Correct cgtwo address.
 1.16 25-Sep-1995  chuck add "xy" xylogics 450/451 config stuff
 1.15 17-Sep-1995  pk vmes => vmes0
 1.14 17-Sep-1995  pk Add cgtwo0.
 1.13 11-Sep-1995  pk `si' and `sw' are scsibusses.
 1.12 05-Sep-1995  pk Add `sw' scsi adapter on obio (per Jason Thorpe, PR#1422).
 1.11 29-Aug-1995  pk Add bwtwo@obio specs (from Jason Thorpe).
 1.10 08-Jul-1995  pk si scsi driver configs.
 1.9 26-Jun-1995  pk xd definitions, from Chuck Cranor.
 1.8 05-Jun-1995  pk Add UNION option.
 1.7 02-Jun-1995  pk Update SCSI decls.
 1.6 02-Mar-1995  pk Make more generic.
 1.5 01-Mar-1995  pk Better 4/100 support.
 1.4 25-Jan-1995  cgd vn -> vnd renaming, for consistency
 1.3 17-Dec-1994  deraadt correct ie[1234] addreses
 1.2 16-Dec-1994  deraadt ie[01234] and obclock
 1.1 07-Dec-1994  deraadt bigtime cleanup
 1.28.2.1 02-Jul-1996  jtc merge in rev 1.29=>1.30
> Turn on disconnect/reselect by default on targets 4-7 ...
 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.45.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.45.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.45.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.51.2.1 20-Nov-1997  mellon Pull rev 1.53 up from trunk (fair)
 1.76.2.4 05-Jul-2000  he Pull up revision 1.112 (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.76.2.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.76.2.2 05-Jan-2000  he Pull up revision 1.91 (requested by phil):
Add coda to the sparc port and enable in GENERIC.
 1.76.2.1 02-May-1999  perry branches: 1.76.2.1.2;
pullup 1.79->1.81 (pk and abs)
 1.76.2.1.2.3 02-Aug-1999  thorpej Update from trunk.
 1.76.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.76.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.90.2.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.90.2.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.91.4.1 15-Nov-1999  fvdl Sync with -current
 1.91.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.91.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.105.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.107.2.5 06-May-2001  he Pull up revision 1.120 (requested by hubertf):
Visually separate the vlan(4) device from the IPv6 devices.
 1.107.2.4 01-May-2001  he Pull up revision 1.119 (requested by he):
Add pseudo-device vlan.
Make sure "rnd is EXPERIMENTAL" comment is removed.
 1.107.2.3 11-Aug-2000  mason Move to default of 64 PTYs in GENERIC kernel config.
Requested by mason, approved by jhawk.
 1.107.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.107.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.119.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.121.2.7 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.121.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.121.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.121.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.121.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.121.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.121.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.123.6.9 11-Dec-2002  thorpej Sync with HEAD.
 1.123.6.8 11-Nov-2002  nathanw Catch up to -current
 1.123.6.7 18-Oct-2002  nathanw Catch up to -current.
 1.123.6.6 17-Sep-2002  nathanw Catch up to -current.
 1.123.6.5 20-Jun-2002  nathanw Catch up to -current.
 1.123.6.4 17-Apr-2002  nathanw Catch up to -current.
 1.123.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.123.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.123.6.1 01-Sep-2001  nathanw file GENERIC was added on branch nathanw_sa on 2002-01-08 00:27:33 +0000
 1.134.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.134.4.1 01-Aug-2002  lukem Pull up revision 1.135 (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.134.2.1 15-Jul-2002  gehenna catch up with -current.
 1.147.2.10 11-Dec-2005  christos Sync with head.
 1.147.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.147.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.147.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.147.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.147.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.147.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.147.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.147.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.147.2.1 03-Aug-2004  skrll Sync with HEAD
 1.149.2.5 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.2.4 15-Jul-2004  he branches: 1.149.2.4.2; 1.149.2.4.4;
Pull up revision 1.161 (via patch, requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.149.2.3 02-Jul-2004  he Pull up revision 1.157 (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.149.2.2 30-Jun-2004  jdc Pull up revision 1.156 (requested by abs in ticket #567).

Add (commented out) ALTQ options to all GENERIC-like files
 1.149.2.1 12-Apr-2004  jmc Pullup rev 1.151 (requested by fair in ticket #114)

Add comment to indicate that the SunSwift Sbus HME/FAS366 SCSI
combination board attaches esp* at sbus*; it's not just "older proms"
 1.149.2.4.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.149.2.4.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.164.4.1 29-Apr-2005  kent sync with -current
 1.165.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.165.2.1 12-Feb-2005  yamt sync with head.
 1.169.4.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.169.4.2 14-Aug-2005  riz branches: 1.169.4.2.2; 1.169.4.2.4;
Pull up revision 1.175 (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.169.4.1 18-Jul-2005  riz Pull up revision 1.172 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.169.4.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.169.4.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.171.2.5 21-Jan-2008  yamt sync with head
 1.171.2.4 15-Nov-2007  yamt sync with head.
 1.171.2.3 03-Sep-2007  yamt sync with head.
 1.171.2.2 30-Dec-2006  yamt sync with head.
 1.171.2.1 21-Jun-2006  yamt sync with head.
 1.182.4.1 09-Sep-2006  rpaulo sync with head
 1.182.2.1 18-Feb-2006  yamt sync with head.
 1.183.2.1 22-Apr-2006  simonb Sync with head.
 1.185.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.185.2.4 03-Sep-2006  yamt sync with head.
 1.185.2.3 11-Aug-2006  yamt sync with head
 1.185.2.2 01-Apr-2006  yamt sync with head.
 1.185.2.1 13-Mar-2006  yamt sync with head.
 1.186.2.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.187.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.189.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.189.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.192.4.2 10-Dec-2006  yamt sync with head.
 1.192.4.1 22-Oct-2006  yamt sync with head
 1.192.2.2 12-Jan-2007  ad Sync with head.
 1.192.2.1 18-Nov-2006  ad Sync with head.
 1.196.2.3 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.196.2.2 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.196.2.1 09-Dec-2006  bouyer branches: 1.196.2.1.2;
Pull up following revision(s) (requested by elad in ticket #254):
sys/arch/sparc64/conf/GENERIC: revision 1.80
sys/arch/sparc/conf/GENERIC: revision 1.197
sparc64: don't enable PaX MPROTECT by default for now.
sparc: add commented out 'FILEASSOC'.
 1.196.2.1.2.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.197.14.2 03-Oct-2007  garbled Sync with HEAD
 1.197.14.1 26-Jun-2007  garbled Sync with HEAD.
 1.197.8.1 11-Jul-2007  mjf Sync with head.
 1.197.6.3 03-Dec-2007  ad Sync with HEAD.
 1.197.6.2 20-Aug-2007  ad Sync with HEAD.
 1.197.6.1 09-Jun-2007  ad Sync with head.
 1.199.8.2 04-Nov-2007  jmcneill Sync with HEAD.
 1.199.8.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.199.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.199.2.1 07-Aug-2007  matt Sync with HEAD.
 1.200.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.200.2.2 09-Jan-2008  matt sync with HEAD
 1.200.2.1 06-Nov-2007  matt sync with HEAD
 1.202.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.202.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.203.16.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.203.16.1 19-Oct-2008  haad Sync with HEAD.
 1.203.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.203.10.6 11-Aug-2010  yamt sync with head.
 1.203.10.5 11-Mar-2010  yamt sync with head
 1.203.10.4 19-Aug-2009  yamt sync with head.
 1.203.10.3 18-Jul-2009  yamt sync with head.
 1.203.10.2 16-May-2009  yamt sync with head
 1.203.10.1 04-May-2009  yamt sync with head.
 1.203.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.203.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.205.8.1 21-Apr-2010  matt sync to netbsd-5
 1.205.4.4 27-Jan-2010  sborrill Pull up the following revisions(s) (requested by bouyer in ticket #1248):
sys/arch/sparc/conf/GENERIC: revision 1.219
sys/arch/sparc/conf/files.sparc: revision 1.149
sys/arch/sparc/dev/apc.c: revision 1.1
sys/arch/sparc/dev/apcreg.h: revision 1.1
sys/dev/DEVNAMES: revision 1.255

Add apc(4), a driver for the Aurora Personality Chip (APC) found
on SPARCstation-4/5, and emulated by qemu to idle the simulator
when the CPU is idle. Infos about the registers from the linux driver.
Not enabled by default because it can cause some Sparc systems to
hang (so says the linux driver).
Only the CPU idle part implemented at this time; fan speed and
Convenience power outlet management to be added.
Tested on qemu.
 1.205.4.3 18-Oct-2009  bouyer Back out 965
 1.205.4.2 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #965):
sys/arch/sparc/conf/GENERIC: revision 1.208
wscons here we come!
(finally)
 1.205.4.1 16-Oct-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #1065):
sys/arch/sparc/conf/GENERIC: revision 1.214
sys/arch/sparc/conf/KRUPS: revision 1.50
sys/arch/sparc/conf/MRCOFFEE: revision 1.28
sys/arch/sparc/conf/TADPOLE3GX: revision 1.47
Enable ddb(4) for sparc GENERIC-like kernels.
Discussed on port-sparc@.
 1.205.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.205.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.205.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.211.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.219.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.219.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.220.2.2 05-Mar-2011  rmind sync with head
 1.220.2.1 30-May-2010  rmind sync with head
 1.225.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.226.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.227.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.227.2.2 30-Oct-2012  yamt sync with head
 1.227.2.1 17-Apr-2012  yamt sync with head
 1.228.2.3 05-Apr-2012  mrg sync to latest -current.
 1.228.2.2 11-Mar-2012  mrg sync to latest -current
 1.228.2.1 18-Feb-2012  mrg merge to -current.
 1.230.8.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.230.6.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.230.2.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.234.2.5 03-Dec-2017  jdolecek update from HEAD
 1.234.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.234.2.3 23-Jun-2013  tls resync from head
 1.234.2.2 25-Feb-2013  tls resync with head
 1.234.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.241.2.2 18-May-2014  rmind sync with head
 1.241.2.1 28-Aug-2013  rmind sync with head
 1.243.4.4 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.243.4.3 15-May-2015  snj branches: 1.243.4.3.2; 1.243.4.3.6;
Pull up following revision(s) (requested by jnemeth in ticket #762):
share/man/man4/options.4: revision 1.442
sys/arch/amd64/conf/ALL: revision 1.18
sys/arch/amd64/conf/GENERIC: revision 1.396
sys/arch/dreamcast/conf/GENERIC: revision 1.119
sys/arch/epoc32/conf/GENERIC: revision 1.6
sys/arch/evbarm/conf/BCM5301X: revision 1.24
sys/arch/evbarm/conf/BCM56340: revision 1.9
sys/arch/evbarm/conf/IMX23_OLINUXINO: revision 1.9
sys/arch/evbarm/conf/std.beagle: revision 1.13
sys/arch/evbarm/conf/std.kobo: revision 1.2
sys/arch/evbarm/conf/std.netwalker: revision 1.10
sys/arch/evbppc/conf/P2020DS: revision 1.25
sys/arch/evbppc/conf/RB800: revision 1.30
sys/arch/evbppc/conf/TWRP1025: revision 1.18
sys/arch/hp300/conf/GENERIC: revision 1.187
sys/arch/hpcsh/conf/GENERIC: revision 1.104
sys/arch/i386/conf/GENERIC: revision 1.1111
sys/arch/i386/conf/MONOLITHIC: revision 1.17
sys/arch/landisk/conf/GENERIC: revision 1.43
sys/arch/luna68k/conf/GENERIC: revision 1.117
sys/arch/macppc/conf/GENERIC: revision 1.316
sys/arch/macppc/conf/GENERIC_601: revision 1.5
sys/arch/mmeye/conf/MMEYE_WLF: revision 1.16
sys/arch/news68k/conf/GENERIC: revision 1.123
sys/arch/sandpoint/conf/GENERIC: revision 1.85
sys/arch/shark/conf/GENERIC: revision 1.119
sys/arch/sparc/conf/GENERIC: revision 1.246
sys/arch/sparc64/conf/GENERIC: revision 1.174
sys/arch/sun3/conf/GENERIC3X: revision 1.125
sys/arch/sun3/conf/GENERIC: revision 1.169
sys/arch/x68k/conf/GENERIC: revision 1.177
sys/arch/zaurus/conf/GENERIC: revision 1.62
sys/conf/files: revision 1.1099
sys/kern/kern_module.c: revisions 1.98, 1.99
Create an "options MODULAR_DEFAULT_AUTOLOAD" config option and add
it to all kernel configs that contain "options MODULAR". This
option turns on module autoloading by default (which is the current
default). This allows people who don't want module autoloading on
by default to disable it by simply removing/commentting this line.
--
fix typo. (s/MODULE_DEFAULT_AUTOLOAD/MODULAR_DEFAULT_AUTOLOAD/)
 1.243.4.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.243.4.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.243.4.3.6.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.243.4.3.2.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.248.2.4 28-Aug-2017  skrll Sync with HEAD
 1.248.2.3 05-Dec-2016  skrll Sync with HEAD
 1.248.2.2 22-Apr-2016  skrll Sync with HEAD
 1.248.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.250.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.253.8.2 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.253.8.1 31-Aug-2017  bouyer apply paych, requested by maxv in ticket #237:
sys/arch/amiga/conf/DRACO patch
sys/arch/amiga/conf/GENERIC patch
sys/arch/amiga/conf/GENERIC.in patch
sys/arch/i386/conf/ALL patch
sys/arch/i386/conf/GENERIC patch
sys/arch/i386/conf/XEN3_DOM0 patch
sys/arch/i386/conf/XEN3_DOMU patch
sys/arch/sparc/conf/GENERIC patch
sys/arch/sparc/conf/KRUPS patch
sys/arch/sparc/conf/MRCOFFEE patch
sys/arch/sparc/conf/TADPOLE3GX patch
sys/arch/sparc64/conf/GENERIC patch
sys/arch/sparc64/conf/NONPLUS64 patch
sys/kern/kern_exec.c patch

Disables compat_svr4 and compat_svr4_32 on each architecture,
and removes the associated module autoload entries.
 1.259.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.259.4.1 10-Jun-2019  christos Sync with HEAD
 1.259.2.4 18-Jan-2019  pgoyette Synch with HEAD
 1.259.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.259.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.259.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.265.2.1 01-May-2019  isaki Adapt dbri to audio2.
- Add some mutex_enter/exit.
- Remove DBRI_BIG_BUFFER option. Such big buffer will not necessary
in audio2.
Thank you, macallan@.
 1.267.4.1 25-Jan-2020  ad Sync with head.
 1.267.2.1 21-Apr-2021  martin Apply patch, requested by tsutsui in ticket #1249:

sys/arch/sparc/conf/GENERIC (apply patch)

PR 56077: remove DIAGNOSTIC from sparc kernel.
 1.272.4.1 09-Oct-2023  snj Apply patch (requested by martin in ticket #401):
Disable DIAGNOSTIC/DEBUG.
 1.273.6.1 02-Aug-2025  perseant Sync with HEAD
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 20-Apr-2004  pk Default to not inlining __cpu_simple_lock().
- the locore version attempts to detect stuck locks
- not inlining saves about 60K on the kernel's text
 1.2 03-Apr-2004  chs add some SUN4D stuff.
zs and zstty no longer need "needs-count" or "needs-flag",
so get rid of those and wild-card the extra zs devices on SUN4D.
 1.1 27-Sep-1998  pk branches: 1.1.46; 1.1.48;
Kernel configuration with multi-processor support.
 1.1.48.1 24-Apr-2004  jdc Pull up revision 1.3 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.1.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.46.1 03-Aug-2004  skrll Sync with HEAD
 1.7 07-Dec-1994  mycroft Clean up deleted files.
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 20-Aug-1994  deraadt no need for timezone spec
 1.4 17-Aug-1994  deraadt add pseudo-device kbd
 1.3 12-Aug-1994  deraadt option GDB isn't valid
disable KGDB because we do not have (userland) support for it
 1.2 27-Jul-1994  deraadt cleanup
 1.1 02-Oct-1993  deraadt branches: 1.1.2;
Chris Torek's sparc port. Missing lots of things.
 1.1.2.3 17-Aug-1994  mycroft update from trunk
 1.1.2.2 12-Aug-1994  mycroft update from trunk
 1.1.2.1 28-Jul-1994  cgd from trunk.
 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.8;
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:22:08 +0000
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.37 06-Jan-1997  mrg include the GENERIC kernel, and then map the disks.
 1.36 06-Dec-1996  pk Uncomment lebuffer devices
 1.35 18-Nov-1996  pk Move *PAGER options and `machine sparc' to std.sparc.
 1.34 03-Nov-1996  pk Declare device `audio' at sbus.
 1.33 03-Oct-1996  abrown Add cgfourteen framebuffer to generic configs
 1.32 02-Oct-1996  mrg update for exec changes.
 1.31 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.30 20-Jun-1996  pk Turn on disconnect/reselect by default on targets 4-7 on the premise that
tape devices normally are set to one of these targets. Tape devices should
be allowed to disconnect for the SCSI bus to operate acceptably.
 1.29 19-Jun-1996  pk add tcx
 1.28 21-May-1996  pk branches: 1.28.2;
Remove the `espdma' special case; all `esp' related dma channels are now
called `dma' on all architectures. Note: `ledma' remains in place.

Also delete a couple of unneeded `needs-flag's in files.sparc.
 1.27 17-May-1996  abrown Add Sun4m power0 power status/control register to GENERIC configuration
 1.26 16-May-1996  pk Add `flags' to the esp entries: disable disconnect & synch negotiation
by default until further notice.
 1.25 16-May-1996  pk Change attributes of `dma', `espdma' and `ledma' (the attributes on the latter
two didn't seem to make much sense anyway..) to allow `esp' devices to be
attached to one of `sbus', `dma' and `espdma'.

Remove the wildcarded `espdma?' and `ledma?' attachments of `esp' and `le'
respectively, in favour of `dma?' and `lebuffer?' (but the latter is not
yet implemented), which seems to better match reality: additional SBus
SCSI/Lance boards call themselves `dma' and `lebuffer'.
 1.24 16-May-1996  thorpej Document the "flags" for the si and sw controllers. While I'm here,
do some re-arrangement (cleanup), and document which devices exist on
which machines, so that people can be better informed when they trim
down their kernels. There are a LOT of comments in this file now!
 1.23 01-Apr-1996  pk Update device list.
 1.22 31-Mar-1996  pk Updates for sun4m.
 1.21 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.20 01-Jan-1996  thorpej "si" and "sw" actually interrupt at level 3 (which I quickly discovered
when porting the driver).
 1.19 08-Oct-1995  pk Add forgotten `eeprom' configuration.
 1.18 04-Oct-1995  pk RCONSOLE => RASTERCONSOLE
 1.17 25-Sep-1995  pk Correct cgtwo address.
 1.16 25-Sep-1995  chuck add "xy" xylogics 450/451 config stuff
 1.15 17-Sep-1995  pk vmes => vmes0
 1.14 17-Sep-1995  pk Add cgtwo0.
 1.13 11-Sep-1995  pk `si' and `sw' are scsibusses.
 1.12 05-Sep-1995  pk Add `sw' scsi adapter on obio (per Jason Thorpe, PR#1422).
 1.11 29-Aug-1995  pk Add bwtwo@obio specs (from Jason Thorpe).
 1.10 08-Jul-1995  pk si scsi driver configs.
 1.9 26-Jun-1995  pk xd definitions, from Chuck Cranor.
 1.8 05-Jun-1995  pk Add UNION option.
 1.7 02-Jun-1995  pk Update SCSI decls.
 1.6 02-Mar-1995  pk Make more generic.
 1.5 01-Mar-1995  pk Better 4/100 support.
 1.4 25-Jan-1995  cgd vn -> vnd renaming, for consistency
 1.3 17-Dec-1994  deraadt correct ie[1234] addreses
 1.2 16-Dec-1994  deraadt ie[01234] and obclock
 1.1 07-Dec-1994  deraadt bigtime cleanup
 1.28.2.1 02-Jul-1996  jtc merge in rev 1.29=>1.30
> Turn on disconnect/reselect by default on targets 4-7 ...
 1.1 04-Mar-2001  mrg branches: 1.1.4;
allow sparc "make release" to build a sparc64 capable 32 bit kernel.
 1.1.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.1.4.1 04-Mar-2001  bouyer file GENERIC_SUN4U was added on branch thorpej_scsipi on 2001-03-12 13:29:19 +0000
 1.106 28-Dec-2022  jakllsch remove lingering strip(4) remnants
 1.105 27-Sep-2020  roy branches: 1.105.20;
vether: Add to kernel configurations

It's only enabled if the kernel enabled bridge AND tap.
Otherwise it's commented out.
 1.104 12-Apr-2020  mrg base INSTALL kernel upon GENERIC with many "no ...".
 1.103 19-Jan-2020  thorpej branches: 1.103.4;
Remove the strip(4) - Starmode Radio IP - pseudo-device driver. It is
long since obsolete.
 1.102 19-Dec-2018  maxv branches: 1.102.6;
Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.101 06-Sep-2018  maxv Retire the 'midway' driver. Discussed on tech-net@ recently and also three
years ago, part of removing the network ATM code.
 1.100 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.99 05-Feb-2018  maxv branches: 1.99.2; 1.99.4;
Nuke DIRECTED_BROADCAST, it is not documented and not enabled anywhere. It
probably wouldn't have built correctly anyway, since there is no associated
defflag.

These ten lines of code in ip_input.c already look a lot better.
 1.98 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.97 29-Jul-2017  maxv Remove TCP_COMPAT_42 from the config files. Pass 3.
 1.96 09-Feb-2017  joerg Bump the ram disk and miniroot size slightly for clang.
 1.95 13-Dec-2016  christos branches: 1.95.2;
wildcard speaker attachments, now that we can handle many of them.
 1.94 10-Dec-2016  christos remove VAUDIOSPEAKER for now, will be done differently.
 1.93 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.92 13-Apr-2016  macallan branches: 1.92.2;
- purge long obsolete RASTERCONSOLE
- add mgx
 1.91 26-Sep-2015  maxv Remove KMEMSTATS. Normally it's ok now.
 1.90 23-Aug-2014  dholland branches: 1.90.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.89 24-Mar-2014  szptvlfn fix manual section numbering of sysctl.
thanks wiz@
 1.88 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.87 27-Apr-2013  christos branches: 1.87.4;
the bogus number police
 1.86 27-Apr-2013  christos remove confusing numeric locators where they are unused.
 1.85 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.84 07-Feb-2013  macallan add sx at mainbus
 1.83 17-Aug-2012  abs branches: 1.83.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.82 26-Jun-2012  macallan switch to WSEMUL_VT100 to reduce differences with sparc64 and other wscons
and fb console using ports
WSEMUL_SUN is left in but commented out so whoever wants it back can have it
with minimal effort
 1.81 11-Mar-2012  nakayama Remove stray comments for LKM.
 1.80 18-Dec-2011  dholland WABPL is no longer considered experimental (has not been for some time)
so update its comment in config files.
 1.79 22-Nov-2011  tls branches: 1.79.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.78 06-Mar-2011  bouyer branches: 1.78.4;
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.77 23-Nov-2010  hannken branches: 1.77.2; 1.77.4;
Remove unused count from pseudo-device md.
 1.76 07-Jul-2010  macallan make sure to include a small font for machines like the SPARCbook 3GX
should fix PR43297
 1.75 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.74 24-Mar-2010  macallan enable CG12 support
 1.73 01-Mar-2010  macallan branches: 1.73.2;
enable PNOZZ_USE_LATCH in case we run into some hardware which needs it
 1.72 05-Dec-2009  pooka branches: 1.72.2;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.71 27-Sep-2009  tsutsui Remove commented out and nonexistent cgthree at obio stuff.

SPARCclassic has onboard CG3 but it's internally connected via SBus,
and there is no info about sun4m machines which actually require
cgthree at obio attachment. Info from jdc@.
 1.70 06-Aug-2009  macallan enable the tcx driver
 1.69 09-Jun-2009  he Add -lprop to the ramdisk build, so that it builds again, due to
recent changes in newfs. Bump the ramdisk size from 1536 to 1800
blocks as a consequence.
 1.68 05-May-2009  macallan enable ZX/Leo since we now support wscons on it
 1.67 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.66 08-Feb-2009  jdc branches: 1.66.2;
Cosmetic clean up:
options<space><tab>
 1.65 06-Feb-2009  jym 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.64 22-Dec-2008  macallan convert to wscons, while there add some missing wsdisplay drivers
 1.63 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.62 31-Jul-2008  simonb branches: 1.62.2; 1.62.4; 1.62.8;
Add "options WAPBL" to standard GENERIC/INSTALL type configs.
 1.61 25-Jun-2008  matt branches: 1.61.2;
Increase RAMDISK size due to ever-increasing bloat.
 1.60 17-Oct-2007  garbled branches: 1.60.16; 1.60.20; 1.60.22; 1.60.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.59 02-Jun-2007  uwe branches: 1.59.10;
Add COMPAT_40. While here, make COMPAT_30 comment match other COMPAT_*.
 1.58 29-Dec-2006  yamt branches: 1.58.6; 1.58.8; 1.58.14;
update comments on NFS_V2_ONLY after nqnfs removal. no functional changes.
from Arnaud Lacombe.
 1.57 02-Oct-2006  chs remove MALLOC_NOINLINE, it doesn't do anything anymore.
 1.56 27-Sep-2006  manu - Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.55 26-Aug-2006  christos branches: 1.55.2; 1.55.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.54 05-Feb-2006  cube branches: 1.54.2;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.53 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.52 07-Dec-2005  tsutsui branches: 1.52.2; 1.52.4; 1.52.6;
Remove obsolete options VNODE_OP_NOINLINE.
 1.51 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.50 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.49 19-Aug-2005  christos 64 bit inode changes.
 1.48 25-Feb-2005  simonb branches: 1.48.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.47 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.46 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.45 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.44 10-Nov-2004  christos branches: 1.44.4; 1.44.6;
Add COMPAT_BSDPTY to the rest of the config files.
 1.43 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.42 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.41 07-Oct-2003  tron branches: 1.41.2;
Add COMPAT_16.
 1.40 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.39 10-Apr-2003  christos branches: 1.39.2;
Bye Bye UCONSOLE
 1.38 08-Mar-2003  lukem crank memory disk from 1360 blocks to 1376 blocks
 1.37 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.36 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.35 14-May-2002  lukem branches: 1.35.2;
- Enable NFS_BOOT_DHCP (as well as the existing NFS_BOOT_BOOTPARAM).
DHCP/Bootp is tried before bootparams in the MI nfs mountroot code.
- Change the order in boot.net from "bootparams then bootp" to
"bootp then bootparams", to be consistent with the MI nfs mountroot code.

(Consistency with other NetBSD ports is good, and things still work
for sites that run bootparams but not dhcp/bootp, although I'd argue that
dhcp/bootp is much easier to setup and manage and is easier to debug
than our rpc.bootparamd...)

Per discussion with Paul Kranenburg and Matt Green.
 1.34 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.33 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.32 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.31 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.30 10-Feb-2002  wiz Update description for icsphy.
 1.29 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.28 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.27 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.26 08-Jul-2001  abs branches: 1.26.2; 1.26.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.25 01-Nov-2000  pk Update comment accompanying the SUN4_MMU3L option.
 1.24 30-Oct-2000  pk Enable sun4 support and VME devices.
 1.23 20-Oct-2000  pk Adjust md root filesystem size.
Enable MFS.
 1.22 02-Oct-2000  abs 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.21 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.20 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.19 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.18 04-Sep-2000  abs Switch INSTALL back to being used by miniroot install.
Add INSTALL-SYSINST config for sysinst install.
These are expected to diverge more as time progresses.
 1.17 22-Aug-2000  abs Diet a little to help fitting onto a floppy
 1.16 27-Jul-2000  mrg remove COMPAT_AOUT option.
 1.15 08-Jul-2000  pk Drop KERNFS
 1.14 31-May-2000  matt branches: 1.14.2;
Make the ramdisk space the same as the ramdisk size being built in distrib
 1.13 08-May-2000  augustss branches: 1.13.2;
Add (sometimes commented out) MIIVERBOSE option.
 1.12 14-Jan-2000  pk Expand md filesystem to 3.6MB.
 1.11 29-Jul-1999  augustss branches: 1.11.2;
It's time to be COMPAT_14.
 1.10 28-Jul-1999  drochner update comments for mi VME
 1.9 26-Jun-1999  mrg enable xbox and ppp
 1.8 06-Jun-1999  mrg update this to GENERIC rev. 1.84.
 1.7 19-May-1999  ad SPARC console is black on white, and is centered by default.
 1.6 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.5 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.4 10-Jan-1999  mrg branches: 1.4.2; 1.4.4; 1.4.6;
bump size of miniroot
 1.3 27-Jul-1998  mrg enable kernfs and mfs.
 1.2 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.1 20-Jun-1998  mrg rename FLOPPY INSTALL, as it is used for cdroms also
 1.4.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.4.4.3 02-Aug-1999  thorpej Update from trunk.
 1.4.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.2.3 03-Jun-2000  he Apply patch (requested by he):
Use 3240 and not 3528 as miniroot size.
 1.4.2.2 01-Mar-2000  he Apply patch (requested by toddpw):
Fix build errors in distrib/sparc, support ``release'' target,
increase size of ramdisk while removing dependency on /etc/disktab,
and notifying kernel.
 1.4.2.1 01-Jul-1999  perry pullup 1.8->1.9 (mrg): add the xbox, be and ppp drivers
 1.11.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.11.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.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.14.2.3 01-Nov-2000  tv Pullup 1.24 [pk]:
Enable sun4 support and VME devices.
 1.14.2.2 19-Oct-2000  tv Commit by patch [pk]:
- boot floppy image out of space: use a two disk system
- update INSTALL kernel
- updates/fixes to miniroot image
- support for building CD image
- update installation doc
 1.14.2.1 22-Aug-2000  abs fix sysinst floppy for NetBSD/sparc, plus small doc fix.
Approved by thorpej, pullup list:
distrib/notes/sparc/install 1.24
distrib/sparc/bootfs.sysinst/Makefile 1.5
distrib/sparc/list2sh.awk 1.4
distrib/sparc/ramdisk.sysinst/Makefile 1.8
distrib/sparc/ramdisk.sysinst/disktab 1.2
distrib/sparc/ramdisk.sysinst/disktab.preinstall delete
distrib/sparc/ramdisk.sysinst/dot.profile.m4 1.5
distrib/sparc/ramdisk.sysinst/list.m4 1.6
distrib/sparc/ramdisk.sysinst/mtree.conf 1.2
distrib/sparc/ramdisk.sysinst/ramdiskbin.m4 1.4
distrib/utils/libhack/Makefile.inc 1.10
sys/arch/sparc/conf/INSTALL 1.17
 1.26.8.8 18-Oct-2002  nathanw Catch up to -current.
 1.26.8.7 01-Aug-2002  nathanw Catch up to -current.
 1.26.8.6 20-Jun-2002  nathanw Catch up to -current.
 1.26.8.5 17-Apr-2002  nathanw Catch up to -current.
 1.26.8.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.26.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.26.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.26.8.1 08-Jul-2001  nathanw file INSTALL was added on branch nathanw_sa on 2002-01-08 00:27:33 +0000
 1.26.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.26.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.26.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.26.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.26.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.26.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.35.2.1 17-Jul-2002  gehenna catch up with -current.
 1.39.2.9 11-Dec-2005  christos Sync with head.
 1.39.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.39.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.39.2.6 15-Feb-2005  skrll Sync with HEAD.
 1.39.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.39.2.4 14-Nov-2004  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.41.2.1 15-Jul-2004  he Pull up revision 1.42 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.44.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.44.6.1 12-Feb-2005  yamt sync with head.
 1.44.4.1 29-Apr-2005  kent sync with -current
 1.48.4.3 03-Sep-2007  yamt sync with head.
 1.48.4.2 30-Dec-2006  yamt sync with head.
 1.48.4.1 21-Jun-2006  yamt sync with head.
 1.52.6.1 22-Apr-2006  simonb Sync with head.
 1.52.4.1 09-Sep-2006  rpaulo sync with head
 1.52.2.1 18-Feb-2006  yamt sync with head.
 1.54.2.1 03-Sep-2006  yamt sync with head.
 1.55.4.1 22-Oct-2006  yamt sync with head
 1.55.2.2 12-Jan-2007  ad Sync with head.
 1.55.2.1 18-Nov-2006  ad Sync with head.
 1.58.14.1 26-Jun-2007  garbled Sync with HEAD.
 1.58.8.1 11-Jul-2007  mjf Sync with head.
 1.58.6.1 09-Jun-2007  ad Sync with head.
 1.59.10.1 06-Nov-2007  matt sync with HEAD
 1.60.24.1 27-Jun-2008  simonb Sync with head.
 1.60.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.60.20.6 11-Aug-2010  yamt sync with head.
 1.60.20.5 11-Mar-2010  yamt sync with head
 1.60.20.4 19-Aug-2009  yamt sync with head.
 1.60.20.3 20-Jun-2009  yamt sync with head
 1.60.20.2 16-May-2009  yamt sync with head
 1.60.20.1 04-May-2009  yamt sync with head.
 1.60.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.60.16.2 28-Sep-2008  mjf Sync with HEAD.
 1.60.16.1 29-Jun-2008  mjf Sync with HEAD.
 1.61.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.61.2.1 19-Oct-2008  haad Sync with HEAD.
 1.62.8.1 21-Apr-2010  matt sync to netbsd-5
 1.62.4.2 18-Oct-2009  bouyer Back out ticket 968
 1.62.4.1 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #968):
sys/arch/sparc/conf/INSTALL: revision 1.64
convert to wscons, while there add some missing wsdisplay drivers
 1.62.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.62.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.62.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.66.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.72.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.72.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.73.2.3 21-Apr-2011  rmind sync with head
 1.73.2.2 05-Mar-2011  rmind sync with head
 1.73.2.1 30-May-2010  rmind sync with head
 1.77.4.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.77.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.78.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.78.4.2 30-Oct-2012  yamt sync with head
 1.78.4.1 17-Apr-2012  yamt sync with head
 1.79.2.2 05-Apr-2012  mrg sync to latest -current.
 1.79.2.1 18-Feb-2012  mrg merge to -current.
 1.83.2.4 03-Dec-2017  jdolecek update from HEAD
 1.83.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.83.2.2 23-Jun-2013  tls resync from head
 1.83.2.1 25-Feb-2013  tls resync with head
 1.87.4.2 18-May-2014  rmind sync with head
 1.87.4.1 28-Aug-2013  rmind sync with head
 1.90.2.4 28-Aug-2017  skrll Sync with HEAD
 1.90.2.3 05-Feb-2017  skrll Sync with HEAD
 1.90.2.2 22-Apr-2016  skrll Sync with HEAD
 1.90.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.92.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.92.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.95.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.99.4.3 21-Apr-2020  martin Sync with HEAD
 1.99.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.99.4.1 10-Jun-2019  christos Sync with HEAD
 1.99.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.99.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.99.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.102.6.1 25-Jan-2020  ad Sync with head.
 1.103.4.1 20-Apr-2020  bouyer Sync with HEAD
 1.105.20.1 13-Jan-2023  martin Pull up following revision(s) (requested by jakllsch in ticket #45):

sys/secmodel/suser/secmodel_suser.c: revision 1.56
sys/sys/kauth.h: revision 1.88
sys/arch/sparc/conf/INSTALL: revision 1.106
share/examples/secmodel/secmodel_example.c: revision 1.29
sys/conf/files: revision 1.1306

remove lingering strip(4) remnants

more strip(4) removal, this time in kauth(9)
 1.5 28-Sep-2000  abs Prior art in naming would suggest INSTALL_SYSINST rather than INSTALL-SYSINST.
 1.4 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.3 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.2 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.1 04-Sep-2000  abs Switch INSTALL back to being used by miniroot install.
Add INSTALL-SYSINST config for sysinst install.
These are expected to diverge more as time progresses.
 1.3 20-Oct-2000  pk This file is no longer used.
 1.2 02-Oct-2000  abs 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.1 28-Sep-2000  abs Prior art in naming would suggest INSTALL_SYSINST rather than INSTALL-SYSINST.
 1.83 24-Feb-2025  andvar s/architecure/architecture/ and few other typos in comments.
 1.82 15-Sep-2024  uwe sparc/conf/KRUPS: sync with GENERIC clean up

Not much to do to actually sync it, as changes done to GENERIC were
also applied to KRUPS, but update the GENERIC version we are supposed
to be in sync with.

While here, comment out most of the more exotic file-system and all
verbose options.

Leave the wsconf section as is. The one in GENERIC is messy and is
not in sync with other wsons ports.
 1.81 26-Apr-2019  sevan branches: 1.81.34;
Use veriexec.config to reduce duplication
 1.80 13-Apr-2019  isaki Add drvctl to kernel which has audio device.
audiocfg(1) requires drvctl(4).
 1.79 14-Jan-2019  mrg normalise comment for fileassoc(8). from PR#44873.
 1.78 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.77 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.76 05-Feb-2018  maxv branches: 1.76.2; 1.76.4;
Nuke DIRECTED_BROADCAST, it is not documented and not enabled anywhere. It
probably wouldn't have built correctly anyway, since there is no associated
defflag.

These ten lines of code in ip_input.c already look a lot better.
 1.75 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.74 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.73 30-Jul-2017  maxv Disable svr4 and svr4_32 on sparc, sparc64 and amiga - the only places
where they were still enabled.
 1.72 13-Dec-2016  christos branches: 1.72.8;
wildcard speaker attachments, now that we can handle many of them.
 1.71 10-Dec-2016  christos remove VAUDIOSPEAKER for now, will be done differently.
 1.70 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.69 26-Nov-2016  christos mention PAX_SEGVGUARD dependency on FILEASSOC
 1.68 26-Sep-2015  maxv branches: 1.68.2;
Remove KMEMSTATS. Normally it's ok now.
 1.67 23-Aug-2014  dholland branches: 1.67.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.66 24-Mar-2014  szptvlfn branches: 1.66.4; 1.66.6; 1.66.10;
fix manual section numbering of sysctl.
thanks wiz@
 1.65 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.64 05-Jun-2013  christos branches: 1.64.2;
remove obsolete networking options
 1.63 27-Apr-2013  christos the bogus number police
 1.62 02-Mar-2013  christos Under FAST_IPSEC, IPSEC_ESP is mandatory; GC it.
 1.61 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.60 26-Jun-2012  macallan branches: 1.60.2;
switch to WSEMUL_VT100 to reduce differences with sparc64 and other wscons
and fb console using ports
WSEMUL_SUN is left in but commented out so whoever wants it back can have it
with minimal effort
 1.59 05-Jun-2012  abs Adjust the WSDISPLAY_COMPAT_USL comment to mention wsconscfg, to at least
give a hint that its not just for third party compat. No functional change.
 1.58 11-Mar-2012  nakayama Remove stray comments for LKM.
 1.57 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.56 22-Nov-2011  tls branches: 1.56.2; 1.56.4;

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.55 06-Mar-2011  bouyer branches: 1.55.4;
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.54 17-Jan-2011  jdc branches: 1.54.2;
Add (commented out) LOCKDEBUG and SYSCALL_DEBUG options.
 1.53 23-Nov-2010  hannken branches: 1.53.2;
Remove unused count from pseudo-device md.
 1.52 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.51 05-Dec-2009  pooka branches: 1.51.2; 1.51.4;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.50 22-Jun-2009  tsutsui Enable ddb(4) for sparc GENERIC-like kernels.
Discussed on port-sparc@.
 1.49 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.48 08-Feb-2009  jdc branches: 1.48.2;
Cosmetic clean up:
options<space><tab>
 1.47 24-Nov-2008  ad Remove softdep, pass 1. We are focused on improving journalling.

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

Proposed on tech-kern@.
 1.45 31-Dec-2007  ad branches: 1.45.6; 1.45.10; 1.45.16; 1.45.18; 1.45.20; 1.45.24;
Remove systrace. Ok core@.
 1.44 17-Oct-2007  garbled branches: 1.44.2; 1.44.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.43 02-Jun-2007  uwe branches: 1.43.10;
Add COMPAT_40. While here, make COMPAT_30 comment match other COMPAT_*.
 1.42 25-Feb-2007  uwe branches: 1.42.4; 1.42.6; 1.42.12;
Catch up with changes in GENERIC and new wscons options.
 1.41 11-Nov-2006  jmmv branches: 1.41.4;
Remove tmpfs's experimental status. OK'ed by core@.
 1.40 27-Sep-2006  manu - Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.39 26-Aug-2006  christos branches: 1.39.2; 1.39.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.38 12-Aug-2006  christos Disable SYSTRACE by default on all kernels (discussed with core)
 1.37 19-Apr-2006  drochner branches: 1.37.6;
adjust comments for the new location of wskbdmap_mfii.c,
addresses PR kern/33290 by henry nelson
 1.36 05-Feb-2006  cube branches: 1.36.2; 1.36.4; 1.36.6;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.35 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.34 07-Dec-2005  tsutsui branches: 1.34.2; 1.34.4; 1.34.6;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.33 22-Nov-2005  macallan uncomment options BLINK, removed uwe's todo comment.
 1.32 08-Oct-2005  uwe branches: 1.32.6;
Sync with GENERIC (1.180).
 1.31 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.30 19-Aug-2005  christos 64 bit inode changes.
 1.29 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.28 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.27 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.26 18-Feb-2005  dsl branches: 1.26.4; 1.26.6;
Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.25 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.24 10-Nov-2004  christos branches: 1.24.4; 1.24.6;
Add COMPAT_BSDPTY to the rest of the config files.
 1.23 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.22 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.21 10-Jul-2004  uwe Sync with relevant portions of GENERIC 1.160.
options<space> police.
Uncomment FFS, as MFS needs it.
 1.20 14-Dec-2003  martin branches: 1.20.2;
Make this look more like GENERIC.
 1.19 14-Dec-2003  uwe There's no such thing as "JavaStation-10". Krups official name is
"JavaStation-NC". Pointed out by Pete Zaitcev (long ago).
 1.18 13-Dec-2003  martin Remove a comment - this is no longer experimental and works with an
unpatched tree.
 1.17 22-Oct-2003  uwe Catch up with GENERIC (1.148).
 1.16 07-Oct-2003  tron Add COMPAT_16.
 1.15 10-Apr-2003  christos branches: 1.15.2;
Bye Bye UCONSOLE
 1.14 04-Dec-2002  uwe Fix an options<space><tab> nit.
 1.13 08-Nov-2002  uwe Oh, COPTS in config overrides optimizations again.
 1.12 03-Oct-2002  uwe Add wscons. Misc catch-up with GENERIC.
 1.11 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.10 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.9 14-May-2002  lukem branches: 1.9.2; 1.9.4;
- Enable NFS_BOOT_DHCP (as well as the existing NFS_BOOT_BOOTPARAM).
DHCP/Bootp is tried before bootparams in the MI nfs mountroot code.
- Change the order in boot.net from "bootparams then bootp" to
"bootp then bootparams", to be consistent with the MI nfs mountroot code.

(Consistency with other NetBSD ports is good, and things still work
for sites that run bootparams but not dhcp/bootp, although I'd argue that
dhcp/bootp is much easier to setup and manage and is easier to debug
than our rpc.bootparamd...)

Per discussion with Paul Kranenburg and Matt Green.
 1.8 06-May-2002  uwe Comment change only. Update the version of GENERIC this config is
synced with.
 1.7 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.6 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.5 28-Mar-2002  uwe Move ms-IIep PCIC driver into mspcic0 at msiiep0. msiiep0 now serves
as a stub bus that knows how to attach drivers for various functions
of PCIC.

This change is a follow up to timer0 at msiiep0 change, since all
children must share same attach arguments and so we no longer can
attach pci0 directly under msiiep0.
 1.4 28-Mar-2002  pk Declare `timer0' as a device on the `msiiep' bus.
 1.3 12-Mar-2002  uwe Enable audiocs at ebus.
 1.2 29-Jan-2002  uwe branches: 1.2.2; 1.2.4;
Comment update for PCI_CONFIG_DUMP: dumping PCI config space for EBus
seems ok now. But an attempt of reading IGA1682 config space past
offset 64 hangs the machine.
 1.1 28-Jan-2002  uwe Experimental config file for JavaStation NC (aka Krups). Not yet
usable without some additional patches to the tree, but handy to have
checked in for reference.
 1.2.4.8 11-Dec-2002  thorpej Sync with HEAD.
 1.2.4.7 11-Nov-2002  nathanw Catch up to -current
 1.2.4.6 18-Oct-2002  nathanw Catch up to -current.
 1.2.4.5 20-Jun-2002  nathanw Catch up to -current.
 1.2.4.4 17-Apr-2002  nathanw Catch up to -current.
 1.2.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.1 29-Jan-2002  nathanw file KRUPS was added on branch nathanw_sa on 2002-02-28 04:12:01 +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 16-Mar-2002  jdolecek Catch up with -current.
 1.2.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.1 29-Jan-2002  jdolecek file KRUPS was added on branch kqueue on 2002-02-11 20:09:02 +0000
 1.9.4.1 01-Aug-2002  lukem Pull up revision 1.10 (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.9.2.1 15-Jul-2002  gehenna catch up with -current.
 1.15.2.8 11-Dec-2005  christos Sync with head.
 1.15.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.5 15-Feb-2005  skrll Sync with HEAD.
 1.15.2.4 14-Nov-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.20.2.1 15-Jul-2004  he Pull up revision 1.22 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.24.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.24.6.1 12-Feb-2005  yamt sync with head.
 1.24.4.1 29-Apr-2005  kent sync with -current
 1.26.6.5 21-Jan-2008  yamt sync with head
 1.26.6.4 03-Sep-2007  yamt sync with head.
 1.26.6.3 26-Feb-2007  yamt sync with head.
 1.26.6.2 30-Dec-2006  yamt sync with head.
 1.26.6.1 21-Jun-2006  yamt sync with head.
 1.26.4.1 18-Jul-2005  riz Pull up revision 1.27 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.32.6.1 29-Nov-2005  yamt sync with head.
 1.34.6.1 22-Apr-2006  simonb Sync with head.
 1.34.4.1 09-Sep-2006  rpaulo sync with head
 1.34.2.1 18-Feb-2006  yamt sync with head.
 1.36.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.36.4.1 11-May-2006  elad sync with head
 1.36.2.2 03-Sep-2006  yamt sync with head.
 1.36.2.1 24-May-2006  yamt sync with head.
 1.37.6.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.39.4.2 10-Dec-2006  yamt sync with head.
 1.39.4.1 22-Oct-2006  yamt sync with head
 1.39.2.1 18-Nov-2006  ad Sync with head.
 1.41.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.42.12.1 26-Jun-2007  garbled Sync with HEAD.
 1.42.6.1 11-Jul-2007  mjf Sync with head.
 1.42.4.1 09-Jun-2007  ad Sync with head.
 1.43.10.2 09-Jan-2008  matt sync with HEAD
 1.43.10.1 06-Nov-2007  matt sync with HEAD
 1.44.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.44.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.45.24.1 21-Apr-2010  matt sync to netbsd-5
 1.45.20.1 16-Oct-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #1065):
sys/arch/sparc/conf/GENERIC: revision 1.214
sys/arch/sparc/conf/KRUPS: revision 1.50
sys/arch/sparc/conf/MRCOFFEE: revision 1.28
sys/arch/sparc/conf/TADPOLE3GX: revision 1.47
Enable ddb(4) for sparc GENERIC-like kernels.
Discussed on port-sparc@.
 1.45.18.3 28-Apr-2009  skrll Sync with HEAD.
 1.45.18.2 03-Mar-2009  skrll Sync with HEAD.
 1.45.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.45.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.45.10.4 11-Aug-2010  yamt sync with head.
 1.45.10.3 11-Mar-2010  yamt sync with head
 1.45.10.2 18-Jul-2009  yamt sync with head.
 1.45.10.1 04-May-2009  yamt sync with head.
 1.45.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.48.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.51.4.3 21-Apr-2011  rmind sync with head
 1.51.4.2 05-Mar-2011  rmind sync with head
 1.51.4.1 30-May-2010  rmind sync with head
 1.51.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.53.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.54.2.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.55.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.55.4.2 30-Oct-2012  yamt sync with head
 1.55.4.1 17-Apr-2012  yamt sync with head
 1.56.4.2 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.56.4.1 12-Jun-2012  riz branches: 1.56.4.1.4; 1.56.4.1.6;
Pull up following revision(s) (requested by abs in ticket #311):
sys/arch/netwinder/conf/GENERIC: revision 1.112
sys/arch/i386/conf/GENERIC: revision 1.1074
sys/arch/atari/conf/MILAN.in: revision 1.26
sys/arch/zaurus/conf/GENERIC: revision 1.54
sys/arch/shark/conf/GENERIC: revision 1.101
sys/arch/hpcmips/conf/MPC303: revision 1.60
sys/arch/i386/conf/XEN3_DOM0: revision 1.67
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.29
sys/arch/vax/conf/GENERIC: revision 1.181
sys/arch/sparc/conf/KRUPS: revision 1.59
sys/arch/evbarm/conf/BEAGLEBOARD: revision 1.27
sys/arch/i386/conf/INSTALL_FLOPPY: revision 1.16
sys/arch/prep/conf/GENERIC: revision 1.163
sys/arch/hpcmips/conf/GENERIC: revision 1.216
sys/arch/sparc/conf/TADPOLE3GX: revision 1.56
sys/arch/shark/conf/INSTALL: revision 1.50
sys/arch/next68k/conf/GENERIC: revision 1.127
sys/arch/evbppc/conf/VIRTEX_GSRD2: revision 1.16
sys/arch/evbppc/conf/VIRTEX_DFC: revision 1.17
sys/arch/evbppc/conf/EXPLORA451: revision 1.48
sys/arch/bebox/conf/INSTALL: revision 1.54
sys/arch/next68k/conf/SLAB: revision 1.46
sys/arch/i386/conf/GENERIC_TINY: revision 1.132
sys/arch/bebox/conf/GENERIC: revision 1.131
sys/arch/amd64/conf/XEN3_DOM0: revision 1.84
sys/arch/amd64/conf/GENERIC: revision 1.356
sys/arch/evbarm/conf/MMNET_GENERIC: revision 1.6
share/man/man4/wscons.4: revision 1.31
sys/arch/hpcmips/conf/TX3912: revision 1.79
sys/arch/evbarm/conf/ARMADILLO9: revision 1.35
sys/arch/hpcsh/conf/GENERIC: revision 1.97
sys/arch/i386/conf/ALL: revision 1.339
sys/arch/hpcmips/conf/TX3922: revision 1.93
sys/arch/cats/conf/INSTALL: revision 1.82
sys/arch/sparc64/conf/GENERIC: revision 1.151
sys/arch/i386/conf/INSTALL_TINY: revision 1.135
sys/arch/evbppc/conf/VIRTEX_GSRD1: revision 1.15
sys/arch/evbarm/conf/TS7200: revision 1.49
sys/arch/hpcmips/conf/VR41XX: revision 1.55
sys/arch/hp700/conf/GENERIC: revision 1.115
sys/arch/cats/conf/GENERIC: revision 1.140
Mention wsconscfg(8) needs WSDISPLAY_COMPAT_USL
If a port is going to have wscons for virtual terminals then it really make=
s
sense to enable WSDISPLAY_COMPAT_USL so the system can switch between the
virtual terminals...
Adjust the WSDISPLAY_COMPAT_USL comment to mention wsconscfg, to at least
give a hint that its not just for third party compat. No functional change.
 1.56.4.1.6.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.56.4.1.4.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.56.2.2 05-Apr-2012  mrg sync to latest -current.
 1.56.2.1 11-Mar-2012  mrg sync to latest -current
 1.60.2.3 03-Dec-2017  jdolecek update from HEAD
 1.60.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.60.2.1 23-Jun-2013  tls resync from head
 1.64.2.2 18-May-2014  rmind sync with head
 1.64.2.1 28-Aug-2013  rmind sync with head
 1.66.10.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.66.6.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.66.4.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.67.2.4 28-Aug-2017  skrll Sync with HEAD
 1.67.2.3 05-Feb-2017  skrll Sync with HEAD
 1.67.2.2 05-Dec-2016  skrll Sync with HEAD
 1.67.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.68.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.72.8.1 31-Aug-2017  bouyer apply paych, requested by maxv in ticket #237:
sys/arch/amiga/conf/DRACO patch
sys/arch/amiga/conf/GENERIC patch
sys/arch/amiga/conf/GENERIC.in patch
sys/arch/i386/conf/ALL patch
sys/arch/i386/conf/GENERIC patch
sys/arch/i386/conf/XEN3_DOM0 patch
sys/arch/i386/conf/XEN3_DOMU patch
sys/arch/sparc/conf/GENERIC patch
sys/arch/sparc/conf/KRUPS patch
sys/arch/sparc/conf/MRCOFFEE patch
sys/arch/sparc/conf/TADPOLE3GX patch
sys/arch/sparc64/conf/GENERIC patch
sys/arch/sparc64/conf/NONPLUS64 patch
sys/kern/kern_exec.c patch

Disables compat_svr4 and compat_svr4_32 on each architecture,
and removes the associated module autoload entries.
 1.76.4.1 10-Jun-2019  christos Sync with HEAD
 1.76.2.3 18-Jan-2019  pgoyette Synch with HEAD
 1.76.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.76.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.81.34.1 02-Aug-2025  perseant Sync with HEAD
 1.60 24-Feb-2025  andvar s/architecure/architecture/ and few other typos in comments.
 1.59 07-Aug-2022  simonb branches: 1.59.10;
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.58 13-Apr-2019  isaki Add drvctl to kernel which has audio device.
audiocfg(1) requires drvctl(4).
 1.57 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.56 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.55 05-Feb-2018  maxv branches: 1.55.2; 1.55.4;
Nuke DIRECTED_BROADCAST, it is not documented and not enabled anywhere. It
probably wouldn't have built correctly anyway, since there is no associated
defflag.

These ten lines of code in ip_input.c already look a lot better.
 1.54 23-Jan-2018  sevan 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.53 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.52 30-Jul-2017  maxv Disable svr4 and svr4_32 on sparc, sparc64 and amiga - the only places
where they were still enabled.
 1.51 13-Dec-2016  christos branches: 1.51.8;
wildcard speaker attachments, now that we can handle many of them.
 1.50 10-Dec-2016  christos remove VAUDIOSPEAKER for now, will be done differently.
 1.49 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.48 26-Sep-2015  maxv branches: 1.48.2;
Remove KMEMSTATS. Normally it's ok now.
 1.47 23-Aug-2014  dholland branches: 1.47.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.46 16-Aug-2014  apb Add "options COMPAT_70" to all kernel configuration files that
already had "options COMPAT_60".
 1.45 24-Mar-2014  szptvlfn branches: 1.45.4; 1.45.6; 1.45.10;
fix manual section numbering of sysctl.
thanks wiz@
 1.44 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.43 05-Jun-2013  christos branches: 1.43.2;
remove obsolete networking options
 1.42 27-Apr-2013  christos the bogus number police
 1.41 02-Mar-2013  christos Under FAST_IPSEC, IPSEC_ESP is mandatory; GC it.
 1.40 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.39 17-Oct-2012  apb Add "options COMPAT_60" to all kernel configuration files
that already had "options COMPAT_50".
 1.38 17-Aug-2012  abs branches: 1.38.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.37 26-Jun-2012  macallan switch to WSEMUL_VT100 to reduce differences with sparc64 and other wscons
and fb console using ports
WSEMUL_SUN is left in but commented out so whoever wants it back can have it
with minimal effort
 1.36 11-Mar-2012  nakayama Remove stray comments for LKM.
 1.35 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.34 22-Nov-2011  tls branches: 1.34.2; 1.34.4; 1.34.8; 1.34.10;

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.33 06-Mar-2011  bouyer branches: 1.33.4;
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.32 17-Jan-2011  jdc branches: 1.32.2;
Add (commented out) LOCKDEBUG and SYSCALL_DEBUG options.
 1.31 05-Dec-2009  pooka branches: 1.31.4; 1.31.6;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.30 16-Aug-2009  uwe options COMPAT_50
 1.29 16-Aug-2009  macallan add the missing wscons bits so this kernel builds again
needs testing on actual hardware which I don't have.
 1.28 22-Jun-2009  tsutsui Enable ddb(4) for sparc GENERIC-like kernels.
Discussed on port-sparc@.
 1.27 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.26 08-Feb-2009  jdc branches: 1.26.2;
Cosmetic clean up:
options<space><tab>
 1.25 24-Nov-2008  ad Remove softdep, pass 1. We are focused on improving journalling.

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

Proposed on tech-kern@.
 1.23 31-Dec-2007  ad branches: 1.23.6; 1.23.10; 1.23.16; 1.23.18; 1.23.20; 1.23.24;
Remove systrace. Ok core@.
 1.22 17-Oct-2007  garbled branches: 1.22.2; 1.22.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.21 02-Jun-2007  uwe branches: 1.21.10;
Add COMPAT_40. While here, make COMPAT_30 comment match other COMPAT_*.
 1.20 12-May-2007  uwe Sync with GENERIC 1.197
 1.19 27-Sep-2006  manu branches: 1.19.4; 1.19.8; 1.19.10; 1.19.16;
- Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.18 26-Aug-2006  christos branches: 1.18.2; 1.18.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.17 12-Aug-2006  christos Disable SYSTRACE by default on all kernels (discussed with core)
 1.16 05-Feb-2006  cube branches: 1.16.2; 1.16.12;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.15 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.14 07-Dec-2005  tsutsui branches: 1.14.2; 1.14.4; 1.14.6;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.13 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.12 19-Aug-2005  christos 64 bit inode changes.
 1.11 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.10 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.9 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.8 09-Jun-2005  tsutsui branches: 1.8.2;
- 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.7 18-Feb-2005  dsl branches: 1.7.4;
Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.6 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.5 10-Nov-2004  christos branches: 1.5.4; 1.5.6;
Add COMPAT_BSDPTY to the rest of the config files.
 1.4 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.3 15-Jul-2004  atatat branches: 1.3.2;
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.2 10-Jul-2004  uwe Sync with relevant portions of GENERIC 1.160.
Uncomment FFS, as MFS needs it.
 1.1 15-Dec-2003  martin branches: 1.1.2;
Add config files for Mr.Coffee JavaStatin 1 machines.
Unfortunately we need two slightly different ones for now (OBP vs. OF)
 1.1.2.1 15-Jul-2004  he Pull up revision 1.3 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.3.2.9 11-Dec-2005  christos Sync with head.
 1.3.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.2.6 15-Feb-2005  skrll Sync with HEAD.
 1.3.2.5 14-Nov-2004  skrll Sync with HEAD.
 1.3.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.2 03-Aug-2004  skrll Sync with HEAD
 1.3.2.1 15-Jul-2004  skrll file MRCOFFEE was added on branch ktrace-lwp on 2004-08-03 10:40:44 +0000
 1.5.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.6.1 12-Feb-2005  yamt sync with head.
 1.5.4.1 29-Apr-2005  kent sync with -current
 1.7.4.1 18-Jul-2005  riz Pull up revision 1.9 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.8.2.4 21-Jan-2008  yamt sync with head
 1.8.2.3 03-Sep-2007  yamt sync with head.
 1.8.2.2 30-Dec-2006  yamt sync with head.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.14.6.1 22-Apr-2006  simonb Sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.14.2.1 18-Feb-2006  yamt sync with head.
 1.16.12.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.16.2.1 03-Sep-2006  yamt sync with head.
 1.18.4.1 22-Oct-2006  yamt sync with head
 1.18.2.1 18-Nov-2006  ad Sync with head.
 1.19.16.2 26-Jun-2007  garbled Sync with HEAD.
 1.19.16.1 22-May-2007  matt Update to HEAD.
 1.19.10.1 11-Jul-2007  mjf Sync with head.
 1.19.8.2 09-Jun-2007  ad Sync with head.
 1.19.8.1 27-May-2007  ad Sync with head.
 1.19.4.1 17-May-2007  yamt sync with head.
 1.21.10.2 09-Jan-2008  matt sync with HEAD
 1.21.10.1 06-Nov-2007  matt sync with HEAD
 1.22.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.22.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.23.24.1 21-Apr-2010  matt sync to netbsd-5
 1.23.20.3 18-Oct-2009  bouyer Back out ticket 990
 1.23.20.2 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #990):
sys/arch/sparc/conf/MRCOFFEE: revision 1.29
add the missing wscons bits so this kernel builds again
needs testing on actual hardware which I don't have.
 1.23.20.1 16-Oct-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #1065):
sys/arch/sparc/conf/GENERIC: revision 1.214
sys/arch/sparc/conf/KRUPS: revision 1.50
sys/arch/sparc/conf/MRCOFFEE: revision 1.28
sys/arch/sparc/conf/TADPOLE3GX: revision 1.47
Enable ddb(4) for sparc GENERIC-like kernels.
Discussed on port-sparc@.
 1.23.18.3 28-Apr-2009  skrll Sync with HEAD.
 1.23.18.2 03-Mar-2009  skrll Sync with HEAD.
 1.23.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.23.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.10.4 11-Mar-2010  yamt sync with head
 1.23.10.3 19-Aug-2009  yamt sync with head.
 1.23.10.2 18-Jul-2009  yamt sync with head.
 1.23.10.1 04-May-2009  yamt sync with head.
 1.23.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.26.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.31.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.31.4.2 21-Apr-2011  rmind sync with head
 1.31.4.1 05-Mar-2011  rmind sync with head
 1.32.2.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.33.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.33.4.2 30-Oct-2012  yamt sync with head
 1.33.4.1 17-Apr-2012  yamt sync with head
 1.34.10.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.34.8.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.34.4.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.34.2.2 05-Apr-2012  mrg sync to latest -current.
 1.34.2.1 11-Mar-2012  mrg sync to latest -current
 1.38.2.4 03-Dec-2017  jdolecek update from HEAD
 1.38.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.2.2 23-Jun-2013  tls resync from head
 1.38.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.43.2.2 18-May-2014  rmind sync with head
 1.43.2.1 28-Aug-2013  rmind sync with head
 1.45.10.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.45.6.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.45.4.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.47.2.3 28-Aug-2017  skrll Sync with HEAD
 1.47.2.2 05-Feb-2017  skrll Sync with HEAD
 1.47.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.48.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.51.8.2 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.51.8.1 31-Aug-2017  bouyer apply paych, requested by maxv in ticket #237:
sys/arch/amiga/conf/DRACO patch
sys/arch/amiga/conf/GENERIC patch
sys/arch/amiga/conf/GENERIC.in patch
sys/arch/i386/conf/ALL patch
sys/arch/i386/conf/GENERIC patch
sys/arch/i386/conf/XEN3_DOM0 patch
sys/arch/i386/conf/XEN3_DOMU patch
sys/arch/sparc/conf/GENERIC patch
sys/arch/sparc/conf/KRUPS patch
sys/arch/sparc/conf/MRCOFFEE patch
sys/arch/sparc/conf/TADPOLE3GX patch
sys/arch/sparc64/conf/GENERIC patch
sys/arch/sparc64/conf/NONPLUS64 patch
sys/kern/kern_exec.c patch

Disables compat_svr4 and compat_svr4_32 on each architecture,
and removes the associated module autoload entries.
 1.55.4.1 10-Jun-2019  christos Sync with HEAD
 1.55.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.55.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.59.10.1 02-Aug-2025  perseant Sync with HEAD
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 15-Dec-2003  martin branches: 1.1.4;
Add config files for Mr.Coffee JavaStatin 1 machines.
Unfortunately we need two slightly different ones for now (OBP vs. OF)
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 15-Dec-2003  skrll file MRCOFFEE_OFW was added on branch ktrace-lwp on 2004-08-03 10:40:44 +0000
 1.96 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.95 03-Dec-2016  christos branches: 1.95.14; 1.95.16;
struct cpu_info is varible size when page_size is not fixed.
 1.94 27-Feb-2016  joerg branches: 1.94.2;
Ignore unused arguments for clang as we pass assembler flags and the
like to the preprocessor-only mode. Conditionalize GCC flags that are
not known to clang accordingly.
 1.93 24-Aug-2015  uebayasi Define ${LINKSCRIPT} in one place.
 1.92 18-Aug-2015  uebayasi Adjust paths to ${KERNLDSCRIPT} files so that dependency is resolved.
 1.91 18-Aug-2015  uebayasi Use ${KERNLDSCRIPT} instead of ${KERN_LDSCRIPT}. The former is added
to ${SYSTEM_DEP} if defined.
 1.90 15-Nov-2014  uebayasi branches: 1.90.2;
Use LINKSCRIPT.
 1.89 03-Oct-2013  mrg add -Wa,-Av8 to CFLAGS and AFLAGS to fix kernel build with binutils 2.23.2.
 1.88 17-Jan-2011  joerg branches: 1.88.6; 1.88.16; 1.88.20;
Move SPARC and SPARC64 to modern CPP. Update UPDATING note for this and
Alpha.
 1.87 06-Jul-2010  mrg branches: 1.87.2;
remove almost all the ability to build netbsd with an a.out target.
we're ELF now, and there are many missing checks against OBJECT_FMT.
if we ever consider switching, the we can figure out what new ones
we need but for now it's just clutter.

this doesn't remove any of the support for exec_aout or any actually
required-for-boot a.out support, only the ability to build a netbsd
release in a.out format. ie, most of this code has been dead for
over a decade.

i've tested builds on vax, amd64, i386, mac68k, macppc, sparc, atari,
amiga, shark, cats, dreamcast, landisk, mmeye and x68k. this covers
the 5 MACHINE_ARCH's affected, and all the other arch code touched.
it also includes some actual run-time testing of sparc, i386 and
shark, and i performed binary comparison upon amiga and x68k as well.


some minor details relevant:
- move shlib.[ch] from ld.aout_so into ldconfig proper, and cut them
down to only the parts ldconfig needs
- remove various unused source files
- switch amiga bootblocks to using elf2bb.h instead of aout2bb.h
 1.86 12-Feb-2008  joerg branches: 1.86.10; 1.86.30; 1.86.32;
Add missing assym.h dependency.
 1.85 11-Dec-2005  christos branches: 1.85.50; 1.85.56;
merge ktrace-lwp.
 1.84 31-May-2005  christos branches: 1.84.2;
s/GENASSYM/GENASSYM_CONF/ so we can use "GENASSYM" as the program name.
 1.83 04-Jun-2004  thorpej Add the %MAKEOPTIONSAPPEND token at the end of the file, after the
common Makefile.kern.inc has been included.
 1.82 26-Nov-2002  thorpej branches: 1.82.6; 1.82.10;
The traditional C preprocessor is fixed in GCC 3.3 now, so no need
to skip -traditional-cpp for HAVE_GCC3.
 1.81 01-Jul-2002  christos add a couple more dependencies so that we can build a kernel without
make depend.
 1.80 04-Jun-2002  thorpej Don't use -traditional-cpp if HAVE_GCC3.
 1.79 22-Jan-2002  pk branches: 1.79.8;
Remove out-dated dependencies on Makefile.
 1.78 23-Nov-2001  atatat Instead of checking for previous usage, just append to some make
variables. Tweak some variables to provide for more uniform defaults.
Minor adaption to makefiles for already converted ports.
 1.77 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.76 16-Nov-2001  atatat Abstract out a large chunk of the kernel build machinery so that new
build features (such as ross's DEBUGLIST) can easily be applied to all
ports. This should reduce the complexity of each port's kernel
Makefile considerably. Line counts:

227 arch/i386/conf/Makefile.i386.orig
98 arch/i386/conf/Makefile.i386
227 arch/alpha/conf/Makefile.alpha.orig
99 arch/alpha/conf/Makefile.alpha
219 arch/sparc/conf/Makefile.sparc.orig
102 arch/sparc/conf/Makefile.sparc
215 arch/vax/conf/Makefile.vax.orig
102 arch/vax/conf/Makefile.vax
253 conf/Makefile.kern.inc

Roll i386, alpha, sparc, and vax over to the new build machinery.
 1.75 26-Oct-2001  jmc 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.74 23-Oct-2001  thorpej branches: 1.74.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.73 29-May-2001  mrg branches: 1.73.2; 1.73.6;
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.72 11-Feb-2001  pk branches: 1.72.2;
Supply a kernel link script that puts `etext' at the end of all
read-only sections. Modelled after a similar change in the i386 port.
 1.71 22-Jan-2001  pk Add `-mno-fpu' to the compiler options once again: the current compiler
(egcs-2.91.66) is still liable to use FPU registers as temporaries.
 1.70 17-Dec-2000  jdolecek delete obsolete comment
 1.69 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.68 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.67 01-Feb-2000  tsutsui Revert STRIPPROG -> STRIP
 1.66 24-Jan-2000  tron Add "dependall" target for comfort.
 1.65 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.64 19-Jan-2000  tsutsui Change STRIPFLAGS=-g for cross-toolchains.
 1.63 26-Jul-1999  cgd branches: 1.63.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.62 10-Jul-1999  christos we don't need no-fpu; anyway this has been renamed in new version of egcs
 1.61 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.60 28-Jun-1999  pk Allow SFILES to be empty; from Julian Coleman.
 1.59 05-May-1999  christos Use -n for ELF. Using -N might work, but produces only one section.
No flags will not work, because it will produce a kernel loaded at 0xf0000000.
This is because the bfd ELF pagesize (in elf32-sparc.c) is 0x10000. Since
we need to load at 0xf0004000, we use -n.
 1.58 30-Apr-1999  christos Add -n for ELF, note weirdness in comment.
 1.57 18-Apr-1999  mrg use LINKFLAGS=-X to avoid stripping out per-file debugging info (idea from chuck@netbsd.org)
 1.56 14-Feb-1999  christos branches: 1.56.2; 1.56.4; 1.56.6;
Elf bits.
 1.55 08-Jan-1999  augustss Add -Wpointer-arith warning since `void *' arithmetic is not ANSI C.
 1.54 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.53 05-Sep-1998  lukem distclean is a synonym for cleandir
 1.52 31-May-1998  thorpej Specify a non-profiling C rule.
 1.51 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.50 12-Nov-1997  thorpej Make sure CPP, AR, AS, and RANLIB are defined.
 1.49 12-Nov-1997  thorpej Define LORDER, NM, and TSORT here, like we do the rest of the tools.
 1.48 03-Oct-1997  lukem branches: 1.48.2;
define SIZE?=size, and use ${SIZE} instead of size. makes cross
compilation easier
 1.47 30-Sep-1997  christos 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.46 23-Sep-1997  pk Move KERNBASE to 0xf0000000.
 1.45 12-Jul-1997  leo branches: 1.45.2;
Generate assym.h dependencies when making 'depend'.
 1.44 14-Mar-1997  mycroft Put the genassym.sh output in a temp file, and mv -f it, in case
it fails spectacularly and doesn't clean up.
 1.43 12-Mar-1997  christos Use genassym.cf
 1.42 05-Feb-1997  pk Add `-mno-fpu' to compiler flags; pulled up from 1.2 version.
 1.41 04-Feb-1997  perry Nuke some options GENERIC residue.
 1.40 04-Feb-1997  perry Nuke some GENERIC residue.
 1.39 24-Jan-1997  pk `::' => `:' ; per recent sys/lib/*/Makefile.inc changes.
 1.38 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.37 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.36 31-Aug-1996  mycroft Wrap the default definition of `S' in `.ifndef'.
 1.35 12-Aug-1996  mycroft Put into . Remove hooks for `config-dependent' and
`device-driver' flags.
 1.34 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.33 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.32 19-May-1996  pk branches: 1.32.4;
We don't generally want to profile `genassym' (easy part of PR#2434).
 1.31 11-May-1996  mycroft Make `make depend' work for libraries.
 1.30 15-Mar-1996  christos Add -Wall -Wstrict-prototypes -Wmissing-prototypes
to the kernel build. The sparc is clean now!
 1.29 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.28 26-Feb-1996  mycroft Define build programs with `?=', so they can be overridden with `makeoptions'.
 1.27 09-Feb-1996  mycroft Fix mkdep problems due to missing flags.
 1.26 03-Feb-1996  mycroft Use `-traditional-cpp' when building .s and .S files.
 1.25 02-Feb-1996  mycroft Clone these, and fix many bugs.
 1.24 02-Feb-1996  mycroft assym.s -> assym.h
(Some ports did this already.)
 1.23 22-Oct-1995  pk Remove `-fno-builtin'.
 1.22 19-Sep-1995  thorpej Compile the kernel with -Werror and -fno-builtin.
 1.21 24-Jun-1995  christos Makefile.`arch`: - Add -lcompat
- Change clean: target to be a double dep one,
so libraries can use the clean target too
 1.20 16-May-1995  jtc Removing -DKERNEL, transition to _KERNEL has been completed
 1.19 08-May-1995  pk Remove -I/usr/include from `genassym' line.
 1.18 23-Mar-1995  jtc Added -D_KERNEL to CFLAGS alongside each -DKERNEL.
 1.17 07-Dec-1994  deraadt bigtime cleanup
 1.16 06-Dec-1994  deraadt clean better
 1.15 20-Nov-1994  deraadt copyright/Id cleanup
 1.14 02-Nov-1994  deraadt clean vnode_if.[ch]
 1.13 20-Jul-1994  deraadt compile kernel with -O2
 1.12 16-Jun-1994  deraadt branches: 1.12.2;
vnode_if cleanup
 1.11 10-Jun-1994  pk New vnode interface.
 1.10 27-May-1994  pk Remove old-style profiling hack.
 1.9 05-May-1994  deraadt split sun4c/sun4m/sun4 support somewhat
 1.8 13-Apr-1994  deraadt compile genassym static
 1.7 17-Mar-1994  pk Some bits and pieces to make a profiled kernel (for the moment).
 1.6 04-Feb-1994  deraadt make make depend dependable
 1.5 04-Feb-1994  deraadt blow away sunos cross compilation gunk. we no longer need it,
as we are capable of compiling ourselves.
 1.4 29-Nov-1993  deraadt more cleanup
 1.3 29-Nov-1993  deraadt start to get rid of some of the hacks
 1.2 11-Oct-1993  deraadt New location for libkern, fixes for many paths.
+ lots of temp changes to be backed out later!
DEBUG=-g always, use gcc, link with libgcc.a, include dirs in
a weird place for my development environment.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.12.2.2 24-Oct-1994  deraadt make the release run more than 10 minutes
 1.12.2.1 20-Jul-1994  cgd from trunk.
 1.32.4.1 12-Jun-1996  pk Add `-mno-fpu' to CFLAGS to work around gcc bug.
 1.45.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.45.2.1 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.48.2.1 12-Nov-1997  thorpej Pull up "make sure tools are defined" changes from trunk.
 1.56.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.56.4.3 02-Aug-1999  thorpej Update from trunk.
 1.56.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.56.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.56.2.1 02-Jul-1999  perry pullup 1.59->1.160 (pk)
 1.63.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.63.2.3 11-Feb-2001  bouyer Sync with HEAD.
 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.72.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.73.6.6 11-Dec-2002  thorpej Sync with HEAD.
 1.73.6.5 01-Aug-2002  nathanw Catch up to -current.
 1.73.6.4 20-Jun-2002  nathanw Catch up to -current.
 1.73.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.73.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.73.6.1 29-May-2001  nathanw file Makefile.sparc was added on branch nathanw_sa on 2002-01-08 00:27:33 +0000
 1.73.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.73.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.73.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.73.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.74.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.79.8.2 17-Jul-2002  gehenna catch up with -current.
 1.79.8.1 15-Jul-2002  gehenna catch up with -current.
 1.82.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.82.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.82.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.82.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.82.6.1 03-Aug-2004  skrll Sync with HEAD
 1.84.2.1 27-Feb-2008  yamt sync with head.
 1.85.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.85.50.1 23-Mar-2008  matt sync with HEAD
 1.86.32.1 05-Mar-2011  rmind sync with head
 1.86.30.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.86.10.1 11-Aug-2010  yamt sync with head.
 1.87.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.88.20.1 18-May-2014  rmind sync with head
 1.88.16.2 03-Dec-2017  jdolecek update from HEAD
 1.88.16.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.88.6.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.90.2.3 05-Dec-2016  skrll Sync with HEAD
 1.90.2.2 19-Mar-2016  skrll Sync with HEAD
 1.90.2.1 22-Sep-2015  skrll Sync with HEAD
 1.94.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.95.16.1 10-Jun-2019  christos Sync with HEAD
 1.95.14.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.13 07-Dec-1994  mycroft Clean up deleted files.
 1.12 05-Dec-1994  deraadt COMPAT_10 all around
 1.11 20-Nov-1994  deraadt copyright/Id cleanup
 1.10 20-Aug-1994  deraadt no need for timezone spec
 1.9 12-Aug-1994  deraadt option GDB isn't valid
disable KGDB because we do not have (userland) support for it
 1.8 01-Aug-1994  deraadt make work
 1.7 27-Jul-1994  deraadt cleanup
 1.6 22-May-1994  deraadt branches: 1.6.2;
update..
 1.5 12-Apr-1994  deraadt partial clean; needs more work
 1.4 03-Mar-1994  deraadt kbd is now a pseudo-device
 1.3 04-Feb-1994  deraadt cleanup
 1.2 02-Dec-1993  deraadt NFS -> NFSSERVER and NFSCLIENT
take out NEWCONFIG option
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.6.2.4 24-Oct-1994  deraadt ship release without DEBUG and DIAGNOSTIC
 1.6.2.3 12-Aug-1994  mycroft update from trunk
 1.6.2.2 01-Aug-1994  cgd try that again.
 1.6.2.1 01-Aug-1994  cgd from trunk.
 1.6 07-Dec-1994  mycroft Clean up deleted files.
 1.5 05-Dec-1994  deraadt COMPAT_10 all around
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 20-Aug-1994  deraadt no need for timezone spec
 1.2 12-Aug-1994  deraadt branches: 1.2.2;
document why this exists
 1.1 12-Aug-1994  deraadt option GDB isn't valid
disable KGDB because we do not have (userland) support for it
 1.2.2.2 24-Oct-1994  deraadt ship release without DEBUG and DIAGNOSTIC
 1.2.2.1 12-Aug-1994  deraadt file SPARC_SCSI3 was added on branch netbsd-1-0 on 1994-10-24 19:51:53 +0000
 1.9 07-Dec-1994  mycroft Clean up deleted files.
 1.8 05-Dec-1994  deraadt COMPAT_10 all around
 1.7 30-Nov-1994  deraadt enable SYSVMSG,SYSVSEM,SYSVSHM
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 12-Aug-1994  deraadt option GDB isn't valid
disable KGDB because we do not have (userland) support for it
 1.4 27-Jul-1994  deraadt cleanup
 1.3 22-May-1994  deraadt branches: 1.3.2;
update..
 1.2 12-May-1994  deraadt SYSVSHM goes away, it will be back soon
 1.1 05-May-1994  deraadt split sun4c/sun4m/sun4 support somewhat
 1.3.2.2 12-Aug-1994  mycroft update from trunk
 1.3.2.1 28-Jul-1994  cgd from trunk.
 1.14 15-May-1996  thorpej These haven't been kept up to date.
 1.13 11-Apr-1996  thorpej Haven't used "options RCONSOLE" for a long time. Update to the new
"options RASTERCONSOLE". Noticed by cgd.
 1.12 02-Jun-1995  pk Update SCSI decls.
 1.11 02-Mar-1995  pk Update for 4/100
 1.10 25-Jan-1995  cgd vn -> vnd renaming, for consistency
 1.9 17-Dec-1994  deraadt correct ie[1234] addreses
 1.8 16-Dec-1994  deraadt ie[01234] and obclock
 1.7 07-Dec-1994  deraadt bigtime cleanup
 1.6 05-Dec-1994  deraadt COMPAT_10 all around
 1.5 30-Nov-1994  deraadt enable SYSVMSG,SYSVSEM,SYSVSHM
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 02-Nov-1994  deraadt first vme ie card
 1.2 26-Oct-1994  deraadt updates
 1.1 02-Oct-1994  deraadt sun4/300 support works
 1.5 15-May-1996  thorpej These haven't been kept up to date.
 1.4 11-Apr-1996  thorpej Haven't used "options RCONSOLE" for a long time. Update to the new
"options RASTERCONSOLE". Noticed by cgd.
 1.3 02-Jun-1995  pk Update SCSI decls.
 1.2 25-Jan-1995  cgd vn -> vnd renaming, for consistency
 1.1 07-Dec-1994  deraadt bigtime cleanup
 1.5 07-Dec-1994  mycroft Clean up deleted files.
 1.4 05-Dec-1994  deraadt COMPAT_10 all around
 1.3 30-Nov-1994  deraadt enable SYSVMSG,SYSVSEM,SYSVSHM
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 26-Oct-1994  deraadt updates
 1.7 15-May-1996  thorpej These haven't been kept up to date.
 1.6 11-Apr-1996  thorpej Haven't used "options RCONSOLE" for a long time. Update to the new
"options RASTERCONSOLE". Noticed by cgd.
 1.5 01-Apr-1996  pk Update device list.
 1.4 02-Jun-1995  pk Update SCSI decls.
 1.3 25-Jan-1995  cgd vn -> vnd renaming, for consistency
 1.2 16-Dec-1994  deraadt SUN4m-only..
 1.1 07-Dec-1994  deraadt bigtime cleanup
 1.5 07-Dec-1994  mycroft Clean up deleted files.
 1.4 05-Dec-1994  deraadt COMPAT_10 all around
 1.3 30-Nov-1994  deraadt enable SYSVMSG,SYSVSEM,SYSVSHM
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 26-Oct-1994  deraadt updates
 1.79 24-Feb-2025  andvar s/architecure/architecture/ and few other typos in comments.
 1.78 08-May-2019  isaki branches: 1.78.34;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.77 13-Apr-2019  isaki branches: 1.77.2;
Add drvctl to kernel which has audio device.
audiocfg(1) requires drvctl(4).
 1.76 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.75 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.74 05-Feb-2018  maxv branches: 1.74.2; 1.74.4;
Nuke DIRECTED_BROADCAST, it is not documented and not enabled anywhere. It
probably wouldn't have built correctly anyway, since there is no associated
defflag.

These ten lines of code in ip_input.c already look a lot better.
 1.73 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.72 30-Jul-2017  maxv Disable svr4 and svr4_32 on sparc, sparc64 and amiga - the only places
where they were still enabled.
 1.71 29-Jul-2017  maxv Remove TCP_COMPAT_42 from the config files. Pass 3.
 1.70 13-Dec-2016  christos branches: 1.70.8;
wildcard speaker attachments, now that we can handle many of them.
 1.69 10-Dec-2016  christos remove VAUDIOSPEAKER for now, will be done differently.
 1.68 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.67 26-Sep-2015  maxv branches: 1.67.2;
Remove KMEMSTATS. Normally it's ok now.
 1.66 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.65 16-Nov-2014  manu branches: 1.65.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.64 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.63 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.62 16-Aug-2014  apb Add "options COMPAT_70" to all kernel configuration files that
already had "options COMPAT_60".
 1.61 24-Mar-2014  szptvlfn branches: 1.61.4;
fix manual section numbering of sysctl.
thanks wiz@
 1.60 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.59 01-Mar-2013  joerg branches: 1.59.6;
Retire OSI network stack. OK core@
 1.58 17-Oct-2012  apb Add "options COMPAT_60" to all kernel configuration files
that already had "options COMPAT_50".
 1.57 26-Jun-2012  macallan branches: 1.57.2;
switch to WSEMUL_VT100 to reduce differences with sparc64 and other wscons
and fb console using ports
WSEMUL_SUN is left in but commented out so whoever wants it back can have it
with minimal effort
 1.56 05-Jun-2012  abs Adjust the WSDISPLAY_COMPAT_USL comment to mention wsconscfg, to at least
give a hint that its not just for third party compat. No functional change.
 1.55 11-Mar-2012  nakayama Remove stray comments for LKM.
 1.54 22-Nov-2011  tls branches: 1.54.2; 1.54.4;

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.53 06-Mar-2011  bouyer branches: 1.53.4;
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.52 17-Jan-2011  jdc branches: 1.52.2;
Add (commented out) LOCKDEBUG and SYSCALL_DEBUG options.
 1.51 23-Nov-2010  hannken branches: 1.51.2;
Remove unused count from pseudo-device md.
 1.50 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.49 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.48 05-Dec-2009  pooka branches: 1.48.2; 1.48.4;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.47 22-Jun-2009  tsutsui Enable ddb(4) for sparc GENERIC-like kernels.
Discussed on port-sparc@.
 1.46 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.45 22-Feb-2009  jun add
COMPAT_50
 1.44 08-Feb-2009  jdc branches: 1.44.2;
Cosmetic clean up:
options<space><tab>
 1.43 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.42 17-Oct-2007  garbled branches: 1.42.16; 1.42.20; 1.42.26; 1.42.28; 1.42.30; 1.42.34;
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  uwe branches: 1.41.10;
Add COMPAT_40. While here, make COMPAT_30 comment match other COMPAT_*.
 1.40 27-Sep-2006  manu branches: 1.40.8; 1.40.10; 1.40.16;
- Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.39 26-Aug-2006  christos branches: 1.39.2; 1.39.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.38 09-Mar-2006  macallan default to sun terminal emulation, add DBRI_* options and comments
 1.37 07-Mar-2006  macallan switch to wscons
 1.36 05-Feb-2006  cube branches: 1.36.2; 1.36.4;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.35 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.34 07-Dec-2005  tsutsui branches: 1.34.2; 1.34.4; 1.34.6;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.33 25-Sep-2005  macallan Put the SPARCbook 3GX and 3GS CPU to sleep when idle
 1.32 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.31 19-Aug-2005  christos 64 bit inode changes.
 1.30 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.29 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.28 16-Jul-2005  macallan added dbri audio driver
 1.27 10-Jul-2005  macallan added Tadpole TS102 SBus-PCMCIA bridge driver (tslot) and a couple of PCMCIA card drivers
 1.26 25-Feb-2005  simonb branches: 1.26.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.25 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.24 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.23 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.22 10-Nov-2004  christos branches: 1.22.4; 1.22.6;
Add COMPAT_BSDPTY to the rest of the config files.
 1.21 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.20 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.19 07-Oct-2003  tron branches: 1.19.2;
Add COMPAT_16.
 1.18 10-Apr-2003  christos branches: 1.18.2;
Bye Bye UCONSOLE
 1.17 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.16 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.15 14-May-2002  lukem branches: 1.15.2; 1.15.4;
- Enable NFS_BOOT_DHCP (as well as the existing NFS_BOOT_BOOTPARAM).
DHCP/Bootp is tried before bootparams in the MI nfs mountroot code.
- Change the order in boot.net from "bootparams then bootp" to
"bootp then bootparams", to be consistent with the MI nfs mountroot code.

(Consistency with other NetBSD ports is good, and things still work
for sites that run bootparams but not dhcp/bootp, although I'd argue that
dhcp/bootp is much easier to setup and manage and is easier to debug
than our rpc.bootparamd...)

Per discussion with Paul Kranenburg and Matt Green.
 1.14 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.13 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.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 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.9 08-Jul-2001  abs branches: 1.9.2; 1.9.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.8 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.7 27-Jul-2000  mrg remove COMPAT_AOUT option.
 1.6 25-Feb-2000  jdc Add auxiotwo (Tadpole 3GX aux 2 register) entry.
 1.5 12-Nov-1999  matt remove reference to auxiotwo
 1.4 11-Nov-1999  matt add COMPAT_14
 1.3 11-Aug-1999  matt branches: 1.3.2; 1.3.4; 1.3.8;
remove some more devices that are not the tadpole.
add the tctrl device (which controls the tadpole microcontroller).
 1.2 01-Aug-1999  matt branches: 1.2.2;
Initial stab at a P9100 console FB driver for the Tadpole 3GX.
It supports RASTERCONSOLE only and the colormap support is
broken (the hardware doesn't seem to be doing what the tech.
docs. say it should be doing). But it is usable as a console
(but with blue on white as the only color choice). I figured
I'd check it in since it is somewhat usable and someone else
might figure what I screwed up in the color map support.
 1.1 30-Jul-1999  matt Add config file specificially for Tadpole 3GX/3GS laptops.
It save ~800KB over the standard GENERIC config file.
 1.2.2.2 02-Aug-1999  thorpej Update from trunk.
 1.2.2.1 01-Aug-1999  thorpej file TADPOLE3GX was added on branch chs-ubc2 on 1999-08-02 20:09:12 +0000
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.9.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.9.8.4 17-Apr-2002  nathanw Catch up to -current.
 1.9.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.9.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.9.8.1 08-Jul-2001  nathanw file TADPOLE3GX was added on branch nathanw_sa on 2002-01-08 00:27:34 +0000
 1.9.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.9.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.4.1 01-Aug-2002  lukem Pull up revision 1.16 (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.15.2.1 15-Jul-2002  gehenna catch up with -current.
 1.18.2.9 11-Dec-2005  christos Sync with head.
 1.18.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.2.6 15-Feb-2005  skrll Sync with HEAD.
 1.18.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.18.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.2.1 15-Jul-2004  he Pull up revision 1.20 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.22.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.6.1 12-Feb-2005  yamt sync with head.
 1.22.4.1 29-Apr-2005  kent sync with -current
 1.26.4.3 03-Sep-2007  yamt sync with head.
 1.26.4.2 30-Dec-2006  yamt sync with head.
 1.26.4.1 21-Jun-2006  yamt sync with head.
 1.34.6.1 22-Apr-2006  simonb Sync with head.
 1.34.4.1 09-Sep-2006  rpaulo sync with head
 1.34.2.1 18-Feb-2006  yamt sync with head.
 1.36.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.36.2.2 03-Sep-2006  yamt sync with head.
 1.36.2.1 13-Mar-2006  yamt sync with head.
 1.39.4.1 22-Oct-2006  yamt sync with head
 1.39.2.1 18-Nov-2006  ad Sync with head.
 1.40.16.1 26-Jun-2007  garbled Sync with HEAD.
 1.40.10.1 11-Jul-2007  mjf Sync with head.
 1.40.8.1 09-Jun-2007  ad Sync with head.
 1.41.10.1 06-Nov-2007  matt sync with HEAD
 1.42.34.1 21-Apr-2010  matt sync to netbsd-5
 1.42.30.1 16-Oct-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #1065):
sys/arch/sparc/conf/GENERIC: revision 1.214
sys/arch/sparc/conf/KRUPS: revision 1.50
sys/arch/sparc/conf/MRCOFFEE: revision 1.28
sys/arch/sparc/conf/TADPOLE3GX: revision 1.47
Enable ddb(4) for sparc GENERIC-like kernels.
Discussed on port-sparc@.
 1.42.28.3 28-Apr-2009  skrll Sync with HEAD.
 1.42.28.2 03-Mar-2009  skrll Sync with HEAD.
 1.42.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.42.26.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.42.20.4 11-Aug-2010  yamt sync with head.
 1.42.20.3 11-Mar-2010  yamt sync with head
 1.42.20.2 18-Jul-2009  yamt sync with head.
 1.42.20.1 04-May-2009  yamt sync with head.
 1.42.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.44.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.48.4.3 21-Apr-2011  rmind sync with head
 1.48.4.2 05-Mar-2011  rmind sync with head
 1.48.4.1 30-May-2010  rmind sync with head
 1.48.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.48.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.51.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.52.2.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.53.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.53.4.2 30-Oct-2012  yamt sync with head
 1.53.4.1 17-Apr-2012  yamt sync with head
 1.54.4.2 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.54.4.1 12-Jun-2012  riz branches: 1.54.4.1.4; 1.54.4.1.6;
Pull up following revision(s) (requested by abs in ticket #311):
sys/arch/netwinder/conf/GENERIC: revision 1.112
sys/arch/i386/conf/GENERIC: revision 1.1074
sys/arch/atari/conf/MILAN.in: revision 1.26
sys/arch/zaurus/conf/GENERIC: revision 1.54
sys/arch/shark/conf/GENERIC: revision 1.101
sys/arch/hpcmips/conf/MPC303: revision 1.60
sys/arch/i386/conf/XEN3_DOM0: revision 1.67
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.29
sys/arch/vax/conf/GENERIC: revision 1.181
sys/arch/sparc/conf/KRUPS: revision 1.59
sys/arch/evbarm/conf/BEAGLEBOARD: revision 1.27
sys/arch/i386/conf/INSTALL_FLOPPY: revision 1.16
sys/arch/prep/conf/GENERIC: revision 1.163
sys/arch/hpcmips/conf/GENERIC: revision 1.216
sys/arch/sparc/conf/TADPOLE3GX: revision 1.56
sys/arch/shark/conf/INSTALL: revision 1.50
sys/arch/next68k/conf/GENERIC: revision 1.127
sys/arch/evbppc/conf/VIRTEX_GSRD2: revision 1.16
sys/arch/evbppc/conf/VIRTEX_DFC: revision 1.17
sys/arch/evbppc/conf/EXPLORA451: revision 1.48
sys/arch/bebox/conf/INSTALL: revision 1.54
sys/arch/next68k/conf/SLAB: revision 1.46
sys/arch/i386/conf/GENERIC_TINY: revision 1.132
sys/arch/bebox/conf/GENERIC: revision 1.131
sys/arch/amd64/conf/XEN3_DOM0: revision 1.84
sys/arch/amd64/conf/GENERIC: revision 1.356
sys/arch/evbarm/conf/MMNET_GENERIC: revision 1.6
share/man/man4/wscons.4: revision 1.31
sys/arch/hpcmips/conf/TX3912: revision 1.79
sys/arch/evbarm/conf/ARMADILLO9: revision 1.35
sys/arch/hpcsh/conf/GENERIC: revision 1.97
sys/arch/i386/conf/ALL: revision 1.339
sys/arch/hpcmips/conf/TX3922: revision 1.93
sys/arch/cats/conf/INSTALL: revision 1.82
sys/arch/sparc64/conf/GENERIC: revision 1.151
sys/arch/i386/conf/INSTALL_TINY: revision 1.135
sys/arch/evbppc/conf/VIRTEX_GSRD1: revision 1.15
sys/arch/evbarm/conf/TS7200: revision 1.49
sys/arch/hpcmips/conf/VR41XX: revision 1.55
sys/arch/hp700/conf/GENERIC: revision 1.115
sys/arch/cats/conf/GENERIC: revision 1.140
Mention wsconscfg(8) needs WSDISPLAY_COMPAT_USL
If a port is going to have wscons for virtual terminals then it really make=
s
sense to enable WSDISPLAY_COMPAT_USL so the system can switch between the
virtual terminals...
Adjust the WSDISPLAY_COMPAT_USL comment to mention wsconscfg, to at least
give a hint that its not just for third party compat. No functional change.
 1.54.4.1.6.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.54.4.1.4.1 22-May-2018  martin Apply patch requested by maxv in ticket #1500:

* disable compat_svr4 and compat_svr4_32 everywhere
* disable compat_ibcs2 everywhere but on Vax
* remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list
 1.54.2.1 05-Apr-2012  mrg sync to latest -current.
 1.57.2.4 03-Dec-2017  jdolecek update from HEAD
 1.57.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.57.2.2 23-Jun-2013  tls resync from head
 1.57.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.59.6.2 18-May-2014  rmind sync with head
 1.59.6.1 28-Aug-2013  rmind sync with head
 1.61.4.3 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.61.4.2 18-Nov-2014  snj branches: 1.61.4.2.2; 1.61.4.2.6;
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.61.4.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.61.4.2.6.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.61.4.2.2.1 25-Feb-2018  snj Apply patch (requested by maxv in ticket #1499):
- disable compat_svr4 and compat_svr4_32 everywhere
- disable compat_ibcs2 everywhere but on Vax
- remove svr4/svr4_32/ibcs2/freebsd from the module autoload list
 1.65.2.4 28-Aug-2017  skrll Sync with HEAD
 1.65.2.3 05-Feb-2017  skrll Sync with HEAD
 1.65.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.65.2.1 22-Sep-2015  skrll Sync with HEAD
 1.67.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.70.8.1 31-Aug-2017  bouyer apply paych, requested by maxv in ticket #237:
sys/arch/amiga/conf/DRACO patch
sys/arch/amiga/conf/GENERIC patch
sys/arch/amiga/conf/GENERIC.in patch
sys/arch/i386/conf/ALL patch
sys/arch/i386/conf/GENERIC patch
sys/arch/i386/conf/XEN3_DOM0 patch
sys/arch/i386/conf/XEN3_DOMU patch
sys/arch/sparc/conf/GENERIC patch
sys/arch/sparc/conf/KRUPS patch
sys/arch/sparc/conf/MRCOFFEE patch
sys/arch/sparc/conf/TADPOLE3GX patch
sys/arch/sparc64/conf/GENERIC patch
sys/arch/sparc64/conf/NONPLUS64 patch
sys/kern/kern_exec.c patch

Disables compat_svr4 and compat_svr4_32 on each architecture,
and removes the associated module autoload entries.
 1.74.4.1 10-Jun-2019  christos Sync with HEAD
 1.74.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.74.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.77.2.1 01-May-2019  isaki Adapt dbri to audio2.
- Add some mutex_enter/exit.
- Remove DBRI_BIG_BUFFER option. Such big buffer will not necessary
in audio2.
Thank you, macallan@.
 1.78.34.1 02-Aug-2025  perseant Sync with HEAD
 1.26 15-May-1996  thorpej These haven't been kept up to date.
 1.25 11-Apr-1996  thorpej Haven't used "options RCONSOLE" for a long time. Update to the new
"options RASTERCONSOLE". Noticed by cgd.
 1.24 02-Jun-1995  pk Update SCSI decls.
 1.23 25-Jan-1995  cgd vn -> vnd renaming, for consistency
 1.22 07-Dec-1994  deraadt bigtime cleanup
 1.21 05-Dec-1994  deraadt COMPAT_10 all around
 1.20 30-Nov-1994  deraadt enable SYSVMSG,SYSVSEM,SYSVSHM
 1.19 20-Nov-1994  deraadt copyright/Id cleanup
 1.18 26-Oct-1994  deraadt updates
 1.17 02-Oct-1994  deraadt sun4/300 support works
 1.16 17-Sep-1994  deraadt new scsi
 1.15 12-Aug-1994  deraadt option GDB isn't valid
disable KGDB because we do not have (userland) support for it
 1.14 27-Jul-1994  deraadt cleanup
 1.13 24-Jun-1994  deraadt branches: 1.13.2;
make it all work, make it faster
 1.12 22-May-1994  deraadt update..
 1.11 12-May-1994  deraadt SYSVSHM goes away, it will be back soon
 1.10 05-May-1994  deraadt split sun4c/sun4m/sun4 support somewhat
 1.9 18-Apr-1994  deraadt shm
 1.8 12-Apr-1994  deraadt partial clean; needs more work
 1.7 03-Mar-1994  deraadt kbd is now a pseudo-device
 1.6 27-Feb-1994  deraadt more more more
 1.5 01-Feb-1994  deraadt sparc runs in current today
 1.4 02-Dec-1993  deraadt NFS -> NFSSERVER and NFSCLIENT
take out NEWCONFIG option
 1.3 27-Oct-1993  deraadt more hacks to my private config file
 1.2 17-Oct-1993  deraadt use RCONSOLE; whee
 1.1 10-Oct-1993  deraadt TDR: config file i'm testing with
files.sparc.newconf: a files file that works
files.sparc: old name for above file, might as well delete
 1.13.2.2 12-Aug-1994  mycroft update from trunk
 1.13.2.1 28-Jul-1994  cgd from trunk.
 1.10 28-Jul-1994  mycroft Clean up deleted files.
 1.9 24-Jun-1994  deraadt make it all work, make it faster
 1.8 22-May-1994  deraadt update..
 1.7 12-May-1994  deraadt SYSVSHM goes away, it will be back soon
 1.6 18-Apr-1994  deraadt shm
 1.5 12-Apr-1994  deraadt partial clean; needs more work
 1.4 03-Mar-1994  deraadt kbd is now a pseudo-device
 1.3 04-Feb-1994  deraadt cleanup
 1.2 02-Dec-1993  deraadt NFS -> NFSSERVER and NFSCLIENT
take out NEWCONFIG option
 1.1 28-Nov-1993  deraadt theo's other test kernel
 1.164 26-Oct-2023  andvar Build db_machdep.c when KGDB option is enabled.
Do not cast (regs)->db_tf.tf_pc to db_addr_t (thus ifdef block is redundant).
Adjust ifdef conditions in db_interface.c to make it build with KGDB option.
While here, add #endif comments for longer blocks.

These changes should make sparc build with KGDB option, once ddb/db_access.c
code will be fixed to build with it.
 1.163 24-Apr-2021  thorpej 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.162 21-Oct-2020  christos branches: 1.162.4;
make process_machdep.c included always since it provides register i/o used by
sys_process_getlwpstatus.c which is always included.
 1.161 20-Oct-2020  christos harmonize process_machdep.c inclusion.
 1.160 12-Sep-2020  isaki Improve am7930 family drivers to share more code.
audioamd(4) on sparc, vsaudio(4) on vax, and bba(4) are.
- Remove complex and useless callbacks: onopen, onclose, and
indirect_{read,write}. This makes audioamd and vsaudio almost the same.
- Remove (already disabled) assembly fast interrupt path from audioamd(4).
cf. http://mail-index.netbsd.org/source-changes/2009/12/19/msg004585.html
- Use trigger_* method rather than start_* method. It's more suitable.
vsaudio(4) was tested by naru@, bba(4) was tested by tsutsui@.
 1.159 01-Mar-2019  macallan defflag SX_DEBUG
 1.158 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.157 21-Jul-2017  nakayama branches: 1.157.2; 1.157.4;
Move the ddb registers and empty command table used for crash(8) into
db_machdep.c like other archs.
 1.156 30-Apr-2016  macallan branches: 1.156.10;
cgfourteen needs glyphcache now
 1.155 21-Apr-2016  macallan cgfourteen needs vcons
 1.154 16-Apr-2013  jdc branches: 1.154.12;
Add PCI fixup for MicroSPARC-IIep.
Unconfigured PCI-PCI bridges and devices behind them are configured.
 1.153 05-Feb-2013  macallan attachment and initialization for SX
 1.152 06-Nov-2012  alnsn Enable bpfjit on sparc.
 1.151 12-Jun-2011  rmind branches: 1.151.2; 1.151.12;
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.150 20-Sep-2010  tsutsui branches: 1.150.6;
Prepare sparc optimized (by 32 bit add-with-carry insns) cpu_in_cksum()
which is reusing in_cksum_internal() in old sparc/in_cksum.c.

~4% improvements of ttcp(1) xfer rates on SS1+ with le(4).
 1.149 15-Jan-2010  bouyer branches: 1.149.2; 1.149.4;
Add apc(4), a driver for the Aurora Personality Chip (APC) found
on SPARCstation-4/5, and emulated by qemu to idle the simulator
when the CPU is idle. Infos about the registers from the linux driver.
Not enabled by default because it can cause some Sparc systems to
hang (so says the linux driver).
Only the CPU idle part implemented at this time; fan speed and
Convenience power outlet management to be added.
Tested on qemu.
 1.148 27-Sep-2009  tsutsui Remove commented out and nonexistent cgthree at obio stuff.

SPARCclassic has onboard CG3 but it's internally connected via SBus,
and there is no info about sun4m machines which actually require
cgthree at obio attachment. Info from jdc@.
 1.147 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.146 20-Feb-2008  drochner branches: 1.146.6; 1.146.10; 1.146.16; 1.146.18; 1.146.20; 1.146.24;
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.145 14-Feb-2008  ad Make sparc use atomic_cas_ulong() for mutex and rwlock operations, and
disable the custom mutex/rwlock code. PR port-sparc/37930. ok martin@
 1.144 25-Jan-2008  joerg Refactor in_cksum/in4_cksum/in6_cksum implementations:
- All three functions are included in the kernel by default.
They call a backend function cpu_in_cksum after possibly
computing the checksum of the pseudo header.
- cpu_in_cksum is the core to implement the one-complement sum.
The default implementation is moderate fast on most platforms
and provides a 32bit accumulator with 16bit addends for L32 platforms
and a 64bit accumulator with 32bit addends for L64 platforms.
It handles edge cases like very large mbuf chains (could happen with
native IPv6 in the future) and provides a good base for new native
implementations.
- Modify i386 and amd64 assembly to use the new interface.

This disables the MD implementations on !x86 until the conversion is
done. For Alpha, the portable version is faster.
 1.143 06-Jan-2008  ad Add MODULAR option. Include kernel linker stuff if MODULAR.
 1.142 17-Oct-2007  garbled branches: 1.142.2; 1.142.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.141 30-Jul-2007  macallan branches: 1.141.6;
add wsdisplay support for cg14
The console will run in 8bit but switch to 32bit in mapped mode so XFree86
with wsfb can run in 24bit colour.
 1.140 07-Jul-2007  tsutsui branches: 1.140.2; 1.140.4;
Remove leftover netns stuff.
 1.139 10-Apr-2007  macallan branches: 1.139.4;
include files.wsfb
 1.138 18-Mar-2007  jdc Add USB support (for the Javastation Espresso).
 1.137 09-Feb-2007  ad branches: 1.137.2; 1.137.6; 1.137.8; 1.137.10;
Merge newlock2 to head.
 1.136 13-Nov-2005  uwe branches: 1.136.22;
G/c arch/sparc/sparc/sys_process.c that has been commented out since
revision 1.1 anyway.
 1.135 25-Sep-2005  macallan Put the SPARCbook 3GX and 3GS CPU to sleep when idle
 1.134 10-Jul-2005  christos - add syscall_{plain,fancy}
- make it use mi_userret
 1.133 06-Jul-2005  macallan sysmon_* attributes for device tctrl
 1.132 06-Jul-2005  macallan Add support for the TS102 PCMCIA controller found in SPARCbooks
 1.131 30-Jun-2005  macallan branches: 1.131.2;
Allow sparc64-style attachment of mouse and keyboard via zstty, needed for
wscons support.
Reviewed by uwe.
 1.130 14-Sep-2004  jdolecek do not include "compat/aout/files.aout", COMPAT_AOUT is soon to be removed
 1.129 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.128 03-Apr-2004  chs add some SUN4D stuff.
zs and zstty no longer need "needs-count" or "needs-flag",
so get rid of those and wild-card the extra zs devices on SUN4D.
 1.127 17-Mar-2004  matt Fix typo (pckbort -> pckbport)
 1.126 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.125 14-Feb-2004  bjh21 Add a new MI attribute, pckbc_machdep_cnattach, and change pckbc_cnattach()
to only call pckbc_machdep_cnattach() if this is present. This allows
pckbc_machdep_cnattach() to be omitted entirely on most ports, where it only
returns ENXIO anyway.

The devices with this attribute at the moment are pc(4) on i386 and bebox, and
pckbc on sparc, where pckbc_machdep_cnattach() mysteriously returns 0 rather
than ENXIO.
 1.124 15-Nov-2003  bouyer Commit changes proposed on tech-kern Thu, 6 Nov 2003
- factor out disksubr.c between sun3, sparc and sparc64. Keep the sun3
groveling code to find a NetBSD disklabel in the first sector (so that it
can find a label at the old sun3 LABELOFFSET) as a fallback is not
label at LABELOFFSET, or sun label is present.
- Fix the sun3 LABELOFFSET (was 64, but the kernel wrote the NetBSD label at
128)
- Make next68k disksubr.c always write a next-compatible disklabel.
- remove #ifdef __sparc__ hack from disklabel(8), and change it to issue
a DIOCWDINFO after writing the disklabel to the raw partition in the
-r/-I case (so that the kernel can convert the label if needed).
 1.123 27-Jul-2003  thorpej Since everyone uses clock_subr.c (or should, if they don't currently),
list it in conf/files instead of in every port's files.*.
 1.122 07-Dec-2002  pk branches: 1.122.6;
Use MI versions of {set,rem}runqueue().
 1.121 26-Oct-2002  jdolecek 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.120 21-Oct-2002  uwe Correct zstty interface attribute (cf files.sparc64 1.69).
Comment out unused kbd_tty and ms_tty attachments.
 1.119 15-Oct-2002  jdc Add audioamd at obio attachment. Now we have working audio on 4/600's :

audioamd0 at obio0 slot 0 offset 0x500000 level 13 softpri 4
audio0 at audioamd0: full duplex
 1.118 03-Oct-2002  uwe Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

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

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.117 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.116 25-Aug-2002  thorpej Split the timer code up into Sun4/Sun4c, Sun4m, and MS-IIep bits, mostly
to make it more readable.
 1.115 24-Aug-2002  thorpej Add autoconfiguration support for the Sun4d "bootbus". Add a
zs @ bootbus attachment.
 1.114 23-Aug-2002  thorpej Add autoconfiguration glue for the Sun4d "cpu-unit". Each processor
board has 2 CPU units (one for each processor), one of which also has
a "bootbus", to which the serial ports, etc. are attached.

We can now probe/attach CPUs on a SPARCserver 1000.
 1.113 17-Jul-2002  thorpej Add SUN4D to the list of arch's in opt_sparc_arch.h.
 1.112 22-Apr-2002  augustss branches: 1.112.2;
Rename the audio "bus" attribute audiobus to avoid confusion with audio
device.
 1.111 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.110 28-Mar-2002  uwe Move ms-IIep PCIC driver into mspcic0 at msiiep0. msiiep0 now serves
as a stub bus that knows how to attach drivers for various functions
of PCIC.

This change is a follow up to timer0 at msiiep0 change, since all
children must share same attach arguments and so we no longer can
attach pci0 directly under msiiep0.
 1.109 28-Mar-2002  pk Untangle clock.c:
* put various time-of-day clock, timer and eeprom drivers in separate files
* avoid unnecessary overhead in interrupt handlers
* make the MSIIEP timer attach through the regular autoconf mechanisms
 1.108 12-Mar-2002  uwe Rework the driver to add EBus DMA support and improve APC DMA support.
Audio-related stuff is left almost intact.

* support audiocs at ebus playback and capture
tested on krups and u5 (thanks, martin)
* make first attempt at supporting audiocs at sbus capture
* nb: full-duplex is not tested
* while here, fix CSAUDIO_MONITOR_MUTE to be of CSAUDIO_MONITOR_CLASS
i.e. outputs.monitor.mute -> monitor.monitor.mute

Ok by pk, eeh.
 1.107 21-Jan-2002  jdolecek branches: 1.107.4;
Switch to MI dev/md_root.c for archs which don't have any special
memory disk hooks (i.e. everything except atari).
 1.106 11-Dec-2001  uwe Add microSPARC-IIep support.
 1.105 04-Dec-2001  lukem s/defopt/defflag/
 1.104 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.103 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.102 08-Jun-2001  mrg branches: 1.102.2; 1.102.8;
split {sunos,svr4}_sigcode out for LKMs
 1.101 21-Mar-2001  pk Merge in4_cksum().
 1.100 17-Jan-2001  fvdl branches: 1.100.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.99 14-Nov-2000  kleink Defopt BLINK.
 1.98 11-Nov-2000  pk Pull in the mk48txx and intersil7170 drivers.
 1.97 12-Oct-2000  christos add sunkbd.c and sunms.c; apparently these are now needed because
tty_conf.c brings them in.
 1.96 23-Aug-2000  pk Use common fb.c from sys/dev/sun.
 1.95 22-Aug-2000  pk Remove driver declarations that are now in /sys/dev/{sbus,sun}
 1.94 03-Jul-2000  pk The `si' driver has been transformed into an MI VME frontend.
 1.93 26-Jun-2000  pk Split si & sw drivers.
 1.92 05-May-2000  augustss branches: 1.92.4;
Use correct file name for amd7930.
 1.91 02-May-2000  augustss Adapt to new am7930 driver. PR 10033 from Gregory McGarry.
 1.90 19-Mar-2000  pk kd.c should not depend on `kbd'.
 1.89 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.88 25-Feb-2000  jdc Add auxiotwo (Tadpole 3GX aux 2 register) entry.
 1.87 25-Feb-2000  pk Remove out-dated comment.
 1.86 14-Feb-2000  thorpej Allow arch-specific code to specify in4_cksum() like it can specify
in_cksum().
 1.85 10-Aug-1999  christos branches: 1.85.2;
s/(sbus | obio)/sbus for the sbus attachments. These were vestiges from
the old code.
 1.84 10-Aug-1999  christos split bwtwo driver in obio and sbus parts
 1.83 09-Aug-1999  matt add entries for the tadpole microcontroller (tctrl) and the
tadpole pcmcia controller (tpcic). Drivers for the former will
show up today, and the latter later this week or next weekend.
 1.82 01-Aug-1999  matt Initial stab at a P9100 console FB driver for the Tadpole 3GX.
It supports RASTERCONSOLE only and the colormap support is
broken (the hardware doesn't seem to be doing what the tech.
docs. say it should be doing). But it is usable as a console
(but with blue on white as the only color choice). I figured
I'd check it in since it is somewhat usable and someone else
might figure what I screwed up in the color map support.
 1.81 30-Jul-1999  matt Add preliminary support for the built-in modem on Tadpole 3GX/S
laptops. There is currently something wrong with the interrupt
code but it does attach and sense a 16550a. (anyways the built
in modem is only a 14.4Kb and you'd really want to use a PCMCIA
modem to get faster dialup rates).
 1.80 28-Jul-1999  drochner back out previous - there is really a "vmebus" attribute
 1.79 28-Jul-1999  christos make the vme stuff compile again; I am not sure this is correct as I don't
have the hardware to test, but it has been broken for 3+ weeks now. Hi
Mr. Drochner!
 1.78 30-Jun-1999  drochner update for new VME framework
 1.77 20-Jun-1999  pk Pull in `sparc/compat_13_machdep.c' for SunOS compatibility too.
 1.76 07-Jun-1999  thorpej Only declare block major numbers for devices which can be the root device.
 1.75 14-May-1999  mrg split the sun ms/kbd drivers into frontend/backend parts at the serial
interface border, so that other serial interfaces can be attached to the
ms/kbd. zero functional changes and mostly involves moving code around
a bit. tested on the SS2.

this is necessary to attach the PCI ultrasparc keyboard/mouse drivers.
 1.74 12-May-1999  mrg pull in files.aout
 1.73 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.72 17-Apr-1999  kleink Inclusions are already relative to the root of the kernel source tree, no need
to traverse the path all the way up again.
 1.71 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.70 14-Feb-1999  pk branches: 1.70.2; 1.70.4; 1.70.6;
Exit: obp.c; Enter: promlib.c & openfirm.c
 1.69 22-Nov-1998  pk Add busses: PCMCIA, MII, ATA
 1.68 26-Sep-1998  pk Add file obp.c
 1.67 23-Sep-1998  pk Make cgsix_sbus & cgsix_obio dependent on their respective attribute.s
 1.66 18-Sep-1998  pk Add `eccmemctl' device.
 1.65 13-Sep-1998  pk Add compat_13_machdep.c
 1.64 30-Aug-1998  pk Define floppy device major number.
 1.63 29-Aug-1998  pk Sbus `esp' and `le' front-ends now attach in `sys/dev/sbus/files.sbus'.
 1.62 27-Aug-1998  mrg move isp sbus attachment to dev/sbus
 1.61 28-Jul-1998  pk Magma driver has been moved to <dev/sbus>
 1.60 28-Jul-1998  pk `le' and `en' now attach to sbus (and lebuffer) in <dev/sbus>
Other `le' front-ends split into separate files.
 1.59 27-Jul-1998  pk Use <dev/sbus/files.sbus>.
 1.58 27-Jul-1998  mrg use lebuffer.c from dev/sbus.
 1.57 21-Jul-1998  drochner adapt to LANCE driver split
 1.56 15-Jul-1998  thorpej Remove the raw HYPERchannel kludge.
 1.55 24-Jun-1998  jonathan Split sparc am7930 driver into sparc attach and "MI" sys/dev/ic/am7930
chipset driver. Needs bus'ifying and register-access.
 1.54 06-Jun-1998  thorpej needs-flag'ize the power device.
 1.53 20-May-1998  pk Add entries for the magma SBus serial/parallel port driver.
 1.52 18-Apr-1998  pk Define `xbox'.
 1.51 31-Mar-1998  pk Accommodate cgsix bus-attach split.
 1.50 21-Mar-1998  pk Declare separate bus attachments for devices that can occur on multiple busses.
 1.49 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.48 25-Jan-1998  pk VME device declaration changes:
- `vmes,vmel' => `vme'
- interrupt locator is the VME interrupt priority (`pri')
 1.47 12-Jan-1998  thorpej Update for changes to config.
 1.46 23-Dec-1997  tv Exclude /dev/fb code if no framebuffer is compiled into the system.
Adds a fb.h flag file with '#define NFB 1' if any such card is configured
in to the kernel.
 1.45 17-Oct-1997  gwr Use common zs code.
 1.44 31-Aug-1997  pk Switch to MI kgdb code.
 1.43 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.42 22-Aug-1997  augustss Make it possible for audio to attach to audioamd.
 1.41 19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.40 07-Jul-1997  pk branches: 1.40.2;
Raise max maxusers to 1024
 1.39 18-May-1997  pk branches: 1.39.2;
Define a `vme' device on `iommu' and allow `vmes' and `vmel' as sub-busses.
 1.38 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.37 15-Mar-1997  christos add emul.c
 1.36 12-Mar-1997  cgd specs for ISP 10x0 (isp) driver Sbus attachment. From Matt Jacob.
 1.35 27-Feb-1997  thorpej esp carries ncr53c9x attribute
 1.34 21-Jan-1997  thorpej branches: 1.34.4;
"md" is declared in sys/conf/files, now.
 1.33 28-Dec-1996  pk rename: ramdisk => md
 1.32 06-Dec-1996  pk Declare lebuffer
 1.31 12-Nov-1996  thorpej Centralize the declaration of the "en" driver (Efficient Networks, Inc.
155Mb/sec ATM interface).
 1.30 01-Nov-1996  pk Declare device `audio' at sbus where it resides on Microsparc machines,
from Nick Sayer's PR#2908.
 1.29 30-Sep-1996  abrown Add cgfourteen driver as device "cgfourteen"
 1.28 22-Jun-1996  chuck sbus specific stuff for eni155s sbus atm card.
XXX: only works on sun4c, needs something better than vtophys() for
machines with IOMMUs(?).
 1.27 20-Jun-1996  pk `rd_root.c' => `md_root.c'
 1.26 20-Jun-1996  pk ramdisk stuff.
 1.25 19-Jun-1996  pk Add tcx definition.
 1.24 29-May-1996  pk Switch to `sys/dev/sun/event.c'.
 1.23 21-May-1996  pk Remove the `espdma' special case; all `esp' related dma channels are now
called `dma' on all architectures. Note: `ledma' remains in place.

Also delete a couple of unneeded `needs-flag's in files.sparc.
 1.22 16-May-1996  pk Change attributes of `dma', `espdma' and `ledma' (the attributes on the latter
two didn't seem to make much sense anyway..) to allow `esp' devices to be
attached to one of `sbus', `dma' and `espdma'.

Remove the wildcarded `espdma?' and `ledma?' attachments of `esp' and `le'
respectively, in favour of `dma?' and `lebuffer?' (but the latter is not
yet implemented), which seems to better match reality: additional SBus
SCSI/Lance boards call themselves `dma' and `lebuffer'.
 1.21 07-May-1996  thorpej Make the MI LANCE driver standalone, and use cfattach to resolve
naming conflicts between bus attachments on ports that can have
multiple instances of the LANCE.
 1.20 11-Apr-1996  thorpej If the power device is configured, don't forget to compile the driver.
Also, add some whitespace for readability.
 1.19 04-Apr-1996  pk Include fd.c if (fdc | fd), so we're not obliged to define a device
at fdc.
 1.18 31-Mar-1996  pk sun4m device definitions and bus structure.
 1.17 17-Mar-1996  cgd adjust to deal with expression support for optional file specs
 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 02-Mar-1996  pk Add ns_cksum.
 1.14 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.13 01-Jan-1996  thorpej "si" and "sw" now have the ncr5380sbc attribute.
 1.12 05-Oct-1995  pk include `files.rcons'.
 1.11 25-Sep-1995  chuck add "xy" xylogics 450/451 config stuff
 1.10 17-Sep-1995  pk Remove rcons lines.
Add cgtwo.
 1.9 05-Sep-1995  pk Add `sw' scsi adapter on obio (per Jason Thorpe, PR#1422).
 1.8 29-Aug-1995  pk Define bwtwo at obio & vme (from Jason Thorpe).
 1.7 08-Jul-1995  pk si scsi driver configs.
 1.6 26-Jun-1995  pk xd definitions, from Chuck Cranor.
 1.5 02-Jun-1995  pk Update SCSI decls.
 1.4 29-May-1995  pk eeprom device (from Jason Thorpe).
 1.3 08-May-1995  christos Added sunos_machdep.c; from Matthew Green
 1.2 28-Apr-1995  cgd rename files files for new config/config.old naming
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.34.4.2 12-Mar-1997  is Merge in changes from The Trunk
 1.34.4.1 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.39.2.3 26-Aug-1997  bouyer Update from trunk.
 1.39.2.2 17-Jul-1997  bouyer Update from trunck.
 1.39.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.40.2.3 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.40.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.40.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.70.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.70.4.3 02-Aug-1999  thorpej Update from trunk.
 1.70.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.70.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.70.2.1 24-Jun-1999  perry pullup 1.76->1.77 (pk): Fixes COMPAT_SUNOS && !COMPAT_13
 1.85.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.85.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.85.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.85.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.92.4.1 22-Jul-2000  pk Pull up revisions 1.93,1.94.

revision 1.94
The `si' driver has been transformed into an MI VME frontend.

revision 1.93
Split si & sw drivers.
 1.100.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.100.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.102.8.11 11-Dec-2002  thorpej Sync with HEAD.
 1.102.8.10 11-Nov-2002  nathanw Catch up to -current
 1.102.8.9 18-Oct-2002  nathanw Catch up to -current.
 1.102.8.8 17-Sep-2002  nathanw Catch up to -current.
 1.102.8.7 27-Aug-2002  nathanw Catch up to -current.
 1.102.8.6 01-Aug-2002  nathanw Catch up to -current.
 1.102.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.102.8.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.102.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.102.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.102.8.1 08-Jun-2001  nathanw file files.sparc was added on branch nathanw_sa on 2002-01-08 00:27:34 +0000
 1.102.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.102.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.102.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.102.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.102.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.102.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.107.4.1 18-Mar-2002  thorpej First cut at mutex and rwlock implementation for SPARC.
 1.112.2.5 31-Aug-2002  gehenna catch up with -current.
 1.112.2.4 21-Jul-2002  gehenna catch up with -current.
 1.112.2.3 15-Jul-2002  gehenna catch up with -current.
 1.112.2.2 17-May-2002  gehenna Remove old block majors list.
 1.112.2.1 16-May-2002  gehenna Include the list of block/character major numbers.
 1.122.6.6 11-Dec-2005  christos Sync with head.
 1.122.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.122.6.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.122.6.3 18-Sep-2004  skrll Sync with HEAD.
 1.122.6.2 03-Sep-2004  skrll Sync with HEAD
 1.122.6.1 03-Aug-2004  skrll Sync with HEAD
 1.131.2.6 27-Feb-2008  yamt sync with head.
 1.131.2.5 04-Feb-2008  yamt sync with head.
 1.131.2.4 21-Jan-2008  yamt sync with head
 1.131.2.3 03-Sep-2007  yamt sync with head.
 1.131.2.2 26-Feb-2007  yamt sync with head.
 1.131.2.1 21-Jun-2006  yamt sync with head.
 1.136.22.1 11-Jan-2007  ad Checkpoint work in progress.
 1.137.10.1 29-Mar-2007  reinoud Pullup to -current
 1.137.8.1 11-Jul-2007  mjf Sync with head.
 1.137.6.3 20-Aug-2007  ad Sync with HEAD.
 1.137.6.2 15-Jul-2007  ad Sync with head.
 1.137.6.1 10-Apr-2007  ad Sync with head.
 1.137.2.2 15-Apr-2007  yamt sync with head.
 1.137.2.1 24-Mar-2007  yamt sync with head.
 1.139.4.1 03-Oct-2007  garbled Sync with HEAD
 1.140.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.140.2.1 07-Aug-2007  matt Sync with HEAD.
 1.141.6.3 23-Mar-2008  matt sync with HEAD
 1.141.6.2 09-Jan-2008  matt sync with HEAD
 1.141.6.1 06-Nov-2007  matt sync with HEAD
 1.142.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.142.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.146.24.1 21-Apr-2010  matt sync to netbsd-5
 1.146.20.1 27-Jan-2010  sborrill Pull up the following revisions(s) (requested by bouyer in ticket #1248):
sys/arch/sparc/conf/GENERIC: revision 1.219
sys/arch/sparc/conf/files.sparc: revision 1.149
sys/arch/sparc/dev/apc.c: revision 1.1
sys/arch/sparc/dev/apcreg.h: revision 1.1
sys/dev/DEVNAMES: revision 1.255

Add apc(4), a driver for the Aurora Personality Chip (APC) found
on SPARCstation-4/5, and emulated by qemu to idle the simulator
when the CPU is idle. Infos about the registers from the linux driver.
Not enabled by default because it can cause some Sparc systems to
hang (so says the linux driver).
Only the CPU idle part implemented at this time; fan speed and
Convenience power outlet management to be added.
Tested on qemu.
 1.146.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.146.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.146.10.3 09-Oct-2010  yamt sync with head
 1.146.10.2 11-Mar-2010  yamt sync with head
 1.146.10.1 04-May-2009  yamt sync with head.
 1.146.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.149.4.2 05-Mar-2011  rmind sync with head
 1.149.4.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.149.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.150.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.151.12.4 03-Dec-2017  jdolecek update from HEAD
 1.151.12.3 23-Jun-2013  tls resync from head
 1.151.12.2 25-Feb-2013  tls resync with head
 1.151.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.151.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.151.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.154.12.3 28-Aug-2017  skrll Sync with HEAD
 1.154.12.2 29-May-2016  skrll Sync with HEAD
 1.154.12.1 22-Apr-2016  skrll Sync with HEAD
 1.156.10.1 25-Jul-2017  snj Pull up following revision(s) (requested by nakayama in ticket #152):
usr.sbin/crash/Makefile: revision 1.37
sys/arch/sparc/conf/files.sparc: revision 1.157
sys/arch/sparc/sparc/db_interface.c: revision 1.94
sys/arch/sparc/sparc/db_machdep.c: revision 1.1
Move the ddb registers and empty command table used for crash(8) into
db_machdep.c like other archs.
--
sparc has db_machdep.c now.
 1.157.4.1 10-Jun-2019  christos Sync with HEAD
 1.157.2.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.162.4.1 22-Mar-2021  thorpej Remove unneeded interface attribute from mspcic; it carries "pcibus"
already, which is all that's required.
 1.29 28-Apr-1995  cgd rename files files for new config/config.old naming
 1.28 27-Apr-1995  christos Use new files.sunos and old files.svr4 :-)
 1.27 25-Apr-1995  pk Audio driver name change.
 1.26 31-Mar-1995  christos Added the svr4 files
 1.25 01-Mar-1995  pk Better 4/100 support.
 1.24 22-Feb-1995  pk add bsd_fdintr.s
 1.23 18-Feb-1995  pk Admit we have a floppy driver.
 1.22 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.21 25-Jan-1995  cgd vn -> vnd renaming, for consistency
 1.20 16-Dec-1994  deraadt oclock for 4/100 and 4/200
 1.19 07-Dec-1994  deraadt bigtime cleanup
 1.18 20-Nov-1994  deraadt copyright/Id cleanup
 1.17 26-Oct-1994  deraadt changed sunos_compat, if_ie
 1.16 15-Oct-1994  deraadt declare obio/sbus in the right place
obio/vmes/vmel support only active if requested
 1.15 02-Oct-1994  deraadt sun4/300 support works
 1.14 17-Sep-1994  deraadt new scsi code
sparc/sbus/* --> sparc/dev/*
 1.13 05-Sep-1994  pk Compile `pamap.c' and `cache.c' with normal compiler rules.
Let's pretend this was a bug in some previous version of gcc...
 1.12 20-Aug-1994  deraadt add addr & level specifiers for non-openboot systems
 1.11 17-Mar-1994  pk Add some DDB files.
 1.10 03-Mar-1994  deraadt kbd is now a pseudo-device
 1.9 01-Feb-1994  deraadt sparc runs in current today
 1.8 28-Nov-1993  deraadt use new sun_exec_aout_makecmds
 1.7 22-Nov-1993  deraadt the sunos files have moved to /sys/compat/sunos
 1.6 14-Nov-1993  deraadt add torek's new cgthree driver.
the brooktree DAC code has been split out from the cgthree driver,
and is now shared with the cgsix.
 1.5 10-Nov-1993  deraadt blast it..
 1.4 10-Nov-1993  deraadt sun_disklabel.c moved
 1.3 27-Oct-1993  deraadt sys/dev/scsi -> sys/arch/sparc/scsi.
 1.2 15-Oct-1993  deraadt arch/sparc/sparc/sys_machdep.c is non optional; there is more in
there than just TRACE
 1.1 10-Oct-1993  deraadt TDR: config file i'm testing with
files.sparc.newconf: a files file that works
files.sparc: old name for above file, might as well delete
 1.13 23-Apr-2021  simonb Merge the .text.* sections into the .text section on MIPS, SPARC and
SPARC64 as is done on all other ports. Mostly costmetic, but does mean
that main() now appears before the _etext symbol instead of after it.
 1.12 25-Aug-2015  uebayasi Don't expand unwanted symbols by cpp(1).
 1.11 24-Aug-2015  uebayasi Don't mention stab and DWARF sections, because these (poorly mtaintained)
lists only help to make them harder to read.

If those sections are found in inputs, they simply appear in outputs as
orphaned sections, sorted by section types and attributes.
 1.10 22-Aug-2015  uebayasi .interp and friends are unlikely to appear in kernels.
 1.9 22-Aug-2015  uebayasi .rel/.rela should not be generated in kernels.
 1.8 22-Aug-2015  uebayasi .init/.fini/.ctors/.dtors should be irrelevant to kernels.
 1.7 21-Aug-2015  uebayasi I bet setting search-directory for ld.so is useless in any kernel.
 1.6 20-Aug-2015  uebayasi Indent with 2 spaces.
 1.5 11-Dec-2005  christos branches: 1.5.122; 1.5.142;
merge ktrace-lwp.
 1.4 24-May-2004  martin Back to SIZEOF_HEADERS.
 1.3 23-May-2004  martin Instead of SIZEOF_HEADERS (which ld gets wrong) use 1024 for now.
 1.2 12-Feb-2001  pk branches: 1.2.4; 1.2.26;
Provide symbol `kernel_data_start' as the first address in the .data segment.
 1.1 11-Feb-2001  pk Supply a kernel link script that puts `etext' at the end of all
read-only sections. Modelled after a similar change in the i386 port.
 1.2.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.26.1 03-Aug-2004  skrll Sync with HEAD
 1.2.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.1 12-Feb-2001  bouyer file kern.ldscript was added on branch thorpej_scsipi on 2001-03-12 13:29:20 +0000
 1.5.142.1 22-Sep-2015  skrll Sync with HEAD
 1.5.122.1 03-Dec-2017  jdolecek update from HEAD
 1.41 21-Aug-2021  andvar s/helt/held+s/eroneously/erroneously/+s/splitted/split/+s/recommented/recommended/
 1.40 04-Apr-2020  jdolecek mark nsmb major obsolete
 1.39 29-Jan-2020  maya remove urio(4), a driver for the Rio500 MP3 player.

At this point it is highly unlikely this 1999 device still has users,
but it still comes up in the context of maxv's USB-fuzzing (and any device
could pretend to be a urio(4)), so it's best to get rid of it.

Renamed all major entries to obsolete, as was done in previous removals.

This still requires an update to sanitizers, but they're located in
"external", perhaps it should be first committed upstream?

Proposed on tech-kern a month ago.
 1.38 28-Jan-2019  dholland branches: 1.38.6;
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.37 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.36 23-Sep-2018  maxv Remove ISDN from the kernel. It has remained unmaintained for a long time,
is of poor quality, and is now an obstacle to MP-ification. It was removed
ten years ago from FreeBSD for the same reason.

This retires a big user of the mbuf API, and will ease maintenance of the
kernel.
 1.35 26-Mar-2017  martin branches: 1.35.12; 1.35.14;
Assign majors for ld(4)
 1.34 23-Apr-2015  pgoyette branches: 1.34.2; 1.34.4;
Update device dependency information - the sysmon major device now depends on the sysmon module itself, not on the individual components.
 1.33 30-Jun-2011  wiz branches: 1.33.12; 1.33.30;
dependant -> dependent
 1.32 06-Mar-2010  plunky use a MI major number for uhso(4) driver
(requested by mrg)
 1.31 06-Mar-2010  plunky add major device for usho(4) driver
 1.30 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.29 31-Dec-2007  ad branches: 1.29.6; 1.29.10; 1.29.16; 1.29.18;
Remove systrace. Ok core@.
 1.28 24-Nov-2006  wiz branches: 1.28.28; 1.28.34; 1.28.42;
s/independant/independent/, from Zafer.
 1.27 11-Dec-2005  christos branches: 1.27.16; 1.27.20; 1.27.22;
merge ktrace-lwp.
 1.26 17-Sep-2005  yamt make VMSWAP optional again.
 1.25 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.24 30-Jul-2005  yamt defflag VMSWAP.
 1.23 13-Jul-2005  kiyohara obsolete fwiso.
 1.22 30-Jun-2005  macallan branches: 1.22.2;
Allow sparc64-style attachment of mouse and keyboard via zstty, needed for
wscons support.
Reviewed by uwe.
 1.21 03-Jun-2005  blymn Remove verified exec major, now a MI one.
 1.20 22-May-2005  macallan uncommented the wd entry since there are a few ways to get IDE hardware into
a SPARC machine.
 1.19 13-Sep-2004  drochner branches: 1.19.10;
add "joy"
 1.18 24-Jul-2004  mrg Hauke Fath's port of the openbsd SUNW,spif driver from PR#26061.
the driver was originally written by Jason L. Wright.

XXX: i haven't tested this on sparc64 at all...
 1.17 10-Dec-2003  jmc Change reference at bottom from sys/dev/majors to sys/conf/majors to match
reality
 1.16 07-Dec-2003  christos add altq
 1.15 07-Dec-2003  christos whitespace fixes.
 1.14 10-Oct-2003  jdolecek reassing majors for crypto and pf to use the newly defined MI major
range
 1.13 10-Oct-2003  jdolecek update the comment - the space for machine-dependant majors
is reduced to 0-143
follows discussion on tech-kern
 1.12 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.11 22-Aug-2003  itojun create /dev/crypto
 1.10 08-Aug-2003  rafal To make keeping these two in sync easier, add commented-out entries for
device-majors used on the other port to each of the sparc{,64} majors
files.
 1.9 27-Jul-2003  itojun reserve cdev major # for PF. ok'ed by technical-exec
 1.8 25-Apr-2003  ragge branches: 1.8.2;
Add ksyms device major.
 1.7 20-Apr-2003  martin Add sysmon device.
 1.6 20-Feb-2003  martin Add a few new devices.
 1.5 24-Nov-2002  martin Assign a major number for "lpt* at ebus?".
 1.4 04-Oct-2002  elric branches: 1.4.2;
assign majors for raw and cooked cgd's.
 1.3 03-Oct-2002  uwe Add majors for wscons devices.
And, no! This does not mean that sparc switches to wscons.
Only Krups has experimental wscons support so far.
 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.sparc was initially added on branch gehenna-devsw.
 1.1.2.3 15-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.4 11-Dec-2002  thorpej Sync with HEAD.
 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.sparc was added on branch nathanw_sa on 2002-09-17 21:17:38 +0000
 1.4.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.2.1 04-Oct-2002  jdolecek file majors.sparc was added on branch kqueue on 2002-10-10 18:36:08 +0000
 1.8.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.10.1 10-Jun-2005  tron Pull up revision 1.21 (requested by elad in ticket #389):
Remove verified exec major, now a MI one.
 1.22.2.3 21-Jan-2008  yamt sync with head
 1.22.2.2 30-Dec-2006  yamt sync with head.
 1.22.2.1 21-Jun-2006  yamt sync with head.
 1.27.22.1 10-Dec-2006  yamt sync with head.
 1.27.20.1 12-Jan-2007  ad Sync with head.
 1.27.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.28.42.1 02-Jan-2008  bouyer Sync with HEAD
 1.28.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.28.28.1 09-Jan-2008  matt sync with HEAD
 1.29.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.29.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.29.10.1 04-May-2009  yamt sync with head.
 1.29.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.33.30.2 28-Aug-2017  skrll Sync with HEAD
 1.33.30.1 06-Jun-2015  skrll Sync with HEAD
 1.33.12.1 03-Dec-2017  jdolecek update from HEAD
 1.34.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.34.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.35.14.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.35.14.1 10-Jun-2019  christos Sync with HEAD
 1.35.12.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.35.12.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.38.6.1 29-Feb-2020  ad Sync with head.
 1.24 04-Jun-2021  martin Sprinkle a few VMSWAP_DEFAULT_PLAINTEXT for architectures where we do not
have any spare cpu cycles to waste (encrypted swap still could be
enabled by the admin in /etc/sysctl.conf).
 1.23 20-Sep-2010  tsutsui branches: 1.23.76; 1.23.80;
Prepare sparc optimized (by 32 bit add-with-carry insns) cpu_in_cksum()
which is reusing in_cksum_internal() in old sparc/in_cksum.c.

~4% improvements of ttcp(1) xfer rates on SS1+ with le(4).
 1.22 11-Dec-2005  christos branches: 1.22.78; 1.22.98; 1.22.100;
merge ktrace-lwp.
 1.21 17-Sep-2005  yamt include "conf/std".
 1.20 22-Jun-2000  fvdl branches: 1.20.24; 1.20.40;
Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.19 15-Nov-1999  fvdl branches: 1.19.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.18 12-Sep-1999  chs branches: 1.18.2; 1.18.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.17 13-Jun-1999  pk Fix typo in previous.
 1.16 06-Jun-1999  mrg EXEC_ELF32 is now default. enable "rnd"
 1.15 24-Mar-1999  mrg branches: 1.15.4;
clean up kernel/config files files for machVM lossage.
 1.14 05-May-1998  mrg make UVM the default on the sparc
 1.13 08-Feb-1998  thorpej Back out previous change (again, grrrr).
 1.12 08-Feb-1998  tv the *PAGER options were moved to the generic config files, but not moved
out of here (causes duplicate opeion errors) -- fix.
 1.11 06-Feb-1998  thorpej Back out previous change. Until the default VM system is UVM, these
"options" ARE required, and leaving them here doens't hurt anything in
the UVM case.
 1.10 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.9 07-May-1997  lukem clean up use of whitespace
 1.8 18-Nov-1996  pk Move *PAGER options and `machine sparc' to std.sparc.
 1.7 02-Oct-1996  mrg update for exec changes.
 1.6 01-Mar-1995  mycroft Clean up deleted files.
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 15-Oct-1994  deraadt declare obio/sbus in the right place
obio/vmes/vmel support only active if requested
 1.3 02-Oct-1994  deraadt sun4/300 support works
 1.2 18-Sep-1994  deraadt add obio for sun4
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.15.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.18.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.19.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.20.40.1 21-Jun-2006  yamt sync with head.
 1.20.24.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.22.100.1 05-Mar-2011  rmind sync with head
 1.22.98.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.22.78.1 09-Oct-2010  yamt sync with head
 1.23.80.1 06-Jun-2021  cjep sync with head
 1.23.76.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.4 01-Mar-1995  mycroft Clean up deleted files.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 15-Oct-1994  deraadt declare obio/sbus in the right place
obio/vmes/vmel support only active if requested
 1.1 02-Oct-1994  deraadt sun4/300 support works
 1.4 01-Mar-1995  mycroft Clean up deleted files.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 15-Oct-1994  deraadt declare obio/sbus in the right place
obio/vmes/vmel support only active if requested
 1.1 02-Oct-1994  deraadt sun4/300 support works
 1.1 30-May-2013  macallan branches: 1.1.2; 1.1.10;
install sxreg.h to /usr/include/sparc/
 1.1.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.1.10.1 30-May-2013  yamt file Makefile was added on branch yamt-pagecache on 2014-05-22 11:40:08 +0000
 1.1.2.2 23-Jun-2013  tls resync from head
 1.1.2.1 30-May-2013  tls file Makefile was added on branch tls-maxphys on 2013-06-23 06:20:12 +0000
 1.50 13-Jun-2002  gmcgarry Hasn't been used for years.
 1.49 11-Mar-2002  pk branches: 1.49.4;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.48 03-Oct-2001  augustss branches: 1.48.4;
Add a new optional method, dev_ioctl, to the audio hardware driver interface.
It is called when an unrecognized ioctl() is performed on a device,
thus allowing ioctl()s that frob the hardware driver (like loading
microcode).
 1.47 09-Jul-2000  pk branches: 1.47.2; 1.47.4;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.46 04-Jun-2000  cgd branches: 1.46.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.45 21-Nov-1999  pk branches: 1.45.2;
Check presence of Sbus interrupt properties before using them.
 1.44 14-Mar-1999  jonathan branches: 1.44.8; 1.44.14;
Use bus_space tags and handles, embedded in MD hooks AM7930_{READ_WRITE}_REG
to handle MD delay and bus padding. Tested on sparc2 by David Brownlee.

Should use regmaps, but that breaks sparc pDMA assembly code.
 1.43 13-Jan-1999  abs fix void arithmetic
 1.42 29-Aug-1998  pk Nuke unnecessary header files.
 1.41 28-Aug-1998  pk Nuke Dprintf; fix formats.
 1.40 17-Aug-1998  augustss * Redo the way the way the MIDI driver attaches to audio devices.
* Improve the midisyn layer a little.
* Add a driver for the Yamaha OPL[23] FM synths.
The opl driver is not finished yet; it sounds pretty awful.

For some strange reason I cannot get any FM sound from my SB64 cards,
but a regular SB16 works fine.
 1.39 24-Jun-1998  jonathan Split arch/sparc/dev/amd7930.c into:
* MI sys/dev/ic/{am7930.c,am7930var.h} chipset driver
* sparc frontend.
Presere revision history (this time).

TODO: bus.h'ify, and padded register mappings.
 1.38 07-May-1998  kleink Fix some arithmetics lossage on typeless pointers.
 1.37 30-Mar-1998  pk Replace direct `sparc_bus_map()' calls with bus space map method.
 1.36 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.35 12-Jan-1998  thorpej Update for changes to config.
 1.34 06-Dec-1997  chuck fix mixer code that was clearly untested:
- allow get/set of enums SUNAUDIO_SOURCE and SUNAUDIO_OUTPUT rather
than returning EINVAL
- add missing SUNAUDIO_MONITOR_CLASS case in query_devinfo
- convert SUNAUDIO_MONITOR case from a MIXER_CLASS to a MIXER_VALUE
like it is supposed to be
- the labels for outputs/record class were swapped: fix it

this patch allows "mixerctl" to work properly on a sparc
 1.33 19-Oct-1997  christos branches: 1.33.2;
Make this compile again.
 1.32 19-Oct-1997  augustss Make the audio API (almost) SunOS compatible.
The changes is to allow some limited mixer manipulation through
the audio device (instead of the mixer device).
This rendered 4 methods in audio_hw_if unused so garbage collect these.
 1.31 11-Oct-1997  mycroft AudioC[A-Z] -> AudioC[a-z]
AudioElinear -> AudioEslinear
 1.30 27-Aug-1997  augustss Change match routine to use "audio" as the ROM name.
 1.29 27-Aug-1997  augustss Fix prototype for amd7930_set_params.
 1.28 24-Aug-1997  augustss - Change audio_hw_if a little: set_param now sets the play and record modes
at the same time instead by using two different calls. This enables
it to check more easily if the combined mode is all right.
- Improve the error checking in audio.c.
- Add a new audio property, AUDIO_PROP_INDEPENDENT, show if the
play and record settings are independent.
- Fix some buglets in audio.c.
 1.27 19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.26 31-Jul-1997  augustss Audio changes:
- Change the way attach and open works to allow multiple audio
devices.
- Split the mulaw.c file into two to avoid dragging in mulaw
convertsion when they are not needed. Add 16 bit alaw/mulaw tables.
- Change the way audio properties are gotten.
- Recognize more versions os SoundBlaster.
 1.25 28-Jul-1997  augustss branches: 1.25.2;
Audio: Remove the machine dependant code I put in audio.c by mistake.
This adds another method to audio_hw_if. Also remove a field from
audio_hw_if that was not read-only.
 1.24 27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.23 27-Jul-1997  augustss Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.22 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.21 15-May-1997  pk Tweak gain curve (from nsayer@kfu.com; PR#2909)
 1.20 09-May-1997  augustss Change the interface between high and lowlevel audio drivers again:
Set the encoding parameters slightly differently.
Remove the SW encoding/decodinf functions from this interface
and move them to the audio_parameter struct; this is both more efficient
and flexible.
 1.19 07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.18 29-Apr-1997  augustss Change the interface between the high and low level audio drivers
so that all audio encoding parameters are set at once. This simplifies
the interface and make error checking easier.
 1.17 20-Mar-1997  mycroft Implement set_format.
 1.16 13-Mar-1997  mycroft Don't share the silence block between devices. Make silence filling work for
more encodings, and make it device-independent. From Lennart Augustsson, in
PR kern/3305.
 1.15 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.14 01-Nov-1996  pk Drop in a sun4m version of AUDIO_SET_SWINTR; thanks to Nick Sayer for
the reminder.
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 28-May-1996  mrg count audio interupts (from OpenBSD).
 1.10 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.9 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.8 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.7 25-Feb-1996  pk Use CPU-type macros
 1.6 19-Feb-1996  pk Fix typo; pointed out by jtk.
 1.5 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.4 19-Jul-1995  brezak Change DEBUG-->AUDIO_DEBUG. PR# port-sparc/1241
 1.3 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.2 04-May-1995  pk Add `evcnt' field.
 1.1 25-Apr-1995  pk New audio driver from Rolf Grossmann.
 1.25.2.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.3 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.2.1 09-Dec-1997  thorpej Sync w/ trunk: fix mixer code (chuck)
 1.44.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.44.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.45.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.46.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.47.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.47.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.47.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.47.2.1 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.48.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.48.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.48.4.1 03-Oct-2001  nathanw file am7930_sparc.c was added on branch nathanw_sa on 2002-04-01 07:42:38 +0000
 1.49.4.1 15-Jul-2002  gehenna catch up with -current.
 1.40 24-Aug-1998  pk These files are no longer used.
 1.39 17-Aug-1998  augustss * Redo the way the way the MIDI driver attaches to audio devices.
* Improve the midisyn layer a little.
* Add a driver for the Yamaha OPL[23] FM synths.
The opl driver is not finished yet; it sounds pretty awful.

For some strange reason I cannot get any FM sound from my SB64 cards,
but a regular SB16 works fine.
 1.38 07-May-1998  kleink Fix some arithmetics lossage on typeless pointers.
 1.37 30-Mar-1998  pk Replace direct `sparc_bus_map()' calls with bus space map method.
 1.36 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.35 12-Jan-1998  thorpej Update for changes to config.
 1.34 06-Dec-1997  chuck fix mixer code that was clearly untested:
- allow get/set of enums SUNAUDIO_SOURCE and SUNAUDIO_OUTPUT rather
than returning EINVAL
- add missing SUNAUDIO_MONITOR_CLASS case in query_devinfo
- convert SUNAUDIO_MONITOR case from a MIXER_CLASS to a MIXER_VALUE
like it is supposed to be
- the labels for outputs/record class were swapped: fix it

this patch allows "mixerctl" to work properly on a sparc
 1.33 19-Oct-1997  christos branches: 1.33.2;
Make this compile again.
 1.32 19-Oct-1997  augustss Make the audio API (almost) SunOS compatible.
The changes is to allow some limited mixer manipulation through
the audio device (instead of the mixer device).
This rendered 4 methods in audio_hw_if unused so garbage collect these.
 1.31 11-Oct-1997  mycroft AudioC[A-Z] -> AudioC[a-z]
AudioElinear -> AudioEslinear
 1.30 27-Aug-1997  augustss Change match routine to use "audio" as the ROM name.
 1.29 27-Aug-1997  augustss Fix prototype for amd7930_set_params.
 1.28 24-Aug-1997  augustss - Change audio_hw_if a little: set_param now sets the play and record modes
at the same time instead by using two different calls. This enables
it to check more easily if the combined mode is all right.
- Improve the error checking in audio.c.
- Add a new audio property, AUDIO_PROP_INDEPENDENT, show if the
play and record settings are independent.
- Fix some buglets in audio.c.
 1.27 19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.26 31-Jul-1997  augustss Audio changes:
- Change the way attach and open works to allow multiple audio
devices.
- Split the mulaw.c file into two to avoid dragging in mulaw
convertsion when they are not needed. Add 16 bit alaw/mulaw tables.
- Change the way audio properties are gotten.
- Recognize more versions os SoundBlaster.
 1.25 28-Jul-1997  augustss branches: 1.25.2;
Audio: Remove the machine dependant code I put in audio.c by mistake.
This adds another method to audio_hw_if. Also remove a field from
audio_hw_if that was not read-only.
 1.24 27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.23 27-Jul-1997  augustss Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.22 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.21 15-May-1997  pk Tweak gain curve (from nsayer@kfu.com; PR#2909)
 1.20 09-May-1997  augustss Change the interface between high and lowlevel audio drivers again:
Set the encoding parameters slightly differently.
Remove the SW encoding/decodinf functions from this interface
and move them to the audio_parameter struct; this is both more efficient
and flexible.
 1.19 07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.18 29-Apr-1997  augustss Change the interface between the high and low level audio drivers
so that all audio encoding parameters are set at once. This simplifies
the interface and make error checking easier.
 1.17 20-Mar-1997  mycroft Implement set_format.
 1.16 13-Mar-1997  mycroft Don't share the silence block between devices. Make silence filling work for
more encodings, and make it device-independent. From Lennart Augustsson, in
PR kern/3305.
 1.15 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.14 01-Nov-1996  pk Drop in a sun4m version of AUDIO_SET_SWINTR; thanks to Nick Sayer for
the reminder.
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 28-May-1996  mrg count audio interupts (from OpenBSD).
 1.10 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.9 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.8 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.7 25-Feb-1996  pk Use CPU-type macros
 1.6 19-Feb-1996  pk Fix typo; pointed out by jtk.
 1.5 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.4 19-Jul-1995  brezak Change DEBUG-->AUDIO_DEBUG. PR# port-sparc/1241
 1.3 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.2 04-May-1995  pk Add `evcnt' field.
 1.1 25-Apr-1995  pk New audio driver from Rolf Grossmann.
 1.25.2.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.3 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.2.1 09-Dec-1997  thorpej Sync w/ trunk: fix mixer code (chuck)
 1.5 24-Aug-1998  pk These files are no longer used.
 1.4 19-Oct-1997  augustss Make the audio API (almost) SunOS compatible.
The changes is to allow some limited mixer manipulation through
the audio device (instead of the mixer device).
This rendered 4 methods in audio_hw_if unused so garbage collect these.
 1.3 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.2 04-May-1995  pk Add `evcnt' field.
 1.1 25-Apr-1995  pk New audio driver from Rolf Grossmann.
 1.3 31-May-2025  jdc Set the idle bit for all the CPU's on a multi-processor system. QEMU uses
this to idle all of the emulated CPU's, otherwise only one CPU is idled.
 1.2 30-Dec-2019  ad branches: 1.2.32;
PR port-sparc/54789: Sparc boot fails with "Trap 0x21 while interrupts disabled"

Remove assumption that cpu_info is smaller than 1kB.
 1.1 15-Jan-2010  bouyer branches: 1.1.2; 1.1.6; 1.1.10; 1.1.70;
Add apc(4), a driver for the Aurora Personality Chip (APC) found
on SPARCstation-4/5, and emulated by qemu to idle the simulator
when the CPU is idle. Infos about the registers from the linux driver.
Not enabled by default because it can cause some Sparc systems to
hang (so says the linux driver).
Only the CPU idle part implemented at this time; fan speed and
Convenience power outlet management to be added.
Tested on qemu.
 1.1.70.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.10.2 21-Apr-2010  matt sync to netbsd-5
 1.1.10.1 15-Jan-2010  matt file apc.c was added on branch matt-nb5-mips64 on 2010-04-21 00:33:47 +0000
 1.1.6.2 11-Mar-2010  yamt sync with head
 1.1.6.1 15-Jan-2010  yamt file apc.c was added on branch yamt-nfs-mp on 2010-03-11 15:02:56 +0000
 1.1.2.2 27-Jan-2010  sborrill Pull up the following revisions(s) (requested by bouyer in ticket #1248):
sys/arch/sparc/conf/GENERIC: revision 1.219
sys/arch/sparc/conf/files.sparc: revision 1.149
sys/arch/sparc/dev/apc.c: revision 1.1
sys/arch/sparc/dev/apcreg.h: revision 1.1
sys/dev/DEVNAMES: revision 1.255

Add apc(4), a driver for the Aurora Personality Chip (APC) found
on SPARCstation-4/5, and emulated by qemu to idle the simulator
when the CPU is idle. Infos about the registers from the linux driver.
Not enabled by default because it can cause some Sparc systems to
hang (so says the linux driver).
Only the CPU idle part implemented at this time; fan speed and
Convenience power outlet management to be added.
Tested on qemu.
 1.1.2.1 15-Jan-2010  sborrill file apc.c was added on branch netbsd-5 on 2010-01-27 21:17:55 +0000
 1.2.32.1 02-Aug-2025  perseant Sync with HEAD
 1.1 15-Jan-2010  bouyer branches: 1.1.2; 1.1.6; 1.1.10;
Add apc(4), a driver for the Aurora Personality Chip (APC) found
on SPARCstation-4/5, and emulated by qemu to idle the simulator
when the CPU is idle. Infos about the registers from the linux driver.
Not enabled by default because it can cause some Sparc systems to
hang (so says the linux driver).
Only the CPU idle part implemented at this time; fan speed and
Convenience power outlet management to be added.
Tested on qemu.
 1.1.10.2 21-Apr-2010  matt sync to netbsd-5
 1.1.10.1 15-Jan-2010  matt file apcreg.h was added on branch matt-nb5-mips64 on 2010-04-21 00:33:47 +0000
 1.1.6.2 11-Mar-2010  yamt sync with head
 1.1.6.1 15-Jan-2010  yamt file apcreg.h was added on branch yamt-nfs-mp on 2010-03-11 15:02:56 +0000
 1.1.2.2 27-Jan-2010  sborrill Pull up the following revisions(s) (requested by bouyer in ticket #1248):
sys/arch/sparc/conf/GENERIC: revision 1.219
sys/arch/sparc/conf/files.sparc: revision 1.149
sys/arch/sparc/dev/apc.c: revision 1.1
sys/arch/sparc/dev/apcreg.h: revision 1.1
sys/dev/DEVNAMES: revision 1.255

Add apc(4), a driver for the Aurora Personality Chip (APC) found
on SPARCstation-4/5, and emulated by qemu to idle the simulator
when the CPU is idle. Infos about the registers from the linux driver.
Not enabled by default because it can cause some Sparc systems to
hang (so says the linux driver).
Only the CPU idle part implemented at this time; fan speed and
Convenience power outlet management to be added.
Tested on qemu.
 1.1.2.1 15-Jan-2010  sborrill file apcreg.h was added on branch netbsd-5 on 2010-01-27 21:17:55 +0000
 1.30 12-Sep-2020  isaki Improve am7930 family drivers to share more code.
audioamd(4) on sparc, vsaudio(4) on vax, and bba(4) are.
- Remove complex and useless callbacks: onopen, onclose, and
indirect_{read,write}. This makes audioamd and vsaudio almost the same.
- Remove (already disabled) assembly fast interrupt path from audioamd(4).
cf. http://mail-index.netbsd.org/source-changes/2009/12/19/msg004585.html
- Use trigger_* method rather than start_* method. It's more suitable.
vsaudio(4) was tested by naru@, bba(4) was tested by tsutsui@.
 1.29 08-May-2019  isaki branches: 1.29.2;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

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

Add MP locking to the audio drivers.

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

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

Welcome to 5.99.57.
 1.26 04-Jun-2011  tsutsui branches: 1.26.2; 1.26.4;
Split device_t/softc of am7930. No crash on TME and GXemul.
 1.25 19-Dec-2009  tsutsui branches: 1.25.4; 1.25.6; 1.25.10;
Disable "fast trap" handlers which invoke software interrupts
in sparc/amd7930intr.s and sparc/bsd_fdintr.s until they are
rewritten to adapt new MI softint(9) API.

No particular comments on PR port-sparc/42192, but
this fixes timeout problem on floppy access on my SPARCstation 1+.

XXX: floppy support on sun4m seems to have another problem (data overrun).
 1.24 17-Sep-2009  tsutsui Use device_t, cfdriver_t, device_private(), device_xname(),
and appropriate types and variables for device_t/softc.
 1.23 03-Dec-2007  ad branches: 1.23.18; 1.23.28; 1.23.36;
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.22 27-Nov-2007  ad Use the softint API.
 1.21 11-Dec-2005  christos branches: 1.21.28; 1.21.30; 1.21.48; 1.21.50; 1.21.56;
merge ktrace-lwp.
 1.20 15-Jan-2005  kent branches: 1.20.10;
ansify and KNF
 1.19 29-Oct-2004  yamt constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.18 11-Jul-2004  mycroft Make this build again.
 1.17 15-Jul-2003  lukem __KERNEL_RCSID()
 1.16 10-Dec-2002  pk branches: 1.16.6;
Remove the `flags' argument from bus_intr_establish().
 1.15 10-Dec-2002  pk The `fast trap' handlers are now pssed as an optional argument to
bus_intr_establish(). Allow fall-back on a regular interrupt handler if
the interrupt level must be shared with another device.
 1.14 09-Dec-2002  pk Finish the switch to the softintr(9) framework.

To make this work, we now have to use separate handler lists for hardware
and software interrupts as the soft interrupt handlers do not return
an `interrupt handled' status.

Thanks to Matt Fredette for providing an initial set of patches on port-sparc.
 1.13 15-Oct-2002  jdc Add audioamd at obio attachment. Now we have working audio on 4/600's :

audioamd0 at obio0 slot 0 offset 0x500000 level 13 softpri 4
audio0 at audioamd0: full duplex
 1.12 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.11 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.10 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9 13-Jun-2002  gmcgarry Make this work with AUDIO_C_HANDLER.
 1.8 11-Mar-2002  pk branches: 1.8.4; 1.8.6;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.7 03-Oct-2001  augustss branches: 1.7.4;
Add a new optional method, dev_ioctl, to the audio hardware driver interface.
It is called when an unrecognized ioctl() is performed on a device,
thus allowing ioctl()s that frob the hardware driver (like loading
microcode).
 1.6 09-Jul-2000  pk branches: 1.6.2; 1.6.4; 1.6.6;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.5 06-Jun-2000  gmcgarry branches: 1.5.2;
- Clean up use of AUDIO_C_HANDLER.
- Copy bus_space handles into auio for fast handler.
 1.4 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.3 08-May-2000  mycroft branches: 1.3.2;
Make the audioamd assembler code compile again.
 1.2 08-May-2000  mycroft Make the SPARC audioamd driver at least *compile*. Well, the C code, that is.
*sigh*
 1.1 02-May-2000  augustss Adapt to new am7930 driver. PR 10033 from Gregory McGarry.
 1.3.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.6.6.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.6.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.6.2 16-Mar-2002  jdolecek Catch up with -current.
 1.6.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.4.1 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.6.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.6.2.1 09-Jul-2000  bouyer file audioamd.c was added on branch thorpej_scsipi on 2000-11-20 20:25:30 +0000
 1.7.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.7.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.7.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.7.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.7.4.1 03-Oct-2001  nathanw file audioamd.c was added on branch nathanw_sa on 2002-04-01 07:42:38 +0000
 1.8.6.1 24-Jun-2002  lukem Pull up revision 1.9 (requested by pk in ticket #357):
Make this work with AUDIO_C_HANDLER.
 1.8.4.1 15-Jul-2002  gehenna catch up with -current.
 1.16.6.5 17-Jan-2005  skrll Sync with HEAD.
 1.16.6.4 02-Nov-2004  skrll Sync with HEAD.
 1.16.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.6.1 03-Aug-2004  skrll Sync with HEAD
 1.20.10.1 07-Dec-2007  yamt sync with head
 1.21.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.21.50.1 09-Jan-2008  matt sync with HEAD
 1.21.48.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.21.48.1 03-Dec-2007  joerg Sync with HEAD.
 1.21.30.1 03-Dec-2007  ad Sync with HEAD.
 1.21.28.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.23.36.1 21-Apr-2010  matt sync to netbsd-5
 1.23.28.1 23-Jan-2010  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1251):
sys/arch/sparc/sparc/auxreg.h: revision 1.13
distrib/sparc/ramdisk/dot.profile: revision 1.20
sys/arch/sparc/dev/audioamd.c: revision 1.25
sys/arch/sparc/dev/fd.c: revision 1.147
sys/arch/sparc/stand/common/promdev.c: revision 1.23
distrib/sparc/miniroot/Makefile.inc: revision 1.16
Build miniroot binaries for sparc with -Os to shrink instfs.tgz
for the second boot floppy which use miniroot objects.
This is workaround for PR install/42146, and ok'ed by mrg@.
Don't try to read disklabel to check FS_RAID on floppy boot since
reopening floppy could cause Data Access Exception later.
Fixes PR port-sparc/42186, ok'ed by mrg@.
Disable "fast trap" handlers which invoke software interrupts
in sparc/amd7930intr.s and sparc/bsd_fdintr.s until they are
rewritten to adapt new MI softint(9) API.
No particular comments on PR port-sparc/42192, but
this fixes timeout problem on floppy access on my SPARCstation 1+.
XXX: floppy support on sun4m seems to have another problem (data overrun).
Use /dev/fd0a rather than /dev/rfd0a to read instfs.tgz image from floppy.
It looks newer (appearred after 1.6) gzip tries to read less than DEV_BSIZE
(to check header?) so we can't use raw device directly.
(note sparc bootfs ramdisk doesn't have dd(1))
Workaround for PR port-sparc/42193, and would also fix PR install/28734.
Explicitly clear AUXIO4M_FTC bit in FTC_FLIP macro used on
pseudo-dma for floppy, as well as AUXIO4C_FTC bit for sun4c.
A comment in the macro says AUXIO4M_FTC bit is auto-clear,
but my two SS20s (including compatible) with 150MHz hyperSPARCs
get data_overrun without it, and no bad side effect on SS5
(works with and without this change).
Closes PR port-sparc/42516, which is the last one of a bunch of
floppy issue on NetBSD/sparc since NetBSD 2.0 days. See
http://mail-index.NetBSD.org/port-sparc/2009/12/20/msg000484.html
for details.
 1.23.18.1 11-Mar-2010  yamt sync with head
 1.25.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.25.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.25.4.1 12-Jun-2011  rmind sync with head
 1.26.4.3 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.26.4.2 20-Nov-2011  mrg use the sc_intr_lock when calling the rint/tint functions.
 1.26.4.1 20-Nov-2011  mrg port the am7930 drivers to audiomp. sparc and pmax GENERIC builds,
but i am unable to test these drivers.
 1.26.2.1 17-Apr-2012  yamt sync with head
 1.27.50.1 10-Jun-2019  christos Sync with HEAD
 1.28.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.28.2.1 22-Apr-2019  isaki Adapt am7930 families to audio2.
- Remove {input/output}_conv stuff from am7930_glue.
Filter pipelines for user encoding are not necessary in audio2
so the driver only needs to handle its hardware encoding.
- audioamd/vsaudio use an ordinal linear-mulaw conversion filter
and bba requires special one. dev/audio/mulaw.c supports this
variant just for bba. It might not a good way for bba but it
keeps all other drivers simple.
- Tested on vsaudio(4) by naru@, bba(4) by tsutsui@ (a few months ago).
Thanks!
 1.29.2.1 31-Mar-2021  martin Apply patch, requested by tsutsui in ticket #1239:

sys/arch/sparc/dev/audioamd.c (apply patch)

Fix for PR 56078 (different solution applied to -current): fix wrong
lock usage.
 1.5 12-Sep-2020  isaki Improve am7930 family drivers to share more code.
audioamd(4) on sparc, vsaudio(4) on vax, and bba(4) are.
- Remove complex and useless callbacks: onopen, onclose, and
indirect_{read,write}. This makes audioamd and vsaudio almost the same.
- Remove (already disabled) assembly fast interrupt path from audioamd(4).
cf. http://mail-index.netbsd.org/source-changes/2009/12/19/msg004585.html
- Use trigger_* method rather than start_* method. It's more suitable.
vsaudio(4) was tested by naru@, bba(4) was tested by tsutsui@.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 15-Jan-2005  kent ansify and KNF
 1.2 08-May-2000  mycroft branches: 1.2.6; 1.2.30;
Fix the RCS tag format. Duh.
 1.1 08-May-2000  mycroft Make the audioamd assembler code compile again.
 1.2.30.1 17-Jan-2005  skrll Sync with HEAD.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 08-May-2000  bouyer file audioamdvar.h was added on branch thorpej_scsipi on 2000-11-20 20:25:30 +0000
 1.24 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.23 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.22 10-May-2021  thorpej branches: 1.22.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.21 24-Apr-2021  thorpej branches: 1.21.2; 1.21.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.20 22-Nov-2020  thorpej branches: 1.20.2;
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.19 18-Jul-2011  mrg branches: 1.19.66;
convert the remaining sparc drivers to CFATTACH_DECL_NEW/cfdata_t/device_t.
(cgsix_obio.c was only partially converted with the rest of the cgsix code
when it was changed some time ago.)
 1.18 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.17 20-Sep-2009  tsutsui - use device_t and cfdriver_t
- use device_private() and device_xname()
- use proper types or variables for device_t/softc
 1.16 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.15 11-Dec-2005  christos branches: 1.15.74; 1.15.76; 1.15.78;
merge ktrace-lwp.
 1.14 26-Aug-2005  drochner s/locdesc_t/int/g
 1.13 28-Jun-2005  drochner branches: 1.13.2;
convert remaining autoconf bus "submatch" functions to use the new
signature (passing locators), and remove some which obviously don't
serve any purpose
(untested, sorry)
 1.12 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.11 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.10 15-Jul-2003  lukem __KERNEL_RCSID()
 1.9 01-Jan-2003  thorpej branches: 1.9.2;
Use aprint_normal() for cfprint routines.
 1.8 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.7 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.4 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.3 25-Aug-2002  thorpej branches: 1.3.2; 1.3.4; 1.3.6;
Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.2 25-Aug-2002  thorpej Add a generic function to translate a device address using a
parent's "ranges" property, and use it.
 1.1 24-Aug-2002  thorpej Add autoconfiguration support for the Sun4d "bootbus". Add a
zs @ bootbus attachment.
 1.3.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.3.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.6.1 25-Aug-2002  jdolecek file bootbus.c was added on branch kqueue on 2002-09-06 08:40:48 +0000
 1.3.4.2 31-Aug-2002  gehenna catch up with -current.
 1.3.4.1 25-Aug-2002  gehenna file bootbus.c was added on branch gehenna-devsw on 2002-08-31 14:52:13 +0000
 1.3.2.4 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.3.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.3.2.1 25-Aug-2002  nathanw file bootbus.c was added on branch nathanw_sa on 2002-08-27 23:45:27 +0000
 1.9.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.2.1 21-Jun-2006  yamt sync with head.
 1.15.78.2 11-Mar-2010  yamt sync with head
 1.15.78.1 16-May-2008  yamt sync with head.
 1.15.76.1 18-May-2008  yamt sync with head.
 1.15.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.66.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.20.2.2 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.20.2.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.21.4.1 31-May-2021  cjep sync with head
 1.21.2.1 13-May-2021  thorpej Sync with HEAD.
 1.22.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 24-Aug-2002  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.114; 1.1.116; 1.1.118;
Add autoconfiguration support for the Sun4d "bootbus". Add a
zs @ bootbus attachment.
 1.1.118.1 16-May-2008  yamt sync with head.
 1.1.116.1 18-May-2008  yamt sync with head.
 1.1.114.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 24-Aug-2002  jdolecek file bootbusvar.h was added on branch kqueue on 2002-09-06 08:40:48 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 24-Aug-2002  gehenna file bootbusvar.h was added on branch gehenna-devsw on 2002-08-31 14:52:13 +0000
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 24-Aug-2002  nathanw file bootbusvar.h was added on branch nathanw_sa on 2002-08-27 23:45:27 +0000
 1.10 25-Apr-1995  pk New audio driver from Rolf Grossmann.
 1.9 04-Mar-1995  pk Move SunOS audio_info compat to <compat/sunos/sunos_ioctl.c>.
 1.8 02-Mar-1995  pk Rename audio*() functions to avoid conflicts with sys/dev/audio.c; this is an
emergency measure, driver needs to be converted to generic audio subsystem.
 1.7 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 02-Nov-1994  deraadt ioctl u_long cmd
 1.4 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.3 02-Oct-1994  deraadt sun4/300 support works
 1.2 17-Sep-1994  deraadt sbus/* --> dev/*
deal with multiple bus types (start of vme/obio support)
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.3 25-Apr-1995  pk New audio driver from Rolf Grossmann.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.3 25-Apr-1995  pk New audio driver from Rolf Grossmann.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.13 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.12 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.11 16-Apr-2000  pk branches: 1.11.4;
Switch initial colormap setup again to be compatible with the PROM's,
i.e. background at index 0: white, foreground at index 255: black.

Also, allocate a slice for an ANSI colormap, so we can experiment
with coloured text on the bare console.
 1.10 04-Apr-2000  pk Use copyin/copyout to get a colormap from/to user space.
Also, prepare for the case of a colormap maintained in kernel space.
 1.9 26-Aug-1999  thorpej branches: 1.9.2;
Initialize the default colormap to 0 == black, all others == full white.
 1.8 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.7 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.6 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.5 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 17-Sep-1994  deraadt sbus/* --> dev/*
deal with multiple bus types (start of vme/obio support)
 1.2 29-Nov-1993  deraadt fbio.h is in machine/
 1.1 11-Nov-1993  deraadt from torek:
new brooktree dac code
hacked cgthree code
new cgsix (ala GX) code
 1.9.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.11.4.1 04-Sep-2002  itojun pullup (itojun)

sys/arch/amiga/dev/grf_cv3d.c 1.11
sys/arch/hpcmips/dev/mq200.c 1.21
sys/arch/i386/i386/sys_machdep.c 1.64
sys/arch/luna68k/dev/lunafb.c 1.9
sys/arch/sparc/dev/bt_subr.c via patch
sys/arch/sparc64/dev/bt_subr.c via patch
sys/arch/sun3/dev/bt_subr.c via patch
sys/compat/ibcs2/ibcs2_stat.c 1.21-1.23
sys/dev/sun/bt_subr.c 1.3
sys/dev/tc/cfb.c 1.34
sys/dev/tc/sfb.c 1.53
sys/dev/tc/xcfb.c 1.29
integer overflow. reported by silvio@qualys.com
 1.5 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.4 27-Feb-1996  thorpej branches: 1.4.30;
First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.3 27-Feb-1996  pk Define a couple more framebuffer control bits.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 11-Nov-1993  deraadt from torek:
new brooktree dac code
hacked cgthree code
new cgsix (ala GX) code
 1.4.30.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.5 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.4 04-Apr-2000  pk Use copyin/copyout to get a colormap from/to user space.
Also, prepare for the case of a colormap maintained in kernel space.
 1.3 26-Aug-1999  thorpej branches: 1.3.2;
Initialize the default colormap to 0 == black, all others == full white.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 11-Nov-1993  deraadt from torek:
new brooktree dac code
hacked cgthree code
new cgsix (ala GX) code
 1.3.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.46 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.45 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.44 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.43 19-Mar-2000  pk branches: 1.43.4;
Use fb_is_console(); retract fbconstty & fbnode from service.
 1.42 10-Aug-1999  christos branches: 1.42.2;
split bwtwo driver in sbus and obio parts.
 1.41 19-May-1999  pk Turn on the video timing which is not always done by the PROM (e.g. if we're
not the console).
 1.40 07-Sep-1998  pk branches: 1.40.8;
Need to cast sbus attach `prom_vaddrs' field.
 1.39 29-Jul-1998  pk Deal with sbus attach args changes.
 1.38 07-Apr-1998  pk bus_space_mmap() has changed to take a `bus_space_handle_t *' argument,
like other bus space methods.
 1.37 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.36 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.35 12-Jan-1998  thorpej Update for changes to config.
 1.34 05-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.33 24-May-1997  pk branches: 1.33.4;
Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.32 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.31 20-Oct-1996  pk Make sure to refer to `sc_ovtype' only when SUN4 is defined, as noted
by `r.evans@ic.ac.uk'.
Also, explicitly testwhether we're dealing with a pfour.
 1.30 13-Oct-1996  christos backout previous kprintf change
 1.29 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.28 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.27 20-Sep-1996  thorpej Don't attach an rcons to a cgfour/cgeight overlay plane; it doesn't work
properly. Problem reported by Charles Hannum.

XXX This is temporary until someone with the hardware has time to fix it!
 1.26 01-Apr-1996  christos branches: 1.26.4;
Eliminated dependencies on dev_conf.h
 1.25 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 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 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.22 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.21 27-Feb-1996  pk `bwtworeg' is just about the same as the generic `fbcontrol'.
 1.20 25-Feb-1996  pk Use CPU-type macros.
 1.19 19-Feb-1996  thorpej Fix bug in bwtwounblank() ... didn't have code to enable video on sun4/200
obio framebuffer. Noticed when my 4/260 dropped into DDB and the screen
didn't unblank. Pull all of the video enable/disable into functions so
this mishap doesn't happen again.
 1.18 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.17 29-Nov-1995  pk Code from Jason to better configure /dev/fb.
 1.16 23-Oct-1995  pk On-board bwtwo diddles a system enable register bit for video, per Jason
Thorpe (PR#1672).
 1.15 09-Oct-1995  pk branches: 1.15.2;
RASTERCONS now works on sun4's too.
 1.14 08-Oct-1995  pk Patch from Jason to factor out a common framebuffer size determination
routine from the individual drivers.
 1.13 05-Oct-1995  pk Do not set `ra_len' in bwtwomatch(); we only need the pixels for CONSOLE,
but if so, we need the lot.
 1.12 04-Oct-1995  pk RCONSOLE => RASTERCONSOLE.
 1.11 17-Sep-1995  pk Change interface to th `fb' pseudo device to not need the major device
number (a la sun3).
Put in new glue for rcons.
 1.10 29-Aug-1995  pk Support for sun4 (from Jason Thorpe).
 1.9 10-Apr-1995  mycroft map --> mmap
 1.8 17-Feb-1995  pk match/attach on sun4's obio bus, from Theo.
 1.7 20-Nov-1994  deraadt copyright/Id cleanup
 1.6 02-Nov-1994  deraadt ioctl u_long cmd
 1.5 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.4 17-Sep-1994  deraadt sbus/* --> dev/*
deal with multiple bus types (start of vme/obio support)
 1.3 04-Jul-1994  deraadt need vm/vm.h
 1.2 11-Oct-1993  deraadt bwtwo.c, cgthree.c: sys-fbio.h -> machine/fbio.h
if_le.c: #ifdef MULTICAST some things, and do arp the old way
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.15.2.1 16-Feb-1996  thorpej Pull in improved framebuffer autoconfiguration code from -current.
Prevents panics when multiple framebuffers are found on sun4 systems.
 1.26.4.2 02-Mar-1997  pk From trunk:
> Make sure to refer to `sc_ovtype' only when SUN4 is defined
 1.26.4.1 10-Dec-1996  mycroft From trunk:
Disable rcons for now.
 1.33.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.40.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.42.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.43.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.18 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.17 19-Sep-2009  tsutsui Split device_t/softc.
Tested on TME emulating SS2.

XXX: bwtwo at obmem on TME emulating sun2 didn't match and cannot test
 1.16 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.15 29-Mar-2006  thorpej branches: 1.15.62; 1.15.64; 1.15.66;
Use device_cfdata().
 1.14 16-Nov-2005  uwe branches: 1.14.4; 1.14.6; 1.14.8; 1.14.10; 1.14.12;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.13 03-Jun-2005  tsutsui branches: 1.13.2; 1.13.8;
Add const.
 1.12 04-Dec-2003  keihan NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.11 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.10 15-Jul-2003  lukem __KERNEL_RCSID()
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Add trailing ; to CFATTACH_DECL.
 1.8 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 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.5 11-Mar-2002  pk branches: 1.5.4;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.4 22-Aug-2000  pk branches: 1.4.4; 1.4.8;
Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.3 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.1 10-Aug-1999  christos branches: 1.1.2;
split bwtwo driver in sbus and obio parts.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.4.8.2 17-Sep-2002  nathanw Catch up to -current.
 1.4.8.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.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.4.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.5.4.1 19-May-2002  gehenna Remove unnecessary #include
 1.9.6.5 11-Dec-2005  christos Sync with head.
 1.9.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.13.8.1 22-Nov-2005  yamt sync with head.
 1.13.2.1 21-Jun-2006  yamt sync with head.
 1.14.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.14.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.14.8.1 01-Apr-2006  yamt sync with head.
 1.14.6.1 22-Apr-2006  simonb Sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.66.2 11-Mar-2010  yamt sync with head
 1.15.66.1 16-May-2008  yamt sync with head.
 1.15.64.1 18-May-2008  yamt sync with head.
 1.15.62.1 02-Jun-2008  mjf Sync with HEAD.
 1.4 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.3 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.1 10-Aug-1999  christos branches: 1.1.2;
split bwtwo driver in sbus and obio parts.
 1.1.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.4 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.3 27-Feb-1996  pk branches: 1.3.30;
`bwtworeg' is just about the same as the generic `fbcontrol'.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.3.30.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.3 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.2 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.1 10-Aug-1999  christos branches: 1.1.2;
split bwtwo driver in sbus and obio parts.
 1.1.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.51 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.50 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.49 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.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 18-Jul-2011  mrg branches: 1.47.2; 1.47.12; 1.47.16;
convert to use device_t, cfdata_t and CFATTACH_DECL_NEW().

XXX: compile time tested only.
 1.46 11-Jun-2008  drochner mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.45 28-Apr-2008  martin branches: 1.45.2; 1.45.4;
Remove clause 3 and 4 from TNF licenses
 1.44 04-Mar-2007  christos branches: 1.44.40; 1.44.42; 1.44.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.43 29-Mar-2006  thorpej branches: 1.43.14;
Use device_cfdata().
 1.42 11-Dec-2005  christos branches: 1.42.4; 1.42.6; 1.42.8; 1.42.10; 1.42.12;
merge ktrace-lwp.
 1.41 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.40 10-Dec-2003  agc branches: 1.40.16; 1.40.24;
Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt, and ratified by
myself - the only discrepancy being the handling of the original
clause 3 in src/usr.sbin/yppoll/yppoll.c.
 1.39 04-Dec-2003  keihan NetBSD.ORG -> NetBSD.org

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

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.37 24-Aug-2003  uwe #include "opt_rcons.h"
 1.36 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.35 15-Jul-2003  lukem __KERNEL_RCSID()
 1.34 29-Jun-2003  fvdl branches: 1.34.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.33 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.32 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.31 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.30 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.29 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.28 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.27 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.26 11-Mar-2002  pk branches: 1.26.4;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.25 24-Sep-2001  eeh branches: 1.25.4;
Change bus_space_mmap() signature to the official one.
 1.24 22-Aug-2000  pk branches: 1.24.2; 1.24.4;
Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.23 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.22 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.21 04-Apr-2000  pk branches: 1.21.4;
Use copyin/copyout to get a colormap from/to user space.
Also, prepare for the case of a colormap maintained in kernel space.
 1.20 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.19 19-Nov-1998  mrg branches: 1.19.10;
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.18 07-Apr-1998  pk bus_space_mmap() has changed to take a `bus_space_handle_t *' argument,
like other bus space methods.
 1.17 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.16 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.15 12-Jan-1998  thorpej Update for changes to config.
 1.14 05-Oct-1997  thorpej branches: 1.14.2;
Copyright assigned to The NetBSD Foundation.
 1.13 24-May-1997  pk branches: 1.13.4;
Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.12 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.11 13-Oct-1996  christos backout previous kprintf change
 1.10 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.8 25-Aug-1996  thorpej Correct mistakes similar to those made in cgfour.c: Log message from
cgfour.c:

Fix a typo and an error in color plane offset calculation. Submitted by
Konrad Schroder <perseant@hitl.washington.edu>, PR #2695.
 1.7 01-Apr-1996  christos Eliminated dependencies on dev_conf.h
 1.6 31-Mar-1996  pk Re-arrange a bit to stear clear of gcc `-Wall' bites.
 1.5 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.4 16-Mar-1996  christos This could have never worked (fb in attach was never initialized); include <sys/systm.h>
 1.3 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.2 28-Feb-1996  thorpej Oops...missed to places where I could have used CPU type macros.
 1.1 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.13.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.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.19.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.21.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.24.4.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.24.4.4 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.24.4.3 28-Jun-2002  jdolecek prove kqfilter hook; it's very simple equivalent of seltrue()
 1.24.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.24.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.2.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.24.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.25.4.5 11-Nov-2002  nathanw Catch up to -current
 1.25.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.25.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.25.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.25.4.1 24-Sep-2001  nathanw file cgeight.c was added on branch nathanw_sa on 2002-04-01 07:42:39 +0000
 1.26.4.1 17-May-2002  gehenna Add device switch.
 1.34.2.5 11-Dec-2005  christos Sync with head.
 1.34.2.4 04-Feb-2005  skrll Adapt to branch.
 1.34.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.34.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.34.2.1 03-Aug-2004  skrll Sync with HEAD
 1.40.24.1 22-Nov-2005  yamt sync with head.
 1.40.16.2 03-Sep-2007  yamt sync with head.
 1.40.16.1 21-Jun-2006  yamt sync with head.
 1.42.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.42.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.42.8.1 01-Apr-2006  yamt sync with head.
 1.42.6.1 22-Apr-2006  simonb Sync with head.
 1.42.4.1 09-Sep-2006  rpaulo sync with head
 1.43.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.44.44.2 04-May-2009  yamt sync with head.
 1.44.44.1 16-May-2008  yamt sync with head.
 1.44.42.2 17-Jun-2008  yamt sync with head.
 1.44.42.1 18-May-2008  yamt sync with head.
 1.44.40.2 29-Jun-2008  mjf Sync with HEAD.
 1.44.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.45.4.1 18-Jun-2008  simonb Sync with head.
 1.45.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.47.16.1 18-May-2014  rmind sync with head
 1.47.12.2 03-Dec-2017  jdolecek update from HEAD
 1.47.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.48.2.1 10-Aug-2014  tls Rebase.
 1.51 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.50 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.49 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.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 18-Jul-2011  mrg branches: 1.46.2; 1.46.12;
convert to use device_t, cfdata_t and CFATTACH_DECL_NEW().

XXX: compile time tested only.
 1.45 11-Jun-2008  drochner mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.44 28-Apr-2008  martin branches: 1.44.2; 1.44.4;
Remove clause 3 and 4 from TNF licenses
 1.43 04-Mar-2007  christos branches: 1.43.40; 1.43.42; 1.43.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.42 29-Mar-2006  thorpej branches: 1.42.14;
Use device_cfdata().
 1.41 11-Dec-2005  christos branches: 1.41.4; 1.41.6; 1.41.8; 1.41.10; 1.41.12;
merge ktrace-lwp.
 1.40 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.39 10-Dec-2003  agc branches: 1.39.16; 1.39.24;
Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt, and ratified by
myself - the only discrepancy being the handling of the original
clause 3 in src/usr.sbin/yppoll/yppoll.c.
 1.38 04-Dec-2003  keihan NetBSD.ORG -> NetBSD.org

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

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.36 24-Aug-2003  uwe #include "opt_rcons.h"
 1.35 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.34 15-Jul-2003  lukem __KERNEL_RCSID()
 1.33 29-Jun-2003  fvdl branches: 1.33.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.32 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.31 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.30 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.29 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.28 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.27 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.26 11-Mar-2002  pk branches: 1.26.4;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.25 24-Sep-2001  eeh branches: 1.25.4;
Change bus_space_mmap() signature to the official one.
 1.24 22-Aug-2000  pk branches: 1.24.2; 1.24.4;
Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.23 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.22 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.21 04-Apr-2000  pk branches: 1.21.4;
Use copyin/copyout to get a colormap from/to user space.
Also, prepare for the case of a colormap maintained in kernel space.
 1.20 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.19 19-Nov-1998  mrg branches: 1.19.10;
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.18 07-Apr-1998  pk bus_space_mmap() has changed to take a `bus_space_handle_t *' argument,
like other bus space methods.
 1.17 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.16 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.15 12-Jan-1998  thorpej Update for changes to config.
 1.14 05-Oct-1997  thorpej branches: 1.14.2;
Copyright assigned to The NetBSD Foundation.
 1.13 24-May-1997  pk branches: 1.13.4;
Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.12 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.11 13-Oct-1996  christos backout previous kprintf change
 1.10 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.8 13-Aug-1996  thorpej Fix a typo and an error in color plane offset calculation. Submitted by
Konrad Schroder <perseant@hitl.washington.edu>, PR #2695.
 1.7 01-Apr-1996  christos branches: 1.7.4;
Eliminated dependencies on dev_conf.h
 1.6 31-Mar-1996  pk Re-arrange a bit to stear clear of gcc `-Wall' bites.
 1.5 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.4 16-Mar-1996  christos include <sys/systm.h>
 1.3 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.2 28-Feb-1996  thorpej Oops...missed to places where I could have used CPU type macros.
 1.1 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.7.4.1 10-Dec-1996  mycroft From trunk:
Fix plane offset calculation.
 1.13.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.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.19.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.21.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.24.4.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.24.4.4 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.24.4.3 28-Jun-2002  jdolecek prove kqfilter hook; it's very simple equivalent of seltrue()
 1.24.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.24.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.2.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.24.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.25.4.5 11-Nov-2002  nathanw Catch up to -current
 1.25.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.25.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.25.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.25.4.1 24-Sep-2001  nathanw file cgfour.c was added on branch nathanw_sa on 2002-04-01 07:42:39 +0000
 1.26.4.1 17-May-2002  gehenna Add device switch.
 1.33.2.5 11-Dec-2005  christos Sync with head.
 1.33.2.4 04-Feb-2005  skrll Adapt to branch.
 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.39.24.1 22-Nov-2005  yamt sync with head.
 1.39.16.2 03-Sep-2007  yamt sync with head.
 1.39.16.1 21-Jun-2006  yamt sync with head.
 1.41.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.41.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.41.8.1 01-Apr-2006  yamt sync with head.
 1.41.6.1 22-Apr-2006  simonb Sync with head.
 1.41.4.1 09-Sep-2006  rpaulo sync with head
 1.42.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.43.44.2 04-May-2009  yamt sync with head.
 1.43.44.1 16-May-2008  yamt sync with head.
 1.43.42.2 17-Jun-2008  yamt sync with head.
 1.43.42.1 18-May-2008  yamt sync with head.
 1.43.40.2 29-Jun-2008  mjf Sync with HEAD.
 1.43.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.44.4.1 18-Jun-2008  simonb Sync with head.
 1.44.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.46.12.3 03-Dec-2017  jdolecek update from HEAD
 1.46.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.46.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.2.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.99 25-Sep-2024  macallan some minor nits:
- clarify 16bit colour table construction a bit
- print some more hw info
- fix WSDISPLAYIO_GVIDEO
 1.98 12-May-2024  macallan branches: 1.98.2;
support 16bit / RGB565 colour
 1.97 24-Apr-2024  macallan allow userland to switch to 16bit colour
 1.96 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.95 13-Jun-2023  macallan - use sx_wait() to avoid stalling the MBus
- request 32bit alignment for glyphcache cells
 1.94 23-May-2023  macallan use macros compatible with xf86-video-suncg14 to issue SX instructions
much more readable, alignment weirdness is handled automatically and code is
interchangable
 1.93 25-May-2022  macallan branches: 1.93.4;
be lazy about clearing the cursor since most likely we're going to overwrite
it anyway. Same logic as in cgsix.
 1.92 17-Dec-2021  macallan only write the mask register if we're actually changing it
 1.91 17-Dec-2021  macallan cg14_invert():
- use only 32bit accesses
- use byte mask / ROPs for partial writes
 1.90 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.89 24-Apr-2021  thorpej branches: 1.89.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.88 11-Aug-2019  macallan branches: 1.88.10;
remove orphaned comment
 1.87 17-Jan-2019  macallan don't crash when we're not the console
 1.86 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.85 25-Jan-2018  macallan branches: 1.85.2; 1.85.4;
do boundary checks when writing cursor sprite colour registers
 1.84 12-Jan-2018  macallan enable font loading
 1.83 06-Jan-2018  macallan support underlines
 1.82 16-Sep-2016  macallan wipe glyph cache as needed when re-entering text mode
now the console is readable again when leaving X
 1.81 02-Jun-2016  macallan branches: 1.81.2;
use DEFATTR if we're not the console and can't init defattr.
should appease clang
TODO: we should really init the glyphcache whith the first screen
 1.80 30-Apr-2016  macallan support anti-aliased fonts, glyphcache etc.
 1.79 25-Jul-2014  dholland branches: 1.79.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.78 23-Apr-2014  macallan rev. 27 SX needs memory referencing instructions written to 64bit aligned
addresses ( my rev. 25 just ignores the lower 3 bits )
so, we zero these bits now
 1.77 16-Mar-2014  dholland branches: 1.77.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.76 14-Aug-2013  macallan comments & whitespace police
 1.75 04-Jun-2013  macallan branches: 1.75.2;
report actual VRAM size in fb_type.fb_size
 1.74 04-Jun-2013  macallan actually map the whole SX IO space instead of just the first page over and
over again (doh)
 1.73 29-May-2013  macallan allow userland to map SX registers and IO space
 1.72 12-Feb-2013  macallan break some more long lines
 1.71 07-Feb-2013  macallan - implement buttom-up copies in cg14_bitblt() so scrolling down works now
- use more registers when copying
- use hardware to draw the cursor
- use putchar() for horizontal scrolling since byte-wise overlapping copy
ops wouldn't be any faster anyway
 1.70 06-Feb-2013  macallan use SX for basic hardware acceleration
not quite complete yet but good enough to be useful
missing things include:
- backwards blits
- ROP support
- the cursor is still drawn by software
 1.69 05-Feb-2013  macallan throw out RASTERCONSOLE goo
 1.68 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.67 11-Jan-2012  macallan branches: 1.67.6;
use rasops_init(0, 0)
 1.66 13-Apr-2011  macallan branches: 1.66.4; 1.66.8;
use the same function whenever we change colour depth
also, when opening the fb device switch to 32bit and back to 8 on close, not
the other way around
 1.65 31-Aug-2010  macallan branches: 1.65.2;
remove shadow framebuffer support, use VCONS_DONT_READ instead
 1.64 10-Jun-2010  macallan Add a couple more hw offset definitions, add an ioctl() to set colour depth
which works like Solaris and Linux, and finally make mmap() behave like an
actual CG14. This should be all we need to get Xorg's suncg14 driver going.
 1.63 08-Jun-2010  macallan get rid of the cg3/cg8 'emulation' kludge since we have the xf86-video-suncg14
driver now
this will probably need some work in cgfourteenmmap() to match what the
driver expects from a cg14
 1.62 27-Aug-2009  macallan branches: 1.62.2; 1.62.4;
use vcons_replay_msgbuf()
 1.61 14-Jul-2009  apb Enclose the argument to #error in quotes, to protect an embedded single
quote. Part of PR 41255 from Kurt Lidl.
 1.60 26-May-2009  macallan use BUS_SPACE_MAP_LARGE to map the framebuffer
 1.59 16-May-2009  cegger KNF, same object code generated
 1.58 16-Apr-2009  macallan use sparc_bus_map_large() to map the framebuffer if we can't find a PROM
mapping - now we won't exhaust the IODEV range and thus prevent other graphics
devices from working.
 1.57 18-Mar-2009  cegger bcopy -> memcpy
 1.56 05-Feb-2009  macallan branches: 1.56.2;
Recycle OBP's framebuffer mapping if available instead of wasting KVA space
by creating our own.
 1.55 12-Dec-2008  macallan some cleanup, add shadowfb support
 1.54 13-Jun-2008  cegger branches: 1.54.4;
use device_lookup_private to get softc
 1.53 17-May-2008  macallan branches: 1.53.2;
struct device * -> device_t
 1.52 17-Oct-2007  garbled branches: 1.52.16; 1.52.18; 1.52.20; 1.52.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.51 19-Aug-2007  jdc branches: 1.51.2;
Also print a new line if we are not the console.
 1.50 30-Jul-2007  macallan branches: 1.50.2;
add hardware cursor support
 1.49 30-Jul-2007  macallan add wsdisplay support for cg14
The console will run in 8bit but switch to 32bit in mapped mode so XFree86
with wsfb can run in 24bit colour.
 1.48 04-Mar-2007  christos branches: 1.48.2; 1.48.10; 1.48.12; 1.48.14;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.47 23-Nov-2006  elad branches: 1.47.4;
Always #undef CG14_MAP_REGS, since it opens a security hole (as the comment
says) and should be used only for debugging.

Okay mouse@, christos@.
 1.46 29-Mar-2006  thorpej branches: 1.46.8; 1.46.10;
Use device_cfdata().
 1.45 04-Mar-2006  uwe branches: 1.45.2; 1.45.4; 1.45.6;
s/u_intN_t/uintN_t/
 1.44 19-Jan-2006  he branches: 1.44.2; 1.44.4;
Wrap the definition of cg14_set_rcons_luts() in an #ifdef RASTERCONSOLE,
to allow the INSTALL kernel to build, as it's unused there.
 1.43 19-Jan-2006  he Make this compile again by ensuring that we don't cast away the volatile
qualifier.
 1.42 17-Jan-2006  christos PR/32552: Antonio Bravo: cgfourteen 24-bit support
Original code from der Mouse, posted to the mailing lists by Jakob Menzi.
 1.41 11-Dec-2005  christos branches: 1.41.2;
merge ktrace-lwp.
 1.40 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.39 04-Jun-2005  tsutsui branches: 1.39.2; 1.39.8;
Fix for gcc -Wcast-qual.
 1.38 13-Nov-2003  chs eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

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

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.36 24-Aug-2003  uwe #include "opt_rcons.h"
 1.35 15-Jul-2003  lukem __KERNEL_RCSID()
 1.34 29-Jun-2003  fvdl branches: 1.34.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.33 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.32 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.31 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.30 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.29 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.28 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.27 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.26 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.25 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.24 03-Aug-2002  itojun correct range check, have overflow check, fix type mismatches,
for cmap args and some other calls. from openbsd
 1.23 03-Apr-2002  darrenr branches: 1.23.2; 1.23.4;
apply patches from PR#10170
 1.22 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.21 24-Sep-2001  eeh branches: 1.21.4;
Change bus_space_mmap() signature to the official one.
 1.20 22-Aug-2000  pk branches: 1.20.2; 1.20.4;
Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.19 09-Jul-2000  pk Re-arrange headers; drop <machine/cpu.h>.
 1.18 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.17 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.16 19-Mar-2000  pk branches: 1.16.4;
Use fb_is_console(); retract fbconstty & fbnode from service.
 1.15 24-Mar-1999  mrg branches: 1.15.8;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.14 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.13 29-Jul-1998  pk We no longer need to get the register sets by ourselves.
 1.12 07-Apr-1998  pk bus_space_mmap() has changed to take a `bus_space_handle_t *' argument,
like other bus space methods.
 1.11 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.10 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.9 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.8 12-Jan-1998  thorpej Update for changes to config.
 1.7 24-May-1997  pk branches: 1.7.8;
Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.6 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.2 01-Oct-1996  abrown Add cgfourteen_poll() entry point to sync with recent changes in frame
buffer cdev code.
 1.1 30-Sep-1996  abrown Initial commit of cg14 framebuffer driver for Sun4m SPARCs.
- This driver supports the on-board mbus-based cgfourteen (sometimes referred
to as "SX") video hardware present on SS20-class machines.
- It does *not* support any of the SX acceleration features.
- It does support the 8-bit mode of the hardware, and looks to X like
a cgthree.
- It does support the cg6-style hardware cursor, even when running X in
cgthree emulation.
- It does support DPMS power-down of compatible displays on later-revision
cg14's.
- There is code to support the true color (32-bit) mode of the cg14 as
cg8 emulation, but it is disabled by default because it is most likely
broken. #define CG14_CG8 to turn it on.

The driver is not yet installed in the conf files, but I will do so
shortly...
 1.7.8.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.15.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.16.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.20.4.7 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.20.4.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.20.4.5 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.20.4.4 28-Jun-2002  jdolecek prove kqfilter hook; it's very simple equivalent of seltrue()
 1.20.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.20.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.20.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.20.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.21.4.8 11-Nov-2002  nathanw Catch up to -current
 1.21.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.21.4.6 17-Sep-2002  nathanw Catch up to -current.
 1.21.4.5 27-Aug-2002  nathanw Catch up to -current.
 1.21.4.4 13-Aug-2002  nathanw Catch up to -current.
 1.21.4.3 17-Apr-2002  nathanw Catch up to -current.
 1.21.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.21.4.1 24-Sep-2001  nathanw file cgfourteen.c was added on branch nathanw_sa on 2002-04-01 07:42:39 +0000
 1.23.4.2 22-Nov-2002  tron Pull up revision 1.25 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.23.4.1 07-Aug-2002  lukem Pull up revision 1.24 (requested by itojun in ticket #616):
correct range check, have overflow check, fix type mismatches,
for cmap args and some other calls. from openbsd
 1.23.2.2 31-Aug-2002  gehenna catch up with -current.
 1.23.2.1 17-May-2002  gehenna Add device switch.
 1.34.2.6 11-Dec-2005  christos Sync with head.
 1.34.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.34.2.4 04-Feb-2005  skrll Adapt to branch.
 1.34.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.34.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.34.2.1 03-Aug-2004  skrll Sync with HEAD
 1.39.8.1 22-Nov-2005  yamt sync with head.
 1.39.2.3 03-Sep-2007  yamt sync with head.
 1.39.2.2 30-Dec-2006  yamt sync with head.
 1.39.2.1 21-Jun-2006  yamt sync with head.
 1.41.2.1 01-Feb-2006  yamt sync with head.
 1.44.4.1 22-Apr-2006  simonb Sync with head.
 1.44.2.1 09-Sep-2006  rpaulo sync with head
 1.45.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.45.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.45.2.1 01-Apr-2006  yamt sync with head.
 1.46.10.1 10-Dec-2006  yamt sync with head.
 1.46.8.1 12-Jan-2007  ad Sync with head.
 1.47.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.48.14.2 03-Sep-2007  skrll Sync with HEAD.
 1.48.14.1 15-Aug-2007  skrll Sync with HEAD.
 1.48.12.1 07-Aug-2007  matt Sync with HEAD.
 1.48.10.1 03-Oct-2007  garbled Sync with HEAD
 1.48.2.1 20-Aug-2007  ad Sync with HEAD.
 1.50.2.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.51.2.1 06-Nov-2007  matt sync with HEAD
 1.52.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.52.20.6 09-Oct-2010  yamt sync with head
 1.52.20.5 11-Aug-2010  yamt sync with head.
 1.52.20.4 16-Sep-2009  yamt sync with head
 1.52.20.3 18-Jul-2009  yamt sync with head.
 1.52.20.2 20-Jun-2009  yamt sync with head
 1.52.20.1 04-May-2009  yamt sync with head.
 1.52.18.2 17-Jun-2008  yamt sync with head.
 1.52.18.1 18-May-2008  yamt sync with head.
 1.52.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.52.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.52.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.53.2.1 18-Jun-2008  simonb Sync with head.
 1.54.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.54.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.54.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.56.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.62.4.3 21-Apr-2011  rmind sync with head
 1.62.4.2 05-Mar-2011  rmind sync with head
 1.62.4.1 03-Jul-2010  rmind sync with head
 1.62.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.62.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.65.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.66.8.1 18-Feb-2012  mrg merge to -current.
 1.66.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.66.4.2 30-Oct-2012  yamt sync with head
 1.66.4.1 17-Apr-2012  yamt sync with head
 1.67.6.5 03-Dec-2017  jdolecek update from HEAD
 1.67.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.67.6.3 23-Jun-2013  tls resync from head
 1.67.6.2 25-Feb-2013  tls resync with head
 1.67.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.75.2.2 18-May-2014  rmind sync with head
 1.75.2.1 28-Aug-2013  rmind sync with head
 1.77.2.1 10-Aug-2014  tls Rebase.
 1.79.4.3 05-Oct-2016  skrll Sync with HEAD
 1.79.4.2 09-Jul-2016  skrll Sync with HEAD
 1.79.4.1 29-May-2016  skrll Sync with HEAD
 1.81.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.85.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.85.4.1 10-Jun-2019  christos Sync with HEAD
 1.85.2.2 18-Jan-2019  pgoyette Synch with HEAD
 1.85.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.88.10.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.89.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.93.4.1 05-Jul-2023  martin Pull up following revision(s) (requested by abs in ticket #224):

sys/dev/wscons/wsdisplay_vconsvar.h: revision 1.34
sys/dev/wscons/wsdisplay_glyphcachevar.h: revision 1.6
sys/arch/sparc/dev/cgfourteen.c: revision 1.94
sys/arch/sparc/dev/cgfourteen.c: revision 1.95
sys/dev/sbus/mgx.c: revision 1.21
sys/dev/sbus/mgx.c: revision 1.22
sys/dev/sbus/mgx.c: revision 1.23
sys/dev/wscons/wsdisplay_vcons.c: revision 1.65
sys/dev/wscons/wsdisplay_vcons.c: revision 1.66
sys/dev/wscons/wsdisplay_glyphcache.c: revision 1.12
sys/arch/sparc/dev/sxvar.h: revision 1.5
sys/arch/sparc/dev/sx.c: revision 1.6
sys/arch/sparc/dev/sx.c: revision 1.7

make vcons_putchar_buffer() return a flag indicating if anything actually
changed, skip the actual drawing op if nothing did

add flags for drivers to requesr R2L bit/byte-ordered fonts, default to
L2R, chack them in vcons_load_font() instead of just trusting that we'd get
what we need

initialize the diagnostic register with the value suggested by the SunOS
header. This sets a bunch of undocumented bits and yields a 10% speed increase
when rendering antialiased text.

use macros compatible with xf86-video-suncg14 to issue SX instructions
much more readable, alignment weirdness is handled automatically and code is
interchangable

allow drivers to specify horizontal alignment of glyph cache cells
for things like SX which have alignment restrictions

add counter to periodically drain the instruction queue in order to avoid
stalling the MBus during long SX operations

adapted from xf86-video-suncg14
- use sx_wait() to avoid stalling the MBus
- request 32bit alignment for glyphcache cells

wait for the engine to go idle before issuing rectfill commands
we get occasional overlap with blit commands if we just wait for fifo slots
needs further investigation, it is possible that not all writes to drawing
engine registers are pipelined and of course we don't have docs

following a hunch...
- cache DEC and FG registers, only write them if the value actually changes
- wait for the engine to go idle before writing DEC
- wait for FIFO slots on everything else
with this we avoid waiting if possible and still avoid overlapping blit and
fill commands
 1.98.2.1 02-Aug-2025  perseant Sync with HEAD
 1.9 14-May-2025  macallan remove definition for non-existant CG14_CURSOR_COLOR3 register
 1.8 12-May-2024  macallan branches: 1.8.2;
moar registers
in particular, document XLUT bits
 1.7 12-Jun-2010  macallan add some more offsets
this should have been committed with the previous, noticed by he
 1.6 17-Oct-2007  garbled branches: 1.6.20; 1.6.40; 1.6.42;
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.5 30-Jul-2007  macallan branches: 1.5.4;
add hardware cursor support
 1.4 30-Jul-2007  macallan add wsdisplay support for cg14
The console will run in 8bit but switch to 32bit in mapped mode so XFree86
with wsfb can run in 24bit colour.
 1.3 17-Jan-2006  christos branches: 1.3.28; 1.3.36; 1.3.40; 1.3.42;
PR/32552: Antonio Bravo: cgfourteen 24-bit support
Original code from der Mouse, posted to the mailing lists by Jakob Menzi.
 1.2 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.1 30-Sep-1996  abrown branches: 1.1.62; 1.1.78; 1.1.86;
Initial commit of cg14 framebuffer driver for Sun4m SPARCs.
- This driver supports the on-board mbus-based cgfourteen (sometimes referred
to as "SX") video hardware present on SS20-class machines.
- It does *not* support any of the SX acceleration features.
- It does support the 8-bit mode of the hardware, and looks to X like
a cgthree.
- It does support the cg6-style hardware cursor, even when running X in
cgthree emulation.
- It does support DPMS power-down of compatible displays on later-revision
cg14's.
- There is code to support the true color (32-bit) mode of the cg14 as
cg8 emulation, but it is disabled by default because it is most likely
broken. #define CG14_CG8 to turn it on.

The driver is not yet installed in the conf files, but I will do so
shortly...
 1.1.86.1 22-Nov-2005  yamt sync with head.
 1.1.78.2 03-Sep-2007  yamt sync with head.
 1.1.78.1 21-Jun-2006  yamt sync with head.
 1.1.62.1 11-Dec-2005  christos Sync with head.
 1.3.42.1 15-Aug-2007  skrll Sync with HEAD.
 1.3.40.1 07-Aug-2007  matt Sync with HEAD.
 1.3.36.1 03-Oct-2007  garbled Sync with HEAD
 1.3.28.1 20-Aug-2007  ad Sync with HEAD.
 1.5.4.1 06-Nov-2007  matt sync with HEAD
 1.6.42.1 03-Jul-2010  rmind sync with head
 1.6.40.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.6.20.1 11-Aug-2010  yamt sync with head.
 1.8.2.1 02-Aug-2025  perseant Sync with HEAD
 1.19 17-Dec-2021  macallan only write the mask register if we're actually changing it
 1.18 30-Apr-2016  macallan support anti-aliased fonts, glyphcache etc.
 1.17 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.16 29-May-2013  macallan branches: 1.16.10;
allow userland to map SX registers and IO space
 1.15 06-Feb-2013  macallan use SX for basic hardware acceleration
not quite complete yet but good enough to be useful
missing things include:
- backwards blits
- ROP support
- the cursor is still drawn by software
 1.14 05-Feb-2013  macallan throw out RASTERCONSOLE goo
 1.13 31-Aug-2010  macallan branches: 1.13.8; 1.13.18;
remove shadow framebuffer support, use VCONS_DONT_READ instead
 1.12 10-Jun-2010  macallan Add a couple more hw offset definitions, add an ioctl() to set colour depth
which works like Solaris and Linux, and finally make mmap() behave like an
actual CG14. This should be all we need to get Xorg's suncg14 driver going.
 1.11 12-Dec-2008  macallan branches: 1.11.4; 1.11.6;
some cleanup, add shadowfb support
 1.10 17-May-2008  macallan branches: 1.10.6;
struct device * -> device_t
 1.9 17-Oct-2007  garbled branches: 1.9.16; 1.9.18; 1.9.20; 1.9.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.8 30-Jul-2007  macallan branches: 1.8.4;
add hardware cursor support
 1.7 30-Jul-2007  macallan add wsdisplay support for cg14
The console will run in 8bit but switch to 32bit in mapped mode so XFree86
with wsfb can run in 24bit colour.
 1.6 17-Jan-2006  christos branches: 1.6.28; 1.6.36; 1.6.40; 1.6.42;
PR/32552: Antonio Bravo: cgfourteen 24-bit support
Original code from der Mouse, posted to the mailing lists by Jakob Menzi.
 1.5 16-Nov-2005  uwe branches: 1.5.2;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.4 23-Aug-2002  thorpej branches: 1.4.6; 1.4.22; 1.4.30;
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.3 29-Jul-1998  pk branches: 1.3.28; 1.3.32; 1.3.40; 1.3.42;
We no longer need to get the register sets by ourselves.
 1.2 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.1 30-Sep-1996  abrown Initial commit of cg14 framebuffer driver for Sun4m SPARCs.
- This driver supports the on-board mbus-based cgfourteen (sometimes referred
to as "SX") video hardware present on SS20-class machines.
- It does *not* support any of the SX acceleration features.
- It does support the 8-bit mode of the hardware, and looks to X like
a cgthree.
- It does support the cg6-style hardware cursor, even when running X in
cgthree emulation.
- It does support DPMS power-down of compatible displays on later-revision
cg14's.
- There is code to support the true color (32-bit) mode of the cg14 as
cg8 emulation, but it is disabled by default because it is most likely
broken. #define CG14_CG8 to turn it on.

The driver is not yet installed in the conf files, but I will do so
shortly...
 1.3.42.1 22-Nov-2002  tron Pull up revision 1.4 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.3.40.1 31-Aug-2002  gehenna catch up with -current.
 1.3.32.1 27-Aug-2002  nathanw Catch up to -current.
 1.3.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.30.1 22-Nov-2005  yamt sync with head.
 1.4.22.2 03-Sep-2007  yamt sync with head.
 1.4.22.1 21-Jun-2006  yamt sync with head.
 1.4.6.1 11-Dec-2005  christos Sync with head.
 1.5.2.1 01-Feb-2006  yamt sync with head.
 1.6.42.1 15-Aug-2007  skrll Sync with HEAD.
 1.6.40.1 07-Aug-2007  matt Sync with HEAD.
 1.6.36.1 03-Oct-2007  garbled Sync with HEAD
 1.6.28.1 20-Aug-2007  ad Sync with HEAD.
 1.8.4.1 06-Nov-2007  matt sync with HEAD
 1.9.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.9.20.3 09-Oct-2010  yamt sync with head
 1.9.20.2 11-Aug-2010  yamt sync with head.
 1.9.20.1 04-May-2009  yamt sync with head.
 1.9.18.1 18-May-2008  yamt sync with head.
 1.9.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.9.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.6.2 05-Mar-2011  rmind sync with head
 1.11.6.1 03-Jul-2010  rmind sync with head
 1.11.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.11.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.13.18.3 03-Dec-2017  jdolecek update from HEAD
 1.13.18.2 23-Jun-2013  tls resync from head
 1.13.18.1 25-Feb-2013  tls resync with head
 1.13.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.16.10.2 29-May-2016  skrll Sync with HEAD
 1.16.10.1 22-Sep-2015  skrll Sync with HEAD
 1.54 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.53 09-Jul-2000  pk Re-arrange headers; drop <machine/cpu.h>.
 1.52 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.51 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.50 16-Apr-2000  pk branches: 1.50.4;
Use screen attributes passed to our hardware rasops routines.

Move colormap initialization to cg6reset(), so this is also done
on last close of the framebuffer device (e.g. after X server shutdown).
 1.49 04-Apr-2000  pk Use copyin/copyout to get a colormap from/to user space.
Also, prepare for the case of a colormap maintained in kernel space.
 1.48 31-Mar-2000  pk Make this compile without RASTERCONSOLE too.
 1.47 30-Mar-2000  pk Add hardware acceleration features for use with the RASTERCONSOLE option.
Code posted on port-sparc by `der Mouse'; it was slightly re-arranged to
fit the layout of this driver.
 1.46 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.45 26-Aug-1999  thorpej branches: 1.45.2;
Initialize the default colormap to 0 == black, all others == full white.
 1.44 30-Jul-1999  thorpej The new rasops stuff is a LOT faster; turn on rasterconsole on the cgsix.
 1.43 24-Mar-1999  mrg branches: 1.43.4;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.42 07-Apr-1998  pk bus_space_mmap() has changed to take a `bus_space_handle_t *' argument,
like other bus space methods.
 1.41 31-Mar-1998  pk Factor out bus code into separate files.
 1.40 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.39 23-Mar-1998  pk Fix yank-and-put error in sbus attach code.
Misc. cleanup.
 1.38 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.37 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.36 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.35 25-Jan-1998  pk bus_tmp() => obio_bus_tmp()
 1.34 12-Jan-1998  thorpej Update for changes to config.
 1.33 07-Aug-1997  pk Do not use `rasterconsole' by default on this framebuffer.
 1.32 29-Jul-1997  fair branches: 1.32.2;
%x -> 0x%x
 1.31 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.30 19-May-1997  pk Replace bus_tmp() by mapdev() equivalent.
 1.29 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.28 13-Oct-1996  christos backout previous kprintf change
 1.27 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.26 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.25 01-Apr-1996  christos Eliminated dependencies on dev_conf.h
 1.24 31-Mar-1996  pk Re-arrange a bit to stear clear of gcc `-Wall' bites.
 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 16-Mar-1996  christos fix format in log()
 1.21 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.20 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.19 25-Feb-1996  pk Use CPU-type macros.
 1.18 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.17 29-Nov-1995  pk Code from Jason to better configure /dev/fb.
 1.16 08-Oct-1995  pk branches: 1.16.2;
Patch from Jason to factor out a common framebuffer size determination
routine from the individual drivers.
 1.15 17-Sep-1995  pk Change interface to th `fb' pseudo device to not need the major device
number (a la sun3).
Put in new glue for rcons.
 1.14 29-Aug-1995  pk If we're the console, say so in attach message.
 1.13 10-Apr-1995  mycroft map --> mmap
 1.12 16-Feb-1995  pk Working "config generic" support; from Theo.
 1.11 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.10 20-Nov-1994  deraadt copyright/Id cleanup
 1.9 02-Nov-1994  deraadt ioctl u_long cmd
 1.8 15-Oct-1994  deraadt sbus_establish() is sun4c/sun4m specific
 1.7 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.6 02-Oct-1994  deraadt sun4/300 support works
 1.5 17-Sep-1994  deraadt sbus/* --> dev/*
deal with multiple bus types (start of vme/obio support)
 1.4 04-Jul-1994  deraadt need vm/vm.h
 1.3 07-May-1994  deraadt update from lite
 1.2 30-Nov-1993  deraadt fbio.h is in machine/
 1.1 11-Nov-1993  deraadt from torek:
new brooktree dac code
hacked cgthree code
new cgsix (ala GX) code
 1.16.2.1 16-Feb-1996  thorpej Pull in improved framebuffer autoconfiguration code from -current.
Prevents panics when multiple framebuffers are found on sun4 systems.
 1.32.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.43.4.1 02-Aug-1999  thorpej Update from trunk.
 1.45.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.50.4.2 27-Jan-2001  jhawk Pull up revision 1.5 of sys/dev/sun/cgsix.c via patch (requested by tsutsui):
Initialize cgsix registers for machines that do not do so by themselves.
Fixes PR port-sparc/11944.
 1.50.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.28 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.27 21-Apr-2016  macallan RASTERCONSOLE is no more
 1.26 27-Oct-2012  chs branches: 1.26.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.25 18-Jul-2011  mrg branches: 1.25.2; 1.25.12;
convert the remaining sparc drivers to CFATTACH_DECL_NEW/cfdata_t/device_t.
(cgsix_obio.c was only partially converted with the rest of the cgsix code
when it was changed some time ago.)
 1.24 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.23 12-Dec-2008  macallan device_t-ify
 1.22 28-Apr-2008  martin branches: 1.22.8;
Remove clause 3 and 4 from TNF licenses
 1.21 04-Mar-2007  christos branches: 1.21.40; 1.21.42; 1.21.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 08-Feb-2007  jdc branches: 1.20.2;
Clarify the console checking comment.
 1.19 10-Jan-2007  jdc sys/dev/sun/cgsix.c expects us to fill in sc->sc_ramsize.
Do that and also use it to replace a local variable.
 1.18 29-Mar-2006  thorpej branches: 1.18.8;
Use device_cfdata().
 1.17 16-Nov-2005  uwe branches: 1.17.4; 1.17.6; 1.17.8; 1.17.10; 1.17.12;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.16 04-Jun-2005  tsutsui branches: 1.16.2; 1.16.8;
Add const.
 1.15 04-Jun-2005  tsutsui Remove an unneeded cast to appease gcc -Wcast-qual.
 1.14 15-Jul-2003  lukem __KERNEL_RCSID()
 1.13 02-Oct-2002  thorpej branches: 1.13.6;
Add trailing ; to CFATTACH_DECL.
 1.12 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.11 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10 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.9 11-Mar-2002  pk branches: 1.9.4;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.8 22-Aug-2000  pk branches: 1.8.2; 1.8.4; 1.8.8;
Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.7 09-Jul-2000  pk Re-arrange headers; drop <machine/cpu.h>.
 1.6 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 30-Mar-2000  pk Add hardware acceleration features for use with the RASTERCONSOLE option.
Code posted on port-sparc by `der Mouse'; it was slightly re-arranged to
fit the layout of this driver.
 1.4 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.3 09-Aug-1999  christos branches: 1.3.2;
PR/8178:Julian Coleman: sparc kernel will not build with cgtwo/cgsix but
without sbus. Remove call to cgsix-sbus-attach (impossible code). Make
routines static (they were declared static, but not defined static and
some compilers can complain).
 1.2 25-Mar-1999  mrg remove opt_uvm.h
 1.1 31-Mar-1998  pk Factor out bus code into separate files.
 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.8.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.8.8.2 17-Sep-2002  nathanw Catch up to -current.
 1.8.8.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.8.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.8.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.9.4.1 19-May-2002  gehenna Remove unnecessary #include
 1.13.6.5 11-Dec-2005  christos Sync with head.
 1.13.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.16.8.1 22-Nov-2005  yamt sync with head.
 1.16.2.3 03-Sep-2007  yamt sync with head.
 1.16.2.2 26-Feb-2007  yamt sync with head.
 1.16.2.1 21-Jun-2006  yamt sync with head.
 1.17.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.17.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.17.8.1 01-Apr-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.18.8.2 09-Feb-2007  ad Sync with HEAD.
 1.18.8.1 12-Jan-2007  ad Sync with head.
 1.20.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.44.2 04-May-2009  yamt sync with head.
 1.21.44.1 16-May-2008  yamt sync with head.
 1.21.42.1 18-May-2008  yamt sync with head.
 1.21.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.21.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.22.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.25.12.2 03-Dec-2017  jdolecek update from HEAD
 1.25.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.25.2.1 30-Oct-2012  yamt sync with head
 1.26.14.1 22-Apr-2016  skrll Sync with HEAD
 1.6 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.5 09-Jul-2000  pk Re-arrange headers; drop <machine/cpu.h>.
 1.4 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 30-Mar-2000  pk Add hardware acceleration features for use with the RASTERCONSOLE option.
Code posted on port-sparc by `der Mouse'; it was slightly re-arranged to
fit the layout of this driver.
 1.2 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.1 31-Mar-1998  pk branches: 1.1.14;
Factor out bus code into separate files.
 1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.7 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.6 30-Mar-2000  pk branches: 1.6.4;
Add hardware acceleration features for use with the RASTERCONSOLE option.
Code posted on port-sparc by `der Mouse'; it was slightly re-arranged to
fit the layout of this driver.
 1.5 21-Mar-1998  pk branches: 1.5.14;
#define several register bank offsets, so we don't need to refer to
structure fields.
 1.4 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 07-May-1994  deraadt update from lite
 1.1 11-Nov-1993  deraadt from torek:
new brooktree dac code
hacked cgthree code
new cgsix (ala GX) code
 1.5.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.6.4.1 27-Jan-2001  jhawk Pull up revisions 1.3-1.4 of sys/dev/sun/cgsixreg.h via patch (requested by tsutsui):
Initialize cgsix registers for machines that do not do so by themselves.
Fixes PR port-sparc/11944.
 1.4 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.3 30-Mar-2000  pk Add hardware acceleration features for use with the RASTERCONSOLE option.
Code posted on port-sparc by `der Mouse'; it was slightly re-arranged to
fit the layout of this driver.
 1.2 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.1 31-Mar-1998  pk branches: 1.1.14;
Factor out bus code into separate files.
 1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.49 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.48 09-Jul-2000  pk Re-arrange headers; drop <machine/cpu.h>.
 1.47 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.46 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.45 16-Apr-2000  pk branches: 1.45.4;
Slight optimization when searching the video parameter table.
 1.44 14-Apr-2000  pk Initialize local variable `bt' in cgthree_attach().
 1.43 04-Apr-2000  pk Use copyin/copyout to get a colormap from/to user space.
Also, prepare for the case of a colormap maintained in kernel space.
 1.42 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.41 26-Aug-1999  thorpej branches: 1.41.2;
Initialize the default colormap to 0 == black, all others == full white.
 1.40 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.39 07-Sep-1998  pk Need to cast sbus attach `prom_vaddrs' field.
 1.38 29-Jul-1998  pk Deal with sbus attach args changes.
 1.37 07-Apr-1998  pk bus_space_mmap() has changed to take a `bus_space_handle_t *' argument,
like other bus space methods.
 1.36 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.35 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.34 12-Jan-1998  thorpej Update for changes to config.
 1.33 24-May-1997  pk branches: 1.33.8;
Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.32 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.31 13-Oct-1996  christos backout previous kprintf change
 1.30 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.29 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.28 31-May-1996  pk Initialize video parameters if the board is not yet running. Useful if
the cg3 is not the console.
 1.27 01-Apr-1996  christos Eliminated dependencies on dev_conf.h
 1.26 31-Mar-1996  pk Re-arrange a bit to stear clear of gcc `-Wall' bites.
 1.25 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.24 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.23 28-Feb-1996  pk Fix typo
 1.22 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.21 27-Feb-1996  pk remove a printf
 1.20 27-Feb-1996  pk Use `video enable' bit in framebuffer control.
 1.19 25-Feb-1996  pk Use CPU-type macros.
 1.18 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.17 29-Nov-1995  pk Code from Jason to better configure /dev/fb.
 1.16 08-Oct-1995  pk branches: 1.16.2;
Patch from Jason to factor out a common framebuffer size determination
routine from the individual drivers.
 1.15 04-Oct-1995  pk RCONSOLE => RASTERCONSOLE.
 1.14 17-Sep-1995  pk Change interface to th `fb' pseudo device to not need the major device
number (a la sun3).
Put in new glue for rcons.
 1.13 10-Apr-1995  mycroft map --> mmap
 1.12 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.11 20-Nov-1994  deraadt copyright/Id cleanup
 1.10 02-Nov-1994  deraadt ioctl u_long cmd
 1.9 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.8 02-Oct-1994  deraadt sun4/300 support works
 1.7 17-Sep-1994  deraadt sbus/* --> dev/*
deal with multiple bus types (start of vme/obio support)
 1.6 04-Jul-1994  deraadt need vm/vm.h
 1.5 13-Apr-1994  deraadt darn, whoops
 1.4 12-Apr-1994  deraadt support mmap() at 0x04000000; fb_size should be rounded up.
 1.3 11-Nov-1993  deraadt from torek:
new brooktree dac code
hacked cgthree code
new cgsix (ala GX) code
 1.2 11-Oct-1993  deraadt bwtwo.c, cgthree.c: sys-fbio.h -> machine/fbio.h
if_le.c: #ifdef MULTICAST some things, and do arp the old way
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.16.2.1 16-Feb-1996  thorpej Pull in improved framebuffer autoconfiguration code from -current.
Prevents panics when multiple framebuffers are found on sun4 systems.
 1.33.8.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.41.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.45.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.6 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.5 27-Feb-1996  pk branches: 1.5.30;
bt_reg => fbcontrol.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 03-Mar-1994  deraadt fix rcsid
 1.2 11-Nov-1993  deraadt from torek:
new brooktree dac code
hacked cgthree code
new cgsix (ala GX) code
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.30.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.58 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 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 18-Jul-2011  mrg branches: 1.55.2; 1.55.12; 1.55.16;
convert to use device_t, cfdata_t and CFATTACH_DECL_NEW().

XXX: compile time tested only.
 1.54 11-Jun-2008  drochner mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.53 04-Mar-2007  christos branches: 1.53.40; 1.53.42; 1.53.44; 1.53.46; 1.53.48;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.52 29-Mar-2006  thorpej branches: 1.52.14;
Use device_cfdata().
 1.51 11-Dec-2005  christos branches: 1.51.4; 1.51.6; 1.51.8; 1.51.10; 1.51.12;
merge ktrace-lwp.
 1.50 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.49 25-Aug-2003  uwe branches: 1.49.16; 1.49.24;
Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.48 24-Aug-2003  uwe #include "opt_rcons.h"
 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 29-Jun-2003  fvdl branches: 1.45.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.44 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.43 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.42 05-Dec-2002  fredette Fixed a null pointer passed to printf().
 1.41 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.40 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.39 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.38 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.37 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.36 03-Aug-2002  itojun correct range check, have overflow check, fix type mismatches,
for cmap args and some other calls. from openbsd
 1.35 05-Aug-2001  jdolecek branches: 1.35.2; 1.35.6; 1.35.14; 1.35.16;
use unsigned variable types as appropriate
 1.34 22-Aug-2000  pk branches: 1.34.4;
Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.33 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.32 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.31 19-Mar-2000  pk branches: 1.31.4;
Use fb_is_console(); retract fbconstty & fbnode from service.
 1.30 30-Jun-1999  drochner branches: 1.30.2;
update for new VME framework
 1.29 07-Apr-1998  pk branches: 1.29.10;
bus_space_mmap() has changed to take a `bus_space_handle_t *' argument,
like other bus space methods.
 1.28 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.27 06-Feb-1998  pk vme_bus_probe() takes an `offset' argument.
 1.26 04-Feb-1998  pk Account for changed vme_bus_probe() arguments.
 1.25 28-Jan-1998  thorpej Use offsetof() from libkern.h
 1.24 25-Jan-1998  pk Convert to new VME interface.
 1.23 12-Jan-1998  thorpej Update for changes to config.
 1.22 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.21 19-May-1997  pk Replace bus_tmp() with mapdev() equivalent.
 1.20 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.19 13-Oct-1996  christos backout previous kprintf change
 1.18 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.17 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.16 18-May-1996  mrg use __P
 1.15 23-Apr-1996  pk Map the pixels explicitly on the VME32 bus.
 1.14 01-Apr-1996  christos Eliminated dependencies on dev_conf.h
 1.13 17-Mar-1996  pk Avoid "unused variable" warning.
 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 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.10 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.9 25-Feb-1996  pk Use CPU-type macros.
 1.8 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.7 29-Nov-1995  pk Code from Jason to better configure /dev/fb.
 1.6 28-Oct-1995  pk Map pixels in VME32 space
 1.5 08-Oct-1995  pk branches: 1.5.2;
Patch from Jason to factor out a common framebuffer size determination
routine from the individual drivers.
 1.4 04-Oct-1995  pk RCONSOLE => RASTERCONSOLE.
 1.3 02-Oct-1995  pk Update to use <machine/cgtworeg.h>
 1.2 02-Oct-1995  pk Get some of the bugs out. Thanks to David Gilbert for testing.
 1.1 17-Sep-1995  pk cgtwo framebuffer, cloned from cgthree.c and sun3's cg2.c.
Note: untested, shall be considered a framework to get things started..
 1.5.2.2 16-Feb-1996  thorpej Pull in improved framebuffer autoconfiguration code from -current.
Prevents panics when multiple framebuffers are found on sun4 systems.
 1.5.2.1 28-Oct-1995  pk Update from trunk: Map pixels in VME32 space.
 1.29.10.1 01-Jul-1999  thorpej Sync w/ -current.
 1.30.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.4.2 16-Aug-2001  tv Pullup [jdolecek]:

sys/arch/amiga/dev/grf_cl.c 1.26
sys/arch/amiga/dev/grfioctl.h 1.14
sys/arch/hpcmips/dev/plumvideo.c 1.20
sys/arch/macppc/dev/ofb.c 1.25
sys/arch/sparc/dev/cgtwo.c 1.35
sys/arch/sparc/include/fbio.h patch
sys/arch/sparc64/include/fbio.h patch
sys/arch/sun3/dev/cg2.c 1.14
sys/arch/sun3/include/fbio.h patch
sys/dev/pci/tga.c 1.35
sys/dev/tc/cfb.c 1.28
sys/dev/tc/mfb.c 1.27
sys/dev/tc/sfb.c 1.46
sys/dev/tc/sfbplus.c 1.10 via patch
sys/dev/tc/tfb.c 1.30
sys/dev/tc/xcfb.c 1.23
sys/net/if_ppp.c 1.71

Use unsigned variable types to make bounds checking more correct.
 1.31.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.34.4.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.34.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.34.4.3 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.34.4.2 28-Jun-2002  jdolecek prove kqfilter hook; it's very simple equivalent of seltrue()
 1.34.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.35.16.1 07-Aug-2002  lukem Pull up revision 1.36 (requested by itojun in ticket #616):
correct range check, have overflow check, fix type mismatches,
for cmap args and some other calls. from openbsd
 1.35.14.2 31-Aug-2002  gehenna catch up with -current.
 1.35.14.1 17-May-2002  gehenna Add device switch.
 1.35.6.6 11-Dec-2002  thorpej Sync with HEAD.
 1.35.6.5 11-Nov-2002  nathanw Catch up to -current
 1.35.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.35.6.3 17-Sep-2002  nathanw Catch up to -current.
 1.35.6.2 13-Aug-2002  nathanw Catch up to -current.
 1.35.6.1 05-Aug-2001  nathanw file cgtwo.c was added on branch nathanw_sa on 2002-08-13 02:18:52 +0000
 1.35.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.45.2.5 11-Dec-2005  christos Sync with head.
 1.45.2.4 04-Feb-2005  skrll Adapt to branch.
 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.49.24.1 22-Nov-2005  yamt sync with head.
 1.49.16.2 03-Sep-2007  yamt sync with head.
 1.49.16.1 21-Jun-2006  yamt sync with head.
 1.51.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.51.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.51.8.1 01-Apr-2006  yamt sync with head.
 1.51.6.1 22-Apr-2006  simonb Sync with head.
 1.51.4.1 09-Sep-2006  rpaulo sync with head
 1.52.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.53.48.1 18-Jun-2008  simonb Sync with head.
 1.53.46.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.53.44.1 04-May-2009  yamt sync with head.
 1.53.42.1 17-Jun-2008  yamt sync with head.
 1.53.40.1 29-Jun-2008  mjf Sync with HEAD.
 1.55.16.1 18-May-2014  rmind sync with head
 1.55.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.56.2.1 10-Aug-2014  tls Rebase.
 1.3 02-Oct-1995  pk Silly me.. there's already a <machine/cgtworeg.h>
 1.2 02-Oct-1995  pk Get some of the bugs out. Thanks to David Gilbert for testing.
 1.1 17-Sep-1995  pk cgtwo framebuffer, cloned from cgthree.c and sun3's cg2.c.
Note: untested, shall be considered a framework to get things started..
 1.17 08-Dec-2018  thorpej Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.16 01-Jul-2011  dyoung branches: 1.16.52; 1.16.54;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.15 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.14 14-Mar-2008  cube branches: 1.14.2; 1.14.4;
Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend). Use proper types and ansify where appropriate.
 1.13 13-Jul-2006  gdamore branches: 1.13.34; 1.13.54; 1.13.58;
Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

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

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

Approved by core@. Fixes PR port-evbmips/32362.
 1.12 16-Nov-2005  uwe branches: 1.12.4; 1.12.8; 1.12.16;
ANSIify.
 1.11 15-Jul-2003  lukem branches: 1.11.16; 1.11.24;
__KERNEL_RCSID()
 1.10 14-Jun-2003  thorpej branches: 1.10.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.9 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.8 08-Oct-2002  uwe G/c unnecessary includes.
 1.7 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.6 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 12-Apr-2002  thorpej Set COM_HW_NO_TXPRELOAD.
 1.3 12-Mar-2002  uwe Drop ebus_bus_map(), use plain bus_space_map() instead.
 1.2 18-Feb-2002  uwe Switch to shared EBus headers in dev/ebus.
 1.1 11-Dec-2001  uwe branches: 1.1.2; 1.1.4;
Attachment for MI com(4) driver at ebus.
 1.1.4.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.1.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 11-Dec-2001  thorpej file com_ebus.c was added on branch kqueue on 2002-01-10 19:48:45 +0000
 1.1.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 11-Dec-2001  nathanw file com_ebus.c was added on branch nathanw_sa on 2002-01-08 00:27:34 +0000
 1.10.2.4 11-Dec-2005  christos Sync with head.
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.24.1 22-Nov-2005  yamt sync with head.
 1.11.16.3 17-Mar-2008  yamt sync with head.
 1.11.16.2 30-Dec-2006  yamt sync with head.
 1.11.16.1 21-Jun-2006  yamt sync with head.
 1.12.16.2 17-Jun-2006  gdamore Fix for another compile problem. bus_intr_establish takes a bus_space_tag_t
on sparc, caught me off-guard. Thanks to macallan@.
 1.12.16.1 15-Jun-2006  gdamore Adapt to new com framework.
 1.12.8.1 11-Aug-2006  yamt sync with head
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.58.2 02-Jun-2008  mjf Sync with HEAD.
 1.13.58.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.54.1 24-Mar-2008  keiichi sync with head.
 1.13.34.1 23-Mar-2008  matt sync with HEAD
 1.14.4.1 16-May-2008  yamt sync with head.
 1.14.2.1 18-May-2008  yamt sync with head.
 1.16.54.1 10-Jun-2019  christos Sync with HEAD
 1.16.52.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.25 08-Dec-2018  thorpej Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.24 01-Jul-2011  dyoung branches: 1.24.52; 1.24.54;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.23 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.22 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.21 14-Mar-2008  cube branches: 1.21.2; 1.21.4;
Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend). Use proper types and ansify where appropriate.
 1.20 29-Feb-2008  dyoung Use pmf_device_register1() instead of shutdownhook_establish() to
register com_cleanup() as the shutdown hook.

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

Protect against dereferencing a NULL softc in comioctl().

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

Cosmetic: use aprint_*_dev(). Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.19 13-Jul-2006  gdamore branches: 1.19.34; 1.19.54; 1.19.58;
Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

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

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

Approved by core@. Fixes PR port-evbmips/32362.
 1.18 16-Nov-2005  uwe branches: 1.18.4; 1.18.8; 1.18.16;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.17 28-Oct-2003  chs branches: 1.17.16; 1.17.24;
uninitialized variables.
 1.16 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.15 15-Jul-2003  lukem __KERNEL_RCSID()
 1.14 14-Jun-2003  thorpej branches: 1.14.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.13 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.12 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.11 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.10 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.8 20-Jun-2001  uwe branches: 1.8.2; 1.8.8;
Attach serial console at com.
 1.7 15-Jul-2000  matt Enhance this so it support the com port on the JavaStation 1 as well as
the tadpole internal modem.
 1.6 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.5 04-Jun-2000  cgd branches: 1.5.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.4 21-Nov-1999  pk branches: 1.4.2;
Check presence of Sbus interrupt properties before using them.
 1.3 12-Nov-1999  matt turns we need to tweak the auxio1 reg to enable the modem. also fix a call
to sbus_bus_map. it's closer to working but I wonder if COM_FREQ is the
right value.
 1.2 03-Aug-1999  matt branches: 1.2.2; 1.2.4; 1.2.8;
Remove the false positive on the probe of the built-in modem
on tadpoles by calling comprobe1 to see if the modem is really
there.
 1.1 30-Jul-1999  matt branches: 1.1.2;
Add preliminary support for the built-in modem on Tadpole 3GX/S
laptops. There is currently something wrong with the interrupt
code but it does attach and sense a 16550a. (anyways the built
in modem is only a 14.4Kb and you'd really want to use a PCMCIA
modem to get faster dialup rates).
 1.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.1.2.1 30-Jul-1999  thorpej file com_obio.c was added on branch chs-ubc2 on 1999-08-02 20:09:13 +0000
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.1 15-Nov-1999  fvdl Sync with -current
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.8.8.4 11-Dec-2002  thorpej Sync with HEAD.
 1.8.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.8.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.8.1 20-Jun-2001  nathanw file com_obio.c was added on branch nathanw_sa on 2002-04-01 07:42:40 +0000
 1.8.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.8.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.14.2.4 11-Dec-2005  christos 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.17.24.1 22-Nov-2005  yamt sync with head.
 1.17.16.3 17-Mar-2008  yamt sync with head.
 1.17.16.2 30-Dec-2006  yamt sync with head.
 1.17.16.1 21-Jun-2006  yamt sync with head.
 1.18.16.3 17-Jun-2006  gdamore Oops... left a static around.
 1.18.16.2 17-Jun-2006  gdamore Fix problems found by macallan@.
 1.18.16.1 15-Jun-2006  gdamore Adapt to new com framework.
 1.18.8.1 11-Aug-2006  yamt sync with head
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.19.58.2 02-Jun-2008  mjf Sync with HEAD.
 1.19.58.1 03-Apr-2008  mjf Sync with HEAD.
 1.19.54.1 24-Mar-2008  keiichi sync with head.
 1.19.34.1 23-Mar-2008  matt sync with HEAD
 1.21.4.2 11-Mar-2010  yamt sync with head
 1.21.4.1 16-May-2008  yamt sync with head.
 1.21.2.1 18-May-2008  yamt sync with head.
 1.24.54.1 10-Jun-2019  christos Sync with HEAD
 1.24.52.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.31 18-Oct-1997  gwr Use common zs code.
 1.30 07-Jul-1997  pk Get console tty size from raster console if applicable.
 1.29 13-Oct-1996  christos backout previous kprintf change
 1.28 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.27 12-Sep-1996  mrg update these for poll(2) changes.
 1.26 05-Sep-1996  thorpej Make the SPARC kernel compile again after recent tty cdevsw changes.
 1.25 02-Sep-1996  mycroft tty stop functions really should return void, not int, and certainly not both.
 1.24 29-May-1996  mrg impliment ttylist stats based on disk stats.
 1.23 19-May-1996  mrg branches: 1.23.4;
set the console struct winsize to the values given in the prom (sun4c/sun4m)
or the eeprom (sun4) when opening the console. (note: sun4 code untested
but jason claims it will `Just Work').
 1.22 18-May-1996  mrg put promdev definition into <machine/bsd_openprom.h>.
 1.21 22-Apr-1996  christos Remove dependency on <sys/cpu.h>
 1.20 01-Apr-1996  christos Eliminated dependencies on dev_conf.h
 1.19 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.18 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.17 25-Feb-1996  pk Use CPU-type macros.
 1.16 13-Feb-1996  pk Fix ANSI prototype goof (from Openbsd).
Add explicit return type to most functions.
V3 PROM console support.
 1.15 13-Jul-1995  pk Move SUN4 console echo hack cnget() (from Chuck Cranor).
 1.14 01-Jun-1995  pk Deal with v.3 proms (sigh).
 1.13 25-Apr-1995  pk Stop-gap measure to prevent panic when select()ing on /dev/console.
 1.12 10-Apr-1995  mycroft cn_tty is unneeded.
 1.11 25-Nov-1994  deraadt cnpollc function for DDB
 1.10 20-Nov-1994  deraadt copyright/Id cleanup
 1.9 02-Nov-1994  deraadt ioctl u_long cmd
 1.8 13-May-1994  deraadt play nice with new tty code
 1.7 05-May-1994  deraadt timeout and ndflush casts
 1.6 14-Feb-1994  deraadt ioctl takes a proc *
 1.5 10-Nov-1993  deraadt s/cntty/cn_tty/
 1.4 13-Oct-1993  deraadt fix typos
 1.3 13-Oct-1993  deraadt fixups for dynamic tty allocation:
cdevsw[]->d_ttys must be initialized
XXstop() functions must be callable from cdevsw[]->d_stop
the console tty is used before vm system is up, and must
allocate it's own clists..
 1.2 11-Oct-1993  deraadt cons.c, zs.c: tty->t_stop doesn't exist here. I think it goes through d_stop
automatically now, but have not checked.
l_ioctl() has no last parameter 'p'
fb.c: move sys/fbio.h to machine/fbio.h
various: typecast parms for timeout() properly
zs.c: extra level of indir in cdevsw[]->d_ttys
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.23.4.1 02-Jun-1996  mrg pull up tty stats "bug fix".
 1.6 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.5 16-Nov-2005  uwe branches: 1.5.178;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.4 19-Mar-2000  pk branches: 1.4.28; 1.4.44; 1.4.52;
Declare the prom stdio nodes and arguments.
 1.3 12-Feb-2000  pk Eliminate much of the goo in setting up zs device addressing.
 1.2 05-Jan-1998  perry branches: 1.2.14;
RCSID Police.
 1.1 18-Oct-1997  gwr Use common zs code.
 1.2.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.52.1 22-Nov-2005  yamt sync with head.
 1.4.44.1 21-Jun-2006  yamt sync with head.
 1.4.28.1 11-Dec-2005  christos Sync with head.
 1.5.178.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 01-Apr-1996  christos Remove last dependency to dev_conf.h and the file itself.
 1.1 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.57 29-Aug-1998  pk Split `esp' driver and DMA engine into separate front-end files.
The Sbus front-ends have all been moved to `sys/dev/sbus', while
the `obio' front-ends remain here.
 1.56 28-Aug-1998  pk Remove cache flush from dma_espintr(); the bus dma routines take care
of that now. Hence we no longer need <sparc/cpuvar.h>.
 1.55 30-Jul-1998  pk Use bus_dma_*() instead of dvma_mapin/dvma_mapout.
 1.54 29-Jul-1998  pk branches: 1.54.2;
Deal with sbus attch args changes.
Use sbus_destroy_attach_args().
 1.53 27-Jul-1998  pk <sparc/dev/sbusvar.h> => <dev/sbus/sbusvar.h>
 1.52 07-Apr-1998  pk The bus space functions now take care of "pass-through" methods.
 1.51 29-Mar-1998  pk Fill in the bus tag's `bus_space_unmap' method.
 1.50 21-Mar-1998  pk Switch to a bus_space(9)-based device attachment scheme.
The dma & lebuffer devices behave like busses to accommodate the
OBP layout. For practical purposes, they are implemented as
Sbus "extensions".
 1.49 07-Feb-1998  pk Define a `DMA_FLUSH' macro; dma chip revs 0 & 1 have a different bit
to reset the internal state engine.
 1.48 12-Jan-1998  thorpej Update for changes to config.
 1.47 16-Oct-1997  mycroft branches: 1.47.2;
Fix up includes.
 1.46 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.45 29-Jul-1997  fair branches: 1.45.2;
%x -> 0x%x
 1.44 26-Jun-1997  thorpej branches: 1.44.2;
Don't print a warning if the returned transfer count is less than 0.
This can happen during perfectly normal operation if:
(a) We are using DMA to select a target, and
(b) we are interrupted by another target reselecting us.
Per discussion with Paul Krannenburg.
 1.43 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.42 27-Apr-1997  pk Remove esp FLUSH when residual bytes are present in FIFO, the ncr53c9x
driver will flush when necessary. Doing the FLUSH here interferes
with DMA-enabled target selection.
 1.41 23-Mar-1997  pk Clamp burst sizes to maximum value of parent.
Reset ledma from leattach().
 1.40 10-Mar-1997  pk Replace `cpumod' with `cpuinfo.cpu_type' equivalents.
 1.39 27-Feb-1997  thorpej Update for MI 53c9x driver.
 1.38 10-Dec-1996  pk branches: 1.38.6;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.37 28-Nov-1996  pk Handle Sbus burst settings in dma reset().
 1.36 27-Nov-1996  pk Handle the `ESC gate array' variant of the DMA engine, including an
essential bug work-around. Graciously supplied by David Miller.

Also re-arrange the macros that do the dma drain song-and-dance for
better clarity.
 1.35 13-Nov-1996  thorpej Use bitmask_snprintf().
 1.34 13-Oct-1996  christos backout previous kprintf change
 1.33 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 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 29-Jun-1996  pk Avoid compiler warning on SUN4-only kernels.
 1.30 12-Jun-1996  pk Use the setting of the ESPCFG2_FE bit rather than revision number to decide
on the ESP chip's maximum transfer count.
 1.29 03-Jun-1996  pk Code the residual computation a bit differently.
 1.28 21-May-1996  pk branches: 1.28.2;
Allow all esp dma channels to be called `dma'.
 1.27 17-May-1996  pk Correct an oversight and a silly past-o in last change.
 1.26 16-May-1996  pk Re-arrange code that looks for the esp driver to allow for the fact that
any "dma" device (i.e. not just "espdma") can have an OBP child. This is
the case with (at least some) SBus SCSI boards.
 1.25 22-Apr-1996  abrown - Changed Sun4m DMA chip support to detect and use maximum available SBus
burst size when transferring data.
- Changed ledma attach code to pay attention to the PROM's notion of what
cable type is being used. Note that this patch does not fix the problem
recently discussed on port-sparc; in most cases the PROM doesn't know
what cable type is being used. The default is now TP rather than AUI,
though. A complete fix is forthcoming.
 1.24 01-Apr-1996  christos Remove casts of printf args for %b format.
 1.23 31-Mar-1996  pk Handle sun4m `ledma' and `espdma'.
DMA setup requires services of the IOMMU.
 1.22 26-Mar-1996  pk Bitfields are unsigned.
 1.21 26-Mar-1996  pk Back to normal printf()s, now that gcc understands `%b'.
 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 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.18 27-Feb-1996  pk Drain rev 1 chips in dma_reset().
 1.17 12-Feb-1996  pk Separate DMA and SCSI routines more.
 1.16 12-Jan-1996  chuck dmamatch never added in the offset for the dma registers to the VA,
and thus probed the wrong address on the 4/300 (but it worked because
it was probing the esp0 registers!).

now that bus_tmp() adds the offset in for us [as of obio 1.19] i
discoved that a byte access to the dma registers is not allowed.
so, i've change probeget to use a word access.
 1.15 18-Dec-1995  pk Towards machine independency, per cgd: macros to access hardware registers.
 1.14 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.13 28-Nov-1995  pk Careful with signed chars (caddr_t *!).
Merge in 1.1 changes.
 1.12 03-Nov-1995  pk Stop DMA before resetting
 1.11 24-Oct-1995  pk Move DMA chip draining to dmaintr() and drain when a (possibly partial)
transfer ends in stead of doing it before starting a new transfer.
Use a different CSR bit to wait for "chip not busy" (may be necessary to
make this conditional on chip revision).
 1.10 18-Aug-1995  pk branches: 1.10.2;
Use bootpath_store() to set next boot component; used in dk_establish()
to match `sd' devices against the PROM's boot path.

Detect DMA "overshoots" when handling odd-sized transfer sizes (e.g., xfers
from/to raw partitions), by using the "Transfer Pad" command when the
transfer count reaches zero.
 1.9 01-Mar-1995  pk Better 4/100 support.
 1.8 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.7 25-Nov-1994  deraadt no need to turn DMA off twice
 1.6 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 15-Oct-1994  deraadt sbus_establish() is sun4c/sun4m specific
 1.3 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.2 02-Oct-1994  deraadt sun4/300 support works
 1.1 17-Sep-1994  deraadt Replacement esp (NCR 53C9X + LSI DMA) scsi driver from Peter Galbavy.
 1.10.2.4 26-Feb-1996  pk From trunk: DMArev1 drainage.
 1.10.2.3 17-Feb-1996  pk Pull over fixes from trunk.
 1.10.2.2 12-Nov-1995  pk Incorporate error-recovery fixes from trunk.
 1.10.2.1 24-Oct-1995  pk Update from trunk: various
 1.28.2.2 02-Jul-1996  jtc merge in rev 1.30=>1.31:
> Avoid compiler warning on SUN4-only kernels.
 1.28.2.1 12-Jun-1996  pk Pull down from trunk:
>rev 1.30: Use the setting of the ESPCFG2_FE bit rather than revision number ...
>rev 1.29: Code the residual computation a bit differently.
 1.38.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.44.2.2 30-Jul-1997  bouyer Sync with trunk.
 1.44.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.45.2.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.47.2.1 07-Feb-1998  mellon Pull up 1.49 (pk)
 1.54.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.13 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.12 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 13-Apr-2008  tsutsui branches: 1.10.2; 1.10.4;
Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
 1.9 16-Nov-2005  uwe branches: 1.9.74;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.8 15-Jul-2003  lukem branches: 1.8.16; 1.8.24;
__KERNEL_RCSID()
 1.7 02-Oct-2002  thorpej branches: 1.7.6;
Add trailing ; to CFATTACH_DECL.
 1.6 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.3 12-Apr-1999  pk branches: 1.3.16; 1.3.20;
Identify ourselves as a SCSI channel to the DMA chip.
 1.2 29-Aug-1998  pk branches: 1.2.6;
Adjust for some small changes in lsi64854 back-end driver.
 1.1 29-Aug-1998  pk Split `esp' driver and DMA engine into separate front-end files.
The Sbus front-ends have all been moved to `sys/dev/sbus', while
the `obio' front-ends remain here.
 1.2.6.1 13-Apr-1999  pk branches: 1.2.6.1.2;
Pull up rev 1.3 from trunk.
 1.2.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.20.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.20.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.16.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.7.6.4 11-Dec-2005  christos Sync with head.
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.24.1 22-Nov-2005  yamt sync with head.
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.9.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.4.1 16-May-2008  yamt sync with head.
 1.10.2.1 18-May-2008  yamt sync with head.
 1.12 29-Aug-1998  pk Split `esp' driver and DMA engine into separate front-end files.
The Sbus front-ends have all been moved to `sys/dev/sbus', while
the `obio' front-ends remain here.
 1.11 27-Jul-1998  pk SBU_BURST_* are now in <dev/sbus/sbusvar.h>
 1.10 28-Nov-1996  pk Fix typo in D_BURST* macros.
 1.9 27-Nov-1996  pk Add some `DMA ESC gate array' specific constants.
 1.8 22-Apr-1996  abrown - Changed Sun4m DMA chip support to detect and use maximum available SBus
burst size when transferring data.
- Changed ledma attach code to pay attention to the PROM's notion of what
cable type is being used. Note that this patch does not fix the problem
recently discussed on port-sparc; in most cases the PROM doesn't know
what cable type is being used. The default is now TP rather than AUI,
though. A complete fix is forthcoming.
 1.7 31-Mar-1996  pk Handle sun4m `ledma' and `espdma'.
DMA setup requires services of the IOMMU.
 1.6 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.5 20-Nov-1994  deraadt branches: 1.5.2;
copyright/Id cleanup
 1.4 28-Oct-1994  deraadt repair a type
 1.3 02-Oct-1994  deraadt sun4/300 support works
 1.2 17-Sep-1994  deraadt Replacement esp (NCR 53C9X + LSI DMA) scsi driver from Peter Galbavy.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.2.1 17-Feb-1996  pk Pull over fixes from trunk.
 1.14 29-Aug-1998  pk Split `esp' driver and DMA engine into separate front-end files.
The Sbus front-ends have all been moved to `sys/dev/sbus', while
the `obio' front-ends remain here.
 1.13 30-Jul-1998  pk Use bus_dma_*() instead of dvma_mapin/dvma_mapout.
 1.12 21-Mar-1998  pk branches: 1.12.2;
Add bus tags.
Add interrupt chaining facility (currently used for `le'; the `esp'
device should follow).
 1.11 27-Nov-1996  pk DMA draining macros have moved to dma.c
 1.10 13-Oct-1996  christos backout previous kprintf change
 1.9 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 22-Apr-1996  abrown - Changed Sun4m DMA chip support to detect and use maximum available SBus
burst size when transferring data.
- Changed ledma attach code to pay attention to the PROM's notion of what
cable type is being used. Note that this patch does not fix the problem
recently discussed on port-sparc; in most cases the PROM doesn't know
what cable type is being used. The default is now TP rather than AUI,
though. A complete fix is forthcoming.
 1.7 31-Mar-1996  pk Handle sun4m `ledma' and `espdma'.
DMA setup requires services of the IOMMU.
 1.6 16-Mar-1996  christos fix format in printf()
 1.5 12-Feb-1996  pk Separate DMA and SCSI routines more.
 1.4 27-Nov-1994  deraadt branches: 1.4.2;
debug code for dma hang
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 02-Oct-1994  deraadt sun4/300 support works
 1.1 17-Sep-1994  deraadt Replacement esp (NCR 53C9X + LSI DMA) scsi driver from Peter Galbavy.
 1.4.2.1 17-Feb-1996  pk Pull over fixes from trunk.
 1.12.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.42 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.41 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.40 10-May-2021  thorpej branches: 1.40.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.39 24-Apr-2021  thorpej branches: 1.39.2; 1.39.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.38 22-Nov-2020  thorpej branches: 1.38.2;
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.37 10-Nov-2019  chs branches: 1.37.8;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.36 18-Oct-2019  msaitoh s/initalize/initialize/ in comment or printf message.
 1.35 18-Oct-2014  snj branches: 1.35.20;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.34 30-Jan-2012  mrg branches: 1.34.6;
avoid writing 1 byte beyond the end of the string promlib.c has given us.
instead of forcing a nul byte afterwards, KASSERT() that the final byte
already is a nul. if there are broken proms... well, we can fix them.

this, plus one more change, allows my SS20 to boot multiuser.
 1.33 18-Jul-2011  mrg branches: 1.33.2; 1.33.6;
convert the remaining sparc drivers to CFATTACH_DECL_NEW/cfdata_t/device_t.
(cgsix_obio.c was only partially converted with the rest of the cgsix code
when it was changed some time ago.)
 1.32 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.31 20-Sep-2009  tsutsui - use device_t and cfdriver_t
- use device_private() and device_xname()
- use proper types or variables for device_t/softc
 1.30 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.29 17-Oct-2007  garbled branches: 1.29.16; 1.29.18; 1.29.20; 1.29.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.28 09-Jul-2007  ad branches: 1.28.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.27 04-Mar-2007  christos branches: 1.27.2; 1.27.4; 1.27.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.26 25-Feb-2007  uwe G/c debugging printf (hi, macallan!).
 1.25 02-Jul-2006  jdc branches: 1.25.10;
PCI device list and interrupt mapping for JavaStation Espresso.
Interrupt line values from Linux sparc sources.
 1.24 24-Nov-2005  he branches: 1.24.4; 1.24.8; 1.24.16;
Remove declaration of a variable which is no longer used.
 1.23 24-Nov-2005  he Make sure the file ends with a newline, so the port builds again.
 1.22 22-Nov-2005  macallan add support for options BLINK
 1.21 16-Nov-2005  uwe ANSIify. Use uint<N>_t. Drop unnecessary inlcudes.
Declare as static everything we don't need to export.
 1.20 12-Aug-2005  macallan branches: 1.20.6;
revert previous version, will create a device node in the boot loader instead
 1.19 12-Aug-2005  macallan For Krups only - attach audiocs at ebus even if there's no sound node in the
device tree. Works only as long as the cs4231 driver doesn't attempt to use
the node since we can't really supply one.
Tested on a Krups with OF 3.11.10
 1.18 10-Jul-2004  pk branches: 1.18.12;
Use bus_space_tag_alloc().
 1.17 24-Apr-2004  kleink Update for new pci_devinfo(9) signature.
 1.16 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.15 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.14 15-Jul-2003  lukem __KERNEL_RCSID()
 1.13 03-May-2003  wiz branches: 1.13.2;
DMA, not dma nor Dma.
 1.12 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.11 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.10 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.9 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.8 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 11-Mar-2002  uwe Do not pass bus type argument (R.I.P.) to bus_space_map2.
 1.5 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.4 18-Feb-2002  uwe Convert to use shared headers in dev/ebus. Move ebus_softc definition here.
Normalize bar field of EBus children PROM "reg" property to be the BAR
offset in PCI config space like on sparc64 when building ebus_attach_args.
 1.3 08-Feb-2002  uwe Cosmetic changes: clean up debugging ifdefs and use consistent wording
in panic messages.
 1.2 31-Jan-2002  uwe Auto-configuration output formatting nit.
Don't start the attachment message on a new line.
 1.1 11-Dec-2001  uwe branches: 1.1.2; 1.1.4;
EBus support for ms-IIep.
 1.1.4.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.1.4.4 16-Mar-2002  jdolecek Catch up with -current.
 1.1.4.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 11-Dec-2001  thorpej file ebus.c was added on branch kqueue on 2002-01-10 19:48:45 +0000
 1.1.2.7 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.1.2.6 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 11-Dec-2001  nathanw file ebus.c was added on branch nathanw_sa on 2002-01-08 00:27:35 +0000
 1.13.2.5 11-Dec-2005  christos Sync with head.
 1.13.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.13.2.1 03-Aug-2004  skrll Sync with HEAD
 1.18.12.4 03-Sep-2007  yamt sync with head.
 1.18.12.3 26-Feb-2007  yamt sync with head.
 1.18.12.2 30-Dec-2006  yamt sync with head.
 1.18.12.1 21-Jun-2006  yamt sync with head.
 1.20.6.2 29-Nov-2005  yamt sync with head.
 1.20.6.1 22-Nov-2005  yamt sync with head.
 1.24.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.24.8.1 11-Aug-2006  yamt sync with head
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.25.10.2 12-Mar-2007  rmind Sync with HEAD.
 1.25.10.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.27.10.1 03-Oct-2007  garbled Sync with HEAD
 1.27.4.1 11-Jul-2007  mjf Sync with head.
 1.27.2.1 15-Jul-2007  ad Sync with head.
 1.28.10.1 06-Nov-2007  matt sync with HEAD
 1.29.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.29.20.2 11-Mar-2010  yamt sync with head
 1.29.20.1 04-May-2009  yamt sync with head.
 1.29.18.1 04-Jun-2008  yamt sync with head
 1.29.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.6.1 18-Feb-2012  mrg merge to -current.
 1.33.2.1 17-Apr-2012  yamt sync with head
 1.34.6.1 03-Dec-2017  jdolecek update from HEAD
 1.35.20.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.37.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.38.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.39.4.1 31-May-2021  cjep sync with head
 1.39.2.1 13-May-2021  thorpej Sync with HEAD.
 1.40.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 18-Feb-2002  uwe We are using shared headers from dev/ebus now.
 1.2 11-Dec-2001  uwe branches: 1.2.2; 1.2.4;
tabify
 1.1 11-Dec-2001  uwe EBus support for ms-IIep. This file should eventually be merged into
sys/dev/ebus/ebusreg.h and shared with sparc64 port.
 1.2.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.2.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 11-Dec-2001  thorpej file ebusreg.h was added on branch kqueue on 2002-01-10 19:48:45 +0000
 1.2.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.1 11-Dec-2001  nathanw file ebusreg.h was added on branch nathanw_sa on 2002-01-08 00:27:35 +0000
 1.2 18-Feb-2002  uwe We are using shared headers from dev/ebus now.
 1.1 11-Dec-2001  uwe branches: 1.1.2; 1.1.4;
EBus support for ms-IIep.
 1.1.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 11-Dec-2001  thorpej file ebusvar.h was added on branch kqueue on 2002-01-10 19:48:45 +0000
 1.1.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 11-Dec-2001  nathanw file ebusvar.h was added on branch nathanw_sa on 2002-01-08 00:27:35 +0000
 1.78 29-Aug-1998  pk Split `esp' driver and DMA engine into separate front-end files.
The Sbus front-ends have all been moved to `sys/dev/sbus', while
the `obio' front-ends remain here.
 1.77 15-Aug-1998  mycroft Minor edit.
 1.76 15-Aug-1998  mycroft Assign copyright to TNF.
 1.75 29-Jul-1998  pk Deal with sbus attach args changes.
 1.74 27-Jul-1998  pk <sparc/dev/sbusvar.h> => <dev/sbus/sbusvar.h>
 1.73 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.72 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.71 12-Jan-1998  thorpej Update for changes to config.
 1.70 05-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.69 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.68 19-Jul-1997  pk branches: 1.68.2;
Use `target selection with DMA' by default.
 1.67 24-May-1997  pk branches: 1.67.2;
Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.66 27-Feb-1997  thorpej Convert the SPARC esp driver to be a front-end for the MI 53c9x driver.
 1.65 10-Dec-1996  pk branches: 1.65.6;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.64 10-Dec-1996  thorpej Fill in sc_link.max_target
 1.63 27-Nov-1996  pk Cancel any queued timer events before re-scheduling a timeout, so esp_abort()
can be called from other places besides the timeout handler.
 1.62 27-Nov-1996  pk Pay attention to DMA errors as reported by DMAINTR() returning -1. If this
happens reset everything.

Re-schedule a timeout when first attempting to abort an operation.
 1.61 16-Nov-1996  pk Add explicit casts to `%l*' formatted arguments.
 1.60 12-Nov-1996  cgd sync with alpha version
 1.59 13-Oct-1996  christos backout previous kprintf change
 1.58 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.57 28-Sep-1996  mycroft Remove unused variable.
 1.56 28-Sep-1996  mycroft Sync with Alpha version.
 1.55 28-Sep-1996  thorpej Sync with the alpha version, fixing several SCSI protocol bugs.

NOTE: THESE FILES ARE NOW IDENTICAL TO THEIR ALPHA COUNTERPARTS.
The C preprocessor does the Right Thing when these files are built
on a SPARC. This makes it significantly easier to diff the two
versions (until a real MI 53c9x driver is done, hint hint).
 1.54 09-Sep-1996  cgd replace sequences of 8 spaces with tabs (only one instance). kill
unnecessary newlines after return statements but before function
close-braces.
 1.53 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.52 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.51 12-Jun-1996  pk Use the setting of the ESPCFG2_FE bit rather than revision number to decide
on the ESP chip's maximum transfer count.
 1.50 12-Jun-1996  pk Correct test for `dmachild' which failed on `esp at obio*' configs (PR#2541).
 1.49 11-Jun-1996  pk Avoid the "features enable" bit on ESP100A's; apperently this is a source
of trouble on many machines (from Krister Walfridsson; PR#2537).
 1.48 30-May-1996  pk Clamp synch-transfer parameters at our maximum values on device-initiated
synch negotiation.
 1.47 21-May-1996  pk branches: 1.47.2;
espattach() requires DMA to be configured. For now, panic if it is not.
 1.46 16-May-1996  pk Use configuration file flags to disable reselection and/or sync negotiation,
on a per target basis (until the driver can sort things out on its own).

Test against "sbus" in stead of "espdma" to find out where in the
configuration tree we are: an esp can be the child of a "dma" on SBus
add-on boards.
 1.45 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.44 23-Mar-1996  pk Remove reference to sense code "internals".
 1.43 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.42 16-Mar-1996  christos fix format in panic()
 1.41 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.40 05-Mar-1996  pk Don't come down so hard on targets that ignore SDTR msgs.
 1.39 29-Feb-1996  pk Don't reset `xs->retries'.
 1.38 26-Feb-1996  pk Interims:
Comment out `STATINT' checking; this is apparently unreliable on some
ESP revisions.
Deal with target initiated synch re-negotiation.
 1.37 22-Feb-1996  mycroft Implement SDEV_AUTOSAVE.
 1.36 21-Feb-1996  pk Correct format in a printf().
 1.35 12-Feb-1996  pk Separate DMA and SCSI routines more.
 1.34 06-Feb-1996  pk Be sure to reset the chip when relection fails to prevent corrupting data.
 1.33 18-Dec-1995  pk Towards machine independency, per cgd: macros to access hardware registers.
 1.32 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.31 01-Dec-1995  pk Don't return `XS_DRIVER_STUFFUP' too easily; this can hose buffer cache
writes. Say XS_TIMEOUT in stead so the scsi code will retry.
 1.30 28-Nov-1995  pk Prevent synch negotiation on ESP100 chips
 1.29 28-Nov-1995  pk Lots of major and minor bug fixes and changes.
- properly do MSG_IN handshaking, so we can actually receive multi-byte msgs.
- do synch negotiation (now that the above works).
- handle disconnects.
There are a few trial-and-error bits at points where the docs I have are
particularly ambiguous about the state of chip and/or SCSI bus.

Things to do:
- more cleanup
- deal with MSG_OUT phase better
- keep some "config reg 3" bits per target (ie. FASTCLK and FASTSCSI).
 1.28 03-Nov-1995  pk Make error recovery actually work, i.e. don't hang on SCSI bus resets
and re-synchronize before re-scheduling pending operations.
Things seem to be a fair bit stabler now.
 1.27 24-Oct-1995  pk Various:
- make esp_poll() approximate the given timeout value.
- introduce esp_abort(), and use it for timed out commands; make targets and driver less confused.
- make {free,ready,nexus}-list management somewhat more coherent.
- make sure we only proceed down the state machine in espintr()
if there really is an interrupt pending.
 1.26 14-Sep-1995  pk branches: 1.26.2;
Re-instate configuration print routines, following Chris' suggestion.
Only prints something if there's no scsi bus to attach.
 1.25 11-Sep-1995  pk We have no need for `esp_print()'; the only child we expect is a `scsibus',
and there's nothing to say if it isn't there. Returning -1 is an error
anyway as noted by Chuck Cranor.
 1.24 06-Sep-1995  pk Probe config registers correctly.
 1.23 18-Aug-1995  pk Use bootpath_store() to set next boot component; used in dk_establish()
to match `sd' devices against the PROM's boot path.

Detect DMA "overshoots" when handling odd-sized transfer sizes (e.g., xfers
from/to raw partitions), by using the "Transfer Pad" command when the
transfer count reaches zero.
 1.22 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.21 13-Jul-1995  pk Have esp_minphys limit transfers to MAXPHYS bytes.
 1.20 02-Jun-1995  pk Try to recover from multi-byte messages sent by a target for which we
get an "Illegal command" (why is this?) when we try to pull it in.
On detection of this condition, we reset the SCSI bus and simply stop asking
this target for an identify messages, for now.
 1.19 01-Mar-1995  pk Better 4/100 support.
 1.18 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.17 01-Feb-1995  mycroft Handle incoming messages longer than 1 byte correctly.
 1.16 07-Jan-1995  mycroft ESP_ID -> ESP_SELID
 1.15 02-Jan-1995  pk Adapt to changed SCSI subsystem.
 1.14 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.13 21-Nov-1994  deraadt C error
 1.12 20-Nov-1994  deraadt copyright/Id cleanup
 1.11 05-Nov-1994  deraadt reset scsi bus at attach time
 1.10 15-Oct-1994  deraadt sbus_establish() is sun4c/sun4m specific
 1.9 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.8 02-Oct-1994  deraadt sun4/300 support works
 1.7 17-Sep-1994  deraadt Replacement esp (NCR 53C9X + LSI DMA) scsi driver from Peter Galbavy.
 1.6 13-Aug-1994  deraadt fix for bug #403 from <grossman@informatik.tu-muenchen.de>
 1.5 27-May-1994  deraadt branches: 1.5.2;
new from torek; now multiple drives will work
 1.4 12-Nov-1993  deraadt new from torek:
add torek's comments to my DMA_DRAIN fix
 1.3 05-Nov-1993  deraadt DELAY(1) after a DMA_DRAIN, to let the esp chip have a chance to
recover from the DMA.. seems to let my ss1+ work with the cache enabled.
+ also esp reset code from Torek.
 1.2 27-Oct-1993  deraadt sys/dev/scsi -> sys/arch/sparc/scsi.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.2.1 13-Aug-1994  mycroft update from trunk
 1.26.2.6 26-Feb-1996  pk From trunk:
`STATINT' is not reliable on some ESP revisions.
Deal with target initiated synch re-negotiation.
 1.26.2.5 21-Feb-1996  pk From trunk: Correct format in a printf().
 1.26.2.4 17-Feb-1996  pk Pull over fixes from trunk.
 1.26.2.3 12-Nov-1995  pk Incorporate error-recovery fixes from trunk.
 1.26.2.2 24-Oct-1995  pk Update from trunk: various
 1.26.2.1 18-Oct-1995  pk Set cfg2 bits for chip revisions ESP100A and above.
 1.47.2.2 15-Oct-1996  mycroft Integrate post-1.2 bug fixes to date.
 1.47.2.1 12-Jun-1996  pk Pull down from trunk:
>rev 1.49/1.51: judicious use of ESPCFG2_FE configuration flag.
>rev 1.50: Correct test for "being child of dma".
>rev 1.48: Clamp synch-transfer parameters at our maximum values ...
 1.65.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.67.2.2 22-Jul-1997  bouyer Sync with trunk.
 1.67.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.68.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.68.2.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.24 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.23 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.22 13-Apr-2008  tsutsui branches: 1.22.2; 1.22.4;
Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
 1.21 12-Feb-2008  joerg branches: 1.21.6;
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.20 04-Mar-2007  christos branches: 1.20.20; 1.20.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 28-Mar-2006  thorpej branches: 1.19.14;
Use device_unit().
 1.18 08-Mar-2006  lukem branches: 1.18.2;
Use the SI capitalization for "Hz", "kHz", and "MHz" in comments and strings.
Add a space between numbers and Hz unit.
 1.17 16-Nov-2005  uwe branches: 1.17.4; 1.17.6; 1.17.8; 1.17.10;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.16 15-Jul-2003  lukem branches: 1.16.16; 1.16.24;
__KERNEL_RCSID()
 1.15 10-Dec-2002  pk branches: 1.15.6;
Remove the `flags' argument from bus_intr_establish().
 1.14 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.13 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.12 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.11 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.10 25-Apr-2001  bouyer branches: 1.10.2; 1.10.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.9 29-Mar-2001  petrov use NCR_F_DMASELECT instead of ncr53c9x_dmaselect
 1.8 09-Jul-2000  pk branches: 1.8.2;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.7 05-Jun-2000  nisimura branches: 1.7.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.6 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.5 11-Jan-2000  pk branches: 1.5.2;
Remove old-style boot device recognition.
 1.4 19-Nov-1998  thorpej branches: 1.4.10;
Adapt to the new scsipi_adapter interface.
 1.3 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.2 29-Aug-1998  pk Adjust for some small changes in lsi64854 back-end driver.
 1.1 29-Aug-1998  pk Split `esp' driver and DMA engine into separate front-end files.
The Sbus front-ends have all been moved to `sys/dev/sbus', while
the `obio' front-ends remain here.
 1.4.10.3 21-Apr-2001  bouyer Sync with HEAD
 1.4.10.2 23-Mar-2001  bouyer Correct attach to ncr53c9x.
 1.4.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.5.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.8.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.8.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.10.8.4 11-Dec-2002  thorpej Sync with HEAD.
 1.10.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.10.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.10.8.1 25-Apr-2001  nathanw file esp_obio.c was added on branch nathanw_sa on 2002-04-01 07:42:40 +0000
 1.10.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.15.6.4 11-Dec-2005  christos Sync with head.
 1.15.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.6.1 03-Aug-2004  skrll Sync with HEAD
 1.16.24.1 22-Nov-2005  yamt sync with head.
 1.16.16.3 27-Feb-2008  yamt sync with head.
 1.16.16.2 03-Sep-2007  yamt sync with head.
 1.16.16.1 21-Jun-2006  yamt sync with head.
 1.17.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.17.8.2 01-Apr-2006  yamt sync with head.
 1.17.8.1 13-Mar-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.18.2.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.19.14.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.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.22.4.1 16-May-2008  yamt sync with head.
 1.22.2.1 18-May-2008  yamt sync with head.
 1.8 27-Feb-1997  thorpej Convert the SPARC esp driver to be a front-end for the MI 53c9x driver.
 1.7 18-Dec-1995  pk branches: 1.7.8;
Towards machine independency, per cgd: macros to access hardware registers.
 1.6 29-Aug-1995  pk branches: 1.6.2;
define reserved bits in cfg2 & cfg3 registers correctly.
 1.5 07-Jan-1995  mycroft Sort.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 17-Sep-1994  deraadt Replacement esp (NCR 53C9X + LSI DMA) scsi driver from Peter Galbavy.
 1.2 27-May-1994  deraadt new from torek; now multiple drives will work
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.6.2.1 17-Feb-1996  pk Pull over fixes from trunk.
 1.7.8.1 12-Mar-1997  is Merge in changes from The Trunk
 1.22 29-Aug-1998  pk Split `esp' driver and DMA engine into separate front-end files.
The Sbus front-ends have all been moved to `sys/dev/sbus', while
the `obio' front-ends remain here.
 1.21 21-Mar-1998  pk Add bus tags to softc.
 1.20 05-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.19 27-Feb-1997  thorpej branches: 1.19.4;
Convert the SPARC esp driver to be a front-end for the MI 53c9x driver.
 1.18 22-Nov-1996  pk branches: 1.18.6;
One control block per target is insufficient if you have a full complement
of targets attached and access those simultaneously (like in a ccd(4) array).
We (now) allocate (somewhat arbitrarily) three per target.
Noticed by Marshall Midden.
 1.17 12-Nov-1996  cgd sync with alpha version
 1.16 13-Oct-1996  christos backout previous kprintf change
 1.15 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.14 28-Sep-1996  thorpej Sync with the alpha version, fixing several SCSI protocol bugs.

NOTE: THESE FILES ARE NOW IDENTICAL TO THEIR ALPHA COUNTERPARTS.
The C preprocessor does the Right Thing when these files are built
on a SPARC. This makes it significantly easier to diff the two
versions (until a real MI 53c9x driver is done, hint hint).
 1.13 16-May-1996  pk branches: 1.13.4;
Use configuration file flags to disable reselection and/or sync negotiation,
on a per target basis (until the driver can sort things out on its own).

Test against "sbus" in stead of "espdma" to find out where in the
configuration tree we are: an esp can be the child of a "dma" on SBus
add-on boards.
 1.12 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.11 12-Feb-1996  pk Separate DMA and SCSI routines more.
 1.10 18-Dec-1995  pk Towards machine independency, per cgd: macros to access hardware registers.
 1.9 28-Nov-1995  pk Prevent synch negotiation on ESP100 chips
 1.8 28-Nov-1995  pk Lots of major and minor bug fixes and changes.
- properly do MSG_IN handshaking, so we can actually receive multi-byte msgs.
- do synch negotiation (now that the above works).
- handle disconnects.
There are a few trial-and-error bits at points where the docs I have are
particularly ambiguous about the state of chip and/or SCSI bus.

Things to do:
- more cleanup
- deal with MSG_OUT phase better
- keep some "config reg 3" bits per target (ie. FASTCLK and FASTSCSI).
 1.7 03-Nov-1995  pk Make error recovery actually work, i.e. don't hang on SCSI bus resets
and re-synchronize before re-scheduling pending operations.
Things seem to be a fair bit stabler now.
 1.6 24-Oct-1995  pk Various:
- make esp_poll() approximate the given timeout value.
- introduce esp_abort(), and use it for timed out commands; make targets and driver less confused.
- make {free,ready,nexus}-list management somewhat more coherent.
- make sure we only proceed down the state machine in espintr()
if there really is an interrupt pending.
 1.5 18-Aug-1995  pk branches: 1.5.2;
Add a debug flag.
Make `sc_dleft' a `ssize_t' since it's involved in a signed
comparison in esp.c.
 1.4 02-Jun-1995  pk Try to recover from multi-byte messages sent by a target for which we
get an "Illegal command" (why is this?) when we try to pull it in.
On detection of this condition, we reset the SCSI bus and simply stop asking
this target for an identify messages, for now.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 02-Oct-1994  deraadt sun4/300 support works
 1.1 17-Sep-1994  deraadt Replacement esp (NCR 53C9X + LSI DMA) scsi driver from Peter Galbavy.
 1.5.2.3 17-Feb-1996  pk Pull over fixes from trunk.
 1.5.2.2 12-Nov-1995  pk Incorporate error-recovery fixes from trunk.
 1.5.2.1 24-Oct-1995  pk Update from trunk: various
 1.13.4.1 15-Oct-1996  mycroft Integrate post-1.2 bug fixes to date.
 1.18.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.19.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5 29-May-1996  pk Swiatch to `sys/dev/sun/event*'.
 1.4 29-May-1996  pk Add missing splx(), per Jason.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 21-Jul-1994  deraadt make X11R5 compile easier
 1.1 02-Oct-1993  deraadt branches: 1.1.2;
Chris Torek's sparc port. Missing lots of things.
 1.1.2.1 22-Jul-1994  cgd from trunk.
 1.3 29-May-1996  pk Swiatch to `sys/dev/sun/event*'.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.48 31-Oct-2000  pk This file now lives in sys/dev/sun.
 1.47 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.46 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.45 17-Apr-2000  pk branches: 1.45.4;
When constructing `ri_devcmap[]', pack four instances of the LUTs in each
32 bit wide entry (as not documented in the non-existent rasops(9)..)
 1.44 16-Apr-2000  pk Initialize the rasops device colormap to match colormaps used by
our supported devices (including even coloured text on the console).
 1.43 19-Mar-2000  pk Add `fb_is_console()', which is a helper function for frame buffer
device drivers used to decide whether or not to act as console output.
 1.42 26-Aug-1999  thorpej branches: 1.42.2;
Suns use black-on-white as the default rcons colors.
 1.41 24-Aug-1999  ad - Update to match new rasops_init semantics
- Set RI_FULLCLEAR so that we clear the *entire* display
- Set RI_CURSOR and cursor position so that old cursor glyph gets wiped

Fixes PR: port-sparc/8121
 1.40 13-Aug-1999  ad The 8bpp PROM console uses index 0 as black, 255 as white. Update ri_devcmap
to cater. Partially addresses PR port-sparc/8121.
 1.39 02-Jun-1999  christos Don't include rasops and wscons goo here; we get it already from fbvar.h
 1.38 02-Jun-1999  mycroft We need wsdisplayvar.h for this to compile now!
 1.37 23-May-1999  ad - Setting initial position of cursor is up to caller.
- Set cursor position properly for SPARC. From Juergen Hannken-Illjes.
 1.36 19-May-1999  ad SPARC console is black on white, and is centered by default.
 1.35 19-May-1999  ad Add arg to rcons_init() that when set causes screen to be cleared.
 1.34 19-May-1999  ad Insert missing code that defines screen metrics for rcons. This fixes the
more blatant rcons brokenness (ie no panics).
 1.33 18-May-1999  ad Fix typo that broke rasops operation.
 1.32 18-May-1999  thorpej Don't clear the screen when we connect rasops; the SPARC doesn't connect
the rasops console until autoconfiguration, and it kinda sucks to have
the boot messages suddenly disappear from the screen.
 1.31 16-May-1999  ad Fix typo on my behalf. From Juergen Hannken-Illjes.
 1.30 15-May-1999  ad Panic if rasops_init() fails us (should never be the case).
 1.29 15-May-1999  ad Make sure rasops_info descriptor is zeroed out before initializing.
 1.28 27-Apr-1999  thorpej Fix a typo that prevented this from compiling.
 1.27 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.26 13-Apr-1999  ad Leave font selection to 'rasops' until 'rasops1' has been completed and can
handle non {8,16} pixel wide fonts.
 1.25 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.24 21-Mar-1998  pk branches: 1.24.10;
Split the fb_setsize() utility in two separate functions: one to be
used by OBP machines and another one for sun4/eeprom machines.
 1.23 07-Jul-1997  pk Get console tty size from raster console if applicable.
 1.22 23-Dec-1996  pk Prevent `unused function' warning (from Robert Evans; PR#2770).
 1.21 13-Oct-1996  christos backout previous kprintf change
 1.20 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.19 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.18 01-Apr-1996  christos Eliminated dependencies on dev_conf.h
 1.17 31-Mar-1996  pk Re-arrange a bit to stear clear of gcc `-Wall' bites.
 1.16 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.15 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.14 25-Feb-1996  pk Use CPU-type macros
 1.13 10-Dec-1995  pk Use `def_width' and `def_height' as default values when getting rom properties.
 1.12 29-Nov-1995  pk Code from Jason to better configure /dev/fb.
 1.11 08-Oct-1995  pk branches: 1.11.2;
Patch from Jason to factor out a common framebuffer size determination
routine from the individual drivers.
 1.10 05-Oct-1995  pk rcons: rc_maxcol and rc_maxrow were swapped.
 1.9 05-Oct-1995  pk Machine dependent RASTERCONSOLE font definition to be passed to rcons_init().
 1.8 02-Oct-1995  pk Make fbrcons_init() resistant against SUN4s.
 1.7 17-Sep-1995  pk Change interface to th `fb' pseudo device to not need the major device
number (a la sun3).
Put in new glue for rcons.
 1.6 10-Apr-1995  mycroft map --> mmap
 1.5 16-Dec-1994  deraadt open changed again
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 02-Nov-1994  deraadt ioctl u_long cmd
 1.2 11-Oct-1993  deraadt cons.c, zs.c: tty->t_stop doesn't exist here. I think it goes through d_stop
automatically now, but have not checked.
l_ioctl() has no last parameter 'p'
fb.c: move sys/fbio.h to machine/fbio.h
various: typecast parms for timeout() properly
zs.c: extra level of indir in cdevsw[]->d_ttys
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.11.2.1 16-Feb-1996  thorpej Pull in improved framebuffer autoconfiguration code from -current.
Prevents panics when multiple framebuffers are found on sun4 systems.
 1.24.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.42.2.2 22-Nov-2000  bouyer Sync with HEAD.
 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.4.2 01-Nov-2000  tv Pullup 1.2 from syssrc/sys/dev/sun/fb.c by patch [pk]:

fb_is_console(): we must match on the `fb' propery in a V0 PROMs root node
only after establishing that the PROM output device is a frame buffer device.
 1.45.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.164 11-Dec-2023  andvar Surround fdc declaration and definition with FD_DEBUG blocks.

FD_DEBUG is defined by default, thus build passes, however would fail otherwise
since it is only used in debug block.
 1.163 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.162 24-Apr-2021  thorpej branches: 1.162.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.161 22-Nov-2020  thorpej branches: 1.161.2;
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.160 10-Nov-2019  chs branches: 1.160.8;
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.159 08-Feb-2019  mrg make *fd*.c's fd_dev_to_type() always a static inline. some
have it as a const, and have code to copy the defaults to
modify them before using them, but that probably requires a
real test to feel confident in changing.
 1.158 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.157 26-Apr-2015  mlelstv branches: 1.157.16; 1.157.18;
Use C99-style initializers for struct dkdriver.
 1.156 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.155 19-Aug-2014  tsutsui branches: 1.155.2;
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().

I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).

Should be pulled up to netbsd-7.
 1.154 25-Jul-2014  dholland branches: 1.154.2;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.153 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.152 16-Mar-2014  dholland branches: 1.152.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.151 10-Oct-2012  tsutsui branches: 1.151.2;
Fix device_t/softc split botches that could be fatal. From
Chuck Silvers' patch posted current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html

Should be pulled up to netbsd-6.
 1.150 17-Jul-2011  mrg branches: 1.150.2; 1.150.8; 1.150.12; 1.150.14;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.149 24-Feb-2010  dyoung A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.148 08-Jan-2010  dyoung branches: 1.148.2;
Expand PMF_FN_* macros.
 1.147 19-Dec-2009  tsutsui Disable "fast trap" handlers which invoke software interrupts
in sparc/amd7930intr.s and sparc/bsd_fdintr.s until they are
rewritten to adapt new MI softint(9) API.

No particular comments on PR port-sparc/42192, but
this fixes timeout problem on floppy access on my SPARCstation 1+.

XXX: floppy support on sun4m seems to have another problem (data overrun).
 1.146 25-May-2009  jnemeth Convert shutdownhook_establish() to pmf_device_register1().

XXX This should be done as part of an overall plan to support
power management and device detachment. However, in order to do
that, I would first have to invent sbus_intr_disestablish(). This
is being done at this time in order to aid in the effort to eliminate
shutdownhook_establish().

This was based on the sys/arch/sparc64/fd.c change. Thanks to jdc@
for testing this version.
 1.145 18-Mar-2009  cegger bzero -> memset
 1.144 13-Jan-2009  yamt branches: 1.144.2;
g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.143 17-Dec-2008  cegger kill MALLOC and FREE macros.
 1.142 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.141 11-Jun-2008  drochner branches: 1.141.4; 1.141.6; 1.141.12;
mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.140 28-Apr-2008  martin branches: 1.140.2; 1.140.4;
Remove clause 3 and 4 from TNF licenses
 1.139 02-Jan-2008  ad branches: 1.139.6; 1.139.8; 1.139.10;
Merge vmlocking2 to head.
 1.138 27-Nov-2007  ad branches: 1.138.2; 1.138.6;
Use the softint API.
 1.137 17-Oct-2007  garbled branches: 1.137.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.136 08-Oct-2007  ad Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
 1.135 29-Jul-2007  ad branches: 1.135.4; 1.135.6; 1.135.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.134 09-Jul-2007  ad branches: 1.134.2; 1.134.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.133 11-May-2007  jnemeth Fixed formatting. Problem was that we were trying to get the result
of a data transfer operation immediately after the data transfer
was finished, instead of waiting for the chip to interrupt us and
tell us that it was finished and had the result for us. This worked
okay for read and write since the operation would be finished very
shortly after the data transfer completed. However, with formatting,
the chip still had most of the rest of the track to do, so we ended
up timing out before the operation was finished. This fix is from
sparc64/dev/fdc.c and was tested on sparc by tnn@.
 1.132 11-May-2007  jnemeth revert last; committed wrong file
 1.131 11-May-2007  jnemeth Fixed formatting. Problem was that we were trying to get the result
of a data transfer operation immediately after the data transfer
was finished, instead of waiting for the chip to interrupt us and
tell us that it was finished and had the result for us. This worked
okay for read and write since the operation would be finished very
shortly after the data transfer completed. However, with formatting,
the chip still had most of the rest of the track to do, so we ended
up timing out before the operation was finished. This fix is from
sparc64/dev/fdc.c and was tested on sparc by tnn@.
 1.130 09-Mar-2007  he branches: 1.130.2; 1.130.4; 1.130.10;
Cast to char* before doing pointer arithmetic.
 1.129 04-Mar-2007  mrg fix fall out from caddr_t changes.
 1.128 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.127 15-Feb-2007  reinoud branches: 1.127.2;
Rename the B_XXX flag to B_DEVPRIVATE flag since it was never used for
debugging and its main use is in device drivers. Its used there to signal
that the flagged buffer has a special meaning or should be handled
differently.

OK'd by Bill Sudenmund on tech-kern.
 1.126 14-Apr-2006  blymn Make i/o statistics collection more generic, include tape drives and
nfs mounts in the set of devices that statistics will be reported on.
 1.125 23-Feb-2006  thorpej branches: 1.125.2; 1.125.4; 1.125.6;
Use device_parent().
 1.124 06-Jan-2006  yamt branches: 1.124.2; 1.124.4;
initialize necessary members of struct buf. PR/32462 from Reinoud Zandijk.
 1.123 04-Jan-2006  yamt add a missing putiobuf in the previous. pointed by Thomas Klausner.
 1.122 04-Jan-2006  yamt - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
 1.121 11-Dec-2005  christos branches: 1.121.2;
merge ktrace-lwp.
 1.120 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.119 01-Nov-2005  bjh21 branches: 1.119.2;
Fix second "no drives attached" message (as seen on sun4c) so as not to
include the device name, since this message is printed on the same line
as the attach message anyway.
 1.118 15-Oct-2005  yamt branches: 1.118.2;
- 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.117 04-Jun-2005  tsutsui branches: 1.117.2;
- Add const.
- Remove parameter names from prototype declarations.
 1.116 28-Oct-2004  yamt move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.115 19-Sep-2004  he Fix build problem -- track the change to <sys/buf.h>.
 1.114 24-Mar-2004  pk Remove my name from the old UCB copyright notice, thereby reducing its
reference count to 1.
 1.113 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.112 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.111 15-Jul-2003  lukem __KERNEL_RCSID()
 1.110 11-Jul-2003  pk Deal with disk change notification.
 1.109 29-Jun-2003  fvdl branches: 1.109.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.108 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.107 18-Jun-2003  drochner don't #include <sys/dkstat.h> where it is (appearently) unused
 1.106 03-May-2003  wiz DMA, not dma nor Dma.
 1.105 25-Feb-2003  thorpej Add missing splbio() protecting of bufpool access. Add a clarifying
comment to <sys/buf.h> reminding everyone of the need for splbio().
 1.104 25-Feb-2003  thorpej Add a new BUF_INIT() macro which initializes b_dep and b_interlock, and
use it. This fixes a few places where either b_dep or b_interlock were
not properly initialized.
 1.103 05-Feb-2003  pk Make the buffer cache code MP-safe.
 1.102 30-Jan-2003  hannken Fix printf() problem caused by "daddr_t" change.
 1.101 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.100 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.99 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.98 10-Dec-2002  pk The `fast trap' handlers are now pssed as an optional argument to
bus_intr_establish(). Allow fall-back on a regular interrupt handler if
the interrupt level must be shared with another device.
 1.97 09-Dec-2002  pk Finish the switch to the softintr(9) framework.

To make this work, we now have to use separate handler lists for hardware
and software interrupts as the soft interrupt handlers do not return
an `interrupt handled' status.

Thanks to Matt Fredette for providing an initial set of patches on port-sparc.
 1.96 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.95 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.94 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.93 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.92 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.91 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.90 06-Aug-2002  hannken Convert to new device buffer queue interface.

Approved by: Paul Kranenburg <pk@netbsd.org>
 1.89 11-Mar-2002  pk branches: 1.89.4;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.88 26-Sep-2001  eeh branches: 1.88.4;
getprop* -> PROM_getprop*
 1.87 08-Jul-2001  wiz branches: 1.87.2; 1.87.4;
Correct various misspellings of 'transfer' and inflected forms.
 1.86 19-Apr-2001  pk Fix fdc_c_hwintr() and use it as a fall back if the `fast trap' handler
cannot be registered.
 1.85 24-Aug-2000  nathanw branches: 1.85.2;
In fdioctl(), allocate fd_formb dynamically when needed, rather than on
the stack, and remove the no-longer-necessary PHOLD()/PRELE() calls
in fdformat().

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

XXX We still have too many mostly-redundant floppy drivers.
 1.84 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.83 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.82 04-Jun-2000  cgd branches: 1.82.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.81 16-May-2000  thorpej branches: 1.81.2;
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.80 07-Apr-2000  thorpej Use separate callouts for motor-on and motor-off. Fixes a condition
where the floppy driver would wedge because a motor-on timeout would
be cancelled by another I/O operation cancelling a motor-off timeout.

From enami tsugutomo <enami@sm.sony.co.jp>.
 1.79 24-Mar-2000  hannken Fix a typo from last commit.
 1.78 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.77 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.76 07-Feb-2000  pk Don't use PROM the virtual address (if any) for the device registers;
they are not reliably mapped. Also, unmap registers if the device
cannot be configured properly.
 1.75 28-Jan-2000  pk fdcstatus() formatting.
 1.74 24-Jan-2000  pk Report write-protected disks.
 1.73 23-Jan-2000  pk * b_cylin -> b_cylinder; deals with PR9283.
* a few optimizations & misc. style updates.
 1.72 21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.71 21-Jan-2000  pk Medium sized code overhaul:
* Improve communication between the `hard' and `soft' interrupt handlers
to better distinguish various interrupt sources.
* Eliminate several race conditions where we would set a time out handler
only after starting the command on the hardware.
* Handle most timeouts by resetting the controller; there isn't much chance
of recovery in any other way. Currently, the exception is a timeout
on I/O, in which case we first try to pulse the controller's TC line
in order to abort the pseudo-dma sequence. Apparently, "normal"
conditions can induce such a timeout when there's no disk in the drive.
* Reduce the formatting gap parameter to 0x54.
* On the obio bus, interpret the `status' attribute.
* Minimize console diagnostic output if the errors we get appear to be
caused by the absence of a disk.
 1.70 17-Jan-2000  pk Use bus_space(9) functions to access the controller registers.
Add probes to the attach routines before poking the chip to see
where the registers are located.
 1.69 11-Jan-2000  pk Remove old-style boot device recognition.
 1.68 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
 1.67 24-Mar-1999  mrg branches: 1.67.2; 1.67.8; 1.67.14;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.66 08-Feb-1999  bouyer Change DIOCEJECT to do what's needed to eject a device before the eject
command (unlock for sd and cd) if no other partitions are open, return
EBUSY otherwise. DIOCEJECT will have the old semantic if its argument is not
0. The old ioctl has been renamed to ODIOCEJECT for binary compatibility.
 1.65 07-Feb-1999  jonathan defopt MEMORY_DISK_{HOOKS,SERVER,IS_ROOT}.
 1.64 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.63 29-Jul-1998  pk Deal with sbus attach args changes.
 1.62 04-Jul-1998  jonathan defopt DDB.
 1.61 05-Jun-1998  mrg remove old (now broken) memory disks hooks code.
 1.60 30-Mar-1998  pk Replace direct `sparc_bus_map()' calls with bus space map method.
 1.59 25-Mar-1998  pk Check for a valid PROM virtual address.
 1.58 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.57 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.56 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.55 12-Jan-1998  thorpej Update for changes to config.
 1.54 19-Oct-1997  pk Nuke 5.25 inch formats.
 1.53 19-Oct-1997  pk Add an odd-ball japanese floppy format (PR#2903).
A good time to get rid of the hard-coded floppy sector size.
 1.52 29-Jul-1997  fair %x -> 0x%x
 1.51 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.50 02-May-1997  pk * finish off support for the 82077 chip as found on sun4m machines.
* add non-dma mode bit to `specify command', so formatting disks starts
working (thanks to Jeremy Cooper for finding out about this).
 1.49 07-Apr-1997  pk sun4c and sun4m `aux' register bits differ slightly.
 1.48 31-Mar-1997  pk Remove bogon from otherwise unused fdchwintr() function.
 1.47 31-Jan-1997  thorpej Use new machine-independent mountroothook code.
 1.46 01-Jan-1997  pk branches: 1.46.2;
RAMDISK_HOOKS => MEMORY_DISK_HOOKS
 1.45 28-Dec-1996  pk rename: ramdisk => md
 1.44 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.43 10-Dec-1996  pk Finish import of floppy formatting code; not really usable yet, lots of
data overruns.
 1.42 08-Dec-1996  pk Import formatting code from the i386 version.
Revise communication between hw & sw interrupt handler.
 1.41 27-Nov-1996  pk Stabilize timeout values in fdcresult() and out_fdc() by adding delay()s.
Noted by Jason Thorpe over in the i386 driver.
 1.40 13-Nov-1996  thorpej Use bitmask_snprintf().
 1.39 13-Oct-1996  christos backout previous kprintf change
 1.38 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.37 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.36 20-Jun-1996  pk When booting from a floppy drive and RAMDSK_HOOKS is defined, arrange for
a callback from memory disk driver to load the actual root image.
 1.35 16-Jun-1996  pk bootpath detection: some (newer?) v2 prom versions use actual device address,
e.g. `/fd@1,72000000'.
 1.34 27-May-1996  pk Fix case where sequence state wasn't updated properly, resulting in
`disk_unbusy' panic.
 1.33 29-Apr-1996  pk branches: 1.33.4;
Chip needs much more time to think things over (up to 2 seconds to complete
a `recalibrate' command if no flop present).
 1.32 22-Apr-1996  christos Remove dependency on <sys/cpu.h>
 1.31 10-Apr-1996  pk `bootdv' is gone. Instead, set the device pointer in the `struct bootpath'
that is passed in the attach arguments.
 1.30 01-Apr-1996  christos - remove dependency to dev_conf.h
- remove unneeded casts for %b
 1.29 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.28 26-Mar-1996  pk Bitfields are unsigned.
 1.27 26-Mar-1996  pk Back to normal printf()s, now that gcc understands `%b'.
 1.26 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.25 16-Mar-1996  christos fix format in printf()
 1.24 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.23 25-Feb-1996  pk Use CPU-type macros.
 1.22 10-Feb-1996  thorpej In fdcretry(), if we're not using implied seeks, set the state to DOSEEK
rather than SEEKCOMPLETE before retrying the operation. If implied seeks
are being used, the state is set to DOIO (no change). This is why I
couldn't reproduce the disk_unbusy() panic on my SS2; it uses implied
seeks. Patch from John F. Woods <jfw@jfwhome.funhouse.com>
 1.21 30-Jan-1996  thorpej Implement DIOCLOCK. It's a no-op in this driver.
 1.20 16-Jan-1996  thorpej Use a shutdownhook to make sure the drive motor is turned off
at halt/reboot time, as suggested by Perry Metzger.
 1.19 15-Jan-1996  thorpej Three distinct changes:
- Better disklabel handling. While a disklabel isn't used
in the driver, some versions of the OpenPROM insist on
one being present in order to boot from floppy. These
changes provide a default label (in a way similar to how
the SCSI disk driver provides a default) so that a user
can more easily place the label on the disk.

- Fix semi-bug in bootpath handling. It appears as if the
bootpath can appear in a couple of formats: "/fd@0,0", which
is what bootpath_fake() creates on v0 proms and may be
passed by some v2 proms, and "/fd0" which is what the
v2 prom on my SS2 passes. We now handle both formats.

- Use a mountroot hook to eject the floppy and wait for
the user to insert a filesystem floppy if we're the boot/root
device.
 1.18 12-Jan-1996  thorpej Balance calls to disk_busy() and disk_unbusy() properly to avoid
dk_busy < 0 panics. Count seeks.
 1.17 11-Jan-1996  pk Return `no error' after ejecting; per Jason.
 1.16 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.15 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.14 11-Nov-1995  pk dk_device => device in controller structure (noted by Jason Thorpe).
 1.13 09-Oct-1995  pk Point `bootdv' at the disk device instead of the controller (from Jason Thorpe).
 1.12 03-Oct-1995  pk Bring reset logic into interrupt state machine.
 1.11 02-Oct-1995  pk Fix some bogus calls to {read/write}disklabel().
 1.10 18-Aug-1995  pk Set `bootdv' if booted from the floppy drive.
 1.9 05-Jul-1995  pk Add xxread/xxwrite.
 1.8 20-May-1995  pk Use a different method to discriminate a 82077 from a 82072 (from Chris Torek);
using the NE7CMD_VERSION command is too unreliable.
 1.7 16-May-1995  pk Really test # of status bytes.
 1.6 25-Apr-1995  pk Do not report each pseudo-DMA overrun as a (soft) error.
Add a small heuristic to converge on an acceptable threshold value.
 1.5 13-Apr-1995  pk Do a probe in fdmatch() to guard against dumb PROMs.
 1.4 10-Apr-1995  mycroft Fdclose --> fdclose
 1.3 07-Apr-1995  pk Add evcnt_attach().
 1.2 22-Feb-1995  pk Reorganize to use fast interrupt handler.
 1.1 17-Feb-1995  pk Pilot sun4c floppy driver based on i386 version;
- same limitations as isa/fd.c: just read/write
- in need of a fast interrupt handler
 1.33.4.1 12-Jun-1996  pk Pull down from trunk:
>rev 1.34: Fix case where sequence state wasn't updated properly ...
 1.46.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.67.14.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.67.14.1 21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

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

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

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.67.8.2 23-Apr-2001  bouyer Sync with HEAD.
 1.67.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.67.2.1 07-Feb-2000  he Apply patch (requested by pk):
Fix several problems:
o Floppy driver dislikes being accessed with no floppy inserted
(PR#5740)
o Floppy drive being detected even though there is none (PR#5760)
o Panic when fdformat is used (PR#9251)
 1.81.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.82.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.85.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.87.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.87.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.87.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.87.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.87.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.87.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.88.4.8 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.88.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.88.4.6 11-Nov-2002  nathanw Catch up to -current
 1.88.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.88.4.4 17-Sep-2002  nathanw Catch up to -current.
 1.88.4.3 13-Aug-2002  nathanw Catch up to -current.
 1.88.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.88.4.1 26-Sep-2001  nathanw file fd.c was added on branch nathanw_sa on 2002-04-01 07:42:41 +0000
 1.89.4.2 31-Aug-2002  gehenna catch up with -current.
 1.89.4.1 17-May-2002  gehenna Add device switch.
 1.109.2.8 11-Dec-2005  christos Sync with head.
 1.109.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.109.2.6 04-Feb-2005  skrll Adapt to branch.
 1.109.2.5 02-Nov-2004  skrll Sync with HEAD.
 1.109.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.109.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.109.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.109.2.1 03-Aug-2004  skrll Sync with HEAD
 1.117.2.6 21-Jan-2008  yamt sync with head
 1.117.2.5 07-Dec-2007  yamt sync with head
 1.117.2.4 27-Oct-2007  yamt sync with head.
 1.117.2.3 03-Sep-2007  yamt sync with head.
 1.117.2.2 26-Feb-2007  yamt sync with head.
 1.117.2.1 21-Jun-2006  yamt sync with head.
 1.118.2.1 02-Nov-2005  yamt sync with head.
 1.119.2.1 22-Nov-2005  yamt sync with head.
 1.121.2.2 01-Mar-2006  yamt sync with head.
 1.121.2.1 15-Jan-2006  yamt sync with head.
 1.124.4.1 22-Apr-2006  simonb Sync with head.
 1.124.2.1 09-Sep-2006  rpaulo sync with head
 1.125.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.125.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.125.2.1 24-May-2006  yamt sync with head.
 1.127.2.2 17-May-2007  yamt sync with head.
 1.127.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.130.10.3 16-Oct-2007  garbled Sync with HEAD
 1.130.10.2 03-Oct-2007  garbled Sync with HEAD
 1.130.10.1 22-May-2007  matt Update to HEAD.
 1.130.4.1 11-Jul-2007  mjf Sync with head.
 1.130.2.5 03-Dec-2007  ad Sync with HEAD.
 1.130.2.4 20-Aug-2007  ad - Alter disk attach/detach to fix a panic when closing a vnd device.
- Sync with HEAD.
 1.130.2.3 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.130.2.2 01-Jul-2007  ad Adapt to callout API change.
 1.130.2.1 27-May-2007  ad Sync with head.
 1.134.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.134.2.1 07-Aug-2007  matt Sync with HEAD.
 1.135.8.1 14-Oct-2007  yamt sync with head.
 1.135.6.2 09-Jan-2008  matt sync with HEAD
 1.135.6.1 06-Nov-2007  matt sync with HEAD
 1.135.4.2 03-Dec-2007  joerg Sync with HEAD.
 1.135.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.137.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.137.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.138.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.138.2.1 31-Dec-2007  ad Catch up with buffer cache changes.
 1.139.10.4 11-Mar-2010  yamt sync with head
 1.139.10.3 20-Jun-2009  yamt sync with head
 1.139.10.2 04-May-2009  yamt sync with head.
 1.139.10.1 16-May-2008  yamt sync with head.
 1.139.8.2 17-Jun-2008  yamt sync with head.
 1.139.8.1 18-May-2008  yamt sync with head.
 1.139.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.139.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.139.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.140.4.1 18-Jun-2008  simonb Sync with head.
 1.140.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.141.12.1 21-Apr-2010  matt sync to netbsd-5
 1.141.6.1 23-Jan-2010  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1251):
sys/arch/sparc/sparc/auxreg.h: revision 1.13
distrib/sparc/ramdisk/dot.profile: revision 1.20
sys/arch/sparc/dev/audioamd.c: revision 1.25
sys/arch/sparc/dev/fd.c: revision 1.147
sys/arch/sparc/stand/common/promdev.c: revision 1.23
distrib/sparc/miniroot/Makefile.inc: revision 1.16
Build miniroot binaries for sparc with -Os to shrink instfs.tgz
for the second boot floppy which use miniroot objects.
This is workaround for PR install/42146, and ok'ed by mrg@.
Don't try to read disklabel to check FS_RAID on floppy boot since
reopening floppy could cause Data Access Exception later.
Fixes PR port-sparc/42186, ok'ed by mrg@.
Disable "fast trap" handlers which invoke software interrupts
in sparc/amd7930intr.s and sparc/bsd_fdintr.s until they are
rewritten to adapt new MI softint(9) API.
No particular comments on PR port-sparc/42192, but
this fixes timeout problem on floppy access on my SPARCstation 1+.
XXX: floppy support on sun4m seems to have another problem (data overrun).
Use /dev/fd0a rather than /dev/rfd0a to read instfs.tgz image from floppy.
It looks newer (appearred after 1.6) gzip tries to read less than DEV_BSIZE
(to check header?) so we can't use raw device directly.
(note sparc bootfs ramdisk doesn't have dd(1))
Workaround for PR port-sparc/42193, and would also fix PR install/28734.
Explicitly clear AUXIO4M_FTC bit in FTC_FLIP macro used on
pseudo-dma for floppy, as well as AUXIO4C_FTC bit for sun4c.
A comment in the macro says AUXIO4M_FTC bit is auto-clear,
but my two SS20s (including compatible) with 150MHz hyperSPARCs
get data_overrun without it, and no bad side effect on SS5
(works with and without this change).
Closes PR port-sparc/42516, which is the last one of a bunch of
floppy issue on NetBSD/sparc since NetBSD 2.0 days. See
http://mail-index.NetBSD.org/port-sparc/2009/12/20/msg000484.html
for details.
 1.141.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.141.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.144.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.148.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.150.14.1 03-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1139):
sys/arch/sun3/dev/fd.c: revision 1.78
sys/arch/sparc/dev/fd.c: revision 1.155
sys/arch/sparc64/dev/fdc.c: revision 1.42
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).
Should be pulled up to netbsd-7.
Sync with sparc/dev/fd.c:1.155.
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).
Should be pulled up to netbsd-7.
Sync with sparc/dev/fd.c rev 1.155.
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
Note sun3 still uses gcc 4.5.4 but also panicked by this old bug,
so probably this problem was triggered by not gcc 4.8 but struct disk
changes (struct disk_geom was added in <sys/disk.h> rev 1.58),
which increased sizeof(struct fd_softc) from 248 bytes to 296 bytes.
(i.e. now struct fd_softc could be allocated in a different pool block,
probably near the wrong pointer of the struct disklabel)
Anyway, this fix should be pullued up to netbsd-7.
(probably I'm the only user of floppy on sun3 though)
 1.150.12.3 03-Dec-2017  jdolecek update from HEAD
 1.150.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.150.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.150.8.2 03-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1139):
sys/arch/sun3/dev/fd.c: revision 1.78
sys/arch/sparc/dev/fd.c: revision 1.155
sys/arch/sparc64/dev/fdc.c: revision 1.42
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).
Should be pulled up to netbsd-7.
Sync with sparc/dev/fd.c:1.155.
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).
Should be pulled up to netbsd-7.
Sync with sparc/dev/fd.c rev 1.155.
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
Note sun3 still uses gcc 4.5.4 but also panicked by this old bug,
so probably this problem was triggered by not gcc 4.8 but struct disk
changes (struct disk_geom was added in <sys/disk.h> rev 1.58),
which increased sizeof(struct fd_softc) from 248 bytes to 296 bytes.
(i.e. now struct fd_softc could be allocated in a different pool block,
probably near the wrong pointer of the struct disklabel)
Anyway, this fix should be pullued up to netbsd-7.
(probably I'm the only user of floppy on sun3 though)
 1.150.8.1 17-Oct-2012  riz branches: 1.150.8.1.2;
Pull up following revision(s) (requested by tsutsui in ticket #602):
sys/arch/sparc/dev/fd.c: revision 1.151
sys/arch/sparc/sparc/memecc.c: revision 1.15
Fix device_t/softc split botches that could be fatal. From
Chuck Silvers' patch posted current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html
Should be pulled up to netbsd-6.
 1.150.8.1.2.1 03-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1139):
sys/arch/sun3/dev/fd.c: revision 1.78
sys/arch/sparc/dev/fd.c: revision 1.155
sys/arch/sparc64/dev/fdc.c: revision 1.42
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).
Should be pulled up to netbsd-7.
Sync with sparc/dev/fd.c:1.155.
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).
Should be pulled up to netbsd-7.
Sync with sparc/dev/fd.c rev 1.155.
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
Note sun3 still uses gcc 4.5.4 but also panicked by this old bug,
so probably this problem was triggered by not gcc 4.8 but struct disk
changes (struct disk_geom was added in <sys/disk.h> rev 1.58),
which increased sizeof(struct fd_softc) from 248 bytes to 296 bytes.
(i.e. now struct fd_softc could be allocated in a different pool block,
probably near the wrong pointer of the struct disklabel)
Anyway, this fix should be pullued up to netbsd-7.
(probably I'm the only user of floppy on sun3 though)
 1.150.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.150.2.1 30-Oct-2012  yamt sync with head
 1.151.2.1 18-May-2014  rmind sync with head
 1.152.2.1 10-Aug-2014  tls Rebase.
 1.154.2.1 24-Aug-2014  martin Pull up following revision(s) (requested by tsutsui in ticket #53):
sys/arch/sun3/dev/fd.c: revision 1.78
sys/arch/sparc/dev/fd.c: revision 1.155
sys/arch/sparc64/dev/fdc.c: revision 1.42
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
 1.155.2.2 06-Jun-2015  skrll Sync with HEAD
 1.155.2.1 06-Apr-2015  skrll Sync with HEAD
 1.157.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.157.18.1 10-Jun-2019  christos Sync with HEAD
 1.157.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.160.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.161.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.162.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 11-Jul-2003  pk Deal with disk change notification.
 1.7 17-Jan-2000  pk branches: 1.7.28;
Use bus_space(9) functions to access the controller registers.
Add probes to the attach routines before poking the chip to see
where the registers are located.
 1.6 02-May-1997  pk branches: 1.6.16; 1.6.22;
* finish off support for the 82077 chip as found on sun4m machines.
* add non-dma mode bit to `specify command', so formatting disks starts
working (thanks to Jeremy Cooper for finding out about this).
 1.5 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.4 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.3 20-May-1995  pk Name fd register structures more appropriately.
 1.2 22-Feb-1995  pk Reorganize to use fast interrupt handler.
 1.1 17-Feb-1995  pk Pilot sun4c floppy driver based on i386 version;
- same limitations as isa/fd.c: just read/write
- in need of a fast interrupt handler
 1.6.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.16.1 07-Feb-2000  he Apply patch (requested by pk):
Fix several problems:
o Floppy driver dislikes being accessed with no floppy inserted
(PR#5740)
o Floppy drive being detected even though there is none (PR#5760)
o Panic when fdformat is used (PR#9251)
 1.7.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.28.1 03-Aug-2004  skrll Sync with HEAD
 1.15 30-Jun-2011  wiz dependant -> dependent
 1.14 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.13 11-Dec-2005  christos branches: 1.13.74; 1.13.76; 1.13.78;
merge ktrace-lwp.
 1.12 11-Jul-2003  pk Deal with disk change notification.
 1.11 03-May-2003  wiz branches: 1.11.2;
DMA, not dma nor Dma.
 1.10 21-Jan-2000  pk Medium sized code overhaul:
* Improve communication between the `hard' and `soft' interrupt handlers
to better distinguish various interrupt sources.
* Eliminate several race conditions where we would set a time out handler
only after starting the command on the hardware.
* Handle most timeouts by resetting the controller; there isn't much chance
of recovery in any other way. Currently, the exception is a timeout
on I/O, in which case we first try to pulse the controller's TC line
in order to abort the pseudo-dma sequence. Apparently, "normal"
conditions can induce such a timeout when there's no disk in the drive.
* Reduce the formatting gap parameter to 0x54.
* On the obio bus, interpret the `status' attribute.
* Minimize console diagnostic output if the errors we get appear to be
caused by the absence of a disk.
 1.9 17-Jan-2000  pk Use bus_space(9) functions to access the controller registers.
Add probes to the attach routines before poking the chip to see
where the registers are located.
 1.8 05-Sep-1998  pk branches: 1.8.6; 1.8.12;
Assign my copyrights to TNF.
 1.7 05-Sep-1998  pk Assign my copyrights to TNF.
 1.6 19-Oct-1997  pk Add an odd-ball japanese floppy format (PR#2903).
A good time to get rid of the hard-coded floppy sector size.
 1.5 08-Dec-1996  pk Import formatting code from the i386 version.
Revise communication between hw & sw interrupt handler.
 1.4 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.3 07-Apr-1995  pk Add evcnt_attach().
 1.2 08-Mar-1995  pk Add a CR.
 1.1 22-Feb-1995  pk Reorganize to use fast interrupt handler.
 1.8.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.6.1 07-Feb-2000  he Apply patch (requested by pk):
Fix several problems:
o Floppy driver dislikes being accessed with no floppy inserted
(PR#5740)
o Floppy drive being detected even though there is none (PR#5760)
o Panic when fdformat is used (PR#9251)
 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.13.78.1 16-May-2008  yamt sync with head.
 1.13.76.1 18-May-2008  yamt sync with head.
 1.13.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.4 25-Jul-1998  pk This file is no longer used.
 1.3 27-Jan-1995  pk Update based on i386 version; from Chuck Cranor.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 26-Oct-1994  deraadt obio/vme16 Intel Ethernet driver by Chuck Cranor. works on vme16.
 1.6 28-Jul-1998  pk This file is now in dev/sbus.
 1.5 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.4 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.3 13-Oct-1996  christos backout previous kprintf change
 1.2 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.1 22-Jun-1996  chuck sbus specific stuff for eni155s sbus atm card.
XXX: only works on sun4c, needs something better than vtophys() for
machines with IOMMUs(?).
 1.35 25-Jan-1998  pk These drivers are now in dev/vme.
The `ie' driver has been split in a VME and OBIO front-end. The latter
lives on in this directory as `if_ie_obio.c'
 1.34 12-Jan-1998  thorpej Update for changes to config.
 1.33 29-Jul-1997  fair fix editing boo-boo
 1.32 29-Jul-1997  fair %x -> 0x%x
 1.31 10-Jun-1997  pk Avoid "false positives" in match routines.
 1.30 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.29 15-Mar-1997  pk Fix a `new-ARP' pasto.
 1.28 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.27 10-Dec-1996  pk branches: 1.27.6;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.26 13-Oct-1996  christos backout previous kprintf change
 1.25 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.24 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.23 10-Apr-1996  pk `bootdv' is gone. Instead, set the device pointer in the `struct bootpath'
that is passed in the attach arguments.
 1.22 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.21 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.20 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.19 25-Feb-1996  pk Use CPU-type macros.
 1.18 12-Jan-1996  chuck we handle all our mappings, so don't have obio.c do any for us
(i.e. don't set ra->ra_len in the match function).
 1.17 24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.16 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.15 11-Apr-1995  pk iestart() returns nothing.
 1.14 11-Apr-1995  mycroft Sync with the rest of the world.
 1.13 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.12 16-Feb-1995  pk Working "config generic" support; from Theo.
 1.11 27-Jan-1995  pk Update based on i386 version; from Chuck Cranor.
 1.10 16-Dec-1994  deraadt obio ie support by chuck and me
 1.9 14-Dec-1994  deraadt obio fixes from the two chucks!
 1.8 29-Nov-1994  deraadt wait for ack from chip
 1.7 25-Nov-1994  deraadt choose {w,b}{copy,zero} automatically
 1.6 23-Nov-1994  deraadt ie cards coldstart with a parity error, reset it
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 02-Nov-1994  deraadt cleanup
 1.3 02-Nov-1994  deraadt ioctl u_long cmd
 1.2 30-Oct-1994  deraadt KNF
 1.1 26-Oct-1994  deraadt obio/vme16 Intel Ethernet driver by Chuck Cranor. works on vme16.
 1.27.6.2 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.27.6.1 06-Mar-1997  is Convert to new ARP code.
 1.5 25-Jan-1998  pk These drivers are now in dev/vme.
The `ie' driver has been split in a VME and OBIO front-end. The latter
lives on in this directory as `if_ie_obio.c'
 1.4 16-Dec-1994  deraadt obio ie support by chuck and me
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 30-Oct-1994  deraadt KNF
 1.1 26-Oct-1994  deraadt obio/vme16 Intel Ethernet driver by Chuck Cranor. works on vme16.
 1.44 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.43 24-Oct-2021  andvar fix various typos in comments, mainly copypasta.
 1.42 25-Apr-2019  msaitoh No functional change:
- Use __arraycount().
- u_int_{8,16,32}_t -> uint_{8,16,32}_t
- KNF.
- Tabify.
- Remove extra space.
 1.41 19-Oct-2013  mrg branches: 1.41.30;
- remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.40 01-Jul-2011  dyoung branches: 1.40.2; 1.40.12; 1.40.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.39 03-Jun-2011  tsutsui Split device_t/softc of i82586. No crash on TME emulating sun2.
 1.38 01-Feb-2011  chuck branches: 1.38.2;
udpate license clauses on my code to match the new-style BSD licenses.
remove no-longer-valid wustl email address for me.
based on diff that rmind@ sent me.

no functional change with this commit.
 1.37 20-Sep-2009  tsutsui branches: 1.37.4; 1.37.6; 1.37.8;
- use device_t and cfdriver_t
- use device_private() and device_xname()
- use proper types or variables for device_t/softc
 1.36 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.35 04-Mar-2007  christos branches: 1.35.40; 1.35.42; 1.35.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.33 16-Nov-2005  uwe branches: 1.33.26;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.32 04-Jun-2005  tsutsui branches: 1.32.2; 1.32.8;
Fix for gcc -Wshadow.
 1.31 15-Mar-2004  pk Replace myetheraddr() by prom_getether().
 1.30 15-Jul-2003  lukem __KERNEL_RCSID()
 1.29 02-Apr-2003  thorpej branches: 1.29.2;
Use PAGE_SIZE rather than NBPG.
 1.28 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.27 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.26 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.25 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.24 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.23 10-Sep-2001  chris branches: 1.23.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.22 24-Apr-2001  thorpej branches: 1.22.2; 1.22.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.21 13-Mar-2001  tsutsui Update for recent changes to the MI i82586 driver.
(added 'why' argument to the channel attention hook function)
 1.20 08-Mar-2001  thorpej Duh, don't forget the proc argument.
 1.19 08-Mar-2001  thorpej Use bus_dmamap_load(), not bus_dmamap_load_raw().
 1.18 22-Jan-2001  bjh21 branches: 1.18.2;
Patch from PR kern/8001, submitted by Rafal Boni.

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

This has been tested on the i386 port with the 'ix' driver in both
16KB (which was the source of the problem) and 32KB modes, as well
as with the 'ef' driver. I've tested it (briefly) with 'ei' on arm26
as well. In theory, drivers other than 'ix' should follow precisely the
same code paths as before.
 1.17 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.16 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.15 15-Jun-2000  pk branches: 1.15.2;
bus_dmapmap_create: boundary must be 0, not NBPG.
 1.14 09-May-2000  pk branches: 1.14.2;
Conform bus_dmamem_{alloc,map} usage to bus_dma(9) specs.
 1.13 11-Jan-2000  pk Remove old-style boot device recognition.
 1.12 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.11 08-Jul-1999  thorpej branches: 1.11.2; 1.11.4; 1.11.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.10 26-Mar-1999  mycroft branches: 1.10.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.9 18-Mar-1999  pk Fix various things that kept this bus front-end from functioning..
 1.8 23-Aug-1998  pk Use bus_dmamem_{alloc,free} instead of the old VM hack.
 1.7 21-Aug-1998  pk Convert to [pv]addr_t.
 1.6 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.5 22-Mar-1998  pk Fill in the pointers the MI back-end expects correctly.
Add comment and diagram explaining the memory layout (to be revisited..).
 1.4 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.3 28-Feb-1998  pk Remove `_NEW_I82586'.
 1.2 07-Feb-1998  chs add UVM stuff.
 1.1 25-Jan-1998  pk sparc/obio bus front-end to the i82586 driver.
 1.10.4.1 02-Aug-1999  thorpej Update from trunk.
 1.11.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.4.1 15-Nov-1999  fvdl Sync with -current
 1.11.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.11.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.11.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.18.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.18.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.22.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.22.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.22.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.22.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.23.4.4 11-Dec-2002  thorpej Sync with HEAD.
 1.23.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.23.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.23.4.1 10-Sep-2001  nathanw file if_ie_obio.c was added on branch nathanw_sa on 2002-04-01 07:42:41 +0000
 1.29.2.5 11-Dec-2005  christos Sync with head.
 1.29.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.32.8.1 22-Nov-2005  yamt sync with head.
 1.32.2.3 03-Sep-2007  yamt sync with head.
 1.32.2.2 26-Feb-2007  yamt sync with head.
 1.32.2.1 21-Jun-2006  yamt sync with head.
 1.33.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.33.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.35.44.2 11-Mar-2010  yamt sync with head
 1.35.44.1 16-May-2008  yamt sync with head.
 1.35.42.1 18-May-2008  yamt sync with head.
 1.35.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.37.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.37.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.37.4.2 12-Jun-2011  rmind sync with head
 1.37.4.1 05-Mar-2011  rmind sync with head
 1.38.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.40.16.1 18-May-2014  rmind sync with head
 1.40.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.40.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.41.30.1 10-Jun-2019  christos Sync with HEAD
 1.57 27-Jul-1998  pk Split the `le' driver front-ends into separate files.
The sbus and lebuffer front-end have moved to dev/sbus.
 1.56 21-Jul-1998  drochner adapt to LANCE driver split
 1.55 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.54 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.53 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.52 12-Jan-1998  thorpej Update for changes to config.
 1.51 05-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.50 09-Sep-1997  pk Turn on D_DSBL_WRINVAL on `ledma'.
 1.49 07-Jul-1997  pk branches: 1.49.2;
Install media functions only if something useful can be returned.
 1.48 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.47 04-Apr-1997  pk Use sc_hwreset() hook to reset ledma (if applicable).
 1.46 23-Mar-1997  pk Clamp burst sizes to maximum value of parent.
Reset ledma from leattach().
 1.45 17-Mar-1997  thorpej Use if_media to select media (or autoselect rules) on the Sun4m.
 1.44 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.43 10-Mar-1997  pk Redo attach code somewhat. Have a go at matching le's and lebuffer's on
machines where the PROM does not provide a parent/child relationship.
 1.42 10-Dec-1996  pk branches: 1.42.6;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.41 06-Dec-1996  pk Detect `lebuffer' parents and use the provided buffer.
 1.40 13-Oct-1996  christos backout previous kprintf change
 1.39 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.38 27-Sep-1996  abrown Oops. Last change will slow down a GENERIC kernel. Add a CPU type test
for cleanliness.
KNF a return statement.
 1.37 27-Sep-1996  abrown Fix long-standing bug with Lance ethernet and Sun4m's, where each packet
would generate two interrupts, one real and one spurious. The solution
is to force a drain of the SBus->MBus write buffers after writing to the
lance to clear the interrupt. Thanks to Chris Torek for pointing out a much
easier way to do this than I had planned...
 1.36 06-Jul-1996  abrown Take advantage of new am7990 sc_nocarrier() function in order to do auto-
matic media detection on Sun4m machines which support multiple media
(UTP and AUI). New function lenocarrier() switches media type when called
if no link? flags are set.

Redefine link flags for Lance ethernet (le):
<none>: switch between media as needed to find carrier (autodetect)
Preference to whatever the PROM is using (AUI if not booted
from the network)
link0: use UTP port only
link1: use AUI port only

This allows Sun4m machines with dual media Lance ethernet adapters to
boot from the network on the UTP port.
 1.35 16-May-1996  pk branches: 1.35.4;
Check for `configuration parent' differently: compare against "sbus"
rather than "ledma".
 1.34 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.33 07-May-1996  thorpej Make the MI LANCE driver standalone, and use cfattach to resolve
naming conflicts between bus attachments on ports that can have
multiple instances of the LANCE.

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.32 22-Apr-1996  abrown Now that we have lehwinit() for the Sun4m, make sure that we wait 20ms
after changing the cable type, as specified in the chip documentation.
Also, sanity-check that sc_dma is valid in case a Sun4m ever exists without
a ledma.
 1.31 22-Apr-1996  christos Oops the name of the UTP/AUI bit changed under me...
 1.30 22-Apr-1996  christos Add a hardware dependent initialization function lehwinit()
to support selecting UTP media on sun4m
 1.29 18-Apr-1996  cgd change LANCE copy & zero functions' names to start with amd7990_, and
remove their 'integrate' (usually defined to be 'static') keywords.
when lance drivers are split up by attachment, more than one file will
reference the copy/zero functions (i.e. not just the file that pulls in
am7990.c... and eventually inclusion of am7990.c should go away entirely).
 1.28 10-Apr-1996  pk `bootdv' is gone. Instead, set the device pointer in the `struct bootpath'
that is passed in the attach arguments.
 1.27 31-Mar-1996  pk Deal with sun4m le/ledma. Work around spurious interrupt problem (aaron).
 1.26 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.25 12-Jan-1996  chuck we handle all our mappings, so don't have obio.c do any for us
(i.e. don't set ra->ra_len in the match function).
 1.24 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.23 10-Dec-1995  mycroft Use the MI LANCE code.
 1.22 06-Dec-1995  pk dvma_malloc => malloc/dvma_mapin. (not the most elegant solution, but it'll
have to do for now).
 1.21 23-Jun-1995  pk Sync with net/if.h
 1.20 12-Apr-1995  pk Use arp_ifinit().
 1.19 09-Apr-1995  pk Adapt to if.h changes.
 1.18 16-Feb-1995  pk Working "config generic" support; from Theo.
 1.17 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.16 20-Nov-1994  deraadt copyright/Id cleanup
 1.15 02-Nov-1994  deraadt ioctl u_long cmd
 1.14 15-Oct-1994  deraadt sbus_establish() is sun4c/sun4m specific
 1.13 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.12 02-Oct-1994  deraadt sun4/300 support works
 1.11 17-Sep-1994  deraadt sbus/* --> dev/*
deal with multiple bus types (start of vme/obio support)
 1.10 04-Jul-1994  deraadt need vm/vm.h
 1.9 02-Jul-1994  deraadt tmd2/rmd2 have bits which must be set to 1
 1.8 17-May-1994  deraadt use ether_input
 1.7 13-May-1994  deraadt new from 4.4-lite
 1.6 22-Apr-1994  deraadt stub fix
 1.5 08-Apr-1994  deraadt MULTICAST is standard now
 1.4 24-Jan-1994  deraadt ether_input() takes ether_type in net byte order now
 1.3 05-Nov-1993  deraadt if_init goes away.
 1.2 11-Oct-1993  deraadt bwtwo.c, cgthree.c: sys-fbio.h -> machine/fbio.h
if_le.c: #ifdef MULTICAST some things, and do arp the old way
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.35.4.2 06-Dec-1996  rat Pullup request 1.36 -> 1.38 from Aaron Brown <abrown@eecs.harvard.edu>

>Fixes a long-standing bug in the Sun4m ethernet driver that causes
>cause each received packet to generate two interrupts rather than one.
 1.35.4.1 17-Jul-1996  jtc Patch from Aaron Brown needed for netboot
 1.42.6.3 12-Mar-1997  is Merge in changes from The Trunk
 1.42.6.2 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.42.6.1 06-Mar-1997  is Convert to new ARP code.
 1.49.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.49.2.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5 29-Aug-1998  pk Split `esp' driver and DMA engine into separate front-end files.
The Sbus front-ends have all been moved to `sys/dev/sbus', while
the `obio' front-ends remain here.
 1.4 28-Aug-1998  pk Specify our boundary restriction when allocating DMAble memory.
 1.3 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.2 29-Jul-1998  pk In the reset() function, preserve the current cable selection bit.
If in auto media select mode, this avoids losing carrier every time
the lance code decides to re-initialize.
 1.1 27-Jul-1998  pk Split the `le' driver front-ends into separate files.
The sbus and lebuffer front-end have moved to dev/sbus.
 1.29 29-May-2022  rin le(4): Fix resource leaks for error paths.

XXX
Compile test only (at least one arch per driver).
 1.28 25-Apr-2019  msaitoh No functional change:
- Use __arraycount().
- u_int_{8,16,32}_t -> uint_{8,16,32}_t
- KNF.
- Tabify.
- Remove extra space.
 1.27 01-Jul-2011  dyoung branches: 1.27.54;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.26 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.25 04-Apr-2008  tsutsui branches: 1.25.2; 1.25.4;
Split device_t/softc for le(4) and variants and misc cosmetic changes.
 1.24 04-Mar-2007  christos branches: 1.24.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 16-Nov-2005  uwe branches: 1.23.26;
Drop unnecessary includes and extern declarations.
Declare match/attach routines static.
 1.22 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.21 15-Mar-2004  pk branches: 1.21.16; 1.21.24;
Replace myetheraddr() by prom_getether().
 1.20 11-Nov-2003  pk Remove ancient DDB-dependent `hide/integrate'.
Simplify lewrcsr/lerdcsr; read-back after write doesn't hurt on sun4 so
skip the cpu type test in generic kernels.
 1.19 15-Jul-2003  lukem __KERNEL_RCSID()
 1.18 02-Apr-2003  thorpej branches: 1.18.2;
Use PAGE_SIZE rather than NBPG.
 1.17 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.16 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.15 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.12 30-May-2001  mrg branches: 1.12.2; 1.12.8;
use _KERNEL_OPT
 1.11 09-Mar-2001  pk pasto: sc_maddr => sc_mem
 1.10 08-Mar-2001  thorpej Duh, don't forget the proc argument.
 1.9 08-Mar-2001  thorpej Use bus_dmamap_load(), not bus_dmamap_load_raw().
 1.8 09-Jul-2000  pk branches: 1.8.2;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.7 09-May-2000  pk branches: 1.7.4;
Conform bus_dmamem_{alloc,map} usage to bus_dma(9) specs.
 1.6 11-Jan-2000  pk Remove old-style boot device recognition.
 1.5 29-Aug-1998  pk branches: 1.5.12;
Split `esp' driver and DMA engine into separate front-end files.
The Sbus front-ends have all been moved to `sys/dev/sbus', while
the `obio' front-ends remain here.
 1.4 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.3 31-Jul-1998  pk Use bus_dmamem_alloc/bus_dmamem_map.
 1.2 28-Jul-1998  pk branches: 1.2.2;
GC.
 1.1 27-Jul-1998  pk Split the `le' driver front-ends into separate files.
The sbus and lebuffer front-end have moved to dev/sbus.
 1.2.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.5.12.2 12-Mar-2001  bouyer Sync with HEAD.
 1.5.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.8.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.8.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.12.8.4 11-Dec-2002  thorpej Sync with HEAD.
 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 30-May-2001  nathanw file if_le_obio.c was added on branch nathanw_sa on 2002-04-01 07:42:42 +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 16-Mar-2002  jdolecek Catch up with -current.
 1.18.2.4 11-Dec-2005  christos Sync with head.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.24.1 22-Nov-2005  yamt sync with head.
 1.21.16.2 03-Sep-2007  yamt sync with head.
 1.21.16.1 21-Jun-2006  yamt sync with head.
 1.23.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.4.1 16-May-2008  yamt sync with head.
 1.25.2.1 18-May-2008  yamt sync with head.
 1.27.54.1 10-Jun-2019  christos Sync with HEAD
 1.6 28-Jul-1998  pk We no longer use these.
 1.5 10-Dec-1995  mycroft Use the MI LANCE code.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 02-Jul-1994  deraadt tmd2/rmd2 have bits which must be set to 1
 1.2 13-May-1994  deraadt new from 4.4-lite
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.9 28-Jul-1998  pk We no longer use these.
 1.8 21-Mar-1998  pk Add bus tags to softc.
 1.7 04-Apr-1997  pk Use sc_hwreset() hook to reset ledma (if applicable).
 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 07-May-1996  thorpej branches: 1.5.8;
Make the MI LANCE driver standalone, and use cfattach to resolve
naming conflicts between bus attachments on ports that can have
multiple instances of the LANCE.

Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_start)()
to take a struct ifnet *, rather than a unit number.
 1.4 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.3 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.2 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.1 10-Dec-1995  mycroft Use the MI LANCE code.
 1.5.8.1 06-Mar-1997  is Convert to new ARP code.
 1.2 30-Oct-1994  mycroft Clean up deleted files.
 1.1 26-Oct-1994  deraadt obio/vme16 Intel Ethernet driver by Chuck Cranor. works on vme16.
 1.19 27-Aug-1998  mrg move isp sbus attachment to dev/sbus
 1.18 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.17 12-Aug-1998  mjacob minor change to make the message less linux like
 1.16 31-Jul-1998  pk Convert to bus dma.
 1.15 31-Jul-1998  thorpej Back out previous; it is perfectly reasonable, and desirable, to print out
debugging info ifdef DEBUG.
 1.14 31-Jul-1998  mjacob >We're not Linux. If we still want driver version strings to be displayed
>at boot, then I suppose DEBUG is a reasonable compromise.
Makes the whole concept useless. This is for default printouts. If you
can build a debug kernel, you know what version you have. This was under
the concept of 'RAS' so that hapless users could tell you microversion
things. But I guess this isn't the right way according to our local
Jesuits. Oh, well. I'll think up something different and hopefully
less objectionable. And yes, NetBSD isn't linux. The developers seem
to be equally bad tempered, but linux is more successful.
 1.13 29-Jul-1998  pk branches: 1.13.2;
Deal with sbus attach args changes.
 1.12 20-Jul-1998  thorpej We're not Linux. If we still want driver version strings to be displayed
at boot, then I suppose DEBUG is a reasonable compromise.
 1.11 18-Jul-1998  mjacob locking now out of main framework for isp_reset/isp_init
 1.10 15-Jul-1998  mjacob new framework
 1.9 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.8 27-Aug-1997  bouyer branches: 1.8.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.7 16-Aug-1997  mjacob Changes for PCI Qlogic ISP2100 meant a few minor changes.
 1.6 08-Jun-1997  thorpej branches: 1.6.2; 1.6.4;
Update for changes in the core ISP driver.
 1.5 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.4 13-Mar-1997  cgd change microcode array definitions from "unsigned short" to the more
correct u_int16_t, and remove bogus casts that the old definition
required.
 1.3 13-Mar-1997  mycroft Make the microcode table const.
 1.2 12-Mar-1997  cgd NetBSD RCS ID tweaks, a few comment block tweaks. Also, make copyright
notices consistent (per Matt Jacob).
 1.1 12-Mar-1997  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 12-Mar-1997  cgd ISP 10x0 driver from Matthew Jacob of NASA Ames Research Center.
(March 12, 1997 version).
 1.6.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.2 26-Aug-1997  bouyer Update from trunk.
 1.6.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.8.4.1 07-Nov-1998  cgd patch to update this code to work with the rest of the updated
MI ISP driver. (mjacob)
 1.13.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.29 18-Oct-1997  gwr Use common zs code.
 1.28 13-Sep-1997  pk In kbdattach() (the pseudo-device attach routine) wait for the keyboard
reset sequence to complete. Just sending the reset command and rushing
off -- like it used to do -- might cause the keyboard's response to get
lost in case the remaining kernel initialization decides to interact
with the console (RB_ASK!) by calling cngetc(), which goes off polling
within the PROM.
 1.27 13-Oct-1996  christos branches: 1.27.10;
backout previous kprintf change
 1.26 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.25 12-Sep-1996  mrg update these for poll(2) changes.
 1.24 30-May-1996  pk event_var.h changed location.
 1.23 01-Apr-1996  christos Remove last dependency to dev_conf.h and the file itself.
 1.22 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.21 25-Feb-1996  pk Use CPU-type macros
 1.20 12-Feb-1996  pk Avoid compiler warning.
 1.19 06-Jul-1995  pk Support KIOC_GETLAYOUT, so other than US keyboards can be dealt with better.
 1.18 10-May-1995  pk Minimalist implementation of KIOC[SG]KEY.
 1.17 02-May-1995  pk Make sure kbdopen() ships the keyboard reset cmd.
 1.16 27-Apr-1995  pk Handle KIOC[GS]LED ioctls; from Lon Willett.
 1.15 20-Nov-1994  deraadt copyright/Id cleanup
 1.14 02-Nov-1994  deraadt ioctl u_long cmd
 1.13 17-Sep-1994  deraadt sbus/* --> dev/*
deal with multiple bus types (start of vme/obio support)
 1.12 25-Aug-1994  deraadt sun4: don't use openprom
 1.11 21-Jul-1994  deraadt make X11R5 compile easier
 1.10 05-May-1994  deraadt branches: 1.10.2;
timeout and ndflush casts
 1.9 16-Apr-1994  deraadt my dumb bug of the week: keyboard repeat fritzed if you typed ^@
and repeated that character forever
 1.8 10-Apr-1994  deraadt small optimization
 1.7 09-Apr-1994  deraadt keyboard repeat code!
 1.6 03-Mar-1994  deraadt kbd is now a pseudo-device
 1.5 03-Mar-1994  deraadt fix comment
 1.4 27-Feb-1994  deraadt whoops
 1.3 27-Feb-1994  deraadt fake out KIOCLAYOUT
 1.2 11-Oct-1993  deraadt cons.c, zs.c: tty->t_stop doesn't exist here. I think it goes through d_stop
automatically now, but have not checked.
l_ioctl() has no last parameter 'p'
fb.c: move sys/fbio.h to machine/fbio.h
various: typecast parms for timeout() properly
zs.c: extra level of indir in cdevsw[]->d_ttys
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.2.1 22-Jul-1994  cgd from trunk.
 1.27.10.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2 21-Jul-1994  mycroft Clean up deleted files.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 21-Oct-2002  uwe branches: 1.2.6;
Clean-up kbd driver layers a bit more. Lift common code into the upper layer.
Add some wskbd TODO remarks (hi, martin).
 1.1 03-Oct-2002  uwe branches: 1.1.2;
First cut at PS/2 keyboard and mouse drivers that talk Sun firm events.
Console and Xsun for Mr.Coffee.
 1.1.2.3 11-Nov-2002  nathanw Catch up to -current
 1.1.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.1 03-Oct-2002  nathanw file kbd_pckbc.c was added on branch nathanw_sa on 2002-10-18 02:39:54 +0000
 1.2.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7 24-May-2022  andvar fix various typos in comment, documentation and log messages.
 1.6 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 07-Apr-2008  tsutsui branches: 1.4.2; 1.4.4;
Split device_t/softc, as following parents in sys/dev/sun.
 1.3 16-Nov-2005  uwe branches: 1.3.74;
ANSIify. Use uint<N>_t. Drop unnecessary includes.
Drop trailing whitespace.
 1.2 16-Jun-2005  jmc branches: 1.2.2; 1.2.8;
Rename a shadowed variable
 1.1 13-Mar-2004  bjh21 branches: 1.1.4;
Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.1.4.6 11-Dec-2005  christos Sync with head.
 1.1.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 13-Mar-2004  skrll file kbd_pckbport.c was added on branch ktrace-lwp on 2004-08-03 10:40:45 +0000
 1.2.8.1 22-Nov-2005  yamt sync with head.
 1.2.2.1 21-Jun-2006  yamt sync with head.
 1.3.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.4.1 16-May-2008  yamt sync with head.
 1.4.2.1 18-May-2008  yamt sync with head.
 1.4 21-Jul-1994  mycroft Clean up deleted files.
 1.3 05-May-1994  deraadt space/tab garple
 1.2 27-Feb-1994  deraadt fake out KIOCLAYOUT
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.54 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.53 16-Mar-2014  dholland branches: 1.53.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.52 19-Oct-2013  mrg - remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.51 27-Oct-2012  chs branches: 1.51.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.50 30-Jul-2012  christos branches: 1.50.2;
move cn_tab initializationt to cpu_startup
 1.49 24-Apr-2011  rmind branches: 1.49.4;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.48 28-Apr-2008  martin branches: 1.48.22; 1.48.28;
Remove clause 3 and 4 from TNF licenses
 1.47 19-Nov-2007  ad branches: 1.47.14; 1.47.16; 1.47.18;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.46 18-Oct-2007  joerg branches: 1.46.2;
Initialise the callbacks for tty.t_rstrt_ch in ttymalloc
as all drivers but Sun/SPARC's kd.c use the same arguments.
Separate callout_reset into callout_schedule and the initial
callout_setfunc using that.
 1.45 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.44 09-Jul-2007  ad branches: 1.44.8; 1.44.10; 1.44.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.43 04-Mar-2007  christos branches: 1.43.2; 1.43.4; 1.43.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.42 16-Feb-2007  ad branches: 1.42.2;
More spllowersoftclock() fallout.
 1.41 01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks!
 1.40 23-Jul-2006  ad branches: 1.40.4; 1.40.6;
Use the LWP cached credentials where sane.
 1.39 14-May-2006  elad integrate kauth.
 1.38 11-Dec-2005  christos branches: 1.38.4; 1.38.6; 1.38.8; 1.38.10; 1.38.12;
merge ktrace-lwp.
 1.37 16-Nov-2005  uwe Drop trailing whitespace.
 1.36 14-Nov-2005  uwe ANSIify. Same code is generated.
While here, collect in one place prototypes that were scattered
throughout the file, apply static to prom_cn* consistently.
 1.35 06-Sep-2005  kleink branches: 1.35.6;
Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges. Noted by David Holland in PR kern/31126.
 1.34 30-Jun-2005  macallan branches: 1.34.2;
Allow sparc64-style attachment of mouse and keyboard via zstty, needed for
wscons support.
Reviewed by uwe.
 1.33 03-Jun-2005  martin Sprinkle some const
 1.32 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.31 16-Mar-2004  pk Use prom_getoption() and drop home-grown string-to-integer conversion code.
 1.30 27-Aug-2003  uwe cc_callout does not belong to struct cons_channel, as it's only used
by sparc for PROM console input channel. Demote it to kd.c as a
static variable.

While there, use callout_schedule instead of callout_reset to
reschedule the PROM polling callout, and init prom_cons_channel
statically.
 1.29 27-Aug-2003  uwe Kill __P().
 1.28 25-Aug-2003  uwe Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.27 24-Aug-2003  uwe #include "opt_rcons.h"
 1.26 15-Jul-2003  lukem __KERNEL_RCSID()
 1.25 29-Jun-2003  fvdl branches: 1.25.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.24 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.23 23-Oct-2002  jdolecek merge kqueue branch into -current

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

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

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.22 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.21 17-Mar-2002  atatat branches: 1.21.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.20 26-Sep-2001  eeh branches: 1.20.4;
getprop* -> PROM_getprop*
 1.19 11-Jun-2001  pk branches: 1.19.2; 1.19.4;
Use NFB from "fb.h" to include console framebuffer support.
 1.18 26-May-2001  pk Pull in "opt_kgdb.h"; see PR#13036.
 1.17 02-May-2001  scw Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.16 02-Nov-2000  eeh branches: 1.16.2;
Adapt to new line discipline scheme.
 1.15 12-Oct-2000  christos add missing kd_attach_input routine.
someone needs to clean this shit up.
 1.14 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.13 04-Jul-2000  pk Pass correct argument to the console channel close routine.
 1.12 21-May-2000  eeh branches: 1.12.4;
Need to provide a consdev to the cons_attach_input call now.
 1.11 19-May-2000  eeh Fix the sparc64 console.

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

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

Have the keyboard driver take over the console when it attaches on a
serial port. When a serial port detects a keyboard and attaches the
keyboard driver, it needs to provide a set of consdev vectors. They
keyboard driver will use those to send I/O to the keyboard and mouse.
 1.10 24-Mar-2000  hannken Fix typos from last commit (callout).
 1.9 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.8 20-Mar-2000  pk Call rcons_ttyinit() on first open.
 1.7 19-Mar-2000  pk Revise console device handling:
* do not require a `zs' driver for console handling
* run the console on PROM primitives until a device recognises
itself as a console device during normal autoconfiguration.
* allow (keyboard) devices to take over the input channel of
the PROM primitive-based console device.

As a result, consinit() is much simplified and does no longer have
to "detect" devices to setup a working console device. This complexity
has moved to individual drivers which interpret the PROM information
after they have attached to decide whether or not to act as a console.
 1.6 06-Mar-2000  thorpej - Implement cnbell() -- ring the console bell. The cn_bell entrypoint
is optional.
- Add cn_bell to statically allocated consdevs as appropriate.
 1.5 05-Aug-1999  thorpej branches: 1.5.2;
Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied. Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

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

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX. This platforms still have this bug until their
XXX spl*() functions are fixed.
 1.4 14-Feb-1999  pk Use the PROMLIB interface.
 1.3 08-Jan-1998  mrg don't call fb_unblank if NFB < 0
 1.2 03-Dec-1997  mjacob handle case of no keyboard configured
 1.1 18-Oct-1997  gwr Use common zs code.
 1.5.2.2 22-Nov-2000  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.12.4.1 05-Jul-2000  thorpej Pull up rev. 1.13 (pk):
Pass correct argument to the console channel close routine.
 1.16.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.19.4.4 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.19.4.3 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.19.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.19.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.19.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.19.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.19.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.4.4 11-Nov-2002  nathanw Catch up to -current
 1.20.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.20.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.20.4.1 26-Sep-2001  nathanw file kd.c was added on branch nathanw_sa on 2002-04-01 07:42:42 +0000
 1.21.4.1 19-May-2002  gehenna Add device switch.
Replace the access to devsw table and the hard-coded majors with devsw API.
 1.25.2.6 11-Dec-2005  christos Sync with head.
 1.25.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.25.2.4 04-Feb-2005  skrll Adapt to 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.34.2.6 07-Dec-2007  yamt sync with head
 1.34.2.5 27-Oct-2007  yamt sync with head.
 1.34.2.4 03-Sep-2007  yamt sync with head.
 1.34.2.3 26-Feb-2007  yamt sync with head.
 1.34.2.2 30-Dec-2006  yamt sync with head.
 1.34.2.1 21-Jun-2006  yamt sync with head.
 1.35.6.1 22-Nov-2005  yamt sync with head.
 1.38.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.38.10.3 13-May-2006  elad sprinkle some #include <sys/kauth.h> in files that use kauth kpi but
don't include it yet. hopefully this will prevent some fallout.
 1.38.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.38.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.38.8.2 11-Aug-2006  yamt sync with head
 1.38.8.1 24-May-2006  yamt sync with head.
 1.38.6.1 01-Jun-2006  kardel Sync with head.
 1.38.4.1 09-Sep-2006  rpaulo sync with head
 1.40.6.1 22-Oct-2006  yamt sync with head
 1.40.4.1 18-Nov-2006  ad Sync with head.
 1.42.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.43.10.1 03-Oct-2007  garbled Sync with HEAD
 1.43.4.1 11-Jul-2007  mjf Sync with head.
 1.43.2.3 03-Dec-2007  ad Sync with HEAD.
 1.43.2.2 23-Oct-2007  ad Sync with head.
 1.43.2.1 15-Jul-2007  ad Sync with head.
 1.44.14.2 21-Nov-2007  bouyer Sync with HEAD
 1.44.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.44.10.2 09-Jan-2008  matt sync with HEAD
 1.44.10.1 06-Nov-2007  matt sync with HEAD
 1.44.8.2 21-Nov-2007  joerg Sync with HEAD.
 1.44.8.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.46.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.47.18.1 16-May-2008  yamt sync with head.
 1.47.16.1 18-May-2008  yamt sync with head.
 1.47.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.48.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.48.22.1 31-May-2011  rmind sync with head
 1.49.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.49.4.1 30-Oct-2012  yamt sync with head
 1.50.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.50.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.51.2.1 18-May-2014  rmind sync with head
 1.53.2.1 10-Aug-2014  tls Rebase.
 1.8 27-Jul-1998  mrg these have moved to sys/dev/sbus.
 1.7 24-Jul-1998  pk Remove conditionals on SUN4C+SUN4M.
A few cosmetic changes.
 1.6 07-Apr-1998  pk The bus space functions now take care of "pass-through" methods.
 1.5 21-Mar-1998  pk Switch to a bus_space(9)-based device attachment scheme.
The dma & lebuffer devices behave like busses to accommodate the
OBP layout. For practical purposes, they are implemented as
Sbus "extensions".
 1.4 12-Jan-1998  thorpej Update for changes to config.
 1.3 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.2 23-Mar-1997  pk Clamp burst sizes to maximum value of parent.
Reset ledma from leattach().
 1.1 06-Dec-1996  pk Special Lance buffer glue.
 1.4 27-Jul-1998  mrg these have moved to sys/dev/sbus.
 1.3 21-Mar-1998  pk Switch to a bus_space(9)-based device attachment scheme.
The dma & lebuffer devices behave like busses to accommodate the
OBP layout. For practical purposes, they are implemented as
Sbus "extensions".
 1.2 10-Mar-1997  pk Add a field indicating this instance has attached to an `le', so we
can have a go at matching le's and lebuffer's on machines where the
PROM does not provide a parent/child relationship.
 1.1 06-Dec-1996  pk branches: 1.1.6;
Special Lance buffer glue.
 1.1.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.4 28-Jul-1998  pk Magma driver has been moved to <dev/sbus>.
 1.3 03-Jun-1998  pk Update from Iain on the parallel port stuff.
 1.2 20-May-1998  pk Do not assume that a parallel component is always configured.
Squash compiler warnings if MAGMA_DEBUG is on.
 1.1 19-May-1998  pk Magma SBus serial & parallel port driver from Iain Hibbert.
 1.3 28-Jul-1998  pk Magma driver has been moved to <dev/sbus>.
 1.2 07-Jun-1998  pk Update from Iain for the parallel port stuff.
 1.1 19-May-1998  pk Magma SBus serial & parallel port driver from Iain Hibbert.
 1.11 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.10 20-Oct-2000  pk branches: 1.10.4; 1.10.8;
Add new-line to md attach message.
 1.9 17-Mar-1999  sommerfe branches: 1.9.8;
defopt MINIROOTSIZE
 1.8 06-Jun-1998  mrg sync with other md_root.c files.
 1.7 05-Jun-1998  mrg make this work with new md root stuff.
 1.6 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.5 28-Dec-1996  pk branches: 1.5.10;
rename: ramdisk => md
 1.4 09-Dec-1996  thorpej Copyright assigned to The NetBSD Foundation.
 1.3 13-Oct-1996  christos backout previous kprintf change
 1.2 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.1 20-Jun-1996  pk memory disk driver hooks to pass on the root filesystem bits.
Note: this file is called `md_root.c' in anticipation of the forthcoming
`rd' => `md' rename.
 1.5.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.8.1 28-Feb-2002  nathanw Catch up to -current.
 1.10.4.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.11 18-Oct-1997  gwr Use common zs code.
 1.10 12-Sep-1996  mrg update these for poll(2) changes.
 1.9 30-May-1996  pk event_var.h changed location.
 1.8 01-Apr-1996  christos Eliminated dependencies on dev_conf.h
 1.7 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.6 25-Feb-1996  pk Use CPU-type macros
 1.5 29-Aug-1995  pk Sun4s must set baud rate on the mouse port (from Jason Thorpe).
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 02-Nov-1994  deraadt ioctl u_long cmd
 1.2 21-Jul-1994  deraadt make X11R5 compile easier
 1.1 02-Oct-1993  deraadt branches: 1.1.2;
Chris Torek's sparc port. Missing lots of things.
 1.1.2.1 22-Jul-1994  cgd from trunk.
 1.2 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.1 03-Oct-2002  uwe branches: 1.1.2; 1.1.8;
First cut at PS/2 keyboard and mouse drivers that talk Sun firm events.
Console and Xsun for Mr.Coffee.
 1.1.8.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.1 03-Oct-2002  nathanw file ms_pckbc.c was added on branch nathanw_sa on 2002-10-18 02:39:54 +0000
 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 08-Sep-2011  jakllsch branches: 1.8.2; 1.8.12;
Another copy/paste problem with a function name in a error printf.
 1.7 08-Sep-2011  jakllsch Correct copy/paste of function name in error printf.
 1.6 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.5 17-Jan-2009  he Use firm_gettime() to retain compatibility with old firm_event. From amiga.
 1.4 07-Apr-2008  tsutsui branches: 1.4.4; 1.4.12;
Split device_t/softc, as following parents in sys/dev/sun.
 1.3 07-Jun-2006  kardel branches: 1.3.60;
convert to timecounters (from branch simonb-timecounters)
 1.2 16-Nov-2005  uwe branches: 1.2.4; 1.2.6; 1.2.8; 1.2.14;
ANSIify. Use uint<N>_t. Drop unnecessary includes.
Drop trailing whitespace.
 1.1 13-Mar-2004  bjh21 branches: 1.1.4; 1.1.18; 1.1.26;
Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.1.26.1 22-Nov-2005  yamt sync with head.
 1.1.18.1 21-Jun-2006  yamt sync with head.
 1.1.4.5 11-Dec-2005  christos Sync with head.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 13-Mar-2004  skrll file ms_pckbport.c was added on branch ktrace-lwp on 2004-08-03 10:40:45 +0000
 1.2.14.1 19-Jun-2006  chap Sync with head.
 1.2.8.1 26-Jun-2006  yamt sync with head.
 1.2.6.1 27-May-2006  kardel convert to timecounters
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.60.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.4.1 04-May-2009  yamt sync with head.
 1.8.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.8.2.1 30-Oct-2012  yamt sync with head
 1.77 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.76 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.75 24-Apr-2021  thorpej branches: 1.75.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.74 24-Mar-2013  jdc branches: 1.74.50;
Check if sbus is defined in the kernel configuration before using it.
From Taylor R Campbell.
 1.73 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.72 01-Jul-2011  dyoung branches: 1.72.2; 1.72.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.71 17-May-2008  macallan more device_t-ification
 1.70 28-Apr-2008  martin branches: 1.70.2;
Remove clause 3 and 4 from TNF licenses
 1.69 16-Nov-2005  uwe branches: 1.69.74; 1.69.76; 1.69.78;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.68 26-Aug-2005  drochner branches: 1.68.6;
s/locdesc_t/int/g
 1.67 30-Jun-2005  drochner branches: 1.67.2;
adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes
 1.66 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.65 27-Jun-2004  pk Always use `full bus space'. In order to implement this more efficiently,
require that all bus tags have pointers to bus_space_read/write functions,
i.e. no run-time hunting for the first "upstream" implementation.
Since this changes the way bus tags should be constructed it makes sense
to do the same thing for the rest of the bus space methods.
So, now bus space tags are generally constructed by copying the parent's bus
tag and then overriding the methods that the bus driver needs to handle,
instead of starting with an empty bus tag and fiiling in only the fields needed.
 1.64 15-Jul-2003  lukem __KERNEL_RCSID()
 1.63 03-May-2003  wiz branches: 1.63.2;
DMA, not dma nor Dma.
 1.62 30-Apr-2003  martin Make this compile with __FULL_SPARC_BUS_SPACE,
from Steve Rumble in PR 21398.
 1.61 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.60 03-Jan-2003  mrg part one of bus_space(9) fixes to enable bus spaces to override the
bus_space_{read,write}_[1248]() functions, which will allow 16-bit
PCMCIA support to work without additional hacks in MI drivers.
this option is not enabled yet.
 1.59 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.58 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.57 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.56 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.55 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.54 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.53 25-Aug-2002  thorpej Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.52 11-Apr-2002  pk branches: 1.52.2;
Pass fully encoded bus addresses in the attach arguments.
 1.51 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.50 24-Sep-2001  eeh branches: 1.50.4;
Change bus_space_mmap() signature to the official one.
 1.49 25-Jul-2000  pk branches: 1.49.2; 1.49.4;
Add `dma' to the `early device' list, since we need it before an `esp'
is configured. Traced and tested by Julian Coleman.
 1.48 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.47 11-Jan-2000  pk branches: 1.47.4;
Remove old-style boot device recognition.
 1.46 28-Jun-1999  pk branches: 1.46.2;
More ugly code to force early configuration of the sun4 on-board timer.
 1.45 05-Sep-1998  eeh branches: 1.45.8;
Remove function naming conflict.
 1.44 21-Aug-1998  pk Convert to [pv]addr_t.
 1.43 07-Apr-1998  pk The bus space functions now take care of "pass-through" methods.
 1.42 29-Mar-1998  pk Implement `_obio_bus_map()' and insert it into the obio bus' bus tag.
Remove obio_bus_probe().
 1.41 23-Mar-1998  pk Only print interesting interrupt levels.
 1.40 21-Mar-1998  pk Switch to a bus_space(9)-based device attachment scheme.

- device attachment arguments contain bus-specific
address and interrupt levels.

- devices must call back on bus map functions to get their
addresses and interrupt levels translated properly.

- sun4m's obio bus is treated like an Sbus slot.

- the sun4-style obio bus has its own attach arguments
and map functions.
 1.39 25-Jan-1998  pk All VME stuff is gone from here.
 1.38 12-Jan-1998  thorpej Update for changes to config.
 1.37 29-Jul-1997  fair %x -> 0x%x
 1.36 10-Jun-1997  pk vme_establishintr: remove SUN4 arch check; this now works on sun4m as well.
 1.35 07-Jun-1997  pk Use the `ranges' property to deal with VMEbus address spaces.
 1.34 24-May-1997  pk Use `rr_iospace' to track the MMU page type bits. On sun4c/sun4m the
iospace value is always learned from the PROM; on sun4, we infer it
from the BUS_* parameters.

This obsoletes the `bustype' argument in bus_tmp().
 1.33 18-May-1997  pk Remove bus_tmp(); it's just a special case of mapdev().
 1.32 18-May-1997  pk A bit of framework for sun4m VME busses.
 1.31 08-Apr-1997  pk Move "range" property description out of generic `romaux'.
Allocate room for this property when needed in bus attachment.
 1.30 10-Mar-1997  pk Replace `cpumod' with `cpuinfo.cpu_type' equivalents.
 1.29 10-Dec-1996  pk branches: 1.29.6;
Not all sun4m's have an `auxio'.
 1.28 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.27 13-Oct-1996  christos backout previous kprintf change
 1.26 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.25 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.24 18-May-1996  mrg don't set tmp twice.
 1.23 05-Apr-1996  chuck make netbsd/sparc boot on sun4 once again. the sun4m changes introduced
config lines for obio0 devices without addresses (thus cf->cf_loc[0] took
the default value of -1). we now ignore these entries on a sun4 since
they could never be valid (eliminates a 'panic:alignment' fault at bootup).
 1.22 31-Mar-1996  pk Handle sun4m `obio' devices.
Cleanup `#if defined(SUN4*)' mess.
 1.21 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.20 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.19 12-Jan-1996  chuck improved handling of mapping of devices who's registers do not reside on
page boundaries:
- change bus_tmp() to include the offset from the start of page in the
returned KVA [rather than forcing each driver to add it back in
individually]
- changed bus_map() to include the offset from the start of page in the
the returned value if a mapping is found in the PROM's KVA area
- clarified a few comments
 1.18 11-Jan-1996  pk Correct page frame calculation after mapdev() interface change.
 1.17 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.16 18-Aug-1995  pk Use actual bus names (matches Chuck's bootpath code).
 1.15 27-May-1995  pk Propagate bootpaths
 1.14 25-Apr-1995  pk Remove duplication of code from subr_autoconf.c
 1.13 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.12 01-Mar-1995  pk Better 4/100 support.
 1.11 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.10 25-Nov-1994  deraadt wzero/wcopy moved to machdep.c
 1.9 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.8 05-Nov-1994  deraadt only print the vec if needed
 1.7 02-Nov-1994  deraadt let busmatch print the level/vec
 1.6 02-Nov-1994  deraadt add wcopy/wzero, and ack VME using ldcontrob
 1.5 26-Oct-1994  deraadt working vme16/32 support
 1.4 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.3 02-Oct-1994  deraadt sun4/300 support works
 1.2 17-Sep-1994  deraadt obio bus driver, for dealing with devices on the sun4 motherboard.
 1.1 24-Aug-1994  deraadt first cut at sun4 on-board io bus
 1.29.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.45.8.1 01-Jul-1999  thorpej Sync w/ -current.
 1.46.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.47.4.1 26-Jul-2000  pk Pull up revision 1.49 from trunk:

Add `dma' to the `early device' list, since we need it before an `esp'
is configured. Traced and tested by Julian Coleman.
 1.49.4.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.49.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.49.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.49.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.49.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.49.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.50.4.7 03-Jan-2003  thorpej Sync with HEAD (again).
 1.50.4.6 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.50.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.50.4.4 27-Aug-2002  nathanw Catch up to -current.
 1.50.4.3 17-Apr-2002  nathanw Catch up to -current.
 1.50.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.50.4.1 24-Sep-2001  nathanw file obio.c was added on branch nathanw_sa on 2002-04-01 07:42:42 +0000
 1.52.2.1 31-Aug-2002  gehenna catch up with -current.
 1.63.2.6 11-Dec-2005  christos Sync with head.
 1.63.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.63.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.63.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.63.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.63.2.1 03-Aug-2004  skrll Sync with HEAD
 1.67.2.1 21-Jun-2006  yamt sync with head.
 1.68.6.1 22-Nov-2005  yamt sync with head.
 1.69.78.2 04-May-2009  yamt sync with head.
 1.69.78.1 16-May-2008  yamt sync with head.
 1.69.76.1 18-May-2008  yamt sync with head.
 1.69.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.70.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.72.12.2 23-Jun-2013  tls resync from head
 1.72.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.72.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.72.2.1 30-Oct-2012  yamt sync with head
 1.74.50.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.74.50.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.74.50.4 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.74.50.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.74.50.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.74.50.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.75.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.14 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.13 09-Jul-2000  pk Re-arrange headers; drop <machine/cpu.h>.
 1.12 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.11 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.10 04-Apr-2000  pk branches: 1.10.4;
Use copyin/copyout to get a colormap from/to user space.
Also, prepare for the case of a colormap maintained in kernel space.
 1.9 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.8 15-Dec-1999  garbled add <machine/tctrl.h> where needed.
Add some undocumented commands to the ts102 registers file, and fix a few
typos.

Modifications to tctrl.c:

Add entrypoints to driver for open/close/ioctl/poll.
Make device work with apmd. (still no support for suspend/sleep)
Make device work with ENVSYS API.
Slightly restructure handling of events.
Add function to make microcontroller requests.
 1.7 12-Nov-1999  matt make this compile under current
 1.6 26-Aug-1999  thorpej branches: 1.6.2; 1.6.4; 1.6.8;
Initialize the default colormap to 0 == black, all others == full white.
 1.5 11-Aug-1999  matt do a little colormap manipulation. use the tft power hooks in tctrl
 1.4 02-Aug-1999  matt Add video blanking support. It does not power-down the TFT
since that requires talking to the H8 microcontroller and
that support is not yet done.
 1.3 02-Aug-1999  matt branches: 1.3.2;
Colormaps now work. Besides a small fencepost error, the real problem
is that the Tadpole 3GX tech-ref-man was WRONG. The RAMDAC registers
at at 4 byte offsets, not 8. Once that was discovered, all the code
just worked.
 1.2 01-Aug-1999  matt fix a few mmap bugs. pretend to be a cg3 and implement a hack
to fack the Xsun server to believe that the p9100's framebuffer
is really a cg3's. So if only colormaps worked, X would be able
to run.
 1.1 01-Aug-1999  matt Initial stab at a P9100 console FB driver for the Tadpole 3GX.
It supports RASTERCONSOLE only and the colormap support is
broken (the hardware doesn't seem to be doing what the tech.
docs. say it should be doing). But it is usable as a console
(but with blue on white as the only color choice). I figured
I'd check it in since it is somewhat usable and someone else
might figure what I screwed up in the color map support.
 1.3.2.2 02-Aug-1999  thorpej Update from trunk.
 1.3.2.1 02-Aug-1999  thorpej file p9100.c was added on branch chs-ubc2 on 1999-08-02 20:09:13 +0000
 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.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.10.4.2 22-Dec-2001  he Apply patch (requested by cyber):
The PROM does not set up the frame buffer if it is not the console.
We should not try to configure it in that case. This makes serial
console work on the SPARCbook, and fixes PR#14213.
Patch comes from revision 1.7 of sys/dev/sbus/p9100.c.
 1.10.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.21 04-Dec-2021  andvar s/establised/established/ in struct variable name. Also fixed typos in comments.
 1.20 22-Nov-2020  thorpej malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.19 13-Oct-2012  jdc branches: 1.19.50;
Adapt to the changed signature of pckbc_cnattach().
 1.18 18-Mar-2008  dogcow branches: 1.18.38; 1.18.48;
pesky missing spaces.
 1.17 15-Mar-2008  cube Split device_t and softc for pckbc(4) and its attachments.
 1.16 03-Dec-2007  ad branches: 1.16.10; 1.16.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.15 17-Oct-2007  garbled branches: 1.15.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.14 09-Jul-2007  ad branches: 1.14.8; 1.14.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.13 16-Nov-2005  uwe branches: 1.13.30; 1.13.32; 1.13.38;
ANSIify. Use uint<N>_t. Drop unnecessary includes.
Drop trailing whitespace.
 1.12 17-Mar-2004  martin branches: 1.12.16; 1.12.24;
Adapt to pckbc -> pckbport changes
 1.11 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.10 10-Feb-2004  bjh21 __HAVE_NWSCONS seems to mean, "If this port uses pckbc(4), it also uses
sys/dev/pckbc/files.pckbc." This is true of sparc, so define __HAVE_NWSCONS,
and remove the code in pckbc_machdep_cnattach() that was conditional on its
not being defined and that is no longer needed (since with __HAVE_NWSCONS,
pckbc_cnattach() will call pckbd_cnattach() itself if necessary).
 1.9 12-Dec-2003  martin Use the new split hard/softinterrupt handlers to avoid running mouse/keyboard
input functions to be run at IPL_SERIAL (instead of the intended IPL_TTY).
 1.8 15-Jul-2003  lukem __KERNEL_RCSID()
 1.7 10-Dec-2002  pk branches: 1.7.6;
Remove the `flags' argument from bus_intr_establish().
 1.6 03-Oct-2002  uwe Search children of the "8042" node to check if keyboard is the stdin.
 1.5 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.4 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 18-Feb-2002  uwe branches: 1.2.2;
Switch to shared EBus headers in dev/ebus.
 1.1 31-Jan-2002  uwe branches: 1.1.2;
Driver for pckbc in javastations. Not finished yet.
 1.1.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.1.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 31-Jan-2002  jdolecek file pckbc_js.c was added on branch kqueue on 2002-02-11 20:09:03 +0000
 1.2.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.1 18-Feb-2002  nathanw file pckbc_js.c was added on branch nathanw_sa on 2002-02-28 04:12:02 +0000
 1.7.6.4 11-Dec-2005  christos Sync with head.
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.12.24.1 22-Nov-2005  yamt sync with head.
 1.12.16.5 24-Mar-2008  yamt sync with head.
 1.12.16.4 17-Mar-2008  yamt sync with head.
 1.12.16.3 07-Dec-2007  yamt sync with head
 1.12.16.2 03-Sep-2007  yamt sync with head.
 1.12.16.1 21-Jun-2006  yamt sync with head.
 1.13.38.1 03-Oct-2007  garbled Sync with HEAD
 1.13.32.1 11-Jul-2007  mjf Sync with head.
 1.13.30.2 03-Dec-2007  ad Sync with HEAD.
 1.13.30.1 01-Jul-2007  ad Adapt to callout API change.
 1.14.10.3 23-Mar-2008  matt sync with HEAD
 1.14.10.2 09-Jan-2008  matt sync with HEAD
 1.14.10.1 06-Nov-2007  matt sync with HEAD
 1.14.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.15.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.16.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.16.10.1 24-Mar-2008  keiichi sync with head.
 1.18.48.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.18.38.1 30-Oct-2012  yamt sync with head
 1.19.50.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.3 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.2 05-Oct-1997  thorpej branches: 1.2.16;
Copyright assigned to The NetBSD Foundation.
 1.1 27-Feb-1996  thorpej branches: 1.1.12;
First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.16.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.19 29-Jul-2012  matt Fix more -fno-common fallout.
 1.18 17-Jul-2011  mrg branches: 1.18.2;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.17 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.16 15-Jul-2003  lukem branches: 1.16.16; 1.16.24;
__KERNEL_RCSID()
 1.15 02-Oct-2002  thorpej branches: 1.15.6;
Add trailing ; to CFATTACH_DECL.
 1.14 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.11 28-Apr-1999  fair branches: 1.11.16; 1.11.20;
Add a 1 second delay to powerdown sequence to prevent the OpenBoot PROMs
from getting control and reporting a "powerdown failure", per PR#7487
 1.10 06-Jun-1998  thorpej branches: 1.10.8;
Only attempt the powerdown if the power register was mapped.
 1.9 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.8 12-Jan-1998  thorpej Update for changes to config.
 1.7 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.6 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 07-Jun-1996  thorpej Squish a couple of rogue $Id's..
 1.2 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.1 31-Mar-1996  pk Diddling of the `power' bit in machine control register (Aaron).
 1.10.8.1 28-Apr-1999  perry branches: 1.10.8.1.2;
pullup 1.10->1.11 (fair)
 1.10.8.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.20.2 18-Oct-2002  nathanw Catch up to -current.
 1.11.20.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.11.16.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.15.6.4 11-Dec-2005  christos Sync with head.
 1.15.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.6.1 03-Aug-2004  skrll Sync with HEAD
 1.16.24.1 22-Nov-2005  yamt sync with head.
 1.16.16.1 21-Jun-2006  yamt sync with head.
 1.18.2.1 30-Oct-2012  yamt sync with head
 1.6 29-Jul-2012  matt Fix more -fno-common fallout.
 1.5 16-Nov-2005  uwe branches: 1.5.112;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.4 21-Mar-1998  pk branches: 1.4.48; 1.4.64; 1.4.72;
Account for changed bus attachment scheme.
 1.3 07-Jun-1996  thorpej Squish a couple of rogue $Id's..
 1.2 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.1 31-Mar-1996  pk Diddling of the `power' bit in machine control register (Aaron).
 1.4.72.1 22-Nov-2005  yamt sync with head.
 1.4.64.1 21-Jun-2006  yamt sync with head.
 1.4.48.1 11-Dec-2005  christos Sync with head.
 1.5.112.1 30-Oct-2012  yamt sync with head
 1.5 13-Apr-1999  ad Fonts for rcons are now handled in sys/dev/wsfont.
 1.4 22-Mar-1998  pk branches: 1.4.10;
Lift the tilde a bit.
 1.3 29-Nov-1995  pk Must change `u_long' to `u_int32_t' as Jason pointed out.
 1.2 08-Oct-1995  pk Fill in `ascent' values correctly.
 1.1 05-Oct-1995  pk Machine dependent RASTERCONSOLE font definition to be passed to rcons_init().
 1.4.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.23 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

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

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.22 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.21 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.20 02-Jan-2020  thorpej - Use todr_gettime_ymdhms / todr_settime_ymdhms.
- Allocate the todr_handle with the softc, not separately.
 1.19 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.18 18-Jul-2011  mrg branches: 1.18.54;
convert the remaining sparc drivers to CFATTACH_DECL_NEW/cfdata_t/device_t.
(cgsix_obio.c was only partially converted with the rest of the cgsix code
when it was changed some time ago.)
 1.17 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.16 12-Dec-2009  tsutsui 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.15 20-Sep-2009  tsutsui - use device_t and cfdriver_t
- use device_private() and device_xname()
- use proper types or variables for device_t/softc
 1.14 04-Sep-2006  gdamore branches: 1.14.60;
Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.13 03-Sep-2006  uwe Catch up with __HAVE_GENERIC_TODR changes.
Compile-tested only.
 1.12 16-Nov-2005  uwe branches: 1.12.4; 1.12.8;
ANSIify. Declare as static everything we don't need to export.
 1.11 05-Jun-2005  jdc branches: 1.11.2; 1.11.8;
Add volatile to make rtc_{g|s}ettime match todr_chip_handle_t.
 1.10 15-Jul-2003  lukem __KERNEL_RCSID()
 1.9 03-Dec-2002  uwe branches: 1.9.6;
The chip treats weekday 1 == Sunday, correct dt_wday adjustment logic
appropriately. NB: the old code would never write weekday zero that,
I've been told, might cause the RTC to reset.
Pointed out by kenh.
 1.8 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.7 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.4 04-Apr-2002  uwe Fix error message.
 1.3 12-Mar-2002  uwe Drop ebus_bus_map(), use plain bus_space_map() instead.
 1.2 18-Feb-2002  uwe Switch to shared EBus headers in dev/ebus.
 1.1 11-Dec-2001  uwe branches: 1.1.2; 1.1.4;
rtc (ds1287a) time of day clock at ebus.
 1.1.4.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.1.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 11-Dec-2001  thorpej file rtc.c was added on branch kqueue on 2002-01-10 19:48:47 +0000
 1.1.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 11-Dec-2001  nathanw file rtc.c was added on branch nathanw_sa on 2002-01-08 00:27:35 +0000
 1.9.6.5 11-Dec-2005  christos Sync with head.
 1.9.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.8.1 22-Nov-2005  yamt sync with head.
 1.11.2.2 30-Dec-2006  yamt sync with head.
 1.11.2.1 21-Jun-2006  yamt sync with head.
 1.12.8.1 14-Sep-2006  yamt sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.14.60.1 11-Mar-2010  yamt sync with head
 1.18.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.84 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.83 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.82 10-May-2021  thorpej branches: 1.82.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.81 24-Apr-2021  thorpej branches: 1.81.2; 1.81.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.80 22-Nov-2020  thorpej branches: 1.80.2;
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.79 10-Nov-2019  chs branches: 1.79.8;
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.78 23-Sep-2012  jdc branches: 1.78.38;
Wrap sbuserr_handler and sbus_error with:
#if (defined(SUN4M) && !defined(MSIIEP)) || defined(SUN4D)
to give them the same scope as the definitions in ../sparc/intr.c.
Allows SUN4C-only kernels to compile.
OK mrg
 1.77 29-Jul-2012  matt branches: 1.77.2;
Fix more -fno-common fallout.
 1.76 30-Jan-2012  mrg avoid writing 1 byte beyond the end of the string promlib.c has given us.
instead of forcing a nul byte afterwards, KASSERT() that the final byte
already is a nul. if there are broken proms... well, we can fix them.

this, plus one more change, allows my SS20 to boot multiuser.
 1.75 01-Jul-2011  dyoung branches: 1.75.2; 1.75.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.74 03-Jan-2010  mrg add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.73 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.72 18-Mar-2009  cegger bzero -> memset
 1.71 16-Dec-2008  christos branches: 1.71.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.70 13-Jun-2008  cegger branches: 1.70.4;
use device_lookup_private to get softc
 1.69 17-May-2008  macallan branches: 1.69.2;
more device_t-ification
 1.68 28-Apr-2008  martin branches: 1.68.2;
Remove clause 3 and 4 from TNF licenses
 1.67 07-Jun-2006  kardel branches: 1.67.60; 1.67.62; 1.67.64;
convert to timecounters (from branch simonb-timecounters)
 1.66 23-Feb-2006  thorpej branches: 1.66.2; 1.66.8;
Use device_parent().
 1.65 16-Nov-2005  uwe branches: 1.65.2; 1.65.4; 1.65.6;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.64 04-Jun-2005  tsutsui branches: 1.64.2; 1.64.8;
Add const.
 1.63 13-Dec-2004  chs for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.62 05-Jul-2004  pk Use bus_space_tag_alloc().
 1.61 27-Jun-2004  pk Always use `full bus space'. In order to implement this more efficiently,
require that all bus tags have pointers to bus_space_read/write functions,
i.e. no run-time hunting for the first "upstream" implementation.
Since this changes the way bus tags should be constructed it makes sense
to do the same thing for the rest of the bus space methods.
So, now bus space tags are generally constructed by copying the parent's bus
tag and then overriding the methods that the bus driver needs to handle,
instead of starting with an empty bus tag and fiiling in only the fields needed.
 1.60 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.59 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.58 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.57 15-Jul-2003  lukem __KERNEL_RCSID()
 1.56 01-Jan-2003  thorpej branches: 1.56.2;
Use aprint_normal() for cfprint routines.
 1.55 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.54 10-Dec-2002  pk bus_intr_establish() now takes an optional `fast trap' handler argument.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.53 06-Dec-2002  pk Pass the `device class interrupt level' on to intr_establish() and use to
raise the ipl in the interrupt handlers to the appropriate level. This avoids
interrupt handler interference if one of the devices actually interrupts at
a lower hardware level than the maximum level assined to a device class.

Based on code from Art Grabowski in openbsd.
 1.52 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.51 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.50 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.49 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.48 25-Aug-2002  thorpej Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.47 25-Aug-2002  thorpej Add a generic function to translate a device address using a
parent's "ranges" property, and use it.
 1.46 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.45 11-Mar-2002  pk branches: 1.45.4; 1.45.6;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.44 31-Dec-2001  uwe Now that sbus_bus_mmap was converted to do the proper address
translation, get rid of sbus_bus_addr. Since sbus_bus_addr is used by
framebuffer drivers that are shared with sparc64 we cannot just change
the callers to use BUS_ADDR() w/out coordinating the change with
sparc64 that uses a different calling protocol, so stub our
sbus_bus_addr to just return BUS_ADDR.
 1.43 20-Dec-2001  uwe Rewrite sbus_bus_mmap to conform to new signature and unbreak bus_space_mmap.
This fixes the problem with X server killing the kernel by writing to
the middle of physical memory instead of the frame buffer.
 1.42 05-Oct-2001  mrg branches: 1.42.4;
avoid a memory leak
 1.41 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.40 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.39 01-Nov-2000  eeh branches: 1.39.2; 1.39.4;
Pass on the sbus frequency.
 1.38 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.37 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.36 11-Jan-2000  pk branches: 1.36.4;
Remove old-style boot device recognition.
 1.35 14-Apr-1999  pk branches: 1.35.2;
Mask out 64-bit burst capability on sun4m's, since some models (SS20)
erroneously report this in their sbus properties.
 1.34 14-Feb-1999  pk branches: 1.34.2;
Use the PROMLIB interface.
 1.33 20-Sep-1998  pk Don't map sbus `registers' on sun4c (i.e. sbus @ mainbus); it's almost
certainly not the control space we want..
 1.32 19-Sep-1998  pk Map Sbus control registers.
 1.31 07-Sep-1998  pk Undo last change (we're passing the address of a pointer here).
 1.30 05-Sep-1998  eeh The `address' field from the prom is really an unsigned 32-bit value.
Make it so.
 1.29 05-Sep-1998  eeh Remove function naming conflict.
 1.28 30-Aug-1998  pk getpropA() => getprop().
 1.27 21-Aug-1998  pk Convert to [pv]addr_t.
 1.26 29-Jul-1998  pk Switch to new sbus attach arguments layout.
 1.25 27-Jul-1998  pk Get headers from <dev/sbus>
 1.24 18-Apr-1998  pk Skeleton code for the SBus expander box.
 1.23 07-Apr-1998  pk No need to export bus_intr_establish().
 1.22 07-Apr-1998  pk The bus space functions now take care of "pass-through" methods.
 1.21 29-Mar-1998  pk Fill in the bus tag's `bus_space_unmap' method.
 1.20 21-Mar-1998  pk Direct the Sbus bus map function through the bus tag.
 1.19 21-Mar-1998  pk Switch to a bus_space(9)-based device attachment scheme.

- device attachment arguments contain bus-specific
address and interrupt levels.

- devices must call back on bus map functions to get their
addresses and interrupt levels translated properly.

- sun4m's obio bus is treated like an Sbus slot.

- the sun4-style obio bus has its own attach arguments
and map functions.
 1.18 12-Jan-1998  thorpej Update for changes to config.
 1.17 01-Jun-1997  pk Set `rr_iospace' to PMAP_OBIO when translating relative sbus addresses.
 1.16 08-Apr-1997  pk Move "range" property description out of generic `romaux'.
Allocate room for this property when needed in bus attachment.
 1.15 10-Mar-1997  pk Replace `cpumod' with `cpuinfo.cpu_type' equivalents.
 1.14 10-Dec-1996  pk branches: 1.14.6;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 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.10 22-Apr-1996  abrown - Changed Sun4m DMA chip support to detect and use maximum available SBus
burst size when transferring data.
- Changed ledma attach code to pay attention to the PROM's notion of what
cable type is being used. Note that this patch does not fix the problem
recently discussed on port-sparc; in most cases the PROM doesn't know
what cable type is being used. The default is now TP rather than AUI,
though. A complete fix is forthcoming.
 1.9 31-Mar-1996  pk Add sbus_translate() to deal with slot address translations, including
new v3 PROM style "range" properties. This routine is also called from obio.c
(which can be viewed upon as just a another Sbus slot).
 1.8 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.7 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.6 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.5 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 02-Oct-1994  deraadt sun4/300 support works
 1.2 17-Sep-1994  deraadt sbus/* --> dev/*
deal with multiple bus types (start of vme/obio support)
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.14.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.34.2.1 14-Apr-1999  pk branches: 1.34.2.1.2;
Pull up rev 1.35 from trunk.
 1.34.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.35.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.35.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.36.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.39.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.39.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.39.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.39.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.39.2.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.39.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.42.4.7 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.42.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.42.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.42.4.4 27-Aug-2002  nathanw Catch up to -current.
 1.42.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.42.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.42.4.1 05-Oct-2001  nathanw file sbus.c was added on branch nathanw_sa on 2002-01-08 00:27:35 +0000
 1.45.6.1 22-Nov-2002  tron Pull up revision 1.46 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.45.4.1 31-Aug-2002  gehenna catch up with -current.
 1.56.2.6 11-Dec-2005  christos Sync with head.
 1.56.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.56.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.56.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.56.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.56.2.1 03-Aug-2004  skrll Sync with HEAD
 1.64.8.1 22-Nov-2005  yamt sync with head.
 1.64.2.1 21-Jun-2006  yamt sync with head.
 1.65.6.2 27-May-2006  kardel convert to timecounters (struct time gone)
 1.65.6.1 22-Apr-2006  simonb Sync with head.
 1.65.4.1 09-Sep-2006  rpaulo sync with head
 1.65.2.1 01-Mar-2006  yamt sync with head.
 1.66.8.1 19-Jun-2006  chap Sync with head.
 1.66.2.1 26-Jun-2006  yamt sync with head.
 1.67.64.3 11-Mar-2010  yamt sync with head
 1.67.64.2 04-May-2009  yamt sync with head.
 1.67.64.1 16-May-2008  yamt sync with head.
 1.67.62.2 17-Jun-2008  yamt sync with head.
 1.67.62.1 18-May-2008  yamt sync with head.
 1.67.60.3 17-Jan-2009  mjf Sync with HEAD.
 1.67.60.2 29-Jun-2008  mjf Sync with HEAD.
 1.67.60.1 02-Jun-2008  mjf Sync with HEAD.
 1.68.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.69.2.1 18-Jun-2008  simonb Sync with head.
 1.70.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.70.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.71.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.75.6.1 18-Feb-2012  mrg merge to -current.
 1.75.2.2 30-Oct-2012  yamt sync with head
 1.75.2.1 17-Apr-2012  yamt sync with head
 1.77.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.78.38.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.79.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.80.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.81.4.1 31-May-2021  cjep sync with head
 1.81.2.1 13-May-2021  thorpej Sync with HEAD.
 1.82.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.7 10-Mar-2024  rillig sparc/sbusreg: fix snprintb format for SBUS_AFSR_BITS
 1.6 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.5 07-Aug-2003  agc branches: 1.5.16; 1.5.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 19-Sep-1998  pk branches: 1.4.46;
Add a bunch of SBus control register definitions.
 1.3 14-Sep-1997  pk Collect sbus status and configuration registers in `struct sbusreg'.
 1.2 20-Nov-1994  deraadt branches: 1.2.14;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.14.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.46.4 11-Dec-2005  christos Sync with head.
 1.4.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.46.1 03-Aug-2004  skrll Sync with HEAD
 1.5.24.1 22-Nov-2005  yamt sync with head.
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.20 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.19 17-May-2008  macallan more device_t-ification
 1.18 28-Apr-2008  martin branches: 1.18.2;
Remove clause 3 and 4 from TNF licenses
 1.17 24-Dec-2005  perry branches: 1.17.74; 1.17.76; 1.17.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.16 11-Dec-2005  christos merge ktrace-lwp.
 1.15 04-Feb-2005  jmc branches: 1.15.6;
Do the same thing sparc64 does and redefine sbus_promaddr_to_handle to a static
inline'd function. This way prototypes for it still work in the master
dev/sbusvar.h header. Found when the recent de-_P'ing occured
 1.14 07-Aug-2003  agc branches: 1.14.8; 1.14.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.13 25-Aug-2002  thorpej branches: 1.13.6;
Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.12 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.11 21-Mar-2002  uwe branches: 1.11.4; 1.11.6;
Fix cast in sbus_promaddr_to_handle().
 1.10 20-Mar-2002  eeh Add sbus_promaddr_to_handle() to convert a prom address to a bus_space_handle_t.
 1.9 19-Sep-1998  pk branches: 1.9.26; 1.9.30;
Map Sbus control registers.
 1.8 29-Jul-1998  pk Lots of things have moved to <dev/sbus/sbusvar.h>
 1.7 07-Apr-1998  pk No need to export bus_intr_establish().
 1.6 21-Mar-1998  pk Direct the Sbus bus map function through the bus tag.
 1.5 21-Mar-1998  pk Sbus attach arguments and map function prototypes go here.
 1.4 22-Apr-1996  abrown - Changed Sun4m DMA chip support to detect and use maximum available SBus
burst size when transferring data.
- Changed ledma attach code to pay attention to the PROM's notion of what
cable type is being used. Note that this patch does not fix the problem
recently discussed on port-sparc; in most cases the PROM doesn't know
what cable type is being used. The default is now TP rather than AUI,
though. A complete fix is forthcoming.
 1.3 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.9.30.2 27-Aug-2002  nathanw Catch up to -current.
 1.9.30.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.9.26.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.26.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.6.1 22-Nov-2002  tron Pull up revision 1.12 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.11.4.1 31-Aug-2002  gehenna catch up with -current.
 1.13.6.4 06-Feb-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.14.10.1 12-Feb-2005  yamt sync with head.
 1.14.8.1 29-Apr-2005  kent sync with -current
 1.15.6.1 21-Jun-2006  yamt sync with head.
 1.17.78.3 11-Mar-2010  yamt sync with head
 1.17.78.2 04-May-2009  yamt sync with head.
 1.17.78.1 16-May-2008  yamt sync with head.
 1.17.76.1 18-May-2008  yamt sync with head.
 1.17.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.66 03-Jul-2000  pk The `si' driver has been transformed into an MI VME frontend.
 1.65 03-Jul-2000  pk * Remove MAX_DMA_LEN & si_minphys().
* Disable the DMA engine when setting up a DMA transfer, just in case
the 5380 driver didn't instruct us to do so already.
* More useful debug output when entering the "left-over bytes" case after
a DMA transfer finishes.
 1.64 29-Jun-2000  pk When winding down a DMA transfer, don't complain about the actual
transfer count being smaller than the minimum transfer size for which
we would use DMA. The device may be disconnecting, to complete the
transaction at a later time. Just let the 5380 engine proceed acting
on the current SCSI bus phase.
 1.63 26-Jun-2000  pk Split si & sw drivers.
 1.62 26-Jun-2000  pk The `sw' driver should not use vme bus routines.
 1.61 25-Jun-2000  pk Use vme_dmamap_create() instead of bus_dmamap_create().
Remove Sun hardware id test from si_match().
 1.60 18-Jun-2000  pk branches: 1.60.2;
Conversion to bus_space*().
 1.59 15-Jun-2000  pk Remove pointless debugging check.
 1.58 15-Jun-2000  pk Enable DMA interrupts.
 1.57 25-Mar-2000  tsutsui branches: 1.57.2;
Add a "sc_rev" member to ncr5380_softc and handle CXD1180 quirk
in MI ncr5380sbc.
 1.56 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.55 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.54 11-Jan-2000  pk Remove old-style boot device recognition.
 1.53 21-Oct-1999  pk Comply with recent MI scsi changes.
 1.52 30-Jun-1999  drochner branches: 1.52.2; 1.52.4; 1.52.6;
update for new VME framework
 1.51 17-Mar-1999  pk branches: 1.51.4;
Got a VME probe result backwards.
 1.50 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.49 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.48 31-Jul-1998  pk Convert to bus_dma.
 1.47 04-Jul-1998  jonathan branches: 1.47.2;
defopt DDB.
 1.46 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.45 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.44 06-Feb-1998  pk vme_bus_probe() takes an `offset' argument.
 1.43 04-Feb-1998  pk Use vme_bus_probe() in si_attach().
 1.42 25-Jan-1998  pk Split si & sw attach routines, and make the si part use the new VME interface.
 1.41 12-Jan-1998  thorpej Update for changes to config.
 1.40 16-Oct-1997  mycroft Fix up includes.
 1.39 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.38 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.37 29-Jul-1997  fair branches: 1.37.2;
%x -> 0x%x
 1.36 24-May-1997  pk branches: 1.36.2;
Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.35 14-Mar-1997  cjs Remove code that stops transfers of >63K. The Sun 4 doesn't have this
limitation, and minphys() is supposed to catch this on other architectures.
 1.34 10-Mar-1997  pk Replace `cpumod' with `cpuinfo.cpu_type' equivalents.
 1.33 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.32 23-Jan-1997  thorpej branches: 1.32.4;
Arrange the code that sets the options flags such that the user can
completely override the defaults (including disabling DMA) in the
kernel config file.
 1.31 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.30 09-Dec-1996  thorpej Copyright assigned to The NetBSD Foundation.
 1.29 13-Nov-1996  thorpej Use bitmask_snprintf().
 1.28 13-Oct-1996  christos backout previous kprintf change
 1.27 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.26 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.25 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.24 13-May-1996  thorpej Enable DMA by default on the 4/100 "sw" controller; the DMA bugs appear
to have been fixed.
 1.23 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.22 26-Mar-1996  pk Back to normal printf()s, now that gcc understands `%b'.
 1.21 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.20 16-Mar-1996  christos fix formats in printf() and panic()
 1.19 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.18 01-Mar-1996  thorpej Fix an operator precedence botch. *sigh* This just hasn't been my week.
 1.17 29-Feb-1996  thorpej Back out the "don't use DMA if SCSI_POLL is set" saftey-net. The
MI 5380 code did something I didn't really expect, which caused DMA
to disable itself if only DMA was enabled. *grumble*
 1.16 25-Feb-1996  pk Use CPU-type macros
 1.15 23-Feb-1996  thorpej Add an "sw_options" patchable global so that folks can still live life
on the edge (of sw DMA uncertainty) with pre-built kernels.
 1.14 23-Feb-1996  thorpej Attempt to work around a hardware bug that screws up DMA on the 4/100.
Apparently, some early 4/100 DMA controllers do illegal memory access on
large ( >= NBPG ) transfers at the end of the transfer. This appears
as SI_CSR_DMA_BUS_ERR in the csr. To work around this, we simply
transfer the (up to 3) missing bytes from the bpr. We were doing this
anyway, so the work-around is to ignore the bus error.

BUT! I goofed when I implemented the "left-over byte" code for the sw!
It *should* be correct now. Keep metrics (acceeible via DDB) on the number
of 1, 2, and 3 byte clean-ups, as well as the number of "clean" transfers,
just so we can get a clearer picture.

Thanks to Andrew Gillham <gillham@whirlpool.com> for noticing this!
 1.13 22-Feb-1996  thorpej If we get a transfer with the SCSI_POLL flag set, don't use DVMA. We
only get these during autoconfiguration and during crash dumps. During
autoconfiguration, the transfers are small enough that DVMA won't be used
anyway. However, using DVMA during a crash dump can be dangerous,
depending on the nature of the panic, so we avoid it.
 1.12 22-Feb-1996  thorpej Bring in Gordon's fix from the sun3 port:

Correct the DMA transfer count when the target disconnects before
the whole transfer is completed. (Affects VME writes)
Reselect now works on the VME si board!
 1.11 09-Jan-1996  thorpej Re-arrange slightly the si_options special case for the `sw'.
 1.10 09-Jan-1996  thorpej Disable DMA by default on the 4/100 `sw' controller. I've had a couple
of reports of data corruption, and would rather be slow and safe until
the DMA bug is fixed.
 1.9 04-Jan-1996  thorpej Fix a typo that would bite if the interrupt level were wildcarded in the
kernel config file.
 1.8 01-Jan-1996  thorpej New driver for the Sun SCSI-3 VME and 4/100-series SCSI "Weird" controllers,
utilizing David Jones' new MI NCR 5380 code. Ported from the sun3 ncr_si.c
and "sw" DMA code written by me.

This driver contains user-configurable "options", which can be set via the
"flags" directive in the kernel configuration file. By default, only
DMA is enabled. DMA completion interrupts and reselection may be enabled
by setting the appropriate bits with "flags". See si.c for details.

Note that DMA completion interrupts and reselection don't yet work on the
4/100 controller. I don't know why, and it's unlikely that I'll have
the opportunity to find out any time soon. DMA does work, and results
in a considerable performance increase.

DMA, DMA completion interrupts, and reslection all work on my 4/260 (VME)
system with modern SCSI-II disks.
 1.7 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.6 14-Sep-1995  pk Re-instate configuration print routines, following Chris' suggestion.
Only prints something if there's no scsi bus to attach.
 1.5 11-Sep-1995  pk We have no need for `si_print()'; the only child we expect is a `scsibus',
and there's nothing to say if it isn't there.
 1.4 03-Sep-1995  pk Patches from Jason Thorpe to deal with 4/110 scsi (PR#1422). Also includes
bootpath glue (PR#1414) (this needs finishing off in disksubr.c).
 1.3 16-Aug-1995  pk Drop si_minphys().
 1.2 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.1 08-Jul-1995  pk si scsi driver, adapted from sun3 version by Jason Thorpe.
Note: re-arranged to use dev/ic/ncr5380* MI files.
 1.32.4.1 12-Mar-1997  is Merge in changes from The Trunk
 1.36.2.2 30-Jul-1997  bouyer Sync with trunk.
 1.36.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.37.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.37.2.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.47.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.51.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.52.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.52.4.1 15-Nov-1999  fvdl Sync with -current
 1.52.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.57.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.60.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.6 03-Jul-2000  pk The `si' driver has been transformed into an MI VME frontend.
 1.5 26-Jun-2000  pk Split si & sw drivers.
 1.4 18-Jun-2000  pk Conversion to bus_space*().
 1.3 01-Jan-1996  thorpej branches: 1.3.30; 1.3.38;
New driver for the Sun SCSI-3 VME and 4/100-series SCSI "Weird" controllers,
utilizing David Jones' new MI NCR 5380 code. Ported from the sun3 ncr_si.c
and "sw" DMA code written by me.

This driver contains user-configurable "options", which can be set via the
"flags" directive in the kernel configuration file. By default, only
DMA is enabled. DMA completion interrupts and reselection may be enabled
by setting the appropriate bits with "flags". See si.c for details.

Note that DMA completion interrupts and reselection don't yet work on the
4/100 controller. I don't know why, and it's unlikely that I'll have
the opportunity to find out any time soon. DMA does work, and results
in a considerable performance increase.

DMA, DMA completion interrupts, and reslection all work on my 4/260 (VME)
system with modern SCSI-II disks.
 1.2 03-Sep-1995  pk Patches from Jason Thorpe to deal with 4/110 scsi (PR#1422). Also includes
bootpath glue (PR#1414) (this needs finishing off in disksubr.c).
 1.1 08-Jul-1995  pk si scsi driver, adapted from sun3 version by Jason Thorpe.
Note: re-arranged to use dev/ic/ncr5380* MI files.
 1.3.38.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.30.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.26 23-Jan-2023  andvar s/lager/larger/ in comments.
 1.25 22-Nov-2020  thorpej malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.24 10-Nov-2019  chs branches: 1.24.8;
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.23 01-Jul-2011  dyoung branches: 1.23.54;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.22 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.21 28-Apr-2008  martin branches: 1.21.8;
Remove clause 3 and 4 from TNF licenses
 1.20 04-Apr-2008  tsutsui branches: 1.20.2; 1.20.4;
Split devict_t/softc for ncr5380sbc SCSI, and misc cosmetic changes.
 1.19 01-Nov-2007  jnemeth branches: 1.19.16;
typo
 1.18 04-Mar-2007  christos branches: 1.18.2; 1.18.18; 1.18.20; 1.18.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 29-Mar-2006  thorpej branches: 1.17.14;
Use device_cfdata().
 1.16 16-Nov-2005  uwe branches: 1.16.4; 1.16.6; 1.16.8; 1.16.10; 1.16.12;
Duplicate open curlies in both #if and #else parts confuse
paren-matching in editors, drop them and add one after #endif.
 1.15 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.14 04-Dec-2003  keihan branches: 1.14.16; 1.14.24;
NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.13 15-Jul-2003  lukem __KERNEL_RCSID()
 1.12 03-May-2003  wiz branches: 1.12.2;
DMA, not dma nor Dma.
 1.11 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.10 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.9 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.6 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.5 20-Aug-2001  wiz branches: 1.5.6;
precede, not preceed.
 1.4 25-Apr-2001  bouyer branches: 1.4.2;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.3 09-Jul-2000  pk branches: 1.3.2; 1.3.4; 1.3.6;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.2 29-Jun-2000  pk When winding down a DMA transfer, don't complain about the actual
transfer count being smaller than the minimum transfer size for which
we would use DMA. The device may be disconnecting, to complete the
transaction at a later time. Just let the 5380 engine proceed acting
on the current SCSI bus phase.
 1.1 26-Jun-2000  pk Split si & sw drivers.
 1.3.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.4.3 22-Jan-2001  bouyer GENERIC without isp now compiles
 1.3.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.3.4.1 09-Jul-2000  bouyer file sw.c was added on branch thorpej_scsipi on 2000-11-20 20:25:34 +0000
 1.3.2.2 22-Jul-2000  pk New in netbsd-1-5: sw.c revision 1.3; swreg.h revision 1.1.

Split si & sw drivers.
 1.3.2.1 09-Jul-2000  pk file sw.c was added on branch netbsd-1-5 on 2000-07-22 21:14:19 +0000
 1.4.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.4.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.4.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.5.6.4 11-Dec-2002  thorpej Sync with HEAD.
 1.5.6.3 18-Oct-2002  nathanw Catch up to -current.
 1.5.6.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.6.1 20-Aug-2001  nathanw file sw.c was added on branch nathanw_sa on 2002-04-01 07:42:43 +0000
 1.12.2.4 11-Dec-2005  christos 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.14.24.1 22-Nov-2005  yamt sync with head.
 1.14.16.3 15-Nov-2007  yamt sync with head.
 1.14.16.2 03-Sep-2007  yamt sync with head.
 1.14.16.1 21-Jun-2006  yamt sync with head.
 1.16.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.16.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.16.8.1 01-Apr-2006  yamt sync with head.
 1.16.6.1 22-Apr-2006  simonb Sync with head.
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.17.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.24.1 13-Nov-2007  bouyer Sync with HEAD
 1.18.20.1 06-Nov-2007  matt sync with HEAD
 1.18.18.1 04-Nov-2007  jmcneill Sync with HEAD.
 1.18.2.1 03-Dec-2007  ad Sync with HEAD.
 1.19.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.19.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.4.2 04-May-2009  yamt sync with head.
 1.20.4.1 16-May-2008  yamt sync with head.
 1.20.2.1 18-May-2008  yamt sync with head.
 1.21.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.23.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.24.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.74; 1.4.76; 1.4.78;
merge ktrace-lwp.
 1.3 04-Dec-2003  keihan NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.2 03-May-2003  wiz branches: 1.2.2;
DMA, not dma nor Dma.
 1.1 26-Jun-2000  pk branches: 1.1.2; 1.1.4;
Split si & sw drivers.
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 26-Jun-2000  bouyer file swreg.h was added on branch thorpej_scsipi on 2000-11-20 20:25:34 +0000
 1.1.2.2 22-Jul-2000  pk New in netbsd-1-5: sw.c revision 1.3; swreg.h revision 1.1.

Split si & sw drivers.
 1.1.2.1 26-Jun-2000  pk file swreg.h was added on branch netbsd-1-5 on 2000-07-22 21:14:20 +0000
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.78.1 16-May-2008  yamt sync with head.
 1.4.76.1 18-May-2008  yamt sync with head.
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.8 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.7 13-Jun-2023  macallan add counter to periodically drain the instruction queue in order to avoid
stalling the MBus during long SX operations
adapted from xf86-video-suncg14
 1.6 13-Apr-2023  macallan initialize the diagnostic register with the value suggested by the SunOS
header. This sets a bunch of undocumented bits and yields a 10% speed increase
when rendering antialiased text.
 1.5 11-Sep-2021  andvar branches: 1.5.4;
Add missing double p and d for stopped and overriden accordingly.
Fix few more typos along the way, mainly in copy-pasted comments.
 1.4 01-Mar-2019  macallan adapt to changes in sxreg.h
 1.3 15-Apr-2014  macallan branches: 1.3.2; 1.3.30;
print chip revision on attach
 1.2 06-Feb-2013  macallan branches: 1.2.2; 1.2.4; 1.2.12;
fix typos, deal with hardware insanity
 1.1 05-Feb-2013  macallan attachment and initialization for SX
 1.2.12.1 10-Aug-2014  tls Rebase.
 1.2.4.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.4.2 25-Feb-2013  tls resync with head
 1.2.4.1 06-Feb-2013  tls file sx.c was added on branch tls-maxphys on 2013-02-25 00:28:57 +0000
 1.2.2.1 18-May-2014  rmind sync with head
 1.3.30.1 10-Jun-2019  christos Sync with HEAD
 1.3.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.2.1 15-Apr-2014  yamt file sx.c was added on branch yamt-pagecache on 2014-05-22 11:40:08 +0000
 1.5.4.1 05-Jul-2023  martin Pull up following revision(s) (requested by abs in ticket #224):

sys/dev/wscons/wsdisplay_vconsvar.h: revision 1.34
sys/dev/wscons/wsdisplay_glyphcachevar.h: revision 1.6
sys/arch/sparc/dev/cgfourteen.c: revision 1.94
sys/arch/sparc/dev/cgfourteen.c: revision 1.95
sys/dev/sbus/mgx.c: revision 1.21
sys/dev/sbus/mgx.c: revision 1.22
sys/dev/sbus/mgx.c: revision 1.23
sys/dev/wscons/wsdisplay_vcons.c: revision 1.65
sys/dev/wscons/wsdisplay_vcons.c: revision 1.66
sys/dev/wscons/wsdisplay_glyphcache.c: revision 1.12
sys/arch/sparc/dev/sxvar.h: revision 1.5
sys/arch/sparc/dev/sx.c: revision 1.6
sys/arch/sparc/dev/sx.c: revision 1.7

make vcons_putchar_buffer() return a flag indicating if anything actually
changed, skip the actual drawing op if nothing did

add flags for drivers to requesr R2L bit/byte-ordered fonts, default to
L2R, chack them in vcons_load_font() instead of just trusting that we'd get
what we need

initialize the diagnostic register with the value suggested by the SunOS
header. This sets a bunch of undocumented bits and yields a 10% speed increase
when rendering antialiased text.

use macros compatible with xf86-video-suncg14 to issue SX instructions
much more readable, alignment weirdness is handled automatically and code is
interchangable

allow drivers to specify horizontal alignment of glyph cache cells
for things like SX which have alignment restrictions

add counter to periodically drain the instruction queue in order to avoid
stalling the MBus during long SX operations

adapted from xf86-video-suncg14
- use sx_wait() to avoid stalling the MBus
- request 32bit alignment for glyphcache cells

wait for the engine to go idle before issuing rectfill commands
we get occasional overlap with blit commands if we just wait for fifo slots
needs further investigation, it is possible that not all writes to drawing
engine registers are pipelined and of course we don't have docs

following a hunch...
- cache DEC and FG registers, only write them if the value actually changes
- wait for the engine to go idle before writing DEC
- wait for FIFO slots on everything else
with this we avoid waiting if possible and still avoid overlapping blit and
fill commands
 1.22 12-May-2024  macallan add simple 16bit load and store ops
 1.21 10-Dec-2021  andvar s/occured/occurred/ in comments, log messages and man pages.
 1.20 08-Dec-2021  macallan be more consistent with underscores in instruction names
 1.19 08-Dec-2021  macallan add SX_ROPB instruction
 1.18 03-Dec-2021  macallan add shift instructions
 1.17 22-Feb-2019  macallan some register bits are defined differently by SunOS's sxreg.h and the SPAM
manual, upon investigation the hardware appears to agree with the SunOS header,
so adapt accordingly
 1.16 08-Dec-2017  macallan branches: 1.16.4;
fix tpyos and pastos
 1.15 07-Dec-2017  macallan add SCATTER/GATHER instructions
 1.14 30-Oct-2017  macallan add load & store instructions for channel data type
mostly for Xorg
 1.13 13-Jan-2017  macallan add SX_STBM ( STore Byte Masked ) instruction
 1.12 30-Apr-2016  macallan branches: 1.12.2;
sprinkle ()s in macros
 1.11 19-Jun-2013  macallan branches: 1.11.8; 1.11.12;
add store-with-clamp instructions
 1.10 12-Jun-2013  macallan fix typo
 1.9 12-Jun-2013  macallan document arithmetics instructions
 1.8 12-Jun-2013  macallan fix serial type&pasto, while there add SX_ADD instructions
 1.7 05-Jun-2013  macallan add a bunch more instructions ( still not complete but we're getting there )
 1.6 04-Jun-2013  macallan add STore with (plane) Mask instruction
 1.5 30-May-2013  macallan add SX_SELECT_S instruction
 1.4 29-May-2013  macallan fix a typo
 1.3 06-Feb-2013  macallan branches: 1.3.4;
add SX_ROP instruction
 1.2 06-Feb-2013  macallan fix typos, deal with hardware insanity
 1.1 05-Feb-2013  macallan attachment and initialization for SX
 1.3.4.4 03-Dec-2017  jdolecek update from HEAD
 1.3.4.3 23-Jun-2013  tls resync from head
 1.3.4.2 25-Feb-2013  tls resync with head
 1.3.4.1 06-Feb-2013  tls file sxreg.h was added on branch tls-maxphys on 2013-02-25 00:28:57 +0000
 1.11.12.2 05-Feb-2017  skrll Sync with HEAD
 1.11.12.1 29-May-2016  skrll Sync with HEAD
 1.11.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.11.8.1 19-Jun-2013  yamt file sxreg.h was added on branch yamt-pagecache on 2014-05-22 11:40:08 +0000
 1.12.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.16.4.1 10-Jun-2019  christos Sync with HEAD
 1.5 13-Jun-2023  macallan add counter to periodically drain the instruction queue in order to avoid
stalling the MBus during long SX operations
adapted from xf86-video-suncg14
 1.4 01-Mar-2019  macallan branches: 1.4.30;
adapt to changes in sxreg.h
 1.3 29-Jun-2014  tsutsui branches: 1.3.28;
Add a newline at end of file.
 1.2 15-Apr-2014  macallan branches: 1.2.2;
print chip revision on attach
 1.1 05-Feb-2013  macallan branches: 1.1.2; 1.1.4; 1.1.12;
attachment and initialization for SX
 1.1.12.1 10-Aug-2014  tls Rebase.
 1.1.4.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.4.2 25-Feb-2013  tls resync with head
 1.1.4.1 05-Feb-2013  tls file sxvar.h was added on branch tls-maxphys on 2013-02-25 00:28:57 +0000
 1.1.2.1 18-May-2014  rmind sync with head
 1.2.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.2.1 15-Apr-2014  yamt file sxvar.h was added on branch yamt-pagecache on 2014-05-22 11:40:08 +0000
 1.3.28.1 10-Jun-2019  christos Sync with HEAD
 1.4.30.1 05-Jul-2023  martin Pull up following revision(s) (requested by abs in ticket #224):

sys/dev/wscons/wsdisplay_vconsvar.h: revision 1.34
sys/dev/wscons/wsdisplay_glyphcachevar.h: revision 1.6
sys/arch/sparc/dev/cgfourteen.c: revision 1.94
sys/arch/sparc/dev/cgfourteen.c: revision 1.95
sys/dev/sbus/mgx.c: revision 1.21
sys/dev/sbus/mgx.c: revision 1.22
sys/dev/sbus/mgx.c: revision 1.23
sys/dev/wscons/wsdisplay_vcons.c: revision 1.65
sys/dev/wscons/wsdisplay_vcons.c: revision 1.66
sys/dev/wscons/wsdisplay_glyphcache.c: revision 1.12
sys/arch/sparc/dev/sxvar.h: revision 1.5
sys/arch/sparc/dev/sx.c: revision 1.6
sys/arch/sparc/dev/sx.c: revision 1.7

make vcons_putchar_buffer() return a flag indicating if anything actually
changed, skip the actual drawing op if nothing did

add flags for drivers to requesr R2L bit/byte-ordered fonts, default to
L2R, chack them in vcons_load_font() instead of just trusting that we'd get
what we need

initialize the diagnostic register with the value suggested by the SunOS
header. This sets a bunch of undocumented bits and yields a 10% speed increase
when rendering antialiased text.

use macros compatible with xf86-video-suncg14 to issue SX instructions
much more readable, alignment weirdness is handled automatically and code is
interchangable

allow drivers to specify horizontal alignment of glyph cache cells
for things like SX which have alignment restrictions

add counter to periodically drain the instruction queue in order to avoid
stalling the MBus during long SX operations

adapted from xf86-video-suncg14
- use sx_wait() to avoid stalling the MBus
- request 32bit alignment for glyphcache cells

wait for the engine to go idle before issuing rectfill commands
we get occasional overlap with blit commands if we just wait for fifo slots
needs further investigation, it is possible that not all writes to drawing
engine registers are pipelined and of course we don't have docs

following a hunch...
- cache DEC and FG registers, only write them if the value actually changes
- wait for the engine to go idle before writing DEC
- wait for FIFO slots on everything else
with this we avoid waiting if possible and still avoid overlapping blit and
fill commands
 1.65 26-Sep-2021  thorpej Driver "kqfilter" entry points return an error code, so if an invalid
filter is requested, return EINVAL rather than 1.
 1.64 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.63 04-Jan-2021  thorpej Use sel{record,remove}_knote().
 1.62 13-Jun-2020  jdc branches: 1.62.2;
Initialise the mutex before we use it.
 1.61 25-Oct-2017  maya Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- { a, b, c, d
+ {
+ .f_isfd = a,
+ .f_attach = b,
+ .f_detach = c,
+ .f_event = d,
};
 1.60 11-Dec-2016  christos catch up with sd changes.
 1.59 25-Jul-2014  dholland branches: 1.59.4; 1.59.8;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.58 16-Mar-2014  dholland branches: 1.58.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.57 19-Oct-2013  mrg - remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.56 27-Oct-2012  chs branches: 1.56.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.55 25-Mar-2012  martin branches: 1.55.2;
Make explicitly clear that we mean raw I/O on device passthru, not just
generic passthru.
 1.54 13-Mar-2012  elad Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
 1.53 18-Jul-2011  mrg branches: 1.53.2; 1.53.6;
convert the remaining sparc drivers to CFATTACH_DECL_NEW/cfdata_t/device_t.
(cgsix_obio.c was only partially converted with the rest of the cgsix code
when it was changed some time ago.)
 1.52 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.51 20-Jun-2011  pgoyette Initialize sensor states before registering
 1.50 21-Nov-2009  rmind branches: 1.50.10;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.49 17-Jul-2008  cegger make this compile
 1.48 11-Jun-2008  drochner branches: 1.48.2;
mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.47 28-Apr-2008  martin branches: 1.47.2; 1.47.4;
Remove clause 3 and 4 from TNF licenses
 1.46 01-Mar-2008  rmind branches: 1.46.2; 1.46.4;
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.45 12-Feb-2008  joerg branches: 1.45.2; 1.45.6;
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.44 16-Nov-2007  xtraeme Extend the envsys2 API (one more time, sorry) as defined in:

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

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

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

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

Update all users and documentation to reflect these changes.
 1.43 17-Oct-2007  garbled branches: 1.43.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.42 09-Jul-2007  ad branches: 1.42.8; 1.42.10; 1.42.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.41 04-Jul-2007  xtraeme s/cur_tre/edata/ => should fix the build error reported by rjs@.
 1.40 01-Jul-2007  xtraeme Use PSWITCH_EVENT_{PRESSED,RELEASED} for consistency with other drivers
using the sysmon_power framework.
 1.39 01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.38 11-Apr-2007  macallan branches: 1.38.4;
clean up tadpole_request() API
from mrg
 1.37 04-Mar-2007  christos branches: 1.37.2; 1.37.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.36 04-Jan-2007  elad branches: 1.36.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.35 23-Jul-2006  ad branches: 1.35.4;
Use the LWP cached credentials where sane.
 1.34 14-May-2006  elad integrate kauth.
 1.33 20-Apr-2006  blymn Prefix iostat structure elements with io_
 1.32 14-Apr-2006  blymn Make i/o statistics collection more generic, include tape drives and
nfs mounts in the set of devices that statistics will be reported on.
 1.31 08-Mar-2006  macallan branches: 1.31.2;
report lid and AC power state to sysmon
 1.30 06-Mar-2006  macallan branches: 1.30.2;
- use a lock to serialize tadpole_request()
- add a callback to signal monitor detection on the external VGA port
- don't call tadpole-request() in interrupt context
- use a kernel thread for various not time-critical work like device
monitoring, LCD status updates, external event handling and so on
(the monitoring stuff is preliminary and to be replaced by a more generic API)
 1.29 11-Dec-2005  christos branches: 1.29.4; 1.29.6; 1.29.8;
merge ktrace-lwp.
 1.28 16-Nov-2005  uwe ANSIify function declarations/defintions. Use uint<N>_t.
Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.27 06-Jul-2005  macallan branches: 1.27.6;
changed envsys support to use the sysmon API, added support for the power
button ( see powerd(8) )
 1.26 13-Feb-2004  wiz branches: 1.26.16;
Uppercase CPU, plural is CPUs.
 1.25 15-Jul-2003  lukem __KERNEL_RCSID()
 1.24 29-Jun-2003  fvdl branches: 1.24.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.23 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.22 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.21 26-Nov-2002  christos si_ -> sel_
 1.20 23-Oct-2002  jdolecek merge kqueue branch into -current

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

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

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.19 14-Oct-2002  takemura Moved MI APM definitions into dev/apm.
 1.18 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.17 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.16 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.15 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.14 11-Mar-2002  pk branches: 1.14.4;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.13 20-Aug-2001  wiz branches: 1.13.2; 1.13.6;
"wierd" is weird.
 1.12 25-Jul-2000  toddpw branches: 1.12.4;
Ignore all undefined bits in the Tadpole microcontroller status register.
Only the low nibble is defined, and on at least one 3gx (mine) there is an
undefined bit which reads as a one -- bit 6 (0x40). This screwed tctrl_intr()
which would loop forever, thinking it always had new events to process.
 1.11 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.10 04-Jun-2000  cgd branches: 1.10.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.9 04-Apr-2000  thorpej branches: 1.9.2;
Fix fallout from callout.
 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 14-Mar-2000  jdc Add port power management ioctls.
 1.6 09-Mar-2000  garbled New features:
tctrl now initializes the state of the internal LCD icons. The icons
are unprogrammed at boot time. This incidentally makes the DC-POWER icon
work.

Fixes:
Fix my stupidity in the ENVSYS stuff, and actually follow the API.
 1.5 17-Dec-1999  garbled avoid uninterruptable sleep on a CMD_REQ ioctl.
 1.4 15-Dec-1999  garbled add <machine/tctrl.h> where needed.
Add some undocumented commands to the ts102 registers file, and fix a few
typos.

Modifications to tctrl.c:

Add entrypoints to driver for open/close/ioctl/poll.
Make device work with apmd. (still no support for suspend/sleep)
Make device work with ENVSYS API.
Slightly restructure handling of events.
Add function to make microcontroller requests.
 1.3 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
 1.2 11-Aug-1999  matt branches: 1.2.2; 1.2.8;
This now works properly and uses interrupts. If you close the lid, the
screen will turn off and when you open the lid screen turns on. If you
do too rapidly, the driver won't be notified but you can press the micro
switch and it will come back. Also "halt -p" now works so you don't
have to do Pause-P to powerdown.
 1.1 09-Aug-1999  matt Add a driver for the Tadpole SPARCbook microcontroller. It doesn't
do much yet (except for power down support). As sson as I figure
out to get its interrupts enabled, it will be much more functional.
(e.g., print console messages on low power warnings, be able to turn
off the TFT, etc.).
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.2.2 26-Jul-2000  toddpw Pull up tctrl.c 1.12, and ts102reg.h 1.6 (both requested by toddpw):
Prevent kernel freeze during boot on some Sparcbook 3gx's (namely, mine).
Sparc "tctrl0" device was sensitive to undefined bits in the hardware.
 1.10.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.12.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.12.4.5 02-Oct-2002  jdolecek do not need the (void *) cast for kn_hook anymore
 1.12.4.4 18-Jun-2002  jdolecek make compile
 1.12.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.12.4.2 09-Sep-2001  thorpej Add kqueue support (not yet compiled).
 1.12.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.13.6.6 11-Dec-2002  thorpej Sync with HEAD.
 1.13.6.5 11-Nov-2002  nathanw Catch up to -current
 1.13.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.13.6.3 17-Sep-2002  nathanw Catch up to -current.
 1.13.6.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.13.6.1 20-Aug-2001  nathanw file tctrl.c was added on branch nathanw_sa on 2002-04-01 07:42:43 +0000
 1.13.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.14.4.1 17-May-2002  gehenna Add device switch.
 1.24.2.6 11-Dec-2005  christos Sync with head.
 1.24.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.2.4 04-Feb-2005  skrll Adapt to branch.
 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.26.16.7 17-Mar-2008  yamt sync with head.
 1.26.16.6 27-Feb-2008  yamt sync with head.
 1.26.16.5 07-Dec-2007  yamt sync with head
 1.26.16.4 03-Sep-2007  yamt sync with head.
 1.26.16.3 26-Feb-2007  yamt sync with head.
 1.26.16.2 30-Dec-2006  yamt sync with head.
 1.26.16.1 21-Jun-2006  yamt sync with head.
 1.27.6.1 22-Nov-2005  yamt sync with head.
 1.29.8.3 11-Aug-2006  yamt sync with head
 1.29.8.2 24-May-2006  yamt sync with head.
 1.29.8.1 13-Mar-2006  yamt sync with head.
 1.29.6.2 01-Jun-2006  kardel Sync with head.
 1.29.6.1 22-Apr-2006  simonb Sync with head.
 1.29.4.1 09-Sep-2006  rpaulo sync with head
 1.30.2.5 13-May-2006  elad sprinkle some #include <sys/kauth.h> in files that use kauth kpi but
don't include it yet. hopefully this will prevent some fallout.
 1.30.2.4 11-May-2006  elad sync with head
 1.30.2.3 19-Apr-2006  elad sync with head - hopefully this will work
 1.30.2.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.30.2.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.31.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.35.4.1 12-Jan-2007  ad Sync with head.
 1.36.2.2 15-Apr-2007  yamt sync with head.
 1.36.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.37.4.1 11-Jul-2007  mjf Sync with head.
 1.37.2.3 03-Dec-2007  ad Sync with HEAD.
 1.37.2.2 15-Jul-2007  ad Sync with head.
 1.37.2.1 27-May-2007  ad Sync with head.
 1.38.4.1 03-Oct-2007  garbled Sync with HEAD
 1.42.14.1 18-Nov-2007  bouyer Sync with HEAD
 1.42.10.3 23-Mar-2008  matt sync with HEAD
 1.42.10.2 09-Jan-2008  matt sync with HEAD
 1.42.10.1 06-Nov-2007  matt sync with HEAD
 1.42.8.1 21-Nov-2007  joerg Sync with HEAD.
 1.43.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.43.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.45.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.45.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.45.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.45.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.45.2.1 24-Mar-2008  keiichi sync with head.
 1.46.4.3 11-Mar-2010  yamt sync with head
 1.46.4.2 04-May-2009  yamt sync with head.
 1.46.4.1 16-May-2008  yamt sync with head.
 1.46.2.2 17-Jun-2008  yamt sync with head.
 1.46.2.1 18-May-2008  yamt sync with head.
 1.47.4.2 18-Jul-2008  simonb Sync with head.
 1.47.4.1 18-Jun-2008  simonb Sync with head.
 1.47.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.47.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.48.2.1 19-Oct-2008  haad Sync with HEAD.
 1.50.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.53.6.1 05-Apr-2012  mrg sync to latest -current.
 1.53.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.53.2.2 30-Oct-2012  yamt sync with head
 1.53.2.1 17-Apr-2012  yamt sync with head
 1.55.2.3 03-Dec-2017  jdolecek update from HEAD
 1.55.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.56.2.1 18-May-2014  rmind sync with head
 1.58.2.1 10-Aug-2014  tls Rebase.
 1.59.8.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.59.4.1 05-Feb-2017  skrll Sync with HEAD
 1.62.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 11-Apr-2007  macallan branches: 1.7.34; 1.7.36; 1.7.38;
clean up tadpole_request() API
from mrg
 1.6 04-Mar-2007  christos branches: 1.6.2; 1.6.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 06-Mar-2006  macallan branches: 1.5.18;
- use a lock to serialize tadpole_request()
- add a callback to signal monitor detection on the external VGA port
- don't call tadpole-request() in interrupt context
- use a kernel thread for various not time-critical work like device
monitoring, LCD status updates, external event handling and so on
(the monitoring stuff is preliminary and to be replaced by a more generic API)
 1.4 16-Nov-2005  uwe branches: 1.4.4; 1.4.6; 1.4.8;
ANSIify function declarations/defintions. Use uint<N>_t.
Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.3 09-Mar-2000  garbled branches: 1.3.28; 1.3.44; 1.3.52;
New features:
tctrl now initializes the state of the internal LCD icons. The icons
are unprogrammed at boot time. This incidentally makes the DC-POWER icon
work.

Fixes:
Fix my stupidity in the ENVSYS stuff, and actually follow the API.
 1.2 15-Dec-1999  garbled add <machine/tctrl.h> where needed.
Add some undocumented commands to the ts102 registers file, and fix a few
typos.

Modifications to tctrl.c:

Add entrypoints to driver for open/close/ioctl/poll.
Make device work with apmd. (still no support for suspend/sleep)
Make device work with ENVSYS API.
Slightly restructure handling of events.
Add function to make microcontroller requests.
 1.1 09-Aug-1999  matt branches: 1.1.2; 1.1.8;
Add a driver for the Tadpole SPARCbook microcontroller. It doesn't
do much yet (except for power down support). As sson as I figure
out to get its interrupts enabled, it will be much more functional.
(e.g., print console messages on low power warnings, be able to turn
off the TFT, etc.).
 1.1.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.52.1 22-Nov-2005  yamt sync with head.
 1.3.44.2 03-Sep-2007  yamt sync with head.
 1.3.44.1 21-Jun-2006  yamt sync with head.
 1.3.28.1 11-Dec-2005  christos Sync with head.
 1.4.8.1 13-Mar-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.18.2 15-Apr-2007  yamt sync with head.
 1.5.18.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.4.1 11-Jul-2007  mjf Sync with head.
 1.6.2.1 27-May-2007  ad Sync with head.
 1.7.38.1 16-May-2008  yamt sync with head.
 1.7.36.1 18-May-2008  yamt sync with head.
 1.7.34.1 02-Jun-2008  mjf Sync with HEAD.
 1.21 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.20 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.19 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.18 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.17 04-Apr-2000  pk branches: 1.17.4;
Use copyin/copyout to get a colormap from/to user space.
Also, prepare for the case of a colormap maintained in kernel space.
 1.16 19-Mar-2000  pk Use fb_is_console(); retract fbconstty & fbnode from service.
 1.15 27-Aug-1999  hannken branches: 1.15.2;
Remove now unused variable `i'.
 1.14 26-Aug-1999  thorpej Initialize the default colormap to 0 == black, all others == full white.
 1.13 29-Jul-1998  pk We no longer need to get the register sets by ourselves.
 1.12 07-Apr-1998  pk bus_space_mmap() has changed to take a `bus_space_handle_t *' argument,
like other bus space methods.
 1.11 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.10 12-Jan-1998  thorpej Update for changes to config.
 1.9 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.8 29-Jul-1997  fair branches: 1.8.2;
%x -> 0x%x
 1.7 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.6 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 04-Oct-1996  thorpej Use FBTYPE_RESERVED3 for our `unknown' fbtype ... RESERVED1 seems to
have disappeared.
 1.2 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.1 19-Jun-1996  pk First go at a TCX framebuffer driver. This version does enough to
load and store colour lookup tables
blank the screen / put monitor in power-saving mode
make X11 run on it in `cgthree' emulation.
 1.8.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.17.4.2 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.17.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.3 22-Aug-2000  pk Use the framebuffer drivers & header files that now live in /sys/dev/sun.
 1.2 09-Oct-1997  jtc branches: 1.2.16;
Fix tipo inherited from old version of TNF copyright template.
 1.1 19-Jun-1996  pk branches: 1.1.10;
First go at a TCX framebuffer driver. This version does enough to
load and store colour lookup tables
blank the screen / put monitor in power-saving mode
make X11 run on it in `cgthree' emulation.
 1.1.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.16.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.22 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.21 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.20 11-Jun-2021  jdc branches: 1.20.2;
During slot enable and disable, make sure that the card Access and VCC
controls are enabled and disabled at the same time.
Also remove the software reset during slot enable (we are already in
reset because of the earlier Access and VCC changes).
While here, convert DELAY() to delay() and tsleep(), like nell(4).
 1.19 24-Apr-2021  thorpej branches: 1.19.2;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.18 19-Oct-2013  mrg branches: 1.18.44;
- remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.17 27-Oct-2012  chs branches: 1.17.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.16 26-Jul-2011  dyoung branches: 1.16.2; 1.16.12;
Don't set the iobase and iosize members of pcmciabus_attach_args because
they're not used in any meaningful way.
 1.15 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.14 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.13 04-Aug-2008  macallan fix another botched device_t-ification
 1.12 17-May-2008  macallan branches: 1.12.4;
struct device * -> device_t
 1.11 17-May-2008  macallan cosmetics:
- finally add my copyright, almost 3 year after the fact
- remove a comment that never applied to the NetBSD port of this driver,
only the OpenBSD version
 1.10 03-Dec-2007  ad branches: 1.10.14; 1.10.16; 1.10.18; 1.10.20;
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.9 17-Oct-2007  garbled branches: 1.9.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.8 09-Jul-2007  ad branches: 1.8.8; 1.8.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.7 06-Mar-2006  macallan branches: 1.7.10; 1.7.24; 1.7.26; 1.7.32;
- use a lock to serialize tadpole_request()
- add a callback to signal monitor detection on the external VGA port
- don't call tadpole-request() in interrupt context
- use a kernel thread for various not time-critical work like device
monitoring, LCD status updates, external event handling and so on
(the monitoring stuff is preliminary and to be replaced by a more generic API)
 1.6 04-Mar-2006  uwe branches: 1.6.2;
s/u_intN_t/uintN_t/
 1.5 16-Nov-2005  macallan branches: 1.5.4; 1.5.6;
- ansify
- pick some KNF nits
- remove trailing whitespaces
- remove some useless commented out code
 1.4 14-Nov-2005  uwe Make this compile with DEBUG.
 1.3 13-Jul-2005  macallan branches: 1.3.6; 1.3.8;
fixed a glitch that would trigger a warning when compiled without tctrl.
Doesn't make much sense since tctrl is on the same chip but anyway.
 1.2 06-Jul-2005  macallan forgot the $NetBSD header
 1.1 06-Jul-2005  macallan Add support for the TS102 PCMCIA controller found in SPARCbooks
 1.3.8.1 22-Nov-2005  yamt sync with head.
 1.3.6.3 11-Dec-2005  christos Sync with head.
 1.3.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.6.1 13-Jul-2005  skrll file ts102.c was added on branch ktrace-lwp on 2005-11-10 13:58:55 +0000
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.1 13-Mar-2006  yamt sync with head.
 1.7.32.1 03-Oct-2007  garbled Sync with HEAD
 1.7.26.1 11-Jul-2007  mjf Sync with head.
 1.7.24.2 03-Dec-2007  ad Sync with HEAD.
 1.7.24.1 15-Jul-2007  ad Sync with head.
 1.7.10.4 07-Dec-2007  yamt sync with head
 1.7.10.3 03-Sep-2007  yamt sync with head.
 1.7.10.2 21-Jun-2006  yamt sync with head.
 1.7.10.1 06-Mar-2006  yamt file ts102.c was added on branch yamt-lazymbuf on 2006-06-21 14:55:54 +0000
 1.8.10.2 09-Jan-2008  matt sync with HEAD
 1.8.10.1 06-Nov-2007  matt sync with HEAD
 1.8.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.9.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.10.20.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.10.20.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.10.18.2 11-Mar-2010  yamt sync with head
 1.10.18.1 04-May-2009  yamt sync with head.
 1.10.16.1 18-May-2008  yamt sync with head.
 1.10.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.10.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.4.1 19-Oct-2008  haad Sync with HEAD.
 1.16.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.16.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.2.1 30-Oct-2012  yamt sync with head
 1.17.2.1 18-May-2014  rmind sync with head
 1.18.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.19.2.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.20.2.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 06-Mar-2006  macallan branches: 1.11.66; 1.11.68; 1.11.70;
- use a lock to serialize tadpole_request()
- add a callback to signal monitor detection on the external VGA port
- don't call tadpole-request() in interrupt context
- use a kernel thread for various not time-critical work like device
monitoring, LCD status updates, external event handling and so on
(the monitoring stuff is preliminary and to be replaced by a more generic API)
 1.10 04-Mar-2006  uwe branches: 1.10.2;
s/u_intN_t/uintN_t/
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.6;
merge ktrace-lwp.
 1.8 06-Jul-2005  macallan Add support for the TS102 PCMCIA controller found in SPARCbooks
 1.7 29-Sep-2002  wiz branches: 1.7.6; 1.7.22;
"definitions" has lots of 'i's, but that's not reason to leave one out.
 1.6 25-Jul-2000  toddpw branches: 1.6.4; 1.6.8;
Ignore all undefined bits in the Tadpole microcontroller status register.
Only the low nibble is defined, and on at least one 3gx (mine) there is an
undefined bit which reads as a one -- bit 6 (0x40). This screwed tctrl_intr()
which would loop forever, thinking it always had new events to process.
 1.5 09-Mar-2000  garbled branches: 1.5.4;
New features:
tctrl now initializes the state of the internal LCD icons. The icons
are unprogrammed at boot time. This incidentally makes the DC-POWER icon
work.

Fixes:
Fix my stupidity in the ENVSYS stuff, and actually follow the API.
 1.4 15-Dec-1999  garbled add <machine/tctrl.h> where needed.
Add some undocumented commands to the ts102 registers file, and fix a few
typos.

Modifications to tctrl.c:

Add entrypoints to driver for open/close/ioctl/poll.
Make device work with apmd. (still no support for suspend/sleep)
Make device work with ENVSYS API.
Slightly restructure handling of events.
Add function to make microcontroller requests.
 1.3 12-Nov-1999  matt add some stuff needed for pcmcia support
 1.2 11-Aug-1999  matt branches: 1.2.2; 1.2.4; 1.2.8;
This now works properly and uses interrupts. If you close the lid, the
screen will turn off and when you open the lid screen turns on. If you
do too rapidly, the driver won't be notified but you can press the micro
switch and it will come back. Also "halt -p" now works so you don't
have to do Pause-P to powerdown.
 1.1 09-Aug-1999  matt Add a driver for the Tadpole SPARCbook microcontroller. It doesn't
do much yet (except for power down support). As sson as I figure
out to get its interrupts enabled, it will be much more functional.
(e.g., print console messages on low power warnings, be able to turn
off the TFT, etc.).
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.1 15-Nov-1999  fvdl Sync with -current
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.4.1 26-Jul-2000  toddpw Pull up tctrl.c 1.12, and ts102reg.h 1.6 (both requested by toddpw):
Prevent kernel freeze during boot on some Sparcbook 3gx's (namely, mine).
Sparc "tctrl0" device was sensitive to undefined bits in the hardware.
 1.6.8.1 18-Oct-2002  nathanw Catch up to -current.
 1.6.4.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.22.1 21-Jun-2006  yamt sync with head.
 1.7.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.10.2.1 13-Mar-2006  yamt sync with head.
 1.11.70.1 16-May-2008  yamt sync with head.
 1.11.68.1 18-May-2008  yamt sync with head.
 1.11.66.1 02-Jun-2008  mjf Sync with HEAD.
 1.78 13-May-2024  msaitoh s/of of/of/ in comment.
 1.77 01-Dec-2023  thorpej Use vmem(9) rather than extent(9) to manage DVMA mappings.
 1.76 21-Jan-2022  thorpej Don't bother with prom_node_to_devhandle() if we're just forwarding along
our own node; use device_handle(self) instead.
 1.75 05-Dec-2021  msaitoh s/alloction/allocation/
 1.74 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.73 10-May-2021  thorpej branches: 1.73.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.72 24-Apr-2021  thorpej branches: 1.72.2; 1.72.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.71 22-Nov-2020  thorpej branches: 1.71.2;
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.70 14-Jun-2020  chs branches: 1.70.2;
replace EX_NOWAIT with EX_WAITOK in device attach methods.
remove checks for failures that can no longer occur.
 1.69 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.68 27-Oct-2012  chs branches: 1.68.38;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.67 29-Jul-2012  matt branches: 1.67.2;
Fix more -fno-common fallout.
 1.66 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.65 18-Jul-2011  mrg branches: 1.65.2; 1.65.6;
convert the remaining sparc drivers to CFATTACH_DECL_NEW/cfdata_t/device_t.
(cgsix_obio.c was only partially converted with the rest of the cgsix code
when it was changed some time ago.)
 1.64 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.63 14-Jan-2011  rmind 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.62 03-Jan-2010  mrg branches: 1.62.4;
add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.61 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.60 20-Sep-2009  tsutsui - use device_t and cfdriver_t
- use device_private() and device_xname()
- use proper types or variables for device_t/softc
 1.59 19-Dec-2008  cegger use M_ZERO on malloc() and remove subsequent bzero().
 1.58 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.57 28-Apr-2008  martin branches: 1.57.8;
Remove clause 3 and 4 from TNF licenses
 1.56 17-Oct-2007  garbled branches: 1.56.16; 1.56.18; 1.56.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.55 17-May-2007  yamt branches: 1.55.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.54 04-Mar-2007  christos branches: 1.54.2; 1.54.4; 1.54.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.53 16-Nov-2005  uwe branches: 1.53.26;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.52 04-Jun-2005  tsutsui branches: 1.52.2; 1.52.8;
fkbyte() is in locore.s and accoring to its description it's used
only for work around unexplained transient bus errors when reading
the VME interrupt vector in vmeintr4m(), so change the prototype
declaration of fkbyte() in vmeintr4m() to appease gcc -Wcast-qual.
 1.51 13-Dec-2004  chs for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.50 27-Jun-2004  pk GC unsed sparc_vme_bus_tag.
 1.49 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.48 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.47 01-Aug-2003  pk Correct some `defined(SUN*)' inconsistencies.
 1.46 15-Jul-2003  lukem __KERNEL_RCSID()
 1.45 18-Jan-2003  thorpej branches: 1.45.2;
Merge the nathanw_sa branch.
 1.44 03-Jan-2003  mrg part one of bus_space(9) fixes to enable bus spaces to override the
bus_space_{read,write}_[1248]() functions, which will allow 16-bit
PCMCIA support to work without additional hacks in MI drivers.
this option is not enabled yet.
 1.43 28-Dec-2002  mrg update the vme bus_space_tag_t to reality.
 1.42 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.41 10-Dec-2002  pk bus_intr_establish() now takes an optional `fast trap' handler argument.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.40 06-Dec-2002  pk Pass the `device class interrupt level' on to intr_establish() and use to
raise the ipl in the interrupt handlers to the appropriate level. This avoids
interrupt handler interference if one of the devices actually interrupts at
a lower hardware level than the maximum level assined to a device class.

Based on code from Art Grabowski in openbsd.
 1.39 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.38 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.37 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.36 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.35 11-Mar-2002  pk branches: 1.35.4; 1.35.6;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.34 26-Sep-2001  eeh branches: 1.34.4;
getprop* -> PROM_getprop*
 1.33 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.32 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.31 24-Apr-2001  thorpej branches: 1.31.2; 1.31.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.30 04-Jul-2000  pk branches: 1.30.2;
Report spurious VME interrupts only #ifdef DEBUG for now. The i82586
based `ie1' board seems to cause this for no apparent reason.
 1.29 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.28 27-Jun-2000  pk VME/IOMMU DMA load must also relocate DVMA addresses to the start of VME space.
 1.27 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.26 25-Jun-2000  pk Implement vme_dmamap_create/vme_dmamap_destroy, which allows us to
select the appropriate DVMA subrange for VME devices.
 1.25 18-Jun-2000  pk branches: 1.25.2;
vme4_dmamap_[un]load: ensure enough DVMA space is allocated to cover the
buffer and store that amount in the DMA map to avoid re-computation.
Also add a cache flush as the bus_dmamap_sync() don't do that yet.
 1.24 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.23 09-May-2000  pk branches: 1.23.2;
The bus_dma(9) implementation now allocates DVMA addresses in
bus_dmamap_load_*() routines only. Note that DMA memory buffers
allocated with bus_dmamem_alloc() _must_ be loaded by bus_dmamap_load_raw().
 1.22 11-Jan-2000  pk Remove old-style boot device recognition.
 1.21 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.20 08-Jul-1999  thorpej branches: 1.20.2; 1.20.4; 1.20.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.19 30-Jun-1999  drochner update for new VME framework
 1.18 14-Apr-1999  pk Initialize the VME bus tag.
 1.17 26-Mar-1999  mycroft branches: 1.17.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.16 08-Feb-1999  fvdl Make this compile for SUN4 only.
 1.15 15-Jan-1999  pk Sanity check from Matthias Drochner.
 1.14 19-Sep-1998  pk Provide an error entry point like sbus and memory.
 1.13 30-Aug-1998  pk getpropA() => getprop().
 1.12 23-Aug-1998  pk Move sparc_vme_dmamem_map() outside `#ifdef SUN4M'
 1.11 23-Aug-1998  pk Rename DVMA constants.
 1.10 20-Aug-1998  pk Flesh out more of the sun4 busdma functions.
 1.9 30-Jul-1998  pk Adapt to changes in the base bus_dma* functions.
 1.8 30-Jul-1998  pk Get to DMA map functions through parent tag, instead of calling some base
functions directly.
 1.7 07-Apr-1998  pk branches: 1.7.2;
Use bus space methods to implement the vme bus space functions.
 1.6 21-Mar-1998  pk Account for bus_space(9)-style bus attachment scheme.
 1.5 06-Feb-1998  pk vme_bus_probe() takes an `offset' argument.
 1.4 04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.3 04-Feb-1998  thorpej Change the last argument of bus_dmamap_sync() from bus_dmasync_op_t to int,
and allow more than one synchronization operation to be specified in
a single call. Dissallow mixing of PRE and POST operations.
 1.2 04-Feb-1998  pk sparc_vme_probe(): handle callback argument.
 1.1 25-Jan-1998  pk sparc/VME bus implementation.
 1.7.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.17.2.1 14-Apr-1999  pk branches: 1.17.2.1.2;
Pull up rev. 1.18 from trunk.
 1.17.2.1.2.3 02-Aug-1999  thorpej Update from trunk.
 1.17.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.17.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.20.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.20.4.1 15-Nov-1999  fvdl Sync with -current
 1.20.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.23.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.2.2 22-Jul-2000  pk Pull up revisions 1.26,1.28,1.30.

revision 1.26
Implement vme_dmamap_create/vme_dmamap_destroy, which allows us to
select the appropriate DVMA subrange for VME devices.

revision 1.28
VME/IOMMU DMA load must also relocate DVMA addresses to the start of VME space.

revision 1.30
Report spurious VME interrupts only #ifdef DEBUG for now. The i82586
based `ie1' board seems to cause this for no apparent reason.
 1.25.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.30.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.31.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.31.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.31.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.31.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.31.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.31.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.34.4.10 03-Jan-2003  thorpej Sync with HEAD (again).
 1.34.4.9 29-Dec-2002  thorpej Sync with HEAD.
 1.34.4.8 19-Dec-2002  thorpej Sync with HEAD.
 1.34.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.34.4.6 18-Oct-2002  nathanw Catch up to -current.
 1.34.4.5 27-Aug-2002  nathanw Catch up to -current.
 1.34.4.4 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.34.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.34.4.2 20-Nov-2001  pk Convert to SA framework.
 1.34.4.1 26-Sep-2001  pk file vme_machdep.c was added on branch nathanw_sa on 2001-11-20 16:29:52 +0000
 1.35.6.1 22-Nov-2002  tron Pull up revision 1.36 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.35.4.1 31-Aug-2002  gehenna catch up with -current.
 1.45.2.6 11-Dec-2005  christos Sync with head.
 1.45.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.45.2.4 18-Dec-2004  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.52.8.1 22-Nov-2005  yamt sync with head.
 1.52.2.2 03-Sep-2007  yamt sync with head.
 1.52.2.1 21-Jun-2006  yamt sync with head.
 1.53.26.2 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.53.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.54.10.1 22-May-2007  matt Update to HEAD.
 1.54.4.1 11-Jul-2007  mjf Sync with head.
 1.54.2.1 27-May-2007  ad Sync with head.
 1.55.10.1 06-Nov-2007  matt sync with HEAD
 1.56.20.3 11-Mar-2010  yamt sync with head
 1.56.20.2 04-May-2009  yamt sync with head.
 1.56.20.1 16-May-2008  yamt sync with head.
 1.56.18.1 18-May-2008  yamt sync with head.
 1.56.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.56.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.57.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.62.4.1 05-Mar-2011  rmind sync with head
 1.65.6.1 18-Feb-2012  mrg merge to -current.
 1.65.2.2 30-Oct-2012  yamt sync with head
 1.65.2.1 17-Apr-2012  yamt sync with head
 1.67.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.68.38.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.70.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.71.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.72.4.1 31-May-2021  cjep sync with head
 1.72.2.1 13-May-2021  thorpej Sync with HEAD.
 1.73.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.8 10-Mar-2024  rillig sparc/vmereg: fix snprintb format VMEBUS_AFSR_BITS
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 16-Nov-2005  uwe branches: 1.6.74; 1.6.76; 1.6.78;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.5 19-Sep-1998  pk branches: 1.5.46; 1.5.62; 1.5.70;
Add %b format strings.
 1.4 05-Sep-1998  pk Assign my copyrights to TNF.
 1.3 25-Jan-1998  pk sparc/VME bus implementation.
 1.2 07-Jun-1997  pk Add some VME address modifiers used by vmebus_translate().
 1.1 18-May-1997  pk A bit of framework for sun4m VME busses.
 1.5.70.1 22-Nov-2005  yamt sync with head.
 1.5.62.1 21-Jun-2006  yamt sync with head.
 1.5.46.1 11-Dec-2005  christos Sync with head.
 1.6.78.1 16-May-2008  yamt sync with head.
 1.6.76.1 18-May-2008  yamt sync with head.
 1.6.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.2 21-Jul-1994  mycroft Clean up deleted files.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2 27-Jul-1998  pk These files are now in <dev/sbus>.
 1.1 18-Apr-1998  pk Skeleton code for the SBus expander box.
 1.2 27-Jul-1998  pk These files are now in <dev/sbus>.
 1.1 18-Apr-1998  pk Skeleton code for the SBus expander box.
 1.39 25-Jan-1998  pk These drivers are now in dev/vme.
The `ie' driver has been split in a VME and OBIO front-end. The latter
lives on in this directory as `if_ie_obio.c'
 1.38 12-Jan-1998  thorpej Update for changes to config.
 1.37 29-Jul-1997  fair %x -> 0x%x
 1.36 19-Jul-1997  pk #include "locators.h"
 1.35 17-Jul-1997  jtk use locator defines in "locators.h" to index cf_loc[]
 1.34 24-Jun-1997  thorpej foosize()'s return value is in DEV_BSIZE units; adjust the size obtained
from the disklabel accordingly.
 1.33 18-Jun-1997  pk xdsize(): only call xdopen()/xdclose() if not already open, per the
current `openmask'.
 1.32 10-Jun-1997  pk Avoid "false positives" in match routines.
 1.31 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.30 10-Mar-1997  pk Replace `cpumod' with `cpuinfo.cpu_type' equivalents.
 1.29 10-Dec-1996  pk branches: 1.29.6;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.28 13-Oct-1996  christos backout previous kprintf change
 1.27 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.26 12-Aug-1996  chuck repair XDC_HWAIT macro to handle the fact that waithead is now
unsigned. should fix xdc watchdog timeouts noted in port-sparc
by nathanw@mit.edu.
 1.25 22-Apr-1996  christos branches: 1.25.4;
Remove dependency on <sys/cpu.h>
 1.24 10-Apr-1996  pk `bootdv' is gone. Instead, set the device pointer in the `struct bootpath'
that is passed in the attach arguments.
 1.23 01-Apr-1996  christos Eliminated dependencies on dev_conf.h
 1.22 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.21 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.20 16-Mar-1996  christos cast argument to probeget()
 1.19 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.18 04-Mar-1996  chuck Fix two bugs reported by Don Koch <aardvark@poirot.krl.com> (PR#2169).
[1] check return value from malloc() for NULL before trying to bzero it.
[2] use "=" rather than "|=" when writing to CSR (otherwise you may
ACK something you don't mean to!).
 1.17 25-Feb-1996  pk Use CPU-type macros
 1.16 22-Feb-1996  thorpej Fixup some RCS ids.
 1.15 08-Feb-1996  chuck - moved disk_busy() call from xdstrategy() to xdc_startbuf()
[prevents disk_unbusy panic when disk is loaded (if no
free IOPBs, xdstrategy() would queue the buffer for pickup
by xdcintr() but xdcintr() would never call disk_busy().
xdc_startbuf() is a better place since all bufs are routed
through here] problem detected by girish@dworkin.wustl.edu,
diagnosed and corrected by me.
- move disk_unbusy() call in xdc_remove_iorq() before the call to
XDC_FREE() [don't want to access a data structure that was just put
on a free list]
 1.14 13-Jan-1996  chuck - call mapiodev() with sizeof(struct xdc) rather than ra_len (which is
zero since xdcmatch no longer sets it). [if you call mapiodev()
with a zero size it will reuse the KVA it returns, swiping the device
out from under you!]
- make xdc->iopbase point in the kernels DVMA space rather than at the
normal malloc'd KVA. this isn't compatable with sun4m [doesn't
have a kernel DVMA space] and will need to be changed later (XXX).
- move disk_attach() to before reading the disk label as per Jason.
otherwise we are reading into an unallocated buffer (oops!)
 1.13 12-Jan-1996  chuck nuke uneeded variable in match function.
 1.12 12-Jan-1996  chuck we no longer need to add in the offset to the mapped VA to get the correct
device address (bus_tmp, bus_map, and mapiodev now do this for us).

also, we handle all our mappings, so don't have obio.c do any for us
(i.e. don't set ra->ra_len in xdcmatch).
 1.11 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.10 11-Dec-1995  pk Adapt to changed mapiodev() interface.
Use new DVMA routines.
 1.9 25-Sep-1995  chuck minor cleanups:
- don't let pcyl go unassigned if we have a non-sunos disklabel.
if nothing else, guess pcyl = ncyl + acyl.
- don't use bogus disklabel data if disk label is invalid
(xdgetdisklabel() now returns if label was ok or not).
- move xddriver decl. before start of actual code (cleanup).
 1.8 25-Sep-1995  chuck bug fix: xddummystrat() was clearing all but B_BUSY when it should
have been clearing just B_BUSY (s/B_BUSY/~B_BUSY/). this
fixes hard hang when reading disklabel when booting system.
minor clean up: added a few prototypes and only fool with bootpath
if booting the system (in xdattach).
 1.7 24-Sep-1995  chuck init bad144 table before we actually try and read anything from the
disk, rather than init'ing after reading block 0 [in case we get an
error reading block zero].
 1.6 18-Sep-1995  pk Make this compile again by calling readdisklabel() with a dummy strategy routine.
XXX - need some reorganization to this from xdopen().
 1.5 18-Aug-1995  pk Do bootpath matching.
 1.4 01-Aug-1995  pk update from Chuck
 1.3 05-Jul-1995  pk KNFify a bit.
 1.2 05-Jul-1995  pk Add xxread/xxwrite.
 1.1 26-Jun-1995  pk SMD disk driver, from Chuck Cranor.
 1.25.4.1 16-Aug-1996  jtc Pulled up from rev 1.26 by request from pk
 1.29.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.4 25-Jan-1998  pk These drivers are now in dev/vme.
The `ie' driver has been split in a VME and OBIO front-end. The latter
lives on in this directory as `if_ie_obio.c'
 1.3 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.2 22-Feb-1996  thorpej Fixup some RCS ids.
 1.1 26-Jun-1995  pk SMD disk driver, from Chuck Cranor.
 1.6 25-Jan-1998  pk These drivers are now in dev/vme.
The `ie' driver has been split in a VME and OBIO front-end. The latter
lives on in this directory as `if_ie_obio.c'
 1.5 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.4 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.3 22-Feb-1996  thorpej Fixup some RCS ids.
 1.2 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.1 26-Jun-1995  pk SMD disk driver, from Chuck Cranor.
 1.3 05-Feb-1998  pk This file has been moved to dev/vme a while ago.
 1.2 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.1 26-Jun-1995  pk SMD disk driver, from Chuck Cranor.
 1.28 25-Jan-1998  pk These drivers are now in dev/vme.
The `ie' driver has been split in a VME and OBIO front-end. The latter
lives on in this directory as `if_ie_obio.c'
 1.27 12-Jan-1998  thorpej Update for changes to config.
 1.26 19-Jul-1997  pk #include "locators.h"
 1.25 17-Jul-1997  jtk use locator defines in "locators.h" to index cf_loc[]
 1.24 24-Jun-1997  thorpej foosize()'s return value is in DEV_BSIZE units; adjust the size obtained
from the disklabel accordingly.
 1.23 18-Jun-1997  pk xysize(): only call xyopen()/xyclose() if not already open, per the
current `openmask'.
 1.22 10-Jun-1997  pk Avoid "false positives" in match routines.
 1.21 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.20 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.19 13-Oct-1996  christos backout previous kprintf change
 1.18 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.17 22-Apr-1996  christos Remove dependency on <sys/cpu.h>
 1.16 10-Apr-1996  pk `bootdv' is gone. Instead, set the device pointer in the `struct bootpath'
that is passed in the attach arguments.
 1.15 01-Apr-1996  christos Eliminated dependencies on dev_conf.h
 1.14 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.13 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.12 16-Mar-1996  christos cast argument to probeget()
 1.11 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.10 04-Mar-1996  chuck Fix two bugs reported by Don Koch <aardvark@poirot.krl.com> (PR#2169)
[these bugs apply to the xy as well as the xd driver]
[1] check return value from malloc() for NULL before trying to bzero it.
[2] use "=" rather than "|=" when writing to CSR (otherwise you may
ACK something you don't mean to!).
 1.9 25-Feb-1996  pk Use CPU-type macros
 1.8 22-Feb-1996  thorpej Fixup some RCS ids.
 1.7 21-Feb-1996  chuck minor clean up: revise locations of disk_busy/disk_unbusy calls to match xd.c
 1.6 13-Jan-1996  chuck - call mapiodev() with sizeof(struct xyc) rather than ra_len (which is
zero since xycmatch no longer sets it). [if you call mapiodev()
with a zero size it will reuse the KVA it returns, swiping the device
out from under you!]
- make xyc->iopbase point in the kernels DVMA space rather than at the
normal malloc'd KVA. this isn't compatable with sun4m [doesn't
have a kernel DVMA space] and will need to be changed later (XXX).
- move disk_attach() to before reading the disk label as per Jason.
otherwise we are reading into an unallocated buffer (oops!)
 1.5 12-Jan-1996  chuck nuke uneeded variable in match function.
 1.4 12-Jan-1996  chuck we no longer need to add in the offset to the mapped VA to get the correct
device address (bus_tmp, bus_map, and mapiodev now do this for us).

also, we handle all our mappings, so don't have obio.c do any for us
(i.e. don't set ra->ra_len in xycmatch).
 1.3 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.2 11-Dec-1995  pk Adapt to changed mapiodev() interface.
Use new DVMA routines.
 1.1 25-Sep-1995  chuck new "xy" disk device driver from me.
the "xy" driver runs Xylogics 450/451 SMD disk controllers.
 1.4 25-Jan-1998  pk These drivers are now in dev/vme.
The `ie' driver has been split in a VME and OBIO front-end. The latter
lives on in this directory as `if_ie_obio.c'
 1.3 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.2 22-Feb-1996  thorpej Fixup some RCS ids.
 1.1 25-Sep-1995  chuck new "xy" disk device driver from me.
the "xy" driver runs Xylogics 450/451 SMD disk controllers.
 1.5 25-Jan-1998  pk These drivers are now in dev/vme.
The `ie' driver has been split in a VME and OBIO front-end. The latter
lives on in this directory as `if_ie_obio.c'
 1.4 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.3 22-Feb-1996  thorpej Fixup some RCS ids.
 1.2 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.1 25-Sep-1995  chuck new "xy" disk device driver from me.
the "xy" driver runs Xylogics 450/451 SMD disk controllers.
 1.124 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.123 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.122 24-Apr-2021  thorpej branches: 1.122.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.121 27-Oct-2012  chs branches: 1.121.52;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.120 26-Jun-2010  tsutsui branches: 1.120.8; 1.120.18;
Remove an unused variable.
 1.119 26-Jun-2010  tsutsui Establish interrupt handlers with proper softc per each zs device
rather than sharing them among all zs devices and searching softc
in handlers.

The latter method is derived from ancient sun3 zs driver which tried
to reduce overhead on autovectored interrupts, but nowadays such hack
might cause recursive global locks on modern SMP capable framework.

Fixes "5.99.30 sparc panic during startup" reported by Hauke Fath
on tech-kern@:
http://mail-index.NetBSD.org/tech-kern/2010/06/19/msg008374.html
and also tested by Jochen Kunz on SS20 with both serial and kbd console.

Ok'ed by mrg@ and dyoung@.
 1.118 04-Jun-2010  macallan make sure we pass a valid consdev pointer to the console keyboard so kbd
knows it's console and passes the right flags to wskbd, now the wskbd will
not drop off the mux when leaving event mode.
Symptoms: now the keyboard should no longer be dead when leaving X and there
should be no more panics caused by it
I tested this on an SS5 and an SS20, may need some more attention and zs.c
sure could use some cleanup - there are a few differences to sparc64 that
really don't make much sense to me, like not passing console flags to zstty
which sparc64 does but sparc avoids, which caused this problem in the first
place.
 1.117 17-Jan-2010  tsutsui branches: 1.117.2; 1.117.4;
Make sure to set ZS_HWFLAG_USE_CONSDEV and zs_consdev into zsc_args
passed to child devices even in !(NWSKBD == 0) case so that zs console
functions are actually used rather than the default prom console.
Fixes stray interrupts on MP machines running GENERIC.MP kernel with
zs serial console.

Ok'ed by mrg@.
 1.116 31-May-2009  martin Properly initialize child attach args to zero - we could end up with
various devices having different ideas about being console otherwise.
 1.115 22-May-2009  mrg add two new functions for z8530tty: zs_chan_lock() and zs_chan_unlock(),
and use them instead of various spl's in the zs.c's.

reviewed by ad and martin.
 1.114 16-May-2009  cegger KNF, same object code generated
 1.113 18-Mar-2009  cegger bcopy -> memcpy
 1.112 17-Nov-2008  martin branches: 1.112.4;
PR port-sparc/39942: ifdef ch0_is_cons declaration and all uses consistently
 1.111 13-Jun-2008  cegger branches: 1.111.2; 1.111.4; 1.111.6;
use device_lookup_private to get softc
 1.110 28-Apr-2008  martin branches: 1.110.2; 1.110.4;
Remove clause 3 and 4 from TNF licenses
 1.109 29-Mar-2008  tsutsui branches: 1.109.2; 1.109.4;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.108 27-Nov-2007  ad branches: 1.108.14;
Use the softint API.
 1.107 09-Nov-2007  ad Call zs_lock_init() to set up the chanstate's lock.
 1.106 14-Mar-2007  jdc branches: 1.106.14; 1.106.16; 1.106.20; 1.106.22;
Final steps to for working wscons on sun-4 class machines. Restructure
the previous revision so that we don't tell the common zs code that we
are the console if we're using wscons. Thanks to wrstuden@ for the hints.
 1.105 08-Feb-2007  jdc branches: 1.105.2; 1.105.6; 1.105.8;
First steps for working wscons on sun-4 class machines - recognise the
console keyboard and mouse on them.

We are not there yet because currently both wsdisplay and zstty assume
that they are the console. On sun-4, zstty wins because it attaches
last and overwrites the console device that wscons had set previously.
 1.104 26-Feb-2006  thorpej branches: 1.104.14;
Use device_is_a().
 1.103 16-Nov-2005  uwe branches: 1.103.2; 1.103.4; 1.103.6;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.102 30-Jun-2005  macallan branches: 1.102.2; 1.102.8;
Allow sparc64-style attachment of mouse and keyboard via zstty, needed for
wscons support.
Reviewed by uwe.
 1.101 03-Apr-2004  chs add some SUN4D stuff.
zs and zstty no longer need "needs-count" or "needs-flag",
so get rid of those and wild-card the extra zs devices on SUN4D.
 1.100 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.99 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.98 15-Jul-2003  lukem __KERNEL_RCSID()
 1.97 28-Jan-2003  pk branches: 1.97.2;
Provide locking required by the interrupt handlers running at IPL_SERIAL.
 1.96 22-Jan-2003  pk Set the interrupt target to the current CPU when directly accessing
the chip for console I/O.
 1.95 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.94 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.93 09-Dec-2002  pk Finish the switch to the softintr(9) framework.

To make this work, we now have to use separate handler lists for hardware
and software interrupts as the soft interrupt handlers do not return
an `interrupt handled' status.

Thanks to Matt Fredette for providing an initial set of patches on port-sparc.
 1.92 09-Oct-2002  jdc Check only the physical address of serial ports on a Sun 4.

Reviewed by Uwe.
 1.91 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.90 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.89 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.88 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.87 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.86 24-Aug-2002  thorpej Add autoconfiguration support for the Sun4d "bootbus". Add a
zs @ bootbus attachment.
 1.85 11-Mar-2002  pk branches: 1.85.4; 1.85.6;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.84 26-Sep-2001  eeh branches: 1.84.4;
getprop* -> PROM_getprop*
 1.83 30-Jun-2001  mrg branches: 1.83.2; 1.83.4;
KGDB needs both zs_putc and zs_getc; make them non-static.
 1.82 26-May-2001  pk Pull in "opt_kgdb.h"; see PR#13036.
 1.81 18-Oct-2000  pk branches: 1.81.2;
Account for the top-most 4 bits of obio addresses being zero on sun 4/100
machines, when inferring zs PROM device numbers from the physical address.
 1.80 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.79 04-Jun-2000  cgd branches: 1.79.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.78 21-Mar-2000  pk branches: 1.78.2;
Delete debugging printf().
 1.77 19-Mar-2000  pk Just don't force the baud rate in the driver, ever.
 1.76 19-Mar-2000  pk Revise console device handling:
* do not require a `zs' driver for console handling
* run the console on PROM primitives until a device recognises
itself as a console device during normal autoconfiguration.
* allow (keyboard) devices to take over the input channel of
the PROM primitive-based console device.

As a result, consinit() is much simplified and does no longer have
to "detect" devices to setup a working console device. This complexity
has moved to individual drivers which interpret the PROM information
after they have attached to decide whether or not to act as a console.
 1.75 14-Mar-2000  jdc Add power management hooks.
 1.74 06-Mar-2000  thorpej - Implement cnbell() -- ring the console bell. The cn_bell entrypoint
is optional.
- Add cn_bell to statically allocated consdevs as appropriate.
 1.73 14-Feb-2000  pk Just skip matching the `slave' property against `cf_unit'.
 1.72 12-Feb-2000  pk Eliminate much of the goo in setting up zs device addressing.
 1.71 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
 1.70 07-Nov-1999  pk Handle empty `input/output path' when looking for console device; patch
from Brian D. Chase.
 1.69 27-Mar-1999  wrstuden branches: 1.69.2; 1.69.8; 1.69.10; 1.69.14;
Add pps support. Only enable pps if CLOCAL & !MDMBUF.
 1.68 05-Mar-1999  pk consinit: cover all cases.
 1.67 02-Mar-1999  pk Sanatize consinit() a bit.
 1.66 22-Feb-1999  pk Since V2 & V3 proms already pass us ihandles for stdin and stdout,
there's no need to open the device a second time. It suffices to
just convert the `ihandles' to `phandles'.
 1.65 16-Feb-1999  pk Use promlib version correctly.
 1.64 14-Feb-1999  pk Use the PROMLIB interface.
 1.63 11-Feb-1999  mycroft Minor cleanup.
Make the initializer for BAUDLO depend on PCLK directly; it was incorrect on
some ports where PCLK is not 4.9152MHz.
XXX Is the default value actually used?
 1.62 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.61 04-Jul-1998  jonathan defopt DDB.
 1.60 23-Apr-1998  chs fix a timing problem with polled output on sun4c's.
 1.59 30-Mar-1998  mycroft Eliminate cs_heldchar. It is not necessary in my version of the driver.
 1.58 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.57 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.56 21-Jan-1998  mrg KNF, and use splzs over splhigh in one place.
 1.55 12-Jan-1998  thorpej Update for changes to config.
 1.54 12-Nov-1997  pk If necessary, defer console output until TX interrupt handler runs.
 1.53 03-Nov-1997  mycroft Handle CDTRCTS, for silly Mac-like connector on some models (e.g. IPX).
 1.52 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.51 22-Oct-1997  gwr Correct the values of zs_unit in consinit(),
so ddb will work on the keyboard/display.
 1.50 18-Oct-1997  gwr branches: 1.50.2;
Use common zs code.
 1.49 31-Aug-1997  pk Allow a BREAK to cause a kgdb_connect().
 1.48 29-Jul-1997  fair branches: 1.48.2;
%x -> 0x%x
 1.47 14-Apr-1997  pk Avoid race for the chip's interrupt pending status bits in zscnputc()
by introducing a single-character queue to defer kernel console output
until the transmitter interrupt handler runs.
 1.46 09-Apr-1997  mrg as per discussion with torek, allow TC=1. also add option
to allow TC=0. the zilog documentation says not to allow
TC=0 -- however, i tested this and it "does work", as far
as i could tell, so, allow this use if so desired.
 1.45 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.44 13-Oct-1996  christos backout previous kprintf change
 1.43 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.42 02-Sep-1996  mycroft tty stop functions really should return void, not int, and certainly not both.
 1.41 30-May-1996  pk Put back a `#if defined(SUN4M)' for now.
 1.40 29-May-1996  pk We really need a ring buffer for every unit.
Eliminate extraneous ttyalloc() calls.
 1.39 29-May-1996  mrg find a couple minor nits from previous change.
 1.38 28-May-1996  mrg change zsinfo to a zs_softc, and impliment intr counts. mostly from OpenBSD.
 1.37 01-Apr-1996  christos branches: 1.37.4;
Eliminated dependencies on dev_conf.h
 1.36 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.35 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.34 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.33 25-Feb-1996  pk Use CPU-type macros.
 1.32 29-Nov-1995  pk Extend the size of the "soft" FIFOs which reportedly reduces the number
of FIFO overflows on high baud rates.
However, doing so on all 4 ports would cost a whopping 64KB (at 4096 entries
per FIFO) of kernel memory. So, the FIFOs are now allocated at attach time
allowing the size for the keyboard and mouse ports to be reduced (to 128)
which should be adequate for the 1200 baud they use.
 1.31 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.30 26-Jun-1995  pk Small optimisation & 1 fewer depedency on zs_ctty.
 1.29 26-Jun-1995  pk Use ZS_DELAY() in a few more places (from Gordon Ross, cf. sun3/dev/zs.c).
 1.28 21-Apr-1995  pk Implement zstty().
 1.27 11-Apr-1995  mycroft Undo accidental change.
 1.26 11-Apr-1995  mycroft Move CHAN_[AB] into here, and prefix with ZS_.
 1.25 11-Apr-1995  mycroft zsreg.h --> z8530.h
 1.24 01-Mar-1995  pk Better 4/100 support.
 1.23 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.22 29-Jan-1995  pk TIOC[SC]DTR ioctls.
 1.21 06-Dec-1994  deraadt TIOC[SG]FLAGS from matthew green
 1.20 26-Nov-1994  deraadt i hate ttyX-ignore-cd, but leave it here for a while longer
 1.19 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.18 20-Nov-1994  deraadt copyright/Id cleanup
 1.17 03-Nov-1994  pk Don't mess with device if it was opened while we napped.
 1.16 02-Nov-1994  deraadt ioctl u_long cmd; and KNF
 1.15 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.14 02-Oct-1994  deraadt sun4/300 support works
 1.13 17-Sep-1994  deraadt sbus/* --> dev/*
deal with multiple bus types (start of vme/obio support)
 1.12 20-Aug-1994  deraadt sun4 needs software delays for register accesses
 1.11 21-Jul-1994  deraadt make X11R5 compile easier
 1.10 24-Jun-1994  deraadt branches: 1.10.2;
sun4c -> SUN4C
 1.9 27-May-1994  pk cast to make compiler happy.
 1.8 19-May-1994  deraadt t_stop has been erradicated
 1.7 14-May-1994  deraadt TIOCSBRK/TIOCCBRK
 1.6 05-May-1994  deraadt timeout and ndflush casts
 1.5 23-Mar-1994  pk DDB support
 1.4 14-Feb-1994  deraadt ioctl takes a proc *
 1.3 13-Oct-1993  deraadt fixups for dynamic tty allocation:
cdevsw[]->d_ttys must be initialized
XXstop() functions must be callable from cdevsw[]->d_stop
the console tty is used before vm system is up, and must
allocate it's own clists..
 1.2 11-Oct-1993  deraadt cons.c, zs.c: tty->t_stop doesn't exist here. I think it goes through d_stop
automatically now, but have not checked.
l_ioctl() has no last parameter 'p'
fb.c: move sys/fbio.h to machine/fbio.h
various: typecast parms for timeout() properly
zs.c: extra level of indir in cdevsw[]->d_ttys
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.2.1 22-Jul-1994  cgd from trunk.
 1.37.4.1 02-Jun-1996  mrg pull up tty stats "bug fix".
 1.48.2.1 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.50.2.4 08-May-1998  mycroft Pull up 1.59-1.60, per request of mycroft.
 1.50.2.3 14-Nov-1997  mellon Pull rev 1.54 up from trunk (pk)
 1.50.2.2 04-Nov-1997  mellon Pull rev 1.52 and 1.53 up from trunk (mycroft)
 1.50.2.1 23-Oct-1997  mellon Pull rev 1.51 up from trunk
 1.69.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.69.10.1 15-Nov-1999  fvdl Sync with -current
 1.69.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.69.2.2 29-Mar-2000  he Apply patch (requested by pk):
Fix a NULL pointer dereference when a zs device interrupts during
autoconfiguration of subdevices (keyboard & mouse).
 1.69.2.1 15-Jan-2000  he Pull up revision 1.70 (requested by pk):
Two fixes:
o Fix out of bound indexing of buffer.
o Default to first serial port if console property is absent.
 1.78.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.79.2.2 19-Oct-2000  he Pull up revision 1.81 (requested by pk):
Account for the top-most 4 bits of obio addresses being zero on
sun 4/100 machines when inferring zs PROM device numbers from the
physical address.
 1.79.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.81.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.83.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.83.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.83.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.83.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.83.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.84.4.7 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.84.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.84.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.84.4.4 17-Sep-2002  nathanw Catch up to -current.
 1.84.4.3 27-Aug-2002  nathanw Catch up to -current.
 1.84.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.84.4.1 26-Sep-2001  nathanw file zs.c was added on branch nathanw_sa on 2002-04-01 07:42:44 +0000
 1.85.6.1 07-Dec-2002  he Pull up revision 1.92 (requested by jdc in ticket #908):
Check only the physical address of serial ports on a Sun4.
 1.85.4.2 31-Aug-2002  gehenna catch up with -current.
 1.85.4.1 19-May-2002  gehenna Remove hard-coded major.
 1.97.2.5 11-Dec-2005  christos Sync with head.
 1.97.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.97.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.97.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.97.2.1 03-Aug-2004  skrll Sync with HEAD
 1.102.8.1 22-Nov-2005  yamt sync with head.
 1.102.2.5 07-Dec-2007  yamt sync with head
 1.102.2.4 15-Nov-2007  yamt sync with head.
 1.102.2.3 03-Sep-2007  yamt sync with head.
 1.102.2.2 26-Feb-2007  yamt sync with head.
 1.102.2.1 21-Jun-2006  yamt sync with head.
 1.103.6.1 22-Apr-2006  simonb Sync with head.
 1.103.4.1 09-Sep-2006  rpaulo sync with head
 1.103.2.1 01-Mar-2006  yamt sync with head.
 1.104.14.1 09-Feb-2007  ad Sync with HEAD.
 1.105.8.1 11-Jul-2007  mjf Sync with head.
 1.105.6.2 03-Dec-2007  ad Sync with HEAD.
 1.105.6.1 10-Apr-2007  ad Sync with head.
 1.105.2.1 24-Mar-2007  yamt sync with head.
 1.106.22.2 08-Dec-2007  mjf Sync with HEAD.
 1.106.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.106.20.1 13-Nov-2007  bouyer Sync with HEAD
 1.106.16.1 09-Jan-2008  matt sync with HEAD
 1.106.14.2 03-Dec-2007  joerg Sync with HEAD.
 1.106.14.1 11-Nov-2007  joerg Sync with HEAD.
 1.108.14.4 17-Jan-2009  mjf Sync with HEAD.
 1.108.14.3 29-Jun-2008  mjf Sync with HEAD.
 1.108.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.108.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.109.4.5 11-Aug-2010  yamt sync with head.
 1.109.4.4 11-Mar-2010  yamt sync with head
 1.109.4.3 20-Jun-2009  yamt sync with head
 1.109.4.2 04-May-2009  yamt sync with head.
 1.109.4.1 16-May-2008  yamt sync with head.
 1.109.2.2 17-Jun-2008  yamt sync with head.
 1.109.2.1 18-May-2008  yamt sync with head.
 1.110.4.1 18-Jun-2008  simonb Sync with head.
 1.110.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.111.6.4 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.111.6.3 16-Jan-2011  bouyer Pull up following revision(s) (requested by mrg in ticket #1526):
sys/arch/sparc/dev/zs.c: revision 1.115
sys/dev/ic/z8530sc.h: revision 1.26
sys/dev/ic/z8530sc.c: revision 1.30
sys/dev/ic/z8530tty.c: revision 1.127
sys/arch/sparc64/dev/zs.c: revision 1.68
add two new functions for z8530tty: zs_chan_lock() and zs_chan_unlock(),
and use them instead of various spl's in the zs.c's.
reviewed by ad and martin.
 1.111.6.2 09-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #800):
sys/arch/sparc/dev/zs.c: revision 1.116
Properly initialize child attach args to zero - we could end up with
various devices having different ideas about being console otherwise.
 1.111.6.1 18-Nov-2008  snj branches: 1.111.6.1.2;
Pull up following revision(s) (requested by martin in ticket #77):
sys/arch/sparc/dev/zs.c: revision 1.112
PR port-sparc/39942: ifdef ch0_is_cons declaration and all uses
consistently
 1.111.6.1.2.1 09-Jun-2009  snj branches: 1.111.6.1.2.1.2;
Pull up following revision(s) (requested by martin in ticket #800):
sys/arch/sparc/dev/zs.c: revision 1.116
Properly initialize child attach args to zero - we could end up with
various devices having different ideas about being console otherwise.
 1.111.6.1.2.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.111.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.111.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.111.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.112.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.117.4.1 03-Jul-2010  rmind sync with head
 1.117.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.120.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.120.8.1 30-Oct-2012  yamt sync with head
 1.121.52.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.122.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.22 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.21 16-May-2009  cegger branches: 1.21.44; 1.21.54;
KNF, same object code generated
 1.20 18-Mar-2009  cegger bcopy -> memcpy
 1.19 18-Mar-2009  cegger bzero -> memset
 1.18 28-Apr-2008  martin branches: 1.18.8; 1.18.14;
Remove clause 3 and 4 from TNF licenses
 1.17 04-Mar-2007  christos branches: 1.17.40; 1.17.42; 1.17.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 16-Nov-2005  uwe branches: 1.16.26;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.15 14-Nov-2005  uwe branches: 1.15.2;
Catch up with the signature change of obio_find_rom_map.
Add __UNVOLATILE when zc is passed as kgdb ioarg.
 1.14 17-Mar-2004  pk branches: 1.14.16;
Rename PROM_getprop*() => prom_getprop*().
 1.13 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 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 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.9 17-Jul-2002  thorpej Remote CPU_ISSUN4OR4C and CPU_ISSUN4COR4M, and instead express them
as (CPU_ISSUN4 || CPU_ISSUN4C) and (CPU_ISSUN4C || CPU_ISSUN4M),
respectively. The compiler can still optimize as desired by expressing
them this way, and it simplifies adding new tests.

While here, just remove CPU_ISSUN4MOR4U; it's not used by anything.
 1.8 26-Sep-2001  eeh branches: 1.8.4; 1.8.12;
getprop* -> PROM_getprop*
 1.7 29-Jun-2001  mrg branches: 1.7.2; 1.7.4;
#include <machine/autoconf.h>
 1.6 26-May-2001  pk Pull in "opt_kgdb.h"; see PR#13036.
 1.5 21-Mar-2000  pk branches: 1.5.6;
findzs() is now used only by the kgbd initialision code.
 1.4 12-Feb-2000  pk Eliminate much of the goo in setting up zs device addressing.
 1.3 03-Feb-1999  mycroft branches: 1.3.8;
Don't set DCD_IE in the frontends. KGDB doesn't even use DCD, and the tty
frontends get it from zsparam() anyway.
 1.2 22-Oct-1997  gwr Correct zs_unit in zs_kgdb_init().
Similar problem as zs.c:consinit().
 1.1 18-Oct-1997  gwr branches: 1.1.2;
Use common zs code.
 1.1.2.1 23-Oct-1997  mellon Pull rev 1.2 up from main trunk
 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.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.7.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.7.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.12.2 21-Jul-2002  gehenna catch up with -current.
 1.8.12.1 19-May-2002  gehenna Replace the access to devsw table and the hard-coded majors with devsw API.
 1.8.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.8.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.8.4.1 26-Sep-2001  nathanw file zs_kgdb.c was added on branch nathanw_sa on 2002-08-01 02:43:22 +0000
 1.11.2.4 11-Dec-2005  christos 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.16.2 03-Sep-2007  yamt sync with head.
 1.14.16.1 21-Jun-2006  yamt sync with head.
 1.15.2.2 22-Nov-2005  yamt sync with head.
 1.15.2.1 14-Nov-2005  yamt file zs_kgdb.c was added on branch yamt-readahead on 2005-11-22 16:08:02 +0000
 1.16.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.44.3 20-Jun-2009  yamt sync with head
 1.17.44.2 04-May-2009  yamt sync with head.
 1.17.44.1 16-May-2008  yamt sync with head.
 1.17.42.1 18-May-2008  yamt sync with head.
 1.17.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.21.54.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.21.44.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 11-Apr-1995  mycroft Move this into a generic location.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.11 18-Oct-1997  gwr Use common zs code.
 1.10 14-Apr-1997  pk Avoid race for the chip's interrupt pending status bits in zscnputc()
by introducing a single-character queue to defer kernel console output
until the transmitter interrupt handler runs.
 1.9 29-May-1996  mrg find a couple minor nits from previous change.
 1.8 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.7 25-Feb-1996  pk Use CPU-type macros.
 1.6 24-Jan-1996  gwr Move struct definitions to MD code.
 1.5 29-Nov-1995  pk Extend the size of the "soft" FIFOs which reportedly reduces the number
of FIFO overflows on high baud rates.
However, doing so on all 4 ports would cost a whopping 64KB (at 4096 entries
per FIFO) of kernel memory. So, the FIFOs are now allocated at attach time
allowing the size for the keyboard and mouse ports to be reduced (to 128)
which should be adequate for the 1200 baud they use.
 1.4 11-Apr-1995  mycroft Move CHAN_[AB] into here, and prefix with ZS_.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 20-Aug-1994  deraadt sun4 needs software delays for register accesses
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.29 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.28 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.27 12-Feb-2012  matt branches: 1.27.46; 1.27.48;
Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.26 21-Nov-2009  rmind branches: 1.26.12; 1.26.16;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.25 16-Nov-2005  uwe branches: 1.25.78;
ANSIify. Use uint<N>_t. Drop trailing whitespace.
Same binary code is generated.
 1.24 31-May-2005  christos branches: 1.24.2; 1.24.8;
add missing const
 1.23 12-Oct-2003  pk Simplify fpu_cleanup() by having it return a code to indicate that a SIGFPE
is to be posted; let trap() deal with constructing the siginfo structure.
 1.22 06-Oct-2003  pk No need for SVR4/SunOS5 FPE_* codes as these are compatible with ours.
 1.21 05-Oct-2003  pk sparc kernel support for SA_SIGINFO.
 1.20 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.19 15-Jul-2003  lukem __KERNEL_RCSID()
 1.18 10-May-2003  martin branches: 1.18.2;
Remove a spurious Debugger() call in a "this should never happen"
(SUN4U only) code path.
 1.17 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.16 06-Jan-2003  pk Protect FPU context switching with its own lock.
 1.15 19-Jan-2002  eeh Remove some DEBUG code.
 1.14 19-Jan-2002  eeh Fix a few more bugs.
 1.13 22-Sep-2001  eeh branches: 1.13.4;
BADREG was no longer defined.
 1.12 22-Sep-2001  eeh Handle fpu registers 32-63 properly.
 1.11 06-Dec-2000  mrg branches: 1.11.2; 1.11.4;
fix warnings in DEBUG & DIAGNSTIC code.
 1.10 16-Aug-2000  pk Drop two `#ifdef SUN4U's, since `sparc{64}/include/instr.h' are now synced.
 1.9 04-Aug-2000  hannken Add missing `#ifdef SUN4U', `FTYPE_LNG' is only defined on sparc64.
 1.8 03-Aug-2000  eeh Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
And rename the 128-bit `x' routines to `q' to match v9 terminology:
i - 32-bit int
x - 64-bit int
s - 32-bit fp
d - 64-bit fp
q - 128-bit fp
 1.7 18-Jun-2000  mrg branches: 1.7.2;
merge in ultrasparc changes
 1.6 29-Jul-1997  fair branches: 1.6.20; 1.6.28;
%x -> 0x%x
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 14-Mar-1996  christos Add and bring prototypes into scope.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.6.28.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.6.20.2 08-Dec-2000  bouyer Sync with HEAD.
 1.6.20.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 07-Aug-2000  mrg pull up 1.8, 1.9 (approved by thorpej):
>Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
>And rename the 128-bit `x' routines to `q' to match v9 terminology:
> i - 32-bit int
> x - 64-bit int
> s - 32-bit fp
> d - 64-bit fp
> q - 128-bit fp

>Add missing `#ifdef SUN4U', `FTYPE_LNG' is only defined on sparc64.
 1.11.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.11.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.13.4.8 17-Jan-2003  pk Fix merge error.
 1.13.4.7 07-Jan-2003  thorpej Sync with HEAD.
 1.13.4.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.13.4.5 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.13.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.13.4.3 04-Jan-2002  eeh curproc->p_md ==> curproc->l_md
 1.13.4.2 20-Nov-2001  pk Convert to SA framework.
 1.13.4.1 22-Sep-2001  pk file fpu.c was added on branch nathanw_sa on 2001-11-20 16:28:02 +0000
 1.18.2.5 11-Dec-2005  christos Sync with head.
 1.18.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.24.8.1 22-Nov-2005  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.25.78.1 11-Mar-2010  yamt sync with head
 1.26.16.1 18-Feb-2012  mrg merge to -current.
 1.26.12.1 17-Apr-2012  yamt sync with head
 1.27.48.1 10-Jun-2019  christos Sync with HEAD
 1.27.46.6 25-Jan-2019  pgoyette Declare the variable which we're using as the return value of the
hook function.
 1.27.46.5 22-Jan-2019  pgoyette Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line
rather than defining an intermediate hook##call function. Almost
all of the hooks are called only once, and although we lose the
ability of doing things like

if (MODULE_HOOK_CALL(...) == 0) ...

we simplify things quite a bit. With this change, we no longer need
to have both declaration and definition macros, and the definition
no longer needs to have both prototype argument list and a "real"
argument list.

FWIW, the above if now needs to written as

int ret;

MODULE_HOOK_CALL(..., ret);
if (ret == 0) ...

with appropriate use of braces {}.
 1.27.46.4 18-Jan-2019  pgoyette Don't restrict hooks to having only int or void types. Pass the hook's
type to the various macros, as needed.

Allows us to reduce diffs to original in at least one or two places (we
no longer have to provide an additional parameter to the hook routine
for returning a non-int return value).
 1.27.46.3 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.27.46.2 13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.27.46.1 02-Oct-2018  pgoyette Use a hook callback to allow sparc fpu code to determine if a process
is running under sunos emulation (in which case, fpu cleanup uses a
different set of fpu_codes[]).
 1.7 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.6 16-Nov-2005  uwe ANSIify. Use uint<N>_t. Drop trailing whitespace.
Same binary code is generated.
 1.5 07-Aug-2003  agc branches: 1.5.16; 1.5.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 15-Jul-2003  lukem __KERNEL_RCSID()
 1.3 14-Mar-1996  christos branches: 1.3.64;
Add and bring prototypes into scope.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.3.64.4 11-Dec-2005  christos Sync with head.
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.24.1 22-Nov-2005  yamt sync with head.
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.6 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 07-Aug-2003  agc branches: 1.4.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 24-Jul-2000  mycroft branches: 1.3.24;
asm volatile --> __asm __volatile
 1.2 20-Nov-1994  deraadt branches: 1.2.32;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.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.3.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.24.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.7 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 15-Jul-2003  lukem __KERNEL_RCSID()
 1.3 26-Aug-2001  eeh branches: 1.3.6; 1.3.22;
Do a more accurate compare.
 1.2 20-Nov-1994  deraadt branches: 1.2.46;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.46.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.3.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.22.1 03-Aug-2004  skrll Sync with HEAD
 1.3.6.2 26-Aug-2001  eeh Do a more accurate compare.
 1.3.6.1 26-Aug-2001  eeh file fpu_compare.c was added on branch nathanw_sa on 2001-08-26 05:46:32 +0000
 1.6 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.5 16-Nov-2005  uwe ANSIify. Use uint<N>_t. Drop trailing whitespace.
Same binary code is generated.
 1.4 07-Aug-2003  agc branches: 1.4.16; 1.4.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 15-Jul-2003  lukem __KERNEL_RCSID()
 1.2 20-Nov-1994  deraadt branches: 1.2.66;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.66.4 11-Dec-2005  christos Sync with head.
 1.2.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.66.1 03-Aug-2004  skrll Sync with HEAD
 1.4.24.1 22-Nov-2005  yamt sync with head.
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.8 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 04-Dec-2001  darrenr branches: 1.5.16;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.4 03-Aug-2000  eeh branches: 1.4.4; 1.4.8;
Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
And rename the 128-bit `x' routines to `q' to match v9 terminology:
i - 32-bit int
x - 64-bit int
s - 32-bit fp
d - 64-bit fp
q - 128-bit fp
 1.3 18-Jun-2000  mrg branches: 1.3.2;
merge in ultrasparc changes
 1.2 20-Nov-1994  deraadt branches: 1.2.32; 1.2.40;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.40.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.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.3.2.1 07-Aug-2000  mrg pull up 1.4 (approved by thorpej):
>Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
>And rename the 128-bit `x' routines to `q' to match v9 terminology:
> i - 32-bit int
> x - 64-bit int
> s - 32-bit fp
> d - 64-bit fp
> q - 128-bit fp
 1.4.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.4.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.16.1 03-Aug-2004  skrll Sync with HEAD
 1.13 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.12 16-Nov-2005  uwe ANSIify. Use uint<N>_t. Drop trailing whitespace.
Same binary code is generated.
 1.11 07-Aug-2003  agc branches: 1.11.16; 1.11.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.10 15-Jul-2003  lukem __KERNEL_RCSID()
 1.9 16-Oct-2002  martin branches: 1.9.6;
Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.
 1.8 23-Jan-2002  pk branches: 1.8.10;
Add missing `#ifdef SUN4U'.
 1.7 19-Jan-2002  eeh Fix a few more bugs.
 1.6 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.5 03-Aug-2000  eeh branches: 1.5.4; 1.5.8;
Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
And rename the 128-bit `x' routines to `q' to match v9 terminology:
i - 32-bit int
x - 64-bit int
s - 32-bit fp
d - 64-bit fp
q - 128-bit fp
 1.4 18-Jun-2000  mrg branches: 1.4.2;
merge in ultrasparc changes
 1.3 14-Mar-1996  christos branches: 1.3.30; 1.3.38;
Add and bring prototypes into scope.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.3.38.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.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.4.2.1 07-Aug-2000  mrg pull up 1.5 (approved by thorpej):
>Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
>And rename the 128-bit `x' routines to `q' to match v9 terminology:
> i - 32-bit int
> x - 64-bit int
> s - 32-bit fp
> d - 64-bit fp
> q - 128-bit fp
 1.5.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.5.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.5.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.5.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.5.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.10.1 08-Nov-2002  tron Pull up revision 1.9 (requested by martin in ticket #916):
Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.
 1.9.6.4 11-Dec-2005  christos 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.24.1 22-Nov-2005  yamt sync with head.
 1.11.16.1 21-Jun-2006  yamt sync with head.
 1.11 30-Aug-2022  rin Drop one more register qualifier.
 1.10 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 16-Nov-2005  uwe branches: 1.8.74; 1.8.76; 1.8.78;
ANSIify. Use uint<N>_t. Drop trailing whitespace.
Same binary code is generated.
 1.7 12-Oct-2003  pk branches: 1.7.16; 1.7.24;
Simplify fpu_cleanup() by having it return a code to indicate that a SIGFPE
is to be posted; let trap() deal with constructing the siginfo structure.
 1.6 18-Jan-2003  thorpej branches: 1.6.2;
Merge the nathanw_sa branch.
 1.5 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.4 03-Aug-2000  eeh branches: 1.4.4; 1.4.8;
Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
And rename the 128-bit `x' routines to `q' to match v9 terminology:
i - 32-bit int
x - 64-bit int
s - 32-bit fp
d - 64-bit fp
q - 128-bit fp
 1.3 18-Jun-2000  mrg branches: 1.3.2;
merge in ultrasparc changes
 1.2 05-Sep-1998  christos branches: 1.2.12; 1.2.20;
Assign copyright to TNF.
 1.1 14-Mar-1996  christos Add and bring prototypes into scope.
 1.2.20.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 07-Aug-2000  mrg pull up 1.4 (approved by thorpej):
>Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
>And rename the 128-bit `x' routines to `q' to match v9 terminology:
> i - 32-bit int
> x - 64-bit int
> s - 32-bit fp
> d - 64-bit fp
> q - 128-bit fp
 1.4.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.8.1 20-Nov-2001  pk Convert to SA framework.
 1.4.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.4 11-Dec-2005  christos Sync with head.
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.24.1 22-Nov-2005  yamt sync with head.
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.8.78.1 16-May-2008  yamt sync with head.
 1.8.76.1 18-May-2008  yamt sync with head.
 1.8.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.14 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.13 16-Nov-2005  uwe ANSIify. Use uint<N>_t. Drop trailing whitespace.
Same binary code is generated.
 1.12 07-Aug-2003  agc branches: 1.12.16; 1.12.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 15-Jul-2003  lukem __KERNEL_RCSID()
 1.10 19-Jan-2002  eeh branches: 1.10.16;
Fix a few more bugs.
 1.9 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.8 26-Aug-2001  eeh branches: 1.8.6;
Fix debug printf.
 1.7 03-Aug-2000  eeh branches: 1.7.4;
Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
And rename the 128-bit `x' routines to `q' to match v9 terminology:
i - 32-bit int
x - 64-bit int
s - 32-bit fp
d - 64-bit fp
q - 128-bit fp
 1.6 24-Jul-2000  mycroft Fix an obvious error that would cause fpu_ftoxi() to drop the upper half.
The compiler even emitted a warning for this...
 1.5 18-Jun-2000  mrg branches: 1.5.2;
merge in ultrasparc changes
 1.4 12-Apr-2000  chs branches: 1.4.2;
unconditionalize "ifdef sparc".
 1.3 14-Mar-1996  christos branches: 1.3.30;
Add and bring prototypes into scope.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.3.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.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.2 07-Aug-2000  mrg pull up 1.7 (approved by thorpej):
>Add fpu emulation instrumentation and fixup FCMP and FCMPE emulation for v9.
>And rename the 128-bit `x' routines to `q' to match v9 terminology:
> i - 32-bit int
> x - 64-bit int
> s - 32-bit fp
> d - 64-bit fp
> q - 128-bit fp
 1.5.2.1 26-Jul-2000  mycroft Approved by thorpej:
Fix an obvious error that would cause fpu_ftoxi() to drop the upper half.
The compiler even emitted a warning for this...

syssrc/sys/arch/sparc/fpu/fpu_implode.c 1.5 -> 1.6
 1.7.4.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.7.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.8.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.8.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.8.6.1 26-Aug-2001  nathanw file fpu_implode.c was added on branch nathanw_sa on 2002-01-08 00:27:36 +0000
 1.10.16.4 11-Dec-2005  christos Sync with head.
 1.10.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.16.1 03-Aug-2004  skrll Sync with HEAD
 1.12.24.1 22-Nov-2005  yamt sync with head.
 1.12.16.1 21-Jun-2006  yamt sync with head.
 1.6 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.5 16-Nov-2005  uwe ANSIify. Use uint<N>_t. Drop trailing whitespace.
Same binary code is generated.
 1.4 07-Aug-2003  agc branches: 1.4.16; 1.4.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 15-Jul-2003  lukem __KERNEL_RCSID()
 1.2 20-Nov-1994  deraadt branches: 1.2.66;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.66.4 11-Dec-2005  christos Sync with head.
 1.2.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.66.1 03-Aug-2004  skrll Sync with HEAD
 1.4.24.1 22-Nov-2005  yamt sync with head.
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.7 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.6 24-May-2022  andvar s/equivalant/equivalent/ in copy pasted comment.
 1.5 16-Nov-2005  uwe ANSIify. Use uint<N>_t. Drop trailing whitespace.
Same binary code is generated.
 1.4 07-Aug-2003  agc branches: 1.4.16; 1.4.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 15-Jul-2003  lukem __KERNEL_RCSID()
 1.2 20-Nov-1994  deraadt branches: 1.2.66;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.66.4 11-Dec-2005  christos Sync with head.
 1.2.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.66.1 03-Aug-2004  skrll Sync with HEAD
 1.4.24.1 22-Nov-2005  yamt sync with head.
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.8 30-Aug-2022  rin Drop one more register qualifier.
 1.7 28-Aug-2022  rin Drop ``register'' qualifier.

No binary changes for GENERIC compiled by GCC 10.4.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 15-Jul-2003  lukem __KERNEL_RCSID()
 1.3 14-Mar-1996  christos branches: 1.3.64;
Add and bring prototypes into scope.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.39 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.38 04-Nov-2024  christos Undo previous lwp.h change.
 1.37 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.36 17-May-2020  ad branches: 1.36.26;
Install sparc/intr.h
 1.35 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.34 29-Mar-2018  joerg branches: 1.34.2;
Move the complex logic for dynamically writing branches from ld.elf_so
into a header for reuse in crt0.o for static ifunc support. Change the
existing logic for sparc64 to use the Bicc variant of ba,a as it allows
+-8MB displacement compared to the BPcc variant's +-1MB. Teach the sparc
variant the same trick for using ba,a and not sethi+jmp when possible.
 1.33 23-Jul-2014  alnsn branches: 1.33.26;
Rename sljitarch.h to sljit_machdep.h.
 1.32 05-Nov-2012  alnsn branches: 1.32.10;
Add sljitarch.h on sparc.
 1.31 17-Jul-2011  joerg branches: 1.31.2; 1.31.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.30 20-May-2011  nakayama Add fenv support for sparc. Mostly copied from sparc64 and share with it.
 1.29 09-Feb-2007  ad branches: 1.29.70; 1.29.76;
Merge newlock2 to head.
 1.28 11-Dec-2005  christos branches: 1.28.20;
merge ktrace-lwp.
 1.27 08-May-2004  kleink branches: 1.27.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.26 11-Apr-2003  jdc branches: 1.26.2;
Install (new) cpuconf.h.

From Christopher SEKIYA in PR port-sparc/21093.
 1.25 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.24 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.22 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.21 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.20 19-Sep-2001  thorpej branches: 1.20.4; 1.20.8; 1.20.12;
Don't do the symlink hack for fbio.h. Just use <dev/sun/fbio.h>.
 1.19 15-Apr-2001  kleink branches: 1.19.2; 1.19.4;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.18 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.17 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.16 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.15 20-Aug-2000  pk branches: 1.15.2;
fbio.h moded to sys/dev/sun.
Retain symlink from /usr/include/machine.
 1.14 26-Jun-2000  kleink Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.13 29-Apr-2000  thorpej Oops, install <machine/lock.h> on these systems, too.
 1.12 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.11 10-Jan-2000  pk Cleanup the list of exported headers a bit.
 1.10 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.9 20-Dec-1999  jdc Added tctrl.h
 1.8 11-Aug-1999  matt branches: 1.8.2; 1.8.8;
Add <machine/apmvar.h> for sparc so that apmd can be built. Eventually
this allow it work on Tadpole SPARCbook 3 laptops (and/or other sparc
with power management).
 1.7 02-May-1999  christos Add bootinfo.h
 1.6 28-Apr-1999  christos Support for installboot
 1.5 15-Jan-1999  bouyer branches: 1.5.4;
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.4 22-Aug-1998  mrg bsd_audioio.h is not used.
 1.3 28-Jul-1998  pk Remove mbppio.h from the list.
Also stop installing db_machdep.h, fbvar.h, z8530.h.
 1.2 20-Jun-1998  mrg moved <machine/sun_disklabel.h> to <dev/sun/disklabel.h>
 1.1 12-Jun-1998  cgd Rework the way kernel include files are installed. In the new method,
as with user-land programs, include files are installed by each directory
in the tree that has includes to install. (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.) The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change. Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.19.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.19.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.19.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.12.2 31-Aug-2002  gehenna catch up with -current.
 1.20.12.1 19-May-2002  gehenna Remove port-dependent conf.h.
 1.20.8.1 18-Mar-2002  thorpej Install mutex_impl.h and rwlock_impl.h
 1.20.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.20.4.4 21-Nov-2002  martin Install mcontext.h, userland needs it.
 1.20.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.20.4.2 13-Aug-2002  nathanw Catch up to -current.
 1.20.4.1 19-Sep-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-08-13 02:18:53 +0000
 1.26.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.2.1 03-Aug-2004  skrll Sync with HEAD
 1.27.12.1 26-Feb-2007  yamt sync with head.
 1.28.20.1 01-Feb-2007  ad Header file cleanup.
 1.29.76.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.70.1 31-May-2011  rmind sync with head
 1.31.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.31.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.32.10.1 10-Aug-2014  tls Rebase.
 1.33.26.2 28-Jul-2018  pgoyette Sync with HEAD
 1.33.26.1 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.34.2.1 10-Jun-2019  christos Sync with HEAD
 1.36.26.1 02-Aug-2025  perseant Sync with HEAD
 1.2 12-Sep-2020  isaki Improve am7930 family drivers to share more code.
audioamd(4) on sparc, vsaudio(4) on vax, and bba(4) are.
- Remove complex and useless callbacks: onopen, onclose, and
indirect_{read,write}. This makes audioamd and vsaudio almost the same.
- Remove (already disabled) assembly fast interrupt path from audioamd(4).
cf. http://mail-index.netbsd.org/source-changes/2009/12/19/msg004585.html
- Use trigger_* method rather than start_* method. It's more suitable.
vsaudio(4) was tested by naru@, bba(4) was tested by tsutsui@.
 1.1 14-Mar-1999  jonathan Use bus_space tags and handles, embedded in MD hooks AM7930_{READ_WRITE}_REG
to handle MD delay and bus padding. Tested on sparc2 by David Brownlee.

Should use regmaps, but that breaks sparc pDMA assembly code.
 1.25 07-May-2019  kamil Switch all users (except ia64) of custom machine/ansi.h to common_ansi.h

Deduplicate the code among ports and poll definitions of types
directly from a compiler.

This fixes miscompilation of certain programs that instruct compilers
to generate code for different types. This bug has been detected with
-fshort-wchar in EFI firmware.

Proposed and discussed on a mailing list (twice).

Itanium uses custom !ELF fallback switch, temporarily leave it as it is.
 1.24 17-Jun-2015  martin branches: 1.24.18;
Make clock_t unsigned int everywhere.
Ok: matt@, mrg@
 1.23 17-Jul-2011  joerg branches: 1.23.12; 1.23.28; 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 27-Mar-2010  tnozaki 1. {wctype,wctrans,mbstate}_t: switch MD to MI like other
libc implementation (such as *BSD and glibc2).

2. don't typedef void * wc{type,trans}_t, suggested by soda@-san.
it may pass through compiler type check, it's harmful.
so i introduce dummy struct __tag_wc{type,trans}_t(iconv_t already does).

no ABI change was made.
 1.21 11-Jan-2009  christos branches: 1.21.4; 1.21.6;
merge christos-time_t
 1.20 17-Oct-2007  garbled branches: 1.20.16; 1.20.18; 1.20.22; 1.20.30;
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.19 03-Sep-2007  drochner clean up some definitions around rune_t which are not needed anymore
 1.18 04-Oct-2006  tnozaki branches: 1.18.8; 1.18.16; 1.18.22; 1.18.26; 1.18.28;
fix gcc -Werror -Wmissing-braces problem
mbstate_t(this is opaque object)'s initializer should be ``{ 0 }'',
so changed 1st field of union from character array to integer.
 1.17 11-Dec-2005  christos branches: 1.17.20; 1.17.22;
merge ktrace-lwp.
 1.16 20-Apr-2005  matt branches: 1.16.2;
For GCC3 and later, use the __builtin_va* constructs.
 1.15 07-Aug-2003  agc branches: 1.15.8; 1.15.14; 1.15.18;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.14 02-Mar-2003  tshiozak branches: 1.14.2;
add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.13 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.12 26-Dec-2000  itojun make mbstate_t bigger (32 -> 128 bytes).
XXX if you have libc after citrus locale import, please recompile libc,
and your applications that use mbstate_t (rather rare). really sorry
for the mess.
 1.11 21-Dec-2000  itojun populate _BSD_MBSTATE_T_. add warning regarding to rune_t.
 1.10 27-Jun-2000  kleink G/c _BSD_INTPTR_T_ and _BSD_UINTPTR_T_.
 1.9 05-Jun-1999  pk branches: 1.9.2; 1.9.10;
64-bit safety to help sharing compilation tools with sparc64.
 1.8 27-Apr-1998  kleink branches: 1.8.10;
Provide definitions for intptr_t and uintptr_t, signed resp. unsigned integral
types large enough to hold any pointer.
 1.7 23-Nov-1997  kleink Add _BSD_SUSECONDS_T_ and _BSD_USECONDS_T_; do some space vs. tab formatting
cleanup
 1.6 15-Nov-1996  jtc Define _BSD_CLOCKID_T_ and _BSD_TIMER_T_
 1.5 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.4 16-Mar-1996  jtc Add _BSD_WINT_T_ definition so we can handle wint_t type added in NA1.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 24-May-1994  deraadt liten
 1.1 10-Oct-1993  deraadt need these
 1.8.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.10.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.9.2.2 05-Jan-2001  bouyer Sync with HEAD
 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.14.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.15.18.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.15.14.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.15.8.1 29-Apr-2005  kent sync with -current
 1.16.2.2 27-Oct-2007  yamt sync with head.
 1.16.2.1 30-Dec-2006  yamt sync with head.
 1.17.22.1 22-Oct-2006  yamt sync with head
 1.17.20.1 18-Nov-2006  ad Sync with head.
 1.18.28.1 06-Nov-2007  matt sync with HEAD
 1.18.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.18.22.1 10-Sep-2007  skrll Sync with HEAD.
 1.18.16.1 03-Oct-2007  garbled Sync with HEAD
 1.18.8.1 09-Oct-2007  ad Sync with head.
 1.20.30.1 19-Jan-2009  skrll Sync with HEAD.
 1.20.22.2 11-Aug-2010  yamt sync with head.
 1.20.22.1 04-May-2009  yamt sync with head.
 1.20.18.2 30-Mar-2008  christos time_t is now __int64_t
 1.20.18.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.20.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.21.6.1 30-May-2010  rmind sync with head
 1.21.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.23.30.1 22-Sep-2015  skrll Sync with HEAD
 1.23.28.1 16-Jul-2015  riz Pull up following revision(s) (requested by martin in ticket #846):
sys/arch/mips/include/ansi.h: revision 1.29
sys/arch/sh3/include/ansi.h: revision 1.16
sys/arch/sparc64/include/ansi.h: revision 1.18
sys/arch/m68k/include/ansi.h: revision 1.24
sys/arch/powerpc/include/ansi.h: revision 1.30
sys/arch/hppa/include/ansi.h: revision 1.14
sys/arch/i386/include/ansi.h: revision 1.27
sys/arch/alpha/include/ansi.h: revision 1.25
sys/arch/usermode/include/ansi.h: revision 1.5
sys/arch/sparc/include/ansi.h: revision 1.24
Make _BSD_CLOCK_T_ unsigned int so it's the same for IPL32 and LP64
environments. We don't really have a powerpc64 native userland
and the mips64 native userland is IPL32 so this shouldn't affect anything.
Make clock_t unsigned
Make clock_t unsigned int everywhere.
Ok: matt@, mrg@
 1.23.12.1 03-Dec-2017  jdolecek update from HEAD
 1.24.18.1 10-Jun-2019  christos Sync with HEAD
 1.10 17-Mar-2012  martin mark reloc bitfield linted
 1.9 10-Dec-2002  thorpej branches: 1.9.146; 1.9.150;
Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.8 15-Mar-1997  pk branches: 1.8.40;
Remove trailing comma in enum definition.
 1.7 20-Nov-1994  deraadt copyright/Id cleanup
 1.6 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.5 18-Oct-1993  deraadt fix a typo
 1.4 18-Oct-1993  pk Put definition of __LDPGSZ and `struct relocation_info' where they belong:
in <machine/exec.h>.
 1.3 15-Oct-1993  deraadt actually put something in a previously empty file.
__LDPGSZ should now be defined here!
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.40.1 11-Dec-2002  thorpej Sync with HEAD.
 1.9.150.1 05-Apr-2012  mrg sync to latest -current.
 1.9.146.1 17-Apr-2012  yamt sync with head
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 14-Oct-2002  takemura branches: 1.2.108; 1.2.110; 1.2.112;
Moved MI APM definitions into dev/apm.
 1.1 11-Aug-1999  matt branches: 1.1.20;
Add <machine/apmvar.h> for sparc so that apmd can be built. Eventually
this allow it work on Tadpole SPARCbook 3 laptops (and/or other sparc
with power management).
 1.1.20.1 18-Oct-2002  nathanw Catch up to -current.
 1.2.112.1 16-May-2008  yamt sync with head.
 1.2.110.1 18-May-2008  yamt sync with head.
 1.2.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.25 06-Jan-2025  martin PR 58960: fix misunderstanding in semantic and provide both the original
id string as well as _NETBSD_REVISIONID.
Do not rely on string concatenation in the inline assembler, use .ascii
and .asciz for individual string parts instead.
 1.24 04-Jan-2025  martin PR 58960: sparc/asm.h: Respect NETBSD_REVISIONID.
 1.23 17-Apr-2020  joerg branches: 1.23.26;
Mark the .ident section as mergable string section to avoid redundant
entries.
 1.22 23-Aug-2015  joerg branches: 1.22.18; 1.22.28;
Use .word for data that is known to be aligned.
 1.21 23-Aug-2015  joerg Remove .proc 1, it has been ignored by gas for ages.
 1.20 12-Apr-2014  joerg branches: 1.20.4;
Add END() macro like most other archs have.
 1.19 12-Sep-2013  joerg branches: 1.19.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.18 20-Dec-2010  joerg branches: 1.18.8; 1.18.18; 1.18.22;
Consistently use .gnu.warning with .pushsectio and .popsection on all
architectures instead of obsolete STABS frames for linker warnings.
 1.17 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.16 20-Jan-2006  christos branches: 1.16.98;
Add a STRONG_ALIAS macro
 1.15 17-Sep-2002  uwe branches: 1.15.22; 1.15.34;
RCSID should go to .ident section.
While here add __KERNEL_RCSID.
 1.14 20-Jul-2002  mrg sync these with the sparc64 versions.
 1.13 24-Jun-2002  thorpej Add ENTRY_NOPROFILE().
 1.12 03-Nov-2001  thorpej branches: 1.12.8;
Changes from Martin Husemann and myself:
- Make the 32-bit SPARC profile support work with the GCC 2.95.3
SPARC ELF compiler, which uses a different name for mcount.
- Make the 64-bit SPARC profile support header look more like the 32-bit
SPARC header (no functional change -- 64-bit SPARC already used the
correct mcount name).
 1.11 23-Jun-2000  kleink branches: 1.11.4; 1.11.6; 1.11.8;
Add a WEAK_ALIAS() macro.
 1.10 24-Feb-1999  chs branches: 1.10.8; 1.10.18;
add RODATA(), which is like ENTRY() but without the _PROF_PROLOGUE.
 1.9 02-Dec-1998  thorpej Argh, fix the ANSI CPP version of the a.out WARN_REFERENCES().
 1.8 02-Dec-1998  thorpej Implement WARN_REFERENCES().
 1.7 01-Jul-1998  tv branches: 1.7.4;
_GLOBAL_OFFSET_TABLE_ needs a _C_LABEL() wrapper, too.
 1.6 01-Jul-1998  tv Change _C_LABEL() to use proper underscoring depending on __ELF__ or not.
 1.5 16-Jul-1997  christos Add RCSID() macro.
 1.4 30-Nov-1996  jtc PROF -> GPROF
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 03-Jun-1994  pk Profile asm entries also.
 1.1 10-Feb-1994  pk Define a few things here, in line with other ports.
 1.7.4.1 25-Feb-1999  chs sync with HEAD - profiling fixes.
 1.10.18.1 25-Jul-2000  kleink Pull up rev. 1.11 (approved by thorpej):
For ELF, add a WEAK_ALIAS() macro.
 1.10.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.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.11.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.11.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.11.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.11.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.11.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.8.2 31-Aug-2002  gehenna catch up with -current.
 1.12.8.1 17-Jul-2002  gehenna catch up with -current.
 1.15.34.1 01-Feb-2006  yamt sync with head.
 1.15.22.1 21-Jun-2006  yamt sync with head.
 1.16.98.1 05-Mar-2011  rmind sync with head
 1.18.22.1 18-May-2014  rmind sync with head
 1.18.18.2 03-Dec-2017  jdolecek update from HEAD
 1.18.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.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.19.2.1 10-Aug-2014  tls Rebase.
 1.20.4.1 22-Sep-2015  skrll Sync with HEAD
 1.22.28.1 20-Apr-2020  bouyer Sync with HEAD
 1.22.18.1 21-Apr-2020  martin Sync with HEAD
 1.23.26.1 02-Aug-2025  perseant Sync with HEAD
 1.51 22-May-2022  andvar fix various small typos, mainly in comments.
 1.50 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.49 17-Jan-2021  mrg set machine_model[] earlier, so that bootstrap can use it.

also, avoid "extern <variable>" in .c files, and add
idempotency to autoconf.h.
 1.48 27-Oct-2012  chs branches: 1.48.50;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.47 01-Jul-2011  dyoung branches: 1.47.2; 1.47.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.46 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.45 12-Feb-2008  joerg branches: 1.45.6; 1.45.8; 1.45.10;
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.44 04-Mar-2006  uwe branches: 1.44.44; 1.44.50;
De-__P.
 1.43 04-Mar-2006  uwe s/u_intN_t/uintN_t/
 1.42 11-Dec-2005  christos branches: 1.42.4; 1.42.6;
merge ktrace-lwp.
 1.41 03-Jun-2005  martin branches: 1.41.2;
Sprinkle some const
 1.40 31-May-2005  christos - sprinkle const
- remove parameter names from function declarations
 1.39 28-Jun-2004  pk Rename bus_translate_address_generic => bus_space_translate_address_generic()
and move prototype to <machine/bus.h>.
 1.38 27-Jun-2004  pk Always use `full bus space'. In order to implement this more efficiently,
require that all bus tags have pointers to bus_space_read/write functions,
i.e. no run-time hunting for the first "upstream" implementation.
Since this changes the way bus tags should be constructed it makes sense
to do the same thing for the rest of the bus space methods.
So, now bus space tags are generally constructed by copying the parent's bus
tag and then overriding the methods that the bus driver needs to handle,
instead of starting with an empty bus tag and fiiling in only the fields needed.
 1.37 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.36 18-Feb-2003  pk branches: 1.36.2;
Move makememarr() into promlib.c.
 1.35 25-Aug-2002  thorpej Add a generic function to translate a device address using a
parent's "ranges" property, and use it.
 1.34 11-Mar-2002  pk branches: 1.34.4;
`bus_type_t' is gone. Retain bus_space_map2() for MD drivers that need
to map registers to a fixed virtual address.
 1.33 21-Mar-2000  pk branches: 1.33.8; 1.33.12;
findzs() is now used only by the kgbd initialision code.
 1.32 11-Jan-2000  pk Remove old-style boot device recognition.
 1.31 14-Feb-1999  pk branches: 1.31.8;
Adjust to functionality and changes introduced with <machine/promlib.h>
 1.30 06-Oct-1998  thorpej configure() prototype is in <sys/device.h>
 1.29 26-Sep-1998  pk Move PROM interface prototypes into openprom.h
Use the `openprom_addr' structure for passing around physical addresses.
 1.28 30-Aug-1998  pk Nuke old getprop() function and put its successor in place.
 1.27 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.26 29-Jul-1998  pk <sparc/dev/sbusvar.h> => <dev/sbus/sbusvar.h>
 1.25 07-Apr-1998  pk Remove old mapdev() function prototype.
 1.24 30-Mar-1998  pk Make mainbus attach phys addr field a bus_addr_t.
 1.23 29-Mar-1998  pk Enter `obio_find_rom_map()' prototype.
Make `oba_paddr' field a `bus_addr_t'.
Define temporary compat `obio_bus_map()'.
 1.22 21-Mar-1998  pk Remove old `confargs' structure which is no longer used; extract the
structures representing the ROM properties.
Also, define the `mainbus' and `obio' attach arguments here.
 1.21 25-Jan-1998  pk bus_map() & bus_untmp() are only used for sun4/obio devices.
 1.20 24-May-1997  pk Always use `rr_iospace' to track the MMU page type bits.
This obsoletes the `bustype' argument in map[io]dev().
 1.19 18-May-1997  pk Remove bus_tmp().
 1.18 08-Apr-1997  pk Move "range" property description out of generic `romaux'.
 1.17 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously supplied
by Chris Demetriou.
 1.16 10-Apr-1996  pk Make room for another `value' in struct bootpath. Drop the global `bootdv'
in favour of storing the device pointer in the bootpath[] element corresponding
to the boot device. This also allows the opportunity to get to "intermediate"
devices (e.g. busses) should the need for this ever arise.
 1.15 31-Mar-1996  pk Add some v3 PROM glue.
Move autoconf subroutine prototypes here (from cpu.h).
 1.14 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.13 15-Jan-1996  thorpej Add a "mountroot hook" mechanism so that devices can take care of
special needs before being used in (*mountroot)().
 1.12 11-Jan-1996  pk Move bus_map() prototype here.
 1.11 11-Dec-1995  pk Change mapdev() and mapiodev() to take a `struct rom_reg', enabling the use
of IO spaces to construct device mappings.
 1.10 18-Aug-1995  pk declarations
 1.9 08-Mar-1995  pk Allow for multiple virtual PROM addresses.
 1.8 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.7 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.4 17-Sep-1994  deraadt "struct confargs" is used for all device match/attach functions. It
tells you what bus (sbus, vme, ...) you are on.
 1.3 19-May-1994  deraadt liten
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 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.33.12.2 27-Aug-2002  nathanw Catch up to -current.
 1.33.12.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.33.8.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.33.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.34.4.1 31-Aug-2002  gehenna catch up with -current.
 1.36.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.36.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.36.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.36.2.1 03-Aug-2004  skrll Sync with HEAD
 1.41.2.2 27-Feb-2008  yamt sync with head.
 1.41.2.1 21-Jun-2006  yamt sync with head.
 1.42.6.1 22-Apr-2006  simonb Sync with head.
 1.42.4.1 09-Sep-2006  rpaulo sync with head
 1.44.50.1 18-Feb-2008  mjf Sync with HEAD.
 1.44.44.1 23-Mar-2008  matt sync with HEAD
 1.45.10.1 16-May-2008  yamt sync with head.
 1.45.8.1 18-May-2008  yamt sync with head.
 1.45.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.47.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.47.2.1 30-Oct-2012  yamt sync with head
 1.48.50.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 28-May-2012  martin Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.
 1.5 04-Mar-2006  uwe branches: 1.5.106; 1.5.110; 1.5.112;
De-__P.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.6;
merge ktrace-lwp.
 1.3 24-Mar-2004  drochner branches: 1.3.16;
remove license clauses 3 and 4 from my cpoyright notices
 1.2 28-Mar-2002  pk branches: 1.2.10;
Define bootinfo record to pass the kernel file path from the boot program.
 1.1 02-May-1999  christos branches: 1.1.2; 1.1.18; 1.1.22;
Add bootinfo.h
 1.1.22.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.18.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.10.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.112.1 05-Jun-2012  jdc Pull up revisions:
src/sys/arch/sparc/include/bootinfo.h revision 1.6
src/sys/arch/sparc/sparc/autoconf.c revision 1.243
src/sys/arch/sparc/stand/boot/boot.c revision 1.28
src/sys/arch/sparc/stand/ofwboot/boot.c revision 1.29
src/sys/arch/sparc64/include/bootinfo.h revision 1.6-1.7
src/sys/arch/sparc64/sparc64/autoconf.c revision 1.186
(requested by martin in ticket #289).

Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.

Ooops, remove definitions duplicated in <sparc/bootinfo.h>
 1.5.110.1 02-Jun-2012  mrg sync to latest -current.
 1.5.106.1 30-Oct-2012  yamt sync with head
 1.4 22-Aug-1998  mrg bsd_audioio.h is not used.
 1.3 04-Mar-1995  pk Sync with sys/audioio.h for now, so SunOS compat works.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.25 24-Dec-2007  perry Remove __attribute__((__noreturn__)) from things already marked __dead
Found by the department of redundancy department.
 1.24 04-Mar-2007  christos branches: 1.24.20; 1.24.28; 1.24.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 11-Dec-2005  christos branches: 1.23.26;
merge ktrace-lwp.
 1.22 31-May-2005  christos branches: 1.22.2;
- sprinkle const
- remove parameter names from function declarations
 1.21 16-Mar-2004  pk Encapsulate retrieval of properties from the global `options' prom node.
 1.20 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.19 16-Jan-2003  pk branches: 1.19.2;
Definitions of some OBP generated CPU mailbox messages.
 1.18 23-Aug-2002  thorpej * Refine the comment describing openprom_addr.
* Add openprom_range and openprom_intr structures.
 1.17 15-Nov-2000  pk branches: 1.17.4; 1.17.8; 1.17.16; 1.17.18;
Adjust setprop() prototype to match that in dev/ofw/openfirm.h
 1.16 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.15 14-Feb-1999  pk branches: 1.15.8;
Adjust to functionality and changes introduced with <machine/promlib.h>
 1.14 26-Sep-1998  pk Add wrappers for PROM's CPU start/stop functions.
 1.13 26-Sep-1998  pk Move PROM interface prototypes into openprom.h
Use the `openprom_addr' structure for passing around physical addresses.
 1.12 12-Sep-1998  pk Expose `v3' routines to everyone.
 1.11 18-May-1996  mrg put promdev definition into <machine/bsd_openprom.h>.
 1.10 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.9 15-May-1996  mrg remove some RCS id's we don't need.
 1.8 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.7 16-Mar-1996  christos add rom routines declarations
 1.6 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.5 22-Feb-1996  pk Correct some prototypes.
 1.4 13-Feb-1996  pk Change some caddr_t's to void *'s.
 1.3 04-Sep-1995  pk Rename a `xxx' function.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.15.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.15.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.17.18.1 22-Nov-2002  tron Pull up revision 1.18 (requested by martin in ticket #948):
* Refine the comment describing openprom_addr.
* Add openprom_range and openprom_intr structures.
 1.17.16.1 31-Aug-2002  gehenna catch up with -current.
 1.17.8.2 17-Jan-2003  thorpej Sync with HEAD.
 1.17.8.1 27-Aug-2002  nathanw Catch up to -current.
 1.17.4.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.2.2 21-Jan-2008  yamt sync with head
 1.22.2.1 03-Sep-2007  yamt sync with head.
 1.23.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.24.28.1 26-Dec-2007  ad Sync with head.
 1.24.20.1 09-Jan-2008  matt sync with 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 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.57 17-Jul-2011  dyoung Switch sparc and sparc64 to new-style <sys/bus.h>.
 1.56 26-May-2009  macallan do as phone suggested - remove sparc_bus_map_large() again and use a flag
instead ( BUS_SPACE_MAP_LARGE )
 1.55 16-Apr-2009  macallan Add sparc_bus_map_large() to map large bus ranges like framebuffers and
apertures outside the IODEV range. ZX for example needs 8MB for the framebuffer
alone while the IODEV range provides only 16MB.
 1.54 28-Apr-2008  martin branches: 1.54.8; 1.54.10; 1.54.14; 1.54.18;
Remove clause 3 and 4 from TNF licenses
 1.53 04-Mar-2007  christos branches: 1.53.40; 1.53.42; 1.53.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.52 21-Feb-2007  mrg add a pair of new bus_dma(9) functions:
int _bus_dmatag_subregion(bus_dma_tag_t tag,
bus_addr_t min_addr,
bus_addr_t max_addr,
bus_dma_tag_t *newtag,
int flags)
void _bus_dmatag_destroy(bus_dma_tag_t tag)

that allow a (normally broken/limited) device to restrict the bus address
range it can talk to. this is used by bce(4) to limit DMA addresses to
1GB range, the maximum the chip can address.

all this is from Yorick Hardy <yhardy@uj.ac.za> with input from several
people on tech-kern.

XXX: bus_dma(9) needs an update still.
 1.51 04-Mar-2006  uwe branches: 1.51.20;
De-__P.
 1.50 04-Mar-2006  uwe s/u_intN_t/uintN_t/
 1.49 16-Feb-2006  perry 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.48 24-Dec-2005  perry branches: 1.48.2; 1.48.4; 1.48.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.47 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.46 11-Dec-2005  christos merge ktrace-lwp.
 1.45 09-Mar-2005  matt branches: 1.45.4;
Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.
 1.44 15-Nov-2004  martin branches: 1.44.4; 1.44.6;
Add bus_space_region_stream* functions (verbatim copy from sparc64).
Fixes PR port-sparc/28302. OK'd by pk.
 1.43 30-Jun-2004  pk Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.
 1.42 28-Jun-2004  pk Rename bus_translate_address_generic => bus_space_translate_address_generic()
and move prototype to <machine/bus.h>.
 1.41 27-Jun-2004  pk Always use `full bus space'. In order to implement this more efficiently,
require that all bus tags have pointers to bus_space_read/write functions,
i.e. no run-time hunting for the first "upstream" implementation.
Since this changes the way bus tags should be constructed it makes sense
to do the same thing for the rest of the bus space methods.
So, now bus space tags are generally constructed by copying the parent's bus
tag and then overriding the methods that the bus driver needs to handle,
instead of starting with an empty bus tag and fiiling in only the fields needed.
 1.40 16-Nov-2003  pk Use __insn_barrier() in all bus_space read/write operations.
 1.39 15-Jun-2003  fvdl branches: 1.39.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.
 1.38 28-Jan-2003  kent Introduce BUS_DMA_NOCACHE, and bus_dmamem_map() of i386 supports it.
 1.37 03-Jan-2003  martin Make the *_stream_* methods always use the *_real accessors.
Define __BUS_SPACE_HAS_STREAM_METHODS.
 1.36 03-Jan-2003  mrg part one of bus_space(9) fixes to enable bus spaces to override the
bus_space_{read,write}_[1248]() functions, which will allow 16-bit
PCMCIA support to work without additional hacks in MI drivers.
this option is not enabled yet.
 1.35 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.34 10-Dec-2002  pk bus_intr_establish() now takes an optional `fast trap' handler argument.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.33 25-Aug-2002  thorpej Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.32 07-May-2002  uwe branches: 1.32.2;
Delint a bit.
 1.31 07-May-2002  uwe bus space methods should be "static __inline__", not "extern __inline__".
Otherwise an unoptimized kernel cannot be linked. Reviewed by pk.
 1.30 23-Apr-2002  pk BUS_ADDR(): avoid signed conversions.
 1.29 21-Mar-2002  eeh Add bus_space_vaddr().
 1.28 11-Mar-2002  pk `bus_type_t' is gone. Retain bus_space_map2() for MD drivers that need
to map registers to a fixed virtual address.
 1.27 15-Dec-2001  soren Use regular read/writes for stream variant calls.
 1.26 24-Sep-2001  eeh branches: 1.26.4;
Change bus_space_mmap() signature to the official one.
 1.25 19-Jul-2001  thorpej branches: 1.25.2;
Add BUS_DMA_READ and BUS_DMA_WRITE flags, that hint the back-end
at dmamap load time that the mapping will be used for a unidirectional
transfer of the specified direction.
 1.24 07-Mar-2001  thorpej branches: 1.24.2;
Add the BUS_DMA_STREAMING flag.
 1.23 09-Jul-2000  pk branches: 1.23.2;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.22 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.21 24-Jun-2000  pk Maintain the DVMA map extent subregion boundaries in the bus_dma map
structure.
 1.20 21-Jun-2000  pk Fix pastos in bus_space_read_region_*() functions.
 1.19 23-May-2000  pk branches: 1.19.4;
Simplify the bus_dma(9) implementation:

- the `alignment' and `boundary' arguments in bus_dmamem_alloc() only
serve as hints on how to break up a DMA transaction into chunks
when necessary; it is not necessary on sparc DVMA hardware.

- exclusively use the VM page size (i.e. PAGE_SIZE et.al.) when computing
resource allocations.

- remember the size of DVMA resource allocations in the private `_ds_sgsize'
field in a dma segment descriptor.
 1.18 09-May-2000  pk The bus_dma(9) implementation now allocates DVMA addresses in
bus_dmamap_load_*() routines only. Note that DMA memory buffers
allocated with bus_dmamem_alloc() _must_ be loaded by bus_dmamap_load_raw().
 1.17 25-Jan-2000  drochner define a "BUS_SPACE_MAP_PREFETCHABLE" flag which basically means that
device accesses are idempotent (but should not be cached by the CPU)
 1.16 23-Mar-1999  drochner branches: 1.16.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.15 29-Jan-1999  drochner fix address incrementing in the read_region_N, write_region_N,
set_region_N and copy_region_N methods
 1.14 26-Nov-1998  pk Turn a bunch of bus_space_*() macros into in-line functions mostly to avoid
variable aliasing.
 1.13 22-Nov-1998  pk Turn the passed tag into "used" arguments.
 1.12 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.11 30-Jul-1998  pk Define a BUS_DMA flag for devices that have a 24-bit address space.
Update _bus_dma* prototypes.
 1.10 07-Apr-1998  pk branches: 1.10.2;
* Pass the bus tag instead of just the cookie to all bus space methods.
* In the bus tag structure, keep a reference to the parent bus.
* Express all bus space methods as inline functions in stead of macros
and use the parent bus tag reference to find the nearest "upstream"
bus that implements the method.
 1.9 29-Mar-1998  pk `sparc_bus_mmap()' declaration moved to machdep.c
 1.8 28-Mar-1998  pk bus_space_probe() prototype.
 1.7 21-Mar-1998  pk Add `interrupt establish' and ` device mmap' methods and macros to
match to the bus tag structure.
 1.6 04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.5 04-Feb-1998  thorpej Change the last argument of bus_dmamap_sync() from bus_dmasync_op_t to int,
and allow more than one synchronization operation to be specified in
a single call. Dissallow mixing of PRE and POST operations.
 1.4 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.3 13-Jan-1998  pk Fix parenthesis inbalance.
 1.2 23-Nov-1997  pk Re-do the `busdma' interface.
 1.1 02-Nov-1997  pk The sparc's bus.h.
 1.10.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.16.8.2 12-Mar-2001  bouyer Sync with HEAD.
 1.16.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.19.4.4 22-Jul-2000  pk Pull up revision 1.21.

Maintain the DVMA map extent subregion boundaries in the bus_dma map
structure.
 1.19.4.3 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.19.4.2 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.19.4.1 27-Jun-2000  pk Pullup rev. 1.20:
Fix pastos in bus_space_read_region_*() functions.
 1.23.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.24.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.24.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.24.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.24.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.2.1 03-Aug-2001  lukem update to -current
 1.25.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.26.4.7 03-Jan-2003  thorpej Sync with HEAD (again).
 1.26.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.26.4.5 27-Aug-2002  nathanw Catch up to -current.
 1.26.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.26.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.26.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.26.4.1 24-Sep-2001  nathanw file bus.h was added on branch nathanw_sa on 2002-01-08 00:27:37 +0000
 1.32.2.1 31-Aug-2002  gehenna catch up with -current.
 1.39.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.39.2.4 29-Nov-2004  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.44.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.44.4.1 29-Apr-2005  kent sync with -current
 1.45.4.3 03-Sep-2007  yamt sync with head.
 1.45.4.2 26-Feb-2007  yamt sync with head.
 1.45.4.1 21-Jun-2006  yamt sync with head.
 1.48.6.1 22-Apr-2006  simonb Sync with head.
 1.48.4.1 09-Sep-2006  rpaulo sync with head
 1.48.2.1 18-Feb-2006  yamt sync with head.
 1.51.20.2 12-Mar-2007  rmind Sync with HEAD.
 1.51.20.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.53.44.3 20-Jun-2009  yamt sync with head
 1.53.44.2 04-May-2009  yamt sync with head.
 1.53.44.1 16-May-2008  yamt sync with head.
 1.53.42.1 18-May-2008  yamt sync with head.
 1.53.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.54.18.1 21-Apr-2010  matt sync to netbsd-5
 1.54.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.54.10.2 18-Oct-2009  bouyer Back out ticket 969
 1.54.10.1 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #969):
sys/arch/sparc/include/bus.h: revision 1.56
sys/arch/sparc/sparc/machdep.c: revision 1.294
do as phone suggested - remove sparc_bus_map_large() again and use a =20=
flag
instead ( BUS_SPACE_MAP_LARGE )
 1.54.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.2 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.1 01-Jul-2011  dyoung branches: 1.1.54;
Per discussion at
<http://mail-index.netbsd.org/tech-kern/2010/04/02/msg007941.html>,
divide each machine's bus.h into bus_defs.h (constants & data types)
and bus_funcs.h (macro implementations of bus_space(9) routines and MD
prototypes).

Note that some bus_space(9) routines' implementation will move to .c
files from inline subroutines or macros in .h files.

I've only made the split for machine architectures where there is PCI.
All of the non-PCI-having architectures will require a similar split.

These #include files are not referenced by any (committed) Makefiles or
header files, yet. Changes to Makefiles, to <sys/bus.h>, and to some
more machine-dependent files will dribble in before I throw the switch.
 1.1.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1 01-Jul-2011  dyoung Per discussion at
<http://mail-index.netbsd.org/tech-kern/2010/04/02/msg007941.html>,
divide each machine's bus.h into bus_defs.h (constants & data types)
and bus_funcs.h (macro implementations of bus_space(9) routines and MD
prototypes).

Note that some bus_space(9) routines' implementation will move to .c
files from inline subroutines or macros in .h files.

I've only made the split for machine architectures where there is PCI.
All of the non-PCI-having architectures will require a similar split.

These #include files are not referenced by any (committed) Makefiles or
header files, yet. Changes to Makefiles, to <sys/bus.h>, and to some
more machine-dependent files will dribble in before I throw the switch.
 1.13 18-Mar-2014  christos Make all __ALIGNBYTES macros return the same type (size_t)
 1.12 20-Jan-2012  joerg branches: 1.12.6; 1.12.10;
Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.11 11-Dec-2005  christos branches: 1.11.112; 1.11.116;
merge ktrace-lwp.
 1.10 07-Jan-2004  martin A __insn_barrier() is now available for all archs, remove the MD version
here. Suggested by Jason Thorpe.
 1.9 16-Nov-2003  pk Introduce __insn_barrier(), designed to prevent instruction re-ordering
with minimal side-effects across its location in the source code.
 1.8 20-Mar-1999  thorpej branches: 1.8.42;
Garbage-collect.
 1.7 01-Jul-1998  tv On ELF, make __indr_reference undefined and __warn_references do nothing,
as on Alpha. This should be fixed to do something in both cases.
 1.6 01-Jul-1998  tv Change _C_LABEL() to use proper underscoring depending on __ELF__ or not.
 1.5 04-Nov-1997  thorpej Bug fixes and cleanup from Chris Demetriou <cgd@pa.dec.com>:
- fix _C_LABEL so that it actually works.
- make __RENAME use _C_LABEL.
- fix __RENAME so that it expects an unquoted argument.
- fix __indr_reference and __warn_references so that they
supply their own final semicolon.
- define __warn_references to nothing if not GNU C (required
by the way it's used).

The __warn_references semicolon change has to be made
so that __warn_references can be defined into nothing.
(A ; all by itself isn't a great idea.) The __indr_reference
change was made for consistency.
 1.4 22-Oct-1997  thorpej Implement __RENAME() in <machine/cdefs.h>
 1.3 27-Dec-1996  pk branches: 1.3.14;
For now, define `__indr_reference' and `__warn_references' as empty
macros if __GNUC__ not defined.
 1.2 23-Mar-1995  jtc Changed name of __weak_reference() to __indr_reference(). They really
are indirect references, and I want to add a real __weak_reference()
macro to <machine/cdefs.h> soon.
 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.3.14.2 04-Nov-1997  thorpej Pull up from trunk: bug fixes and cleaups.
 1.3.14.1 22-Oct-1997  thorpej Pull up from trunk: Implement __RENAME() in <machine/cdefs.h>
 1.8.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.42.1 03-Aug-2004  skrll Sync with HEAD
 1.11.116.1 18-Feb-2012  mrg merge to -current.
 1.11.112.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.11.112.1 17-Apr-2012  yamt sync with head
 1.12.10.1 18-May-2014  rmind sync with head
 1.12.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6 28-Mar-2023  andvar s/interrput/interrupt/ and s/accesss/access/ in comments.
 1.5 20-May-2003  nakayama Correct invalid type.
 1.4 03-May-2003  wiz DMA, not dma nor Dma.
 1.3 04-Oct-1995  pk Add a few constants used for mapping bit and pieces in the kernel driver.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 14-Aug-1994  deraadt branches: 1.1.2;
needed for X
 1.1.2.2 14-Aug-1994  deraadt needed for X
 1.1.2.1 14-Aug-1994  deraadt file cgtworeg.h was added on branch netbsd-1-0 on 1994-08-14 00:13:21 +0000
 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 27-Feb-2002  christos branches: 1.19.8;
- define other DEV_ constants that the local port uses.
- delete cdev_decl(mm) since <sys/conf.h> does it.
 1.18 26-Mar-2001  lukem branches: 1.18.2; 1.18.8;
- add dev_noimpl(xxx,yyy) macro to replace "(dev_type_xxx((*))) yyy",
and use appropriately

- create more helper macros:
. cdev__xyz_init(c,n), such as cdev__ocri_init() for
/* open, close, read, ioctl */, etc.
. cdev__xRy_init(c,n), where nullop is used instead of enodev to dummy out
method `R' and the comments now read /* xxx (read) yyy */ instead
. cdev__xyz_t_init(c,n,t) - as per cdev__xyz_init, but sets d_type = t
as well

- use seltrue instead of dev_noimpl(poll,*), as (IIRC) cdevsw.d_poll should
always DTRT WRT returning a valid result. (a few devices previously
incorrectly returned ENODEV)

- use dev_noimpl(stop,enodev) instead of dev_noimpl(stop,nullop) if tty
== 0, because it doesn't matter if dev_type_stop isn't implemented in that
case, and it allows the use of the cdev__xyz_init macros. certain ports
(sparc,sparc64,x68k) used the nullop method for dev_type_stop in a few
drivers, whereas everything else uses enodev

- ensure that the comments are accurate WRT the behaviour of a given entry
 1.17 15-Dec-1999  garbled branches: 1.17.6;
Add new spl level for tadpole devices splts102.
Device entrypoints for tctrl device (tadpole micro controller)
add header for direct-access ioctl to the tadpole microcontroller.
 1.16 01-Aug-1999  matt branches: 1.16.2; 1.16.8;
Initial stab at a P9100 console FB driver for the Tadpole 3GX.
It supports RASTERCONSOLE only and the colormap support is
broken (the hardware doesn't seem to be doing what the tech.
docs. say it should be doing). But it is usable as a console
(but with blue on white as the only color choice). I figured
I'd check it in since it is somewhat usable and someone else
might figure what I screwed up in the color map support.
 1.15 30-Jul-1999  matt Add preliminary support for the built-in modem on Tadpole 3GX/S
laptops. There is currently something wrong with the interrupt
code but it does attach and sense a 16550a. (anyways the built
in modem is only a 14.4Kb and you'd really want to use a PCMCIA
modem to get faster dialup rates).
 1.14 13-Nov-1998  oster branches: 1.14.6;
Updating of bdev's and cdev's to support RAIDframe.
 1.13 10-Oct-1998  thorpej Add scsibus entry points to the cdevsw[].
 1.12 21-Sep-1998  pk Fill the `bpp' slot.
 1.11 05-Sep-1998  christos Assign copyright to TNF.
 1.10 20-May-1998  pk Add `mtty' and `mbpp' entries for the magma driver by Iain Hibbert.
 1.9 18-Oct-1997  gwr Use common zs code.
 1.8 31-Dec-1996  mrg oops; rd -> md paul left behind...
 1.7 11-Nov-1996  pk Declare `cgtwo' and `rd' character devices.
 1.6 30-Sep-1996  abrown Add cgfourteen to conf.h.
Add new framebuffer types for recent-model graphics devices to fbio.h.
 1.5 07-Sep-1996  mycroft Implement poll(2).
 1.4 20-Jun-1996  pk ramdisk stuff
 1.3 19-Jun-1996  pk Remove a "notyet" in last commit.
 1.2 19-Jun-1996  pk tcx declaration
 1.1 30-Mar-1996  christos New md conf.h per Jason's plan.
 1.14.6.1 02-Aug-1999  thorpej Update from trunk.
 1.16.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.2.2 27-Mar-2001  bouyer Sync with HEAD.
 1.16.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.17.6.1 09-Apr-2001  nathanw Catch up with -current.
 1.18.8.3 17-Sep-2002  nathanw Catch up to -current.
 1.18.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.18.8.1 26-Mar-2001  nathanw file conf.h was added on branch nathanw_sa on 2002-02-28 04:12:03 +0000
 1.18.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.18.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.19.8.1 19-May-2002  gehenna Remove port-dependent conf.h.
 1.111 13-Jul-2023  riastradh 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.
 1.110 14-Aug-2021  ryo branches: 1.110.4;
Improved the performance of kernel profiling on MULTIPROCESSOR, and possible to get profiling data for each CPU.

In the current implementation, locks are acquired at the entrance of the mcount
internal function, so the higher the number of cores, the more lock conflict
occurs, making profiling performance in a MULTIPROCESSOR environment unusable
and slow. Profiling buffers has been changed to be reserved for each CPU,
improving profiling performance in MP by several to several dozen times.

- Eliminated cpu_simple_lock in mcount internal function, using per-CPU buffers.
- Add ci_gmon member to struct cpu_info of each MP arch.
- Add kern.profiling.percpu node in sysctl tree.
- Add new -c <cpuid> option to kgmon(8) to specify the cpuid, like openbsd.
For compatibility, if the -c option is not specified, the entire system can be
operated as before, and the -p option will get the total profiling data for
all CPUs.
 1.109 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.108 16-May-2020  ad branches: 1.108.2;
PR port-sparc/55261: sparc still panics running ATF tests

Reinstate the cpu_info change and remove __HAVE_CPU_DATA_FIRST to fix
build failure.
 1.107 16-May-2020  ad Back out previous - it doesn't work.
 1.106 15-May-2020  ad PR port-sparc/55261: sparc still panics running ATF tests

Put cpu_data at the end of cpu_info to see how that modifies the symptom.
 1.105 10-Mar-2020  christos tuck curproc/curlwp under _KERNEL only (no _KMEMUSER)
 1.104 30-Dec-2019  ad PR port-sparc/54789: Sparc boot fails with "Trap 0x21 while interrupts disabled"

Remove assumption that cpu_info is smaller than 1kB.
 1.103 01-Dec-2019  ad Fix false sharing problems with cpu_info. Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
the IPI bitmask and ci_want_resched.
 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 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.100 16-Jan-2018  mrg branches: 1.100.2; 1.100.4;
implement cpuctl identify for sparc and sparc64.

sparc:
- move enum vactype and struct cacheinfo into cpu.h
- move the cache flags from cpuinfo.flags into CACHEINFO.c_flags
(this allows the new cache_printf_backend() to see them.)
remove unused CPUFLG_CACHEIOMMUTABLES and CPUFLG_CACHEDVMA.
- align xmpsg to 64 bytes
- move cache_print() into cache_print.h so it can be shared with
cpuctl. it only depends upon a working printf().
- if found, store the CPU node's "name" into cpu_longname. this
changes the default output to show the local CPU not the
generic CPU family. eg:
cpu0 at mainbus0: mid 8: Ross,RT625 @ 90 MHz, on-chip FPU
vs the generic "RT620/625" previously shown.
- for each CPU export these things:
- name
- fpuname
- mid
- cloc
- freq
- psr impl and version
- mmu impl, version, and number of contexts
- cacheinfo structure (which changed for the first time ever
with this commit.)

sparc64:
- add a minimal "cacheinfo" structure to export the i/d/e-cache
size and linesize.
- store %ver, cpu node "name" and cacheinfo in cpu_info.
- set cpu_info ver, name and cacheinfo in cpu_attach(), and
export them via sysctl, as well as CPU ID and clock freq

cpuctl:
- add identifycpu_bind() that returns false on !x86 as their
identify routines do not need to run on a particular CPU to
obtain its information, and use it to avoid trying to set
affinity when not needed.
- add sparc and sparc64 cpu identify support using the newly
exported values.
 1.99 02-Dec-2017  macallan - return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.98 16-Jun-2017  jdolecek dumpconf(void) long doesn't exist, remove the prototype

PR kern/39714 by Henning Petersen
 1.97 10-Dec-2016  mrg branches: 1.97.8;
rearrange slightly to enable crash(8) to build.
 1.96 10-Dec-2016  mrg move struct cpu_info and xpmsg into <machine/cpu.h> from
<sparc/sparc/cpuvar.h>. this enables them for crash(8)
and this seems more natural to me anyway.
 1.95 19-Oct-2013  christos branches: 1.95.6; 1.95.10;
make cpu_need_resched() macros consistent; __USE flags
 1.94 01-May-2012  martin branches: 1.94.2; 1.94.4;
On unaligned access, provide the data address to the signal handler, instead
of the faulting instructions address.
 1.93 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.92 30-Jul-2011  martin branches: 1.92.2; 1.92.6;
Get rid of #ifdef __sparc__ in uvm code - as noted by cgd back 1996,
now that we have __HAVE_CPU_VMSPACE_EXEC/cpu_vmspace_exec().
 1.91 24-Jan-2011  martin Provide LWP_PC
 1.90 13-Jan-2011  mrg branches: 1.90.2; 1.90.4;
introduce a hack to workaround the savefpstate IPI get's NULL
struct fpstate *.

add a new entry point ipi_savefpstate() that is used for this IPI
instead of the plain ipi_savefpstate(). check for %o0 being NULL,
and if so, just return.

add event counters for the savefpstate IPI, and another one for
when it detects the NULL problem.

make the cpu_info struct xmpsg be aligned to a single cache line.

with this change applied (and another minor change in testing) my
SS20 with dual SM75's has survived for 17 hours on build.sh -j5,
and has reported 7 NULL savefps. (the minor change seems to have
a significant effect at reducing this number, but more testing is
needed for it.)


XXX: this is horrible and we really need to find the real problem
XXX: but this should let people use sparc smp again, and fixes
XXX: for the real problem can be tested by seeing if any of the
XXX: savefp IPI null counter becomes non-zero.
 1.89 03-Jan-2010  mrg branches: 1.89.4;
add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.88 03-Jan-2010  mrg add two new members to struct intrhand: ih_realfun and ih_realarg, and
use them to take the kernel lock around non-IPL_VM interrupts, using
a intr_biglock_wrapper() function ike x86 does.
 1.87 21-Oct-2009  rmind 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.86 29-May-2009  mrg fix up cpu_setfunc() as noted by uwe:

- don't call lwp_startup for cpu_setfunc() users
- introduce lwp_setfunc_trampoline instead
- no need to set the "new" lwp for setfunc
 1.85 27-May-2009  mrg avoid a local variable in a do {} while (0) macro.
 1.84 27-Feb-2008  xtraeme branches: 1.84.4; 1.84.14; 1.84.22;
Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.83 03-Dec-2007  ad branches: 1.83.10; 1.83.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.82 17-Oct-2007  garbled branches: 1.82.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.81 17-May-2007  yamt branches: 1.81.8; 1.81.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.80 04-Mar-2007  christos branches: 1.80.2; 1.80.4; 1.80.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.79 16-Feb-2007  ad branches: 1.79.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.78 09-Feb-2007  ad Merge newlock2 to head.
 1.77 11-Dec-2005  christos branches: 1.77.20;
merge ktrace-lwp.
 1.76 27-Oct-2005  uwe We need to init p_md.md_flags on fork, so implement cpu_proc_fork().
 1.75 26-Oct-2005  uwe Add missing extern to make the definition of softnet_cookie into a declaration.
 1.74 26-Oct-2005  uwe Cosmetic. Kill __P. Remove few remaining paramter names in
prototypes. CONSTCOND in while (0). Move wcopy/wzero declarations
with the rest of machdep.c. Add some blank lines for readability.
 1.73 25-Sep-2005  uwe branches: 1.73.2;
G/c msiiep_swap_endian, it's no longer used now that we run without
byteswapping in the PCIC.
 1.72 16-Jun-2005  briggs branches: 1.72.2;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.71 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.69 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.68 02-May-2004  pk The cpu_exit() detour is no longer necessary.
 1.67 17-Apr-2004  pk Remove the cache_flush() trampoline; it's no longer directly cross-called.
Instead, implement the MP parts in terms of cross-callable vcache_flush_range()
function.
 1.66 04-Jan-2004  jdolecek branches: 1.66.2;
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.65 08-Nov-2003  tsutsui #if defined(_KERNEL_OPT) is enough, #if !defined(_LKM) isn't needed
in that case. Pointed out by mrg.
 1.64 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.63 22-Jan-2003  pk branches: 1.63.2;
Add functions to set & get the interrupt target CPU.
 1.62 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.61 16-Jan-2003  pk Rename the current mp_{pause,resume}_cpus() => mp_{pause,resume}_cpus_ddb().
Implement mp_pause_cpus/mp_resume_cpus on top of the PROM services.
 1.60 14-Jan-2003  pk Add CLKF_LOPRI() macro that allows a (timer) interrupt handler to determine
whether it is interrupting code running at a given IPL level.
 1.59 12-Jan-2003  pk schedcpu() has been fixed; now we can notify another CPU about a pending
reschedule request.
 1.58 12-Jan-2003  pk Remove needless indirection from the curproc() macro.
 1.57 10-Jan-2003  pk Replace `want_resched' and `want_ast' globals by per-CPU variables.
 1.56 06-Jan-2003  pk Move schedintr() to clock.c and initialise schedhz in initclocks(), so
these are available to all timer implementations.
 1.55 03-Jan-2003  mrg remove dead extern fpproc/foundfpu declarations.
 1.54 10-Dec-2002  pk * intr_establish() now takes an optional `fast trap' routine argument.
* also remove __P().
 1.53 09-Dec-2002  pk setsoftint() is no longer used.
 1.52 06-Dec-2002  pk Pass the `device class interrupt level' on to intr_establish() and use to
raise the ipl in the interrupt handlers to the appropriate level. This avoids
interrupt handler interference if one of the devices actually interrupts at
a lower hardware level than the maximum level assined to a device class.

Based on code from Art Grabowski in openbsd.
 1.51 28-Nov-2002  pk Not all sun4m platforms have version 8 sparc CPUs. So go out to the PROM
and get the CPU architecture version from the PROM cpu node `sparc-version'
property.
 1.50 26-Nov-2002  pk Add `machdep.cpu_arch' sysctl to determine the CPU architecture version.
Currrently, cpu types `sun4' and `sun4c' produce version 7, all others
version 8.
 1.49 03-Feb-2002  darrenr * add machdep.booted_device and machdep.boot_args (both fetched from
appropriate PROM variables).
* return "netbsd" for machdep.booted_kernel if the PROM doesn't return us a
kernel name.
 1.48 11-Dec-2001  uwe Export msiiep_swap_endian(onoff) from msiiep.c to turn on/off
automagic endian swapping performed by PCI controller. Need it in
several places where we want to enter PROM repl.
 1.47 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.46 12-Nov-2001  pk Remove redundant declarations.
 1.45 27-Sep-2001  mrg branches: 1.45.2; 1.45.4;
implement generic soft interrupts as described in softintr(9). convert
the network, clock & serial softint's to use them.
 1.44 14-Jun-2001  thorpej branches: 1.44.2; 1.44.4;
Don't need to prototype child_return() here, it's in <sys/proc.h>.
 1.43 15-Mar-2001  mrg sprinkle KERNEL_LOCK() and KERNEL_PROC_LOCK() where they're missing. add
SYSCALL_DEBUG support to trap.c.
 1.42 21-Jan-2001  christos branches: 1.42.2;
fix bit rot so that MP kernel compiles s/cpu_no/ci_cpuid/
 1.41 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.40 05-Jun-2000  thorpej Fix typo. kern/10291.
 1.39 03-Jun-2000  thorpej Provide a CPU_IS_PRIMARY() macro in the MULTIPROCESSOR case.
 1.38 31-May-2000  pk Move switchexit() declaration in here.
 1.37 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Fix a bug where all cpu_info structures except for the boot CPUs
would exist at both a CPU-local VA (CPUINFO_VA) and a gloal VA;
The boot CPU's existed only a CPUINFO_VA.
- Add a self-reference pointer to the cpu_info that references the
global address in the MULTIPROCESSOR case. Just allow it to reference
the `local' VA in the single-processor case, as CPUINFO_VA is global
enough when there's only one processor to care about. Change curcpu()
to return the global address.
 1.36 26-May-2000  thorpej branches: 1.36.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.35 16-Dec-1999  thorpej Provide cpu_boot_secondary_cpus().
 1.34 04-Oct-1999  pk branches: 1.34.2; 1.34.8;
Implement sysctl `machdep.booted_kernel'.
 1.33 10-Aug-1999  thorpej Define cpu_number() as discussed on tech-smp.
 1.32 19-Jan-1999  pk Add SIR_SERIAL soft interrupt source.
 1.31 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.30 13-Oct-1998  pk CLKF_INTR() needs to have a MULTIPROCESSOR version.
 1.29 05-Oct-1998  thorpej cpu_set_kpc() prototype is already in <sys/systm.h>.
 1.28 26-Sep-1998  pk mp_{pause,resume,halt}_cpu() prototypes.
 1.27 23-Aug-1998  pk Nuke obsolete prototype.
 1.26 21-Aug-1998  pk iommu_{enter,remove} moved to iommuvar.h
 1.25 22-Nov-1997  tv eliminate declarations of global data in <sparc/cpu.h> and declare in
source files, reducing global symblol replication in .o kernel files
 1.24 15-Mar-1997  pk Add fix_align() and emulinstr() prototypes.
 1.23 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.22 05-Sep-1996  thorpej Make the SPARC kernel compile again after recent tty cdevsw changes.
 1.21 31-Mar-1996  pk Move autoconf subroutine prototypes to autoconf.h
Deal with sun4m `software interrupts'.
 1.20 15-Mar-1996  christos Fix prototypes for the latest kpc changes.
 1.19 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.18 14-Mar-1996  pk Remove cpu_set_init_frame().
 1.17 28-Jun-1995  cgd remove unused cpu_exec() definitions. moved "broken swap" markers, for
ports that still need it, to types.h.
 1.16 19-May-1995  pk cpu_swapout() not needed after all.
 1.15 08-May-1995  pk Start swapping.
 1.14 05-May-1995  cgd define BROKEN_SWAP and/or cpu_swapout as appropriate.
 1.13 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.12 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.11 25-Nov-1994  deraadt prototype wcopy/wzero
 1.10 20-Nov-1994  deraadt copyright/Id cleanup
 1.9 26-Oct-1994  deraadt vme interrupt support
 1.8 27-Sep-1994  deraadt USPAGE
 1.7 19-May-1994  deraadt liten
 1.6 05-May-1994  deraadt profiling and clock stuff
 1.5 05-May-1994  deraadt flags foo
 1.4 22-Mar-1994  deraadt move defn of trapvec to cpu.h
 1.3 01-Feb-1994  deraadt sparc runs in current today
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.34.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.34.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.34.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.34.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.36.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.42.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.42.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.44.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.44.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.44.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.45.4.12 17-Jan-2003  thorpej Sync with HEAD.
 1.45.4.11 15-Jan-2003  thorpej Sync with HEAD.
 1.45.4.10 06-Jan-2003  martin Catch up to -current.
 1.45.4.9 03-Jan-2003  thorpej Pass exit2 or lwp_exit2 to switchexit(), as is suggested in comments,
and eliminate switchlwpexit().
 1.45.4.8 03-Jan-2003  thorpej Sync with HEAD (again).
 1.45.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.45.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.45.4.5 28-Feb-2002  nathanw Catch up to -current.
 1.45.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.45.4.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.45.4.2 20-Nov-2001  pk Adjust prototypes for SA support.
 1.45.4.1 27-Sep-2001  pk file cpu.h was added on branch nathanw_sa on 2001-11-20 16:20:50 +0000
 1.45.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.63.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.63.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.63.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.63.2.1 03-Aug-2004  skrll Sync with HEAD
 1.66.2.1 24-Apr-2004  jdc Pull up revision 1.67 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.72.2.5 17-Mar-2008  yamt sync with head.
 1.72.2.4 07-Dec-2007  yamt sync with head
 1.72.2.3 03-Sep-2007  yamt sync with head.
 1.72.2.2 26-Feb-2007  yamt sync with head.
 1.72.2.1 21-Jun-2006  yamt sync with head.
 1.73.2.1 02-Nov-2005  yamt sync with head.
 1.77.20.2 12-Jan-2007  ad sparc MD changes.
 1.77.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.79.2.2 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.79.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.80.10.1 22-May-2007  matt Update to HEAD.
 1.80.4.1 11-Jul-2007  mjf Sync with head.
 1.80.2.2 03-Dec-2007  ad Sync with HEAD.
 1.80.2.1 27-May-2007  ad Sync with head.
 1.81.10.3 23-Mar-2008  matt sync with HEAD
 1.81.10.2 09-Jan-2008  matt sync with HEAD
 1.81.10.1 06-Nov-2007  matt sync with HEAD
 1.81.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.82.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.83.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.83.10.1 24-Mar-2008  keiichi sync with head.
 1.84.22.1 21-Apr-2010  matt sync to netbsd-5
 1.84.14.2 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.84.14.1 09-Jan-2010  snj Pull up following revision(s) (requested by mrg in ticket #1223):
sys/arch/sparc/include/cpu.h: revision 1.86
sys/arch/sparc/sparc/locore.s: revision 1.246
sys/arch/sparc/sparc/vm_machdep.c: revision 1.100
fix up cpu_setfunc() as noted by uwe:
- don't call lwp_startup for cpu_setfunc() users
- introduce lwp_setfunc_trampoline instead
- no need to set the "new" lwp for setfunc
 1.84.4.2 11-Mar-2010  yamt sync with head
 1.84.4.1 20-Jun-2009  yamt sync with head
 1.89.4.1 05-Mar-2011  rmind sync with head
 1.90.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.90.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.92.6.2 02-Jun-2012  mrg sync to latest -current.
 1.92.6.1 24-Feb-2012  mrg sync to -current.
 1.92.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.92.2.2 23-May-2012  yamt sync with head.
 1.92.2.1 17-Apr-2012  yamt sync with head
 1.94.4.1 18-May-2014  rmind sync with head
 1.94.2.2 03-Dec-2017  jdolecek update from HEAD
 1.94.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.95.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.95.6.2 28-Aug-2017  skrll Sync with HEAD
 1.95.6.1 05-Feb-2017  skrll Sync with HEAD
 1.97.8.1 08-Dec-2017  msaitoh Pull up following revision(s) (requested by macallan in ticket #429):
sys/arch/sparc/sparc/cpu.c: revision 1.250
sys/arch/sparc/include/cpu.h: revision 1.99
sys/arch/sparc/sparc/intr.c: revision 1.119
- return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.100.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.100.4.1 10-Jun-2019  christos Sync with HEAD
 1.100.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.108.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.110.4.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.5 08-Oct-2016  joerg Macros expanding to defined() expression is not actually correct ISO C
behavior. Since it is not clear whether someone might decide to define
the macros to random non-1 values, introduce a level of indirection and
count the same of the helper macros.
 1.4 11-Dec-2005  christos branches: 1.4.122; 1.4.142; 1.4.146;
merge ktrace-lwp.
 1.3 16-Jan-2005  chs implement pmap_wired_count(). use more macros for determining MMU type.
 1.2 07-Aug-2003  agc branches: 1.2.8;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 09-Apr-2003  thorpej branches: 1.1.2;
Move CPU configuration predicates to <machine/cpuconf.h>.
 1.1.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.1.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.1 03-Aug-2004  skrll Sync with HEAD
 1.2.8.1 29-Apr-2005  kent sync with -current
 1.4.146.1 04-Nov-2016  pgoyette Sync with HEAD
 1.4.142.1 05-Dec-2016  skrll Sync with HEAD
 1.4.122.1 03-Dec-2017  jdolecek update from HEAD
 1.32 10-Mar-2024  rillig sparc: fix snprintb formats for SFSR_BITS
 1.31 06-Sep-2021  andvar fix various typos in comments.
 1.30 29-Aug-2019  msaitoh Add missing NUL to prevent buffer overrun.
 1.29 04-Dec-2013  jdc branches: 1.29.22; 1.29.30; 1.29.34;
Clarify comment about SER_SZERR.
 1.28 11-Dec-2005  christos branches: 1.28.112; 1.28.122; 1.28.128;
merge ktrace-lwp.
 1.27 10-Sep-2005  uwe Add definitions for microSPARC-IIep memory fault registers.
 1.26 27-Apr-2004  pk branches: 1.26.12;
Bits 0 (MMU Enable) and 1 (Fault inhibit) are common among the implementations
of the SRMMU control register. Reflect that fact in the definitions here.

Also add the swift `store allocate' bit.
 1.25 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.24 31-Dec-2002  pk branches: 1.24.2;
Add some more definitions: SRMMU and MXCC reset register.
 1.23 24-Aug-2002  thorpej Add Sun4d cpu-unit ASIs.
 1.22 05-May-2000  pk branches: 1.22.8; 1.22.12; 1.22.20;
Define some more bits in the MXCC control register.
 1.21 01-May-2000  pk Add definitions of HyperSPARC block fill/copy ASIs.
 1.20 30-Apr-2000  pk Rename MXCC control register.
Add MXCC stream register definitions.
 1.19 19-Jan-1999  pk branches: 1.19.8;
Define Hypersparc ICCR bits.
 1.18 20-Sep-1998  pk Name fault registers more like they're referred to in various docs.
 1.17 06-Sep-1998  pk Use the new "%b" format.
 1.16 26-Jul-1998  pk Define hypersparc instruction-cache flush ASI.
 1.15 20-Jul-1997  pk Remove a couple of "ms2 only" from cache-flush ASIs.
 1.14 06-Jul-1997  pk Define the turbosparc's processor configuration register.
 1.13 22-Mar-1997  pk For each major "module", define a separate set of MMU control register bits.
 1.12 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.11 15-May-1996  mrg remove some RCS id's we don't need.
 1.10 31-Mar-1996  pk Add SRMMU/sun4m definitions.
Cleanup (i.e. mostly delete) `#if defined (SUN4*)' in here.
 1.9 23-Oct-1995  pk Define VIDEO enable bit (per Jason Thorpe; PR#1672).
 1.8 25-Jun-1995  pk add a couple more sun4m bits.
 1.7 13-Apr-1995  pk Add `region' ASI.
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 26-Oct-1994  deraadt vme, and cleanup some messy #ifdef stuff
 1.4 20-Aug-1994  deraadt add sun4 control space areas
 1.3 04-Jul-1994  deraadt add srmmu flush/prope ASI sub-codes
 1.2 05-May-1994  deraadt add sun4m ASI definitions
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.19.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.22.20.1 31-Aug-2002  gehenna catch up with -current.
 1.22.12.2 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.22.12.1 27-Aug-2002  nathanw Catch up to -current.
 1.22.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.24.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.26.12.1 21-Jun-2006  yamt sync with head.
 1.28.128.1 18-May-2014  rmind sync with head
 1.28.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.112.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 01-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #145):

sys/arch/sparc/include/ctlreg.h: revision 1.30
sys/dev/pci/if_xgereg.h: revision 1.3

Add missing NUL to prevent buffer overrun.
 1.29.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.29.22.1 26-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1387):

sys/arch/sparc/include/ctlreg.h: revision 1.30
sys/dev/pci/if_xgereg.h: revision 1.3

Add missing NUL to prevent buffer overrun.
 1.30 26-Oct-2023  andvar Build db_machdep.c when KGDB option is enabled.
Do not cast (regs)->db_tf.tf_pc to db_addr_t (thus ifdef block is redundant).
Adjust ifdef conditions in db_interface.c to make it build with KGDB option.
While here, add #endif comments for longer blocks.

These changes should make sparc build with KGDB option, once ddb/db_access.c
code will be fixed to build with it.
 1.29 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.28 06-Nov-2017  christos branches: 1.28.16;
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.27 10-Dec-2016  mrg rearrange slightly to enable crash(8) to build.
 1.26 26-May-2011  joerg branches: 1.26.14; 1.26.32; 1.26.36;
Introduce DDB_EXPR_FMT and replace the logic around DB_EXPR_T_IS_QUAD.
 1.25 11-Apr-2011  mrg obsolete DB_AOUT_SYMBOLS. however, we need to leave most of the code
in db_sym.[ch] as it is used by the elf version of crash(8).

i will be cleaning up the db_sym.c code in a follow up commit to avoid
having dead code compiled.
 1.24 14-Jan-2011  rmind branches: 1.24.2;
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.23 21-Feb-2007  thorpej branches: 1.23.68;
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.22 01-Apr-2006  cherry branches: 1.22.14;
closes: PR kern/32359

modifies machine/db_machdep.h: BKPT_SET(inst) to BKPT_SET(inst, addr) for all archs ie; passess the
breakpoint address as well.

Patch from cherry@mahiti.org
 1.21 04-Mar-2006  uwe branches: 1.21.2; 1.21.4; 1.21.6;
De-__P.
 1.20 29-Apr-2003  scw branches: 1.20.18; 1.20.32; 1.20.34;
Add a BKPT_ADDR() macro which gives MD code a chance to munge a
breakpoint address before it's used. Currently a no-op on all but sh5.

This is useful on sh5, for example, to mask off the instruction
type encoding in the bottom two address bits, and makes it possible
to do "db> break $rXX" instead of manually munging the address.
 1.19 07-Jan-2003  pk Simplify ddb register storage setup: remove MULTIPROCESSOR special cases
and keep the ddb register copies on the current stack always.
 1.18 07-Jan-2003  pk * Maintain a pointer to the cpu_info structure of the CPU being examined.
* Force cpu_Debugger() to have a stack frame, so tracing can at least
start off matching arguments and function calls correctly.
 1.17 09-Nov-2001  thorpej Remove unneeded declarations of the db_machine_init() function. The
ARM ports are the only ones that actually have one, and it is about
to change.
 1.16 30-Jun-2001  mrg branches: 1.16.2; 1.16.6; 1.16.8;
for now, KGDB kernels do not have access to multiple cpu's trapframe.
 1.15 08-Jun-2001  mrg if MULTIPROCESSOR, make the registers virtual, so that we can access other
processors registers. rework enter/exit ddb code to look more like the i386
code. make "mach cpu" and "mach cpu N" work.
 1.14 29-Jun-2000  mrg branches: 1.14.2;
remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 30-Apr-1999  christos branches: 1.13.2;
Compile in support for ELF symbols.
 1.12 21-Aug-1998  pk branches: 1.12.8;
Convert to [pv]addr_t & [pv]size_t.
 1.11 10-Dec-1997  pk Code for software-assisted DDB single-stepping from Chuck Silvers.
 1.10 31-Aug-1997  pk Switch to MI kgdb code.
 1.9 26-Jun-1997  thorpej branches: 1.9.4;
#define DB_AOUT_SYMBOLS
 1.8 05-Feb-1997  pk db_expr_t is now a long.
 1.7 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.6 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.5 09-Feb-1996  christos A few prototype fixes
 1.4 10-Dec-1995  mycroft Include vm.h, rather than guessing which files we need.
 1.3 09-Feb-1995  pk We have more registers.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 24-Mar-1994  pk DDB support
 1.9.4.1 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.16.8.3 07-Jan-2003  thorpej Sync with HEAD.
 1.16.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.16.8.1 30-Jun-2001  nathanw file db_machdep.h was added on branch nathanw_sa on 2002-01-08 00:27:37 +0000
 1.16.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.16.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.34.1 22-Apr-2006  simonb Sync with head.
 1.20.32.1 09-Sep-2006  rpaulo sync with head
 1.20.18.2 26-Feb-2007  yamt sync with head.
 1.20.18.1 21-Jun-2006  yamt sync with head.
 1.21.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.21.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.21.2.1 11-Apr-2006  yamt sync with head
 1.22.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.23.68.3 31-May-2011  rmind sync with head
 1.23.68.2 21-Apr-2011  rmind sync with head
 1.23.68.1 05-Mar-2011  rmind sync with head
 1.24.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.36.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.26.32.1 05-Feb-2017  skrll Sync with HEAD
 1.26.14.1 03-Dec-2017  jdolecek update from HEAD
 1.28.16.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 30-Aug-2011  bouyer 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.5 29-Jun-1996  pk Put native NetBSD disk label in a piece of wasteland within a SunOS label.
 1.4 01-Sep-1995  pk Enable writing of disklabels (Many thanks to Jason Thorpe, Gordon Ross
and Matthew Green).
 1.3 12-Jul-1995  thorpej Zap duplicate RCS id.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 14-Oct-1994  cgd move arch dependence to archs. clean up a bit. deal with weird MAXPARTITONS.
 1.10 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.9 28-Apr-2008  martin branches: 1.9.44;
Remove clause 3 and 4 from TNF licenses
 1.8 04-Mar-2006  uwe branches: 1.8.68; 1.8.70; 1.8.72;
De-__P.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6;
merge ktrace-lwp.
 1.6 19-Jun-2005  thorpej branches: 1.6.2;
Move common Sun3/Sun4 EEPROM definitions in to <dev/sun/eeprom.h>
 1.5 19-Jun-2005  thorpej Fix some whitespace.
 1.4 20-Jul-2002  mrg branches: 1.4.6;
sync these with the sparc64 versions.
 1.3 03-Mar-2002  jmc branches: 1.3.6;
Provide a definition for DEV_EEPROM so mem.c will compile if SUN4 is defined.
 1.2 29-Aug-1995  pk branches: 1.2.46; 1.2.50;
Export `eeprom_va' so drivers can peek at the configuration (from Jason Thorpe).
 1.1 29-May-1995  pk eeprom device for Sun4 from Jason Thorpe.
 1.2.50.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.50.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.46.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.46.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.6.1 31-Aug-2002  gehenna catch up with -current.
 1.4.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.1 21-Jun-2006  yamt sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.72.1 16-May-2008  yamt sync with head.
 1.8.70.1 18-May-2008  yamt sync with head.
 1.8.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.44.1 03-Dec-2017  jdolecek update from HEAD
 1.10 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.9 12-Aug-2017  joerg Add sparc/sparc64 support for irelative relocations.
 1.8 02-Feb-2017  martin PR port-sparc64/51925: cosmetic cleanup, no functional change
 1.7 30-May-2009  skrll branches: 1.7.22; 1.7.40; 1.7.44; 1.7.48;
Add TLS relocation definitions.
 1.6 09-Dec-2001  thorpej branches: 1.6.122;
Add support for dumping ELF-cormat core files.
 1.5 02-Apr-2000  minoura branches: 1.5.8; 1.5.12;
Move dl* function definitions to libc on ELF.
Based on the patch supplied by Takuya Shiozaki <tshiozak@astec.co.jp>.
See http://mail-index.netbsd.org/tech-userlevel/2000/02/23/0000.html.
 1.4 25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.3 14-May-1999  eeh branches: 1.3.2; 1.3.4; 1.3.6;
Let NetBSD/sparc know about 64-bit formats even if it can't execute them.
 1.2 01-Jul-1998  tv branches: 1.2.10;
Add relocation definitions used by ld.elf_so.
 1.1 26-Sep-1996  cgd add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.
 1.2.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.5.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.122.1 20-Jun-2009  yamt sync with head
 1.7.48.1 21-Apr-2017  bouyer Sync with HEAD
 1.7.44.1 20-Mar-2017  pgoyette Sync with HEAD
 1.7.40.2 28-Aug-2017  skrll Sync with HEAD
 1.7.40.1 05-Feb-2017  skrll Sync with HEAD
 1.7.22.1 03-Dec-2017  jdolecek update from HEAD
 1.1 29-Mar-2018  joerg branches: 1.1.2;
Move the complex logic for dynamically writing branches from ld.elf_so
into a header for reuse in crt0.o for static ifunc support. Change the
existing logic for sparc64 to use the Bicc variant of ba,a as it allows
+-8MB displacement compared to the BPcc variant's +-1MB. Teach the sparc
variant the same trick for using ba,a and not sethi+jmp when possible.
 1.1.2.2 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.1.2.1 29-Mar-2018  pgoyette file elf_support.h was added on branch pgoyette-compat on 2018-03-30 06:20:12 +0000
 1.13 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.12 16-Mar-2000  mycroft Foolish consistency. Mainly, always use underscores and sys/endian.h.
 1.11 21-Aug-1999  simonb branches: 1.11.2;
Include <sys/endian.h> after defining whether where are little- or
big-endian. i386, pc532 and vax still include <machine/byte_swap.h>
and define macros for the {n,h}to{h,n}*() functions. mips also
defines some endian-independent assembly-code aliases for unaligned
memory accesses.
 1.10 24-Jan-1999  mycroft Mark [hn]to[nh][ls]() with __const__, so they are subject to CSE.
 1.9 15-Jan-1999  bouyer 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.8 31-Jul-1998  mycroft (Always) (practice) (safe) (macro expansion).
 1.7 09-Oct-1997  bouyer branches: 1.7.4;
Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.6 11-Oct-1996  christos branches: 1.6.10;
add in_addr_t and in_port_t
 1.5 14-Aug-1996  thorpej Back out previous; this is a bigger problem than I expected.
 1.4 14-Aug-1996  thorpej The htonl(), htons(), etc. functions return u_long and u_short. Add
casts to the big-endian versions of these calls so that the compiler
won't complain when they're passed as arguments to printf().
 1.3 13-Feb-1996  christos - Fix setcxsegmap prototype.
- Cast ?TO? macros to NULL to avoid compiler warnings
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 10-Oct-1993  deraadt need these
 1.6.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.4.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1 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:25:39 +0000
 1.8 08-Oct-1996  cgd moved to aout_machdep.h (via repository copy)
 1.7 20-Nov-1994  deraadt copyright/Id cleanup
 1.6 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.5 18-Oct-1993  deraadt fix a typo
 1.4 18-Oct-1993  pk Put definition of __LDPGSZ and `struct relocation_info' where they belong:
in <machine/exec.h>.
 1.3 15-Oct-1993  deraadt actually put something in a previously empty file.
__LDPGSZ should now be defined here!
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.7 20-Aug-2000  pk fbio.h moded to sys/dev/sun.
Retain symlink from /usr/include/machine.
 1.6 01-Aug-1999  matt branches: 1.6.2; 1.6.12;
Initial stab at a P9100 console FB driver for the Tadpole 3GX.
It supports RASTERCONSOLE only and the colormap support is
broken (the hardware doesn't seem to be doing what the tech.
docs. say it should be doing). But it is usable as a console
(but with blue on white as the only color choice). I figured
I'd check it in since it is somewhat usable and someone else
might figure what I screwed up in the color map support.
 1.5 30-Sep-1996  abrown branches: 1.5.24;
Add cgfourteen to conf.h.
Add new framebuffer types for recent-model graphics devices to fbio.h.
 1.4 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 27-Feb-1994  deraadt add things needed by the cgsix
 1.1 16-Oct-1993  deraadt fbio.h, mailed from Torek. This file is from Sprite, and clearly an
extensively modified SunOS file. *sigh*.
(ie. Feel free to rewrite it from scratch...)
 1.5.24.1 02-Aug-1999  thorpej Update from trunk.
 1.6.12.1 16-Aug-2001  tv Pullup [jdolecek]:

sys/arch/amiga/dev/grf_cl.c 1.26
sys/arch/amiga/dev/grfioctl.h 1.14
sys/arch/hpcmips/dev/plumvideo.c 1.20
sys/arch/macppc/dev/ofb.c 1.25
sys/arch/sparc/dev/cgtwo.c 1.35
sys/arch/sparc/include/fbio.h patch
sys/arch/sparc64/include/fbio.h patch
sys/arch/sun3/dev/cg2.c 1.14
sys/arch/sun3/include/fbio.h patch
sys/dev/pci/tga.c 1.35
sys/dev/tc/cfb.c 1.28
sys/dev/tc/mfb.c 1.27
sys/dev/tc/sfb.c 1.46
sys/dev/tc/sfbplus.c 1.10 via patch
sys/dev/tc/tfb.c 1.30
sys/dev/tc/xcfb.c 1.23
sys/net/if_ppp.c 1.71

Use unsigned variable types to make bounds checking more correct.
 1.6.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.15 25-Aug-2003  uwe Framebuffer code common to sparc and sparc64 was merged and moved to
dev/sun 3 years ago. Remove these redundant and out-of-date copies.
All code now uses dev/sun/fbvar.h
 1.14 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.13 26-Jun-2000  simonb branches: 1.13.24;
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.12 19-Mar-2000  pk branches: 1.12.4;
Add `fb_is_console()', which is a helper function for frame buffer
device drivers used to decide whether or not to act as console output.
 1.11 13-Apr-1999  ad branches: 1.11.2;
Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.10 21-Mar-1998  pk branches: 1.10.10;
Split the fb_setsize() utility in two separate functions: one to be
used by OBP machines and another one for sun4/eeprom machines.
 1.9 07-Jul-1997  pk fbrcons_{rows,cols} helper functions.
 1.8 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.7 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.6 29-Nov-1995  pk Code from Jason to better configure /dev/fb.
 1.5 08-Oct-1995  pk branches: 1.5.2;
Patch from Jason to factor out a common framebuffer size determination
routine from the individual drivers.
 1.4 05-Oct-1995  pk RCONSOLE => RASTERCONSOLE.
 1.3 17-Sep-1995  pk Remove all rcons related stuff from `fbdevice'; this is now defined in
dev/rcons/rcons.h.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.2.1 16-Feb-1996  thorpej Pull in improved framebuffer autoconfiguration code from -current.
Prevents panics when multiple framebuffers are found on sun4 systems.
 1.10.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.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.12.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.13.24.1 03-Aug-2004  skrll Sync with HEAD
 1.2 14-Jan-2017  martin Make the copies of the FE_* macros match verbatim to avoid a gcc warning
when both ieeefp.h and fenv.h are included.
 1.1 20-May-2011  nakayama branches: 1.1.2; 1.1.6; 1.1.18; 1.1.36; 1.1.40;
Add fenv support for sparc. Mostly copied from sparc64 and share with it.
 1.1.40.1 20-Mar-2017  pgoyette Sync with HEAD
 1.1.36.1 05-Feb-2017  skrll Sync with HEAD
 1.1.18.1 03-Dec-2017  jdolecek update from HEAD
 1.1.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.6.1 20-May-2011  jruoho file fenv.h was added on branch jruoho-x86intr on 2011-06-06 09:06:45 +0000
 1.1.2.2 31-May-2011  rmind sync with head
 1.1.2.1 20-May-2011  rmind file fenv.h was added on branch rmind-uvmplock on 2011-05-31 03:04:17 +0000
 1.13 30-Oct-2024  riastradh Sprinkle <sys/featuretest.h> where _*_SOURCE macros are consulted.

Otherwise, the feature tests might come out wrong. For example,
header files that check for _NETBSD_SOURCE won't get the default when
no other _*_SOURCE macros are defined; header files that check for
_POSIX_C_SOURCE might miss _XOPEN_SOURCE, which is supposed to imply
a corresponding _POSIX_C_SOURCE.

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
 1.12 25-Nov-2009  martin branches: 1.12.100;
Remove double include that prevented the right machdep LDBL_* constants
to be used.

Noticed by Masao Uebayashi.
 1.11 25-Oct-2008  mrg move the float definitions all into <sparc/float.h> and make that
version work in either 32 or 64 bit mode.
 1.10 12-May-2003  kleink branches: 1.10.104; 1.10.108; 1.10.114;
Rename <sys/float_ieee.h> to <sys/float_ieee754.h>, following libc's
convention for these.
 1.9 19-Apr-2003  christos PR/3012: Greg A. Woods: Write all float.h files [except the vax of course]
in terms of float_ieee.h
 1.8 18-Feb-1998  mycroft Minor changes to make all the float.h files match.
 1.7 03-Feb-1998  mycroft Prototype __flt_rounds() consistently.
 1.6 18-Jul-1997  thorpej branches: 1.6.6;
Change the extern declaration of __flt_rounds() into a proper prototype.
 1.5 20-Jun-1995  jtc Wrap with #ifndef _XXX_FLOAT_H_/#define _XXX_FLOAT_H_/ ... /#endif.
 1.4 20-Jun-1995  jtc #include <sys/cdefs.h>.
Wrap __flt_rounds() declaration with __BEGIN_DECLS/__END_DECLS.
 1.3 10-Apr-1995  jtc Changed FLT_ROUNDS from constant to a call to __flt_rounds(), so that the
current rounding mode is accurately reported.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.6.6.1 08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.10.114.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.108.2 11-Mar-2010  yamt sync with head
 1.10.108.1 04-May-2009  yamt sync with head.
 1.10.104.1 17-Jan-2009  mjf Sync with HEAD.
 1.12.100.1 02-Aug-2025  perseant Sync with HEAD
 1.11 15-Feb-2022  palle Document the calculation of CC64FSZ
 1.10 11-Apr-2018  palle Fix typo in comment
 1.9 06-Oct-2015  martin branches: 1.9.16;
Do not use #ifdef SUN4U when testing for cpu features of post-v8 CPUs,
it is not good for SUN4V-only kernels. Instead use __sparc_v9__ (which
is also defined by the sparc compiler when called with cpu=ultrasparc).
ok: mrg@
 1.8 12-Apr-2011  mrg branches: 1.8.14; 1.8.32;
make sparc/frame.h idempotent.
 1.7 04-Mar-2006  uwe branches: 1.7.94; 1.7.100;
s/u_intN_t/uintN_t/
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.6;
merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 04-Dec-2001  darrenr branches: 1.4.16;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.3 22-Mar-2001  mrg branches: 1.3.2; 1.3.8;
sync with sparc64.
 1.2 20-Nov-1994  deraadt branches: 1.2.32; 1.2.44;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.44.1 09-Apr-2001  nathanw Catch up with -current.
 1.2.32.1 27-Mar-2001  bouyer Sync with HEAD.
 1.3.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.8.1 22-Mar-2001  nathanw file frame.h was added on branch nathanw_sa on 2002-01-08 00:27:38 +0000
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.16.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.7.100.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.94.1 21-Apr-2011  rmind sync with head
 1.8.32.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.8.14.1 03-Dec-2017  jdolecek update from HEAD
 1.9.16.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.5 08-Aug-2010  chs merge sparc and sparc64 fsr.h into one file.
add the missing FSR_TT_* definitions.
fix FSR_FTT_MASK. fix the V9 FCC fields.
 1.4 11-Dec-2005  christos branches: 1.4.78; 1.4.98; 1.4.100;
merge ktrace-lwp.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 20-Nov-1994  deraadt branches: 1.2.66;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.66.1 03-Aug-2004  skrll Sync with HEAD
 1.4.100.1 05-Mar-2011  rmind sync with head
 1.4.98.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.4.78.1 11-Aug-2010  yamt sync with head.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 19-Jun-2005  thorpej Move common Sun ID PROM definitions into <dev/sun/idprom.h>.
 1.7 04-Dec-2001  darrenr branches: 1.7.16;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.6 27-Nov-1999  mrg branches: 1.6.8; 1.6.12;
s/long/int/ to make this identical the sparc64 version.
 1.5 10-Mar-1997  pk branches: 1.5.22; 1.5.28;
Move some constants from param.h in here
 1.4 01-Feb-1995  pk branches: 1.4.10;
Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 20-Aug-1994  deraadt the sun4c "fake idprom inside the nvram" looks exactly like a sun4 idprom.
 1.1 08-Aug-1994  deraadt first cuts
 1.4.10.1 12-Mar-1997  is Merge in changes from The Trunk
 1.5.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.6.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.16.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18 31-Jan-2014  matt Consolidate the 128-bit long double defintions to <sys/ieee754.h>
Each arch that uses it now defines __HAVE_LONG_DOUBLE to 128.
<machine/ieee.h> is now just include the machine's math.h followed
by <sys/ieee754.h>
 1.17 15-Dec-2013  christos Add linted comments.
 1.16 20-Nov-2013  martin PR 48384: reorganize struct ieee_ext for sparc64 to only use a high/low
part for the mantissa.
Adjust arch specific code accordingly.
 1.15 14-Feb-2013  martin branches: 1.15.2;
We have an implicit 1 MSB bit in the mantissa. Pointed out by Matt Thomas.
Fixes PR port-sparc64/47536.
 1.14 10-Jul-2011  matt branches: 1.14.2; 1.14.8; 1.14.12;
Add defines for extu_frac[ln]m
 1.13 20-Sep-2010  christos cargo cult the x86 changes.
 1.12 04-Feb-2007  christos branches: 1.12.48; 1.12.68; 1.12.70;
remove dup definition
 1.11 03-Feb-2007  christos make extended precision gdtoa friendly.
 1.10 11-Dec-2005  christos branches: 1.10.20; 1.10.24;
merge ktrace-lwp.
 1.9 15-Apr-2005  kleink branches: 1.9.2;
Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.

IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.8 28-Oct-2003  kleink branches: 1.8.8; 1.8.14;
Make the extended-precision definitions available for _KERNEL (i.e. the
FPU support package), too; reported by Chuck Silvers.
 1.7 27-Oct-2003  kleink Err, rename some members added in previous to make them reflect their
semantics better.
 1.6 26-Oct-2003  kleink For convenient use in libc, add unions of the C floating types and their
corresponding structure definitions.
 1.5 26-Oct-2003  kleink Use <sys/ieee754.h> where applicable.
 1.4 26-Oct-2003  kleink Rip out E80 format definitions which are neither "notyet", nor going to
happen.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 20-Nov-1994  deraadt branches: 1.2.66;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.66.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.66.1 03-Aug-2004  skrll Sync with HEAD
 1.8.14.1 19-Apr-2005  tron Pull up revision 1.9 (requested by kleink in ticket #163):
Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.
IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.2.1 26-Feb-2007  yamt sync with head.
 1.10.24.1 07-May-2007  pavel Pull up following revision(s) (requested by manu in ticket #607):
lib/libc/arch/i386/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoa.c: revision 1.2-1.3
lib/libc/arch/x86_64/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoaimp.h: revision 1.6
sys/arch/m68k/include/ieee.h: revision 1.13
usr.bin/xlint/lint1/scan.l: revision 1.36-1.37
lib/libc/stdio/snprintf_ss.c: revision 1.4
lib/libc/arch/i386/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfscanf.c: revision 1.38
sys/arch/sparc/include/ieee.h: revision 1.11-1.12
lib/libc/gdtoa/dtoa.c: revision 1.4
lib/libc/stdio/Makefile.inc: revision 1.35
lib/libc/stdio/fvwrite.c: revision 1.17
lib/libc/arch/m68k/gen/fpclassifyl.c: revision 1.2
lib/libc/arch/i386/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfprintf.c: revision 1.55-1.57
lib/libc/stdio/vsnprintf_ss.c: revision 1.3
lib/libc/stdio/vfwprintf.c: revision 1.10
sys/arch/x86/include/ieee.h: revision 1.10
lib/libc/gdtoa/dmisc.c: revision 1.3
lib/libc/gdtoa/Makefile.inc: revision 1.5
sys/arch/hppa/include/ieee.h: revision 1.10
lib/libc/arch/x86_64/gen/fpclassifyl.c: revision 1.3
lib/libc/arch/i386/gen/fpclassifyl.c: revision 1.2
sys/sys/ieee754.h: revision 1.7
lib/libc/gdtoa/gdtoa.h: revision 1.7
include/stdio.h: revision 1.67-1.68
lib/libc/gdtoa/hdtoa.c: revision 1.1-1.4
lib/libc/gdtoa/ldtoa.c: revision 1.1-1.4
defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
Fix for issue reported in PR lib/35401 as well as related overflow bugs.
deal with hex doubles.
Instead of abusing stdio to get a signal-safe version of sprintf, provide one.
remove __SAFE
add long double and hex double support from freebsd.
make this compile.
add new prototypes.
add the new files to the build. Note I am not bumping libc now, because
these are not used yet.
Merge the int bit with the high fraction bit. Add constants/macros
needed by gdtoa.
add constants used by gdtoa
since the int bit is merged, do the explicit math.
ext_int bit is no more.
ext_int bit is no more.
- merge change from freebsd
- add support for building as vfprintf.c
- XXX: we strdup to simplify the freeing logic. This should be fixed for
efficiency in the vfprintf case.
use vfwprintf.c
enable wide doubles.
some int -> size_t
deal with sparc64 that has 112 bits of mantissa.
make extended precision gdtoa friendly.
int/size_t changes
make this gdtoa friendly.
remove dup definition
use dtoa() instead of returning empty when we don't have extended precision
information.
Fix previous, add forgotten pointer dereference in the call to dtoa().
Add a cheesy workaround marked XXX for the situation where the
strtod() implementation available in the environment does not
handle hex floats.
Discussed with and suggested by christos
From Christos: gdtoa fixes for m68k. M68k ports should build now, but
printing extended precision is a little off.
vax does not have <machine/ieee.h> or long double
It would be nice if the compiler provided something like __IEEE_MATH__
bring in FreeBSD's vfscanf() to gain multi-byte/collation support.
Unfortunately it is too difficult to make vfwscanf and this share
the same code like I did with printf, because for string parsing
the code is too different.
 1.10.20.1 09-Feb-2007  ad Sync with HEAD.
 1.12.70.1 05-Mar-2011  rmind sync with head
 1.12.68.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.12.48.1 09-Oct-2010  yamt sync with head
 1.14.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.12.1 25-Feb-2013  tls resync with head
 1.14.8.1 14-Feb-2013  jdc Pull up revision 1.15 (requested by martin in ticket #821).

We have an implicit 1 MSB bit in the mantissa. Pointed out by Matt Thomas.
Fixes PR port-sparc64/47536.
 1.14.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.2.1 18-May-2014  rmind sync with head
 1.10 14-Jan-2017  christos remove dup definitions
 1.9 03-Jan-2015  martin branches: 1.9.2;
Avoid defining macros from the <fenv.h> namespace here (especially with
different values).
 1.8 20-Mar-2012  christos branches: 1.8.2; 1.8.16;
make fp_except unsigned
 1.7 20-May-2011  nakayama branches: 1.7.4; 1.7.8;
Add fenv support for sparc. Mostly copied from sparc64 and share with it.
 1.6 24-Apr-2011  tron Don't define "fenv_t" and "fexcept_t" for NetBSD/sparc64 because the
definitions clash with "/usr/include/sparc64/fenv.h".

This fixes the build of e.g. "pkgsrc/databases/mysql51-client" under
NetBSD/sparc64 current.
 1.5 05-Aug-2008  matt branches: 1.5.16; 1.5.22;
Update <machine/ieeefp.h> to use the C99 FE_* definitions instead of the
NetBSD defined ones. Redefine the NetBSD ones in terms of the C99 ones.
Step 1 to having <fenv.h>
 1.4 21-Sep-2001  eeh branches: 1.4.4; 1.4.122; 1.4.126; 1.4.128; 1.4.132;
Correct values for different rounding modes.
 1.3 05-Jan-1998  perry branches: 1.3.26; 1.3.28;
RCSID Police.
 1.2 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.1 10-Apr-1995  jtc Sparc specific portions of ieeefp.h (fp_rnd, fp_except, constants, etc.).
 1.3.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.26.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.132.1 19-Oct-2008  haad Sync with HEAD.
 1.4.128.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.126.1 04-May-2009  yamt sync with head.
 1.4.122.1 28-Sep-2008  mjf Sync with HEAD.
 1.4.4.2 21-Sep-2001  eeh Correct values for different rounding modes.
 1.4.4.1 21-Sep-2001  eeh file ieeefp.h was added on branch nathanw_sa on 2001-09-21 20:32:34 +0000
 1.5.22.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.16.1 31-May-2011  rmind sync with head
 1.7.8.1 05-Apr-2012  mrg sync to latest -current.
 1.7.4.1 17-Apr-2012  yamt sync with head
 1.8.16.2 05-Feb-2017  skrll Sync with HEAD
 1.8.16.1 06-Apr-2015  skrll Sync with HEAD
 1.8.2.1 03-Dec-2017  jdolecek update from HEAD
 1.9.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 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 14-Jul-2003  pk The source register field was missing from the `i_loadstore' format.
From Jason Wright (openbsd) in private communication.
 1.5 16-Aug-2000  pk branches: 1.5.24;
Sync with sparc64.
 1.4 10-Dec-1997  pk branches: 1.4.14;
Code for software-assisted DDB single-stepping from Chuck Silvers.
 1.3 14-Mar-1997  christos Asi instruction struct was missing the immediate bit!
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.4 13-Aug-2014  matt Include <sys/common_int_const.h> if __INTMAX_C_SUFFIX__ is defined.
 1.3 29-May-2010  tnozaki branches: 1.3.18;
fix wrong integer promotion rule(removed U suffix from UINT{8,16}_C).
see ISO/IEC 9899:1999 7.18.4.3.
 1.2 28-Apr-2008  martin branches: 1.2.20; 1.2.22;
Remove clause 3 and 4 from TNF licenses
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12; 1.1.130; 1.1.132; 1.1.134;
Add definitions of C99 integer constant macros.
 1.1.134.2 11-Aug-2010  yamt sync with head.
 1.1.134.1 16-May-2008  yamt sync with head.
 1.1.132.1 18-May-2008  yamt sync with head.
 1.1.130.1 02-Jun-2008  mjf Sync with HEAD.
 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:44 +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:54:37 +0000
 1.2.22.1 30-May-2010  rmind sync with head
 1.2.20.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.18.1 03-Dec-2017  jdolecek update from HEAD
 1.7 21-Aug-2014  martin Revert previous, we have restores ABI for {u,}int_fast_*_t.
 1.6 15-Aug-2014  martin All FAST datatypes are int (32 bit) on both sparc and sparc64, only FAST64
variants are long (sparc64) or long long (sparc).
 1.5 13-Aug-2014  matt include <sys/common_int_fmtio.h> if __INTPTR_FMTd__ is defined
 1.4 28-Apr-2008  martin branches: 1.4.44;
Remove clause 3 and 4 from TNF licenses
 1.3 15-Oct-2001  kleink branches: 1.3.4; 1.3.122; 1.3.124; 1.3.126;
Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4;
Add definitions for C99 fastest minimum-width integer types.
 1.1 15-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 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:54:37 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.126.1 16-May-2008  yamt sync with head.
 1.3.124.1 18-May-2008  yamt sync with head.
 1.3.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.4.2 15-Oct-2001  kleink Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.3.4.1 15-Oct-2001  kleink file int_fmtio.h was added on branch nathanw_sa on 2001-10-15 21:32:26 +0000
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.8 13-Aug-2014  matt Include <sys/common_init_limits.h> if __SIG_ATOMIC_MAX__ is defined.
 1.7 28-Apr-2008  martin branches: 1.7.44;
Remove clause 3 and 4 from TNF licenses
 1.6 17-Oct-2007  garbled branches: 1.6.16; 1.6.18; 1.6.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.5 31-Aug-2007  drochner Fix definitions of UCHAR_MAX/USHRT_MAX and related
types. C99 requires that these definitions promote to (signed/unsigned)
integer the same way as the types the definition is for. And since
unsigned char/short fit into an "int" on all our archs and thus promote
to signed int, the definitions must not be unsigned.
Fixes PR lib/31306 by Neil Booth.
 1.4 11-Dec-2005  christos branches: 1.4.30; 1.4.38; 1.4.44; 1.4.48; 1.4.50;
merge ktrace-lwp.
 1.3 08-May-2004  kleink branches: 1.3.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.10; 1.2.26;
Add definitions for C99 fastest minimum-width integer types.
 1.1 15-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 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:54:38 +0000
 1.2.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.26.1 03-Aug-2004  skrll Sync with HEAD
 1.2.10.2 26-Apr-2001  kleink Add definitions for C99 fastest minimum-width integer types.
 1.2.10.1 26-Apr-2001  kleink file int_limits.h was added on branch nathanw_sa on 2001-04-26 16:25:27 +0000
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.12.1 03-Sep-2007  yamt sync with head.
 1.4.50.1 06-Nov-2007  matt sync with HEAD
 1.4.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.4.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.4.38.1 03-Oct-2007  garbled Sync with HEAD
 1.4.30.1 09-Oct-2007  ad Sync with head.
 1.6.20.1 16-May-2008  yamt sync with head.
 1.6.18.1 18-May-2008  yamt sync with head.
 1.6.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.44.1 03-Dec-2017  jdolecek update from HEAD
 1.7 13-Aug-2014  matt include <sys/common_int_mwgwtypes.h> if __UINT_FAST64_TYPE__ is defined.
 1.6 28-Apr-2008  martin branches: 1.6.44;
Remove clause 3 and 4 from TNF licenses
 1.5 24-Dec-2005  perry branches: 1.5.74; 1.5.76; 1.5.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.4 15-Oct-2001  kleink branches: 1.4.4; 1.4.36;
Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.3 14-Oct-2001  kleink Fix a pasto in the __COMPILER_INT64__-based definition of {u,}intmax_t.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4;
Add definitions for C99 fastest minimum-width integer types.
 1.1 14-Apr-2001  kleink branches: 1.1.2;
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.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:54:38 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.36.1 21-Jun-2006  yamt sync with head.
 1.4.4.2 15-Oct-2001  kleink Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.4.4.1 15-Oct-2001  kleink file int_mwgwtypes.h was added on branch nathanw_sa on 2001-10-15 19:49:17 +0000
 1.5.78.1 16-May-2008  yamt sync with head.
 1.5.76.1 18-May-2008  yamt sync with head.
 1.5.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.44.1 03-Dec-2017  jdolecek update from HEAD
 1.11 13-Aug-2014  matt Include <sys/common_int_types.h> if __UINTPTR_TYPE__ is defined.
 1.10 24-Dec-2005  perry branches: 1.10.122;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 25-May-2005  kleink branches: 1.8.2;
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.7 07-Aug-2003  agc branches: 1.7.6; 1.7.14;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 28-Apr-2001  kleink branches: 1.6.8; 1.6.24;
* Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.5 17-Apr-2001  kleink Oops, intptrs are always long integers.
 1.4 12-Apr-2001  kleink Replace the 'unsigned __COMPILER_INT64__' construct with a new name,
__COMPILER_UINT64__, to be supplied - if such a case is made, it shouldn't
be assumed that the unsigned type-specifier may be applied to it.
 1.3 03-Jan-2001  takemura branches: 1.3.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.2 27-Jun-2000  kleink branches: 1.2.2;
Resolve some formatting nits; add __intptr_t and __uintptr_t.
 1.1 26-Jun-2000  kleink Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.2.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 27-Jun-2000  bouyer file int_types.h was added on branch thorpej_scsipi on 2000-11-20 20:25:39 +0000
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.24.1 03-Aug-2004  skrll Sync with HEAD
 1.6.8.2 28-Apr-2001  kleink * Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.6.8.1 28-Apr-2001  kleink file int_types.h was added on branch nathanw_sa on 2001-04-28 15:41:33 +0000
 1.7.14.1 28-May-2005  tron Pull up revision 1.8 (requested by klein in ticket #346):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.7.6.1 29-May-2005  riz Pull up revision 1.8 (requested by kleink in ticket #1555):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.10.122.1 03-Dec-2017  jdolecek update from HEAD
 1.14 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.13 21-Aug-2019  msaitoh branches: 1.13.8;
Fix typo (s/contoller/controller/).
 1.12 27-Jul-2012  matt branches: 1.12.40;
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.11 28-Apr-2008  martin branches: 1.11.34;
Remove clause 3 and 4 from TNF licenses
 1.10 03-Dec-2007  ad branches: 1.10.14; 1.10.16; 1.10.18;
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.9 04-May-2006  yamt branches: 1.9.18; 1.9.36; 1.9.38; 1.9.44;
implement splraiseipl() for sparc.
reviewed by Martin Husemann.

while i'm here, use macros for some MD constants (eg. IPL_ZS)
as suggested by Havard Eidnes.
 1.8 04-Mar-2006  uwe branches: 1.8.2; 1.8.4; 1.8.6;
De-__P.
 1.7 16-Jun-2003  thorpej branches: 1.7.18; 1.7.32; 1.7.34;
Rename IPL_IMP -> IPL_VM.
 1.6 31-Dec-2002  pk Define IPL_SCHED at level 11 and make splsched() use it.
 1.5 09-Dec-2002  pk Finish the switch to the softintr(9) framework.

To make this work, we now have to use separate handler lists for hardware
and software interrupts as the soft interrupt handlers do not return
an `interrupt handled' status.

Thanks to Matt Fredette for providing an initial set of patches on port-sparc.
 1.4 06-Dec-2002  pk Start using IPL_* constants from intr.h; phase out PIL_* in psl.h
 1.3 27-Sep-2001  mrg branches: 1.3.4; 1.3.8;
implement generic soft interrupts as described in softintr(9). convert
the network, clock & serial softint's to use them.
 1.2 25-Nov-1998  pk branches: 1.2.22; 1.2.24;
Add IPL_SERIAL
 1.1 22-Nov-1998  pk Define `interrupt priority levels'.
XXX - for now, these arbitrary identifiers; NO INTERPRETATION IS DEFINED YET
 1.2.24.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.22.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.8.1 17-Mar-2002  thorpej IPL_IMP -> IPL_VM
 1.3.4.3 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.3.4.2 11-Dec-2002  thorpej Sync with HEAD.
 1.3.4.1 27-Sep-2001  thorpej file intr.h was added on branch nathanw_sa on 2002-12-11 06:12:08 +0000
 1.7.34.2 01-Jun-2006  kardel Sync with head.
 1.7.34.1 22-Apr-2006  simonb Sync with head.
 1.7.32.1 09-Sep-2006  rpaulo sync with head
 1.7.18.2 07-Dec-2007  yamt sync with head
 1.7.18.1 21-Jun-2006  yamt sync with head.
 1.8.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.4.1 11-May-2006  elad sync with head
 1.8.2.1 24-May-2006  yamt sync with head.
 1.9.44.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.38.1 09-Jan-2008  matt sync with HEAD
 1.9.36.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.9.18.1 03-Dec-2007  ad Sync with HEAD.
 1.10.18.1 16-May-2008  yamt sync with head.
 1.10.16.1 18-May-2008  yamt sync with head.
 1.10.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.34.1 30-Oct-2012  yamt sync with head
 1.12.40.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.13.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.9 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.8 04-Dec-2001  darrenr branches: 1.8.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.7 18-Oct-1997  gwr branches: 1.7.30; 1.7.34;
Use common zs code.
 1.6 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.5 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.4 06-Jul-1995  pk Support KIOC_GETLAYOUT, so other than US keyboards can be dealt with better.
 1.3 26-Apr-1995  pk define LED controls
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 21-Jul-1994  deraadt branches: 1.1.2;
make X11R5 compile easier
 1.1.2.2 21-Jul-1994  deraadt make X11R5 compile easier
 1.1.2.1 21-Jul-1994  deraadt file kbd.h was added on branch netbsd-1-0 on 1994-07-21 22:06:14 +0000
 1.7.34.2 27-Aug-2002  nathanw Catch up to -current.
 1.7.34.1 08-Jan-2002  nathanw Catch up to -current.
 1.7.30.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.7.30.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.8.1 31-Aug-2002  gehenna catch up with -current.
 1.6 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.5 18-Oct-1997  gwr branches: 1.5.30; 1.5.34; 1.5.42;
Use common zs code.
 1.4 10-May-1995  pk Minimalist implementation of KIOC[SG]KEY.
 1.3 26-Apr-1995  pk define LED controls
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 21-Jul-1994  deraadt branches: 1.1.2;
make X11R5 compile easier
 1.1.2.2 21-Jul-1994  deraadt make X11R5 compile easier
 1.1.2.1 21-Jul-1994  deraadt file kbio.h was added on branch netbsd-1-0 on 1994-07-21 22:06:18 +0000
 1.5.42.1 31-Aug-2002  gehenna catch up with -current.
 1.5.34.1 27-Aug-2002  nathanw Catch up to -current.
 1.5.30.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 09-Oct-1997  jtc branches: 1.3.152; 1.3.154; 1.3.156;
Fix tipo inherited from old version of TNF copyright template.
 1.2 20-Sep-1997  pk Remove the `segmap' array from the header. Insert an offset and count
field to get to it instead.

Add field `kernbase' so libkvm can be independent of the kernel's link address.
 1.1 09-Nov-1996  pk branches: 1.1.10;
Define new-style kernel crash dump format.
 1.1.10.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.10.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.156.1 16-May-2008  yamt sync with head.
 1.3.154.1 18-May-2008  yamt sync with head.
 1.3.152.1 02-Jun-2008  mjf Sync with HEAD.
 1.25 16-Mar-2024  christos make all QUAD constants look the same.
 1.24 14-Mar-2024  christos Sync with x86_64 the quad constants. No reason to be different
 1.23 21-Jan-2019  dholland Fix wrong scoping of {U,}LLONG_MAX. More cases, not just amd64.
PR 53298 from Roberto E. Vargas Caballero.
 1.22 21-Apr-2014  matt branches: 1.22.26; 1.22.28;
Since all our compilers support __DBL_* and __FLT_*, use them to define
{DBL,FLT}_{DIG,MIN,MAX}
 1.21 11-Apr-2013  christos branches: 1.21.4; 1.21.8;
add missing SSIZE_MIN
 1.20 28-Mar-2012  christos branches: 1.20.2;
- Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.19 07-Jun-2010  tnozaki branches: 1.19.8; 1.19.12;
1. MB_LEN_MAX switch MD to MI.
2. unfortunately hppa's MB_LEN_MAX is defined incorrectly 6 instead of 32
so we have to add more setlocale(3) __RENAME func, __setlocale50.
3. move setlocale1.c and setlocale32.c to lib/libc/compat/locale/*
prepareing for next libc major crunk.
4. bump libc minor version.
 1.18 17-Oct-2007  garbled branches: 1.18.20; 1.18.40; 1.18.42;
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.17 31-Aug-2007  drochner Fix definitions of UCHAR_MAX/USHRT_MAX and related
types. C99 requires that these definitions promote to (signed/unsigned)
integer the same way as the types the definition is for. And since
unsigned char/short fit into an "int" on all our archs and thus promote
to signed int, the definitions must not be unsigned.
Fixes PR lib/31306 by Neil Booth.
 1.16 11-Dec-2005  christos branches: 1.16.30; 1.16.38; 1.16.44; 1.16.48; 1.16.50;
merge ktrace-lwp.
 1.15 07-Aug-2003  agc branches: 1.15.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.14 28-Apr-2003  bjh21 branches: 1.14.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.13 03-May-2002  thorpej Don't define _LP64 here.
 1.12 08-Aug-2000  tshiozak branches: 1.12.4; 1.12.8;
Preparation for the future introduction of multibyte locale.
- MB_LEN_MAX is increased to 32.
- To ensure binary compatibility for old executables
under multibyte locale, versioned setlocale is added.
- __mb_len_cur definision is added in setlocale.c
and enable it in stdlib.h .
It is also important for multibyte locale stuffs,
but I just forgot.
 1.11 07-Mar-2000  kleink branches: 1.11.2; 1.11.4;
Define ISO C99 (unsigned) long long (min, max) symbols.
 1.10 27-Nov-1999  mrg merge sparc64 limits.h; these files are now identical. this includes
a `fix' for when s?size_t was changed from int to long but the
definitions of S?SIZE_MAX were left as U?INT_MAX. these are now
U?LONG_MAX.
 1.9 06-Aug-1998  kleink branches: 1.9.12; 1.9.18;
_POSIX_SOURCE -> _POSIX_C_SOURCE
 1.8 09-Jan-1998  perry multiple include protect machine/limits.h, fixes pr 4473 (from Mika Nystrom)
 1.7 05-Jan-1996  pk Use {U,L} suffices per Charles' recommendation.
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 05-Oct-1994  jtc Add constants required by XPG3
 1.4 13-May-1994  deraadt sync with 4.4-lite
 1.3 27-Jan-1994  pk BLAST!
 1.2 19-Oct-1993  deraadt Define the {QUAD,UQUAD}_{MIN,MAX} things here.
 1.1 10-Oct-1993  deraadt need these
 1.9.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.11.4.1 09-Aug-2000  tshiozak pull up the following changes (approved by thorpej):
> cvs rdiff -r1.9 -r1.10 basesrc/include/locale.h
> cvs rdiff -r1.45 -r1.46 basesrc/include/stdlib.h
> cvs rdiff -r1.16 -r1.17 basesrc/lib/libc/locale/Makefile.inc
> cvs rdiff -r1.17 -r1.18 basesrc/lib/libc/locale/setlocale.c
> cvs rdiff -r0 -r1.2 basesrc/lib/libc/locale/setlocale_sb.c
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/alpha/include/limits.h
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/arm26/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/arm32/include/limits.h
> cvs rdiff -r1.14 -r1.15 syssrc/sys/arch/i386/include/limits.h
> cvs rdiff -r1.12 -r1.13 syssrc/sys/arch/m68k/include/limits.h
> cvs rdiff -r1.13 -r1.14 syssrc/sys/arch/mips/include/limits.h
> cvs rdiff -r1.10 -r1.11 syssrc/sys/arch/pc532/include/limits.h
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/powerpc/include/limits.h
> cvs rdiff -r1.2 -r1.3 syssrc/sys/arch/sh3/include/limits.h
> cvs rdiff -r1.11 -r1.12 syssrc/sys/arch/sparc/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/sparc64/include/limits.h
> cvs rdiff -r1.9 -r1.10 syssrc/sys/arch/vax/include/limits.h
>
> Outline:
>
> Preparation for the future introduction of multibyte locale.
> - MB_LEN_MAX is increased to 32.
> - To ensure binary compatibility for old executables
> under multibyte locale, versioned setlocale is added.
> - __mb_len_cur definision is added in setlocale.c
> and enable it in stdlib.h .
> It is also important for multibyte locale stuffs,
> but I just forgot.
 1.11.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.12.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.12.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 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.15.16.1 03-Sep-2007  yamt sync with head.
 1.16.50.1 06-Nov-2007  matt sync with HEAD
 1.16.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.16.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.16.38.1 03-Oct-2007  garbled Sync with HEAD
 1.16.30.1 09-Oct-2007  ad Sync with head.
 1.18.42.1 03-Jul-2010  rmind sync with head
 1.18.40.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.18.20.1 11-Aug-2010  yamt sync with head.
 1.19.12.1 05-Apr-2012  mrg sync to latest -current.
 1.19.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.19.8.1 17-Apr-2012  yamt sync with head
 1.20.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.2.1 23-Jun-2013  tls resync from head
 1.21.8.1 10-Aug-2014  tls Rebase.
 1.21.4.1 18-May-2014  rmind sync with head
 1.22.28.1 10-Jun-2019  christos Sync with HEAD
 1.22.26.1 26-Jan-2019  pgoyette Sync with HEAD
 1.11 06-Aug-2014  joerg Consistently define WARN in a way that passes format string checks, i.e.
always uses the same number of arguments as given in the format string.
 1.10 28-Apr-2008  martin branches: 1.10.44; 1.10.60;
Remove clause 3 and 4 from TNF licenses
 1.9 25-Jan-2006  christos branches: 1.9.72; 1.9.74; 1.9.76;
free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.8 01-Mar-2003  pk branches: 1.8.18; 1.8.30;
Add support for large kernels by searching for a physical memory segment
to fit it in. As a bonus, the kernel is now also mapped to the virtual
address (i.e. KERNBASE) it is linked at.
 1.7 08-Dec-2002  uwe Use 0x07ffffff for LOADADDR mask. This still provides for 128MB (and
given that PROM maps just 4 or 16 this is not going to be a bottle
neck). Doesn't really affect normal kernels, need it for the changed
kernel base address (uncommitted) hack for broken javastation OFW.
Ok by pk.
 1.6 20-Jul-2002  mrg sync these with the sparc64 versions.
 1.5 04-Dec-2001  thorpej branches: 1.5.8;
Don't declare which exec formats to support in loadfile_machdep.h.
Instead, give each user of loadfile() control over which exec formats
it wants to support.
 1.4 31-Oct-2001  thorpej Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.3 16-Aug-2000  mrg branches: 1.3.4; 1.3.6; 1.3.8;
deal with 64 bit ELF
 1.2 30-Apr-1999  christos branches: 1.2.2; 1.2.4; 1.2.14;
Load the header too.
 1.1 28-Apr-1999  christos MD version of loadfile.h
 1.2.14.1 26-Aug-2000  mrg pull up 1.3. approved by thorpej:
>deal with 64 bit ELF
 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.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.8.3 11-Dec-2002  thorpej Sync with HEAD.
 1.3.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.3.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.8.1 31-Aug-2002  gehenna catch up with -current.
 1.8.30.1 01-Feb-2006  yamt sync with head.
 1.8.18.1 21-Jun-2006  yamt sync with head.
 1.9.76.1 16-May-2008  yamt sync with head.
 1.9.74.1 18-May-2008  yamt sync with head.
 1.9.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.60.1 10-Aug-2014  tls Rebase.
 1.10.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.34 13-Feb-2022  riastradh sparc: __cpu_simple_lock membar audit.

No functional change -- comments only, to justify the absence of
barriers with reference to chapter & verse.
 1.33 29-Nov-2019  riastradh Nix mb_* on sparc and sparc64.
 1.32 17-Sep-2017  christos branches: 1.32.4;
more const.
 1.31 28-Apr-2008  martin branches: 1.31.44;
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 10-Sep-2007  skrll Merge nick-csl-alignment.
 1.28 17-Feb-2007  ad branches: 1.28.4; 1.28.12; 1.28.16; 1.28.20; 1.28.22;
Put a sock in it..
 1.27 16-Feb-2007  ad branches: 1.27.2;
Pacify lint.
 1.26 15-Feb-2007  ad Pacify lint/gcc.
 1.25 11-Feb-2007  ad inline -> __inline
 1.24 09-Feb-2007  ad Merge newlock2 to head.
 1.23 04-Mar-2006  uwe branches: 1.23.14;
De-__P.
 1.22 28-Dec-2005  perry branches: 1.22.4; 1.22.6;
inline -> __inline
 1.21 24-Dec-2005  perry __asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.20 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.19 11-Dec-2005  christos merge ktrace-lwp.
 1.18 03-Feb-2005  chs branches: 1.18.6;
add the early-clobber modifier on the destination reg of ldstub.
in some implementations (eg. sun4c), the hardware modifies the destination
reg before checking for write permission on the memory location. without
this change, gcc was using the same register for the address and the
destination, so if the store part of the instruction faulted, the address
was already gone when the instruction was retried after resolving the fault.
part of PR 25633, PR 25896.
 1.17 20-Apr-2004  pk branches: 1.17.4; 1.17.6;
Turn __CPU_SIMPLE_LOCK_INLINE into !__CPU_SIMPLE_LOCK_NOINLINE, so we don't
screw up user land.
 1.16 19-Apr-2004  pk __cpu_simple_lock() isn't a pure function.
 1.15 18-Apr-2004  pk Make inlining __cpu_simple_lock() optional. Add a version with a built-in
spin out counter that panics with a diagnostic.
 1.14 26-Dec-2003  mrg branches: 1.14.2;
convert __ldstub() from a ({}) macro into a properly static inline function.
the latter is not valid for C++ so says GCC3.
 1.13 16-Nov-2003  pk __cpu_simple_unlock: use __insn_barrier() instead of a "memory" clobber.
 1.12 09-Nov-2003  pk __cpu_simple_unlock: avoid instruction re-ordering by the compiler.
 1.11 26-Sep-2003  nathanw Move __cpu_simple_lock_t and __SIMPLELOCK_{UN,}LOCKED to machine/types.h
so that they can be used in a namespace-friendly way.
 1.10 05-May-2000  hannken branches: 1.10.16; 1.10.28;
Fix for lint during build of libc.
 1.9 02-May-2000  thorpej Let each platform typedef the new __cpu_simple_lock_t, which should
be the most efficient type used for the atomic operations in the
simplelock structure, and should also be __volatile.
 1.8 30-Apr-2000  pk FIx declaration in __ldstub.
 1.7 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.6 27-Jul-1999  thorpej branches: 1.6.2;
Make a slight rearrangement in how <machine/lock.h> is included.
 1.5 27-Jul-1999  thorpej Define apporpriate an value for SIMPLELOCK_LOCKED, based on the
semantics of ldstub.
 1.4 27-Jul-1999  thorpej Prepend `cpu_' to the machine-dependent atomic locking primitivies.
 1.3 04-Nov-1998  chs branches: 1.3.8;
LOCKDEBUG enhancements for non-MP:
keep a list of locked locks.
use this to print where the lock was locked
when we either go to sleep with a lock held
or try to free a locked lock.
 1.2 05-Oct-1998  pk If a lock is held do not spin in a read/write loop but just read the lock
until it is released. This is easier on the bus cache coherency logic.
 1.1 27-Sep-1998  pk sparc spin lock functions.
 1.3.8.1 02-Aug-1999  thorpej Update from trunk.
 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.10.28.4 04-Feb-2005  skrll Sync with HEAD.
 1.10.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.28.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 19-Mar-2002  thorpej Change __cpu_simple_lock_t to a single byte.
 1.14.2.2 16-Mar-2005  tron Pull up revision 1.18 (requested by chs in ticket #1159):
add the early-clobber modifier on the destination reg of ldstub.
in some implementations (eg. sun4c), the hardware modifies the destination
reg before checking for write permission on the memory location. without
this change, gcc was using the same register for the address and the
destination, so if the store part of the instruction faulted, the address
was already gone when the instruction was retried after resolving the fault.
part of PR 25633, PR 25896.
 1.14.2.1 24-Apr-2004  jdc branches: 1.14.2.1.2;
Pull up revisions 1.15-1.17 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.14.2.1.2.1 16-Mar-2005  tron Pull up revision 1.18 (requested by chs in ticket #1159):
add the early-clobber modifier on the destination reg of ldstub.
in some implementations (eg. sun4c), the hardware modifies the destination
reg before checking for write permission on the memory location. without
this change, gcc was using the same register for the address and the
destination, so if the store part of the instruction faulted, the address
was already gone when the instruction was retried after resolving the fault.
part of PR 25633, PR 25896.
 1.17.6.1 12-Feb-2005  yamt sync with head.
 1.17.4.1 29-Apr-2005  kent sync with -current
 1.18.6.3 27-Oct-2007  yamt sync with head.
 1.18.6.2 26-Feb-2007  yamt sync with head.
 1.18.6.1 21-Jun-2006  yamt sync with head.
 1.22.6.1 22-Apr-2006  simonb Sync with head.
 1.22.4.1 09-Sep-2006  rpaulo sync with head
 1.23.14.3 06-Feb-2007  ad Test for the presence of 'membar' by checking for __sparc_v9__.
 1.23.14.2 12-Jan-2007  ad Make sparc64 build again.
 1.23.14.1 12-Jan-2007  ad sparc MD changes.
 1.27.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.28.22.1 06-Nov-2007  matt sync with HEAD
 1.28.20.1 02-Oct-2007  joerg Sync with HEAD.
 1.28.16.1 15-Aug-2007  skrll Provide __SIMPLELOCK_{UN,}LOCKED_P and __cpu_simple_lock_{set,clear}
for all architectures.
 1.28.12.1 03-Oct-2007  garbled Sync with HEAD
 1.28.4.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.44.1 03-Dec-2017  jdolecek update from HEAD
 1.32.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 11-Dec-2021  mrg remove clause 3 from all my licenses that aren't conflicting with
another copyright claim line. again. (i did this in 2008 and then
did not update all of my personal templates.)
 1.1 24-Jan-2021  mrg branches: 1.1.4;
avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.1.4.2 03-Apr-2021  thorpej Sync with HEAD.
 1.1.4.1 24-Jan-2021  thorpej file locore.h was added on branch thorpej-futex on 2021-04-03 22:28:38 +0000
 1.2 04-Nov-2024  christos Undo previous lwp.h change.
 1.1 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 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:56:08 +0000
 1.7 01-Feb-2014  matt Export __HAVE_LONG_DOUBLE 128 to kernel for emulation
 1.6 31-Jan-2014  matt Consolidate the 128-bit long double defintions to <sys/ieee754.h>
Each arch that uses it now defines __HAVE_LONG_DOUBLE to 128.
<machine/ieee.h> is now just include the machine's math.h followed
by <sys/ieee754.h>
 1.5 15-Dec-2008  mrg branches: 1.5.14; 1.5.24; 1.5.28;
merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.4 19-Feb-2002  simonb branches: 1.4.118; 1.4.122; 1.4.130; 1.4.132; 1.4.136;
Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.3 05-Feb-2000  kleink branches: 1.3.6; 1.3.10; 1.3.14;
Improve namespace test macros a bit.
 1.2 04-Jan-2000  kleink const -> __const and include <sys/cdefs.h> earlier; fixes PR lib/9052
by Takahiro Kambe.
 1.1 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.3.14.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.10.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.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.3.6.1 05-Feb-2000  bouyer file math.h was added on branch thorpej_scsipi on 2000-11-20 20:25:40 +0000
 1.4.136.1 11-May-2009  bouyer branches: 1.4.136.1.2;
Pull up following revision(s) (requested by mrg in ticket #750):
sys/arch/sparc64/include/math.h: revision 1.7
sys/arch/sparc/include/math.h: revision 1.5
merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.4.136.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.4.132.1 11-May-2009  bouyer Pull up following revision(s) (requested by mrg in ticket #750):
sys/arch/sparc64/include/math.h: revision 1.7
sys/arch/sparc/include/math.h: revision 1.5
merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.4.130.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.122.1 04-May-2009  yamt sync with head.
 1.4.118.1 17-Jan-2009  mjf Sync with HEAD.
 1.5.28.1 18-May-2014  rmind sync with head
 1.5.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.14.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2 28-Jul-1998  pk This file is now in <dev/sbus>
 1.1 03-Jun-1998  pk Magma parallel port ioctls per Iain Hibbert.
 1.22 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.21 04-Nov-2024  christos Undo previous lwp.h change.
 1.20 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.19 18-May-2024  thorpej branches: 1.19.2;
Clean up the <sys/ucontext.h> <-> <machine/mcontext.h> interface up
a little:
- Define _UC_MD_BIT* constants for the available machine-dependent bits,
and use those constants to define the machine-dependent bits as well
as the machine-independent bits that have machine-dependent values.
- Explicitly generate an error if _UC_TLSBASE, _UC_SETSTACK, or
_UC_CLRSTACK are not defined by <machine/mcontext.h>.
 1.18 27-Dec-2019  kamil Harmonize the namespace of fast TLS base pointer getter functions

Protect __lwp_getprivate_fast() with _RTLD_SOURCE, _LIBC_SOURCE and
__LIBPTHREAD_SOURCE__.

Include in this namespace <sys/tcl.h> and use __BEGIN_DECLS/__END_DECLS
for the sake of consistency.
 1.17 19-Feb-2018  mrg branches: 1.17.4;
fix _UC_MACHINE32_FP() -- use 32 bit pointer value so that [15] is
the right offset. do this by using __greg32_t, which is only in
the sparc64 version, and these are only useful there, so move them.
 1.16 18-Feb-2018  christos Make _UC_MACHINE_FP() compile again and fix it so that it does not add
the offset twice.
 1.15 17-Feb-2018  kamil Improve _UC_MACHINE_FP() for SPARC/SPARC64

Introduce a static inline function _uc_machine_fp() that contains improved
caluclation of a frame pointer.

Algorithm:

uptr *stk_ptr;
# if defined (__arch64__)
stk_ptr = (uptr *) (*sp + 2047);
# else
stk_ptr = (uptr *) *sp;
# endif
*bp = stk_ptr[15];

Noted by <mrg>
 1.14 15-Feb-2018  kamil Introduce _UC_MACHINE_FP() as a macro

_UC_MACHINE_FP() is a helper macro to extract from mcontext a frame pointer.

Don't rely on this interface as a compiler might strip frame pointer or
optimize it making this interface unreliable.


For hppa assume a small frame context, for larger frames FP might be located
in a different register (4 instead of 3).

For ia64 there is no strict frame pointer, and registers might rotate.
Reuse 79 following:

./gcc/config/ia64/ia64.h:#define HARD_FRAME_POINTER_REGNUM LOC_REG (79)

Once ia64 will mature, this should be revisited.

A macro can encapsulate a real function for extracting Frame Pointer on
more complex CPUs / ABIs.


For the remaining CPUs, reuse standard register as defined in appropriate ABI.

The direct users of this macro are LLVM and GCC with Sanitizers.

Proposed on tech-userlevel@.

Sponsored by <The NetBSD Foundation>
 1.13 12-Sep-2012  manu branches: 1.13.32;
setcontext() used to be incompatible with -lpthread since it affected
the TLS pointer, therefore wrecking the pthread environement.

Some ports had _UC_TLSBASE flag or equivalent (_UC_UNIQUE on alpha)
that controlled whether setcontext() would change the TLS pointer.
This change let libpthread override setcontext() with its own version
that unsets _UC_TLSBASE, enabling safe usage of setcontext() with
-lpthread.

We also have the following required changes here:
- rename alpha's _UC_UNIQUE into _UC_TLSBASE
- add _UC_TLSBASE definition in header file for all ports
(powerpc, sh3, sparc and sparc64 lack the implementation for now)
- introduce a libc stub that can be overriden for setcontext()
- modify MD libcs swapcontext() implementations so that they use the
setcontext() libc stub instead of doing a plain system call.

While we are there:
- document various MD _UC_* flags in header file
- add libc and libpthread tests for swapcontext() behavior
(hopefully helpful to spot MD problems introduced with this change)

Future work:
- Deciding whether kernel support or _UC_TLSBASE should be added for
powerpc, sh3, sparc and sparc64 is left to portmasters
sparc64

Approved by core@
 1.12 25-Feb-2011  joerg branches: 1.12.4;
Be nicer to software that insists on -ansi and use __inline.
 1.11 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.10 26-Oct-2008  mrg branches: 1.10.16; 1.10.22; 1.10.24;
expose both sparc and sparc64 context bits.
 1.9 28-Apr-2008  martin branches: 1.9.6;
Remove clause 3 and 4 from TNF licenses
 1.8 29-Mar-2006  cube branches: 1.8.62; 1.8.64; 1.8.66;
Add the netbsd32 MD bits for sparc64 and amd64 to support SA.

Many thanks to all who helped for that little project, notably Martin
Husemann for teaching me a bit about the very special sparc64 world.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6; 1.7.8; 1.7.10; 1.7.12;
merge ktrace-lwp.
 1.6 10-Jul-2005  martin Fix COMPAT_NETBSD32 ucontext padding and move the definition next to the
(sparc) original.
 1.5 01-Jan-2004  pk branches: 1.5.14; 1.5.16;
Enable reset of a process's alternative signal stack flag.
 1.4 12-Oct-2003  pk There's no point in having two separate sets of padding; add the local
__filler bytes to _UC_MACHINE_PAD.
 1.3 08-Oct-2003  thorpej Add some accessor macros for the ucontext:
* _UC_MACHINE_PC() - access the program counter
* _UC_MACHINE_INTRV() - access the integer return value register
* _UC_MACHINE_SET_PC() - set the program counter (this requires
special handling on some platforms).
 1.2 18-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 20-Nov-2001  pk branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.3 17-Dec-2002  thorpej Reconcile the sparc/sparc64 mcontexts by using the sparc64 header
for sparc, as well (it is #ifdef __arch64__'d already).
 1.1.2.2 21-Jun-2002  gmcgarry Provide _UC_MACHINE_SP()
 1.1.2.1 20-Nov-2001  pk SPARC mcontext definitions.
 1.2.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.5.14.1 11-Jul-2005  tron Pull up revision 1.6 (requested by martin in ticket #570):
Fix COMPAT_NETBSD32 ucontext padding and move the definition next to the
(sparc) original.
 1.7.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.7.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.7.8.1 01-Apr-2006  yamt sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.66.2 04-May-2009  yamt sync with head.
 1.8.66.1 16-May-2008  yamt sync with head.
 1.8.64.1 18-May-2008  yamt sync with head.
 1.8.62.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.62.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.24.1 05-Mar-2011  bouyer Sync with HEAD
 1.10.22.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.16.1 05-Mar-2011  rmind sync with head
 1.12.4.1 30-Oct-2012  yamt sync with head
 1.13.32.3 21-Mar-2018  martin Pull up the following, requested by kamil in ticket #552:

external/gpl3/gcc{.old}/dist/libsanitizer/asan/asan_linux.cc 1.4
sys/arch/aarch64/include/mcontext.h 1.2
sys/arch/alpha/include/mcontext.h 1.9
sys/arch/amd64/include/mcontext.h 1.19
sys/arch/arm/include/mcontext.h 1.19
sys/arch/hppa/include/mcontext.h 1.9
sys/arch/i386/include/mcontext.h 1.14
sys/arch/ia64/include/mcontext.h 1.6
sys/arch/m68k/include/mcontext.h 1.10
sys/arch/mips/include/mcontext.h 1.22
sys/arch/or1k/include/mcontext.h 1.2
sys/arch/powerpc/include/mcontext.h 1.18
sys/arch/riscv/include/mcontext.h 1.5
sys/arch/sh3/include/mcontext.h 1.11
sys/arch/sparc/include/mcontext.h 1.14-1.17
sys/arch/sparc64/include/mcontext.h 1.10
sys/arch/vax/include/mcontext.h 1.9
tests/lib/libc/sys/Makefile 1.50
tests/lib/libc/sys/t_ucontext.c 1.2-1.5
sys/arch/hppa/include/mcontext.h 1.10
sys/arch/ia64/include/mcontext.h 1.7

- Introduce _UC_MACHINE_FP(). _UC_MACHINE_FP() is a helper
macro to extract from mcontext a frame pointer.
- Add new tests in lib/libc/sys/t_ucontext:
* ucontext_sp (testing _UC_MACHINE_SP)
* ucontext_fp (testing _UC_MACHINE_FP)
* ucontext_pc (testing _UC_MACHINE_PC)
* ucontext_intrv (testing _UC_MACHINE_INTRV)

Add a dummy implementation of _UC_MACHINE_INTRV() for ia64.

Implement _UC_MACHINE_INTRV() for hppa.

Make the t_ucontext.c test more portable.

We now have _UC_MACHINE_FP.
 1.13.32.2 26-Feb-2018  snj revert ticket 552, which broke the build
 1.13.32.1 25-Feb-2018  snj Pull up following revision(s) (requested by kamil in ticket #552):
sys/arch/aarch64/include/mcontext.h: 1.2
sys/arch/alpha/include/mcontext.h: 1.9
sys/arch/amd64/include/mcontext.h: 1.19
sys/arch/arm/include/mcontext.h: 1.19
sys/arch/hppa/include/mcontext.h: 1.9
sys/arch/i386/include/mcontext.h: 1.14
sys/arch/ia64/include/mcontext.h: 1.6
sys/arch/m68k/include/mcontext.h: 1.10
sys/arch/mips/include/mcontext.h: 1.22
sys/arch/or1k/include/mcontext.h: 1.2
sys/arch/powerpc/include/mcontext.h: 1.18
sys/arch/riscv/include/mcontext.h: 1.5
sys/arch/sh3/include/mcontext.h: 1.11
sys/arch/sparc/include/mcontext.h: 1.14-1.17
sys/arch/sparc64/include/mcontext.h: 1.10
sys/arch/vax/include/mcontext.h: 1.9
tests/lib/libc/sys/Makefile: 1.50
tests/lib/libc/sys/t_ucontext.c: 1.2
Introduce _UC_MACHINE_FP() as a macro
_UC_MACHINE_FP() is a helper macro to extract from mcontext a frame pointer.
Don't rely on this interface as a compiler might strip frame pointer or
optimize it making this interface unreliable.
For hppa assume a small frame context, for larger frames FP might be located
in a different register (4 instead of 3).
For ia64 there is no strict frame pointer, and registers might rotate.
Reuse 79 following:
./gcc/config/ia64/ia64.h:#define HARD_FRAME_POINTER_REGNUM LOC_REG (79)
Once ia64 will mature, this should be revisited.
A macro can encapsulate a real function for extracting Frame Pointer on
more complex CPUs / ABIs.
For the remaining CPUs, reuse standard register as defined in appropriate ABI.
The direct users of this macro are LLVM and GCC with Sanitizers.
Proposed on tech-userlevel@.
Sponsored by <The NetBSD Foundation>
--
Improve _UC_MACHINE_FP() for SPARC/SPARC64
Introduce a static inline function _uc_machine_fp() that contains improved
caluclation of a frame pointer.
Algorithm:
uptr *stk_ptr;
# if defined (__arch64__)
stk_ptr = (uptr *) (*sp + 2047);
# else
stk_ptr = (uptr *) *sp;
# endif
*bp = stk_ptr[15];
Noted by <mrg>
--
Make _UC_MACHINE_FP() compile again and fix it so that it does not add
the offset twice.
--
fix _UC_MACHINE32_FP() -- use 32 bit pointer value so that [15] is
the right offset. do this by using __greg32_t, which is only in
the sparc64 version, and these are only useful there, so move them.
--
Add new tests in lib/libc/sys/t_ucontext
New tests:
- ucontext_sp
- ucontext_fp
- ucontext_pc
- ucontext_intrv
They test respectively:
- _UC_MACHINE_SP
- _UC_MACHINE_FP
- _UC_MACHINE_PC
- _UC_MACHINE_INTRV
These tests attempt to access and print the values from ucontext, without
interpreting the values.
This is a follow up of the _UC_MACHINE_FP() introduction.
These tests use PRIxREGISTER, and require to be built with -D_KERNTYPES.
Sponsored by <The NetBSD Foundation>
 1.17.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.19.2.1 02-Aug-2025  perseant Sync with HEAD
 1.13 12-Jul-2023  riastradh 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.
 1.12 09-Jul-2023  riastradh machine/mutex.h: Sprinkle includes so this can be used by crash(8).

XXX pullup-10
 1.11 29-Nov-2019  riastradh branches: 1.11.26;
Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.
 1.10 28-Apr-2008  martin branches: 1.10.88;
Remove clause 3 and 4 from TNF licenses
 1.9 23-Apr-2008  martin branches: 1.9.2;
Include psl.h to provide the details of ipl_cookie_t
 1.8 14-Feb-2008  ad branches: 1.8.6; 1.8.8;
Make sparc use atomic_cas_ulong() for mutex and rwlock operations, and
disable the custom mutex/rwlock code. PR port-sparc/37930. ok martin@
 1.7 02-Jan-2008  ad Merge vmlocking2 to head.
 1.6 21-Nov-2007  yamt branches: 1.6.2; 1.6.6;
make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.5 17-Oct-2007  garbled branches: 1.5.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.4 28-May-2007  mrg branches: 1.4.8; 1.4.10; 1.4.14;
disable mutex_spin_enter() & mutex_spin_exit() as they are currently
broken and cause MULTIPROCESSOR kernels to hang while entering
userland boot up.
 1.3 15-Feb-2007  ad branches: 1.3.4; 1.3.8; 1.3.10; 1.3.16;
Add MUTEX_CLEAR_WAITERS().
 1.2 09-Feb-2007  ad Merge newlock2 to head.
 1.1 12-Jan-2007  ad branches: 1.1.2;
file mutex.h was initially added on branch newlock2.
 1.1.2.7 02-Feb-2007  ad Fix declarations. Spotted by uebayasi.
 1.1.2.6 01-Feb-2007  ad Fix broken declaration in previous.
 1.1.2.5 01-Feb-2007  ad Handle hppa weirdness.
 1.1.2.4 01-Feb-2007  ad Header file cleanup.
 1.1.2.3 28-Jan-2007  ad - Fix sequence error between saving/raising the SPL.
- Changes for JavaStation.
- Fix bugs with mips & sparc support routines.
 1.1.2.2 17-Jan-2007  ad Fix detection of deadlock against the big lock.
 1.1.2.1 12-Jan-2007  ad sparc MD changes.
 1.3.16.1 26-Jun-2007  garbled Sync with HEAD.
 1.3.10.1 11-Jul-2007  mjf Sync with head.
 1.3.8.2 03-Dec-2007  ad Sync with HEAD.
 1.3.8.1 09-Jun-2007  ad Sync with head.
 1.3.4.6 27-Feb-2008  yamt sync with head.
 1.3.4.5 21-Jan-2008  yamt sync with head
 1.3.4.4 07-Dec-2007  yamt sync with head
 1.3.4.3 03-Sep-2007  yamt sync with head.
 1.3.4.2 26-Feb-2007  yamt sync with head.
 1.3.4.1 15-Feb-2007  yamt file mutex.h was added on branch yamt-lazymbuf on 2007-02-26 09:08:17 +0000
 1.4.14.1 21-Nov-2007  bouyer Sync with HEAD
 1.4.10.3 23-Mar-2008  matt sync with HEAD
 1.4.10.2 09-Jan-2008  matt sync with HEAD
 1.4.10.1 06-Nov-2007  matt sync with HEAD
 1.4.8.1 21-Nov-2007  joerg Sync with HEAD.
 1.5.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.5.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.6.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.2.1 01-Jan-2008  ad Locking changes for sparc.
 1.8.8.1 18-May-2008  yamt sync with head.
 1.8.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.2.1 16-May-2008  yamt sync with head.
 1.10.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.11.26.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.1 18-Mar-2002  thorpej branches: 1.1.2;
file mutex_impl.h was initially added on branch newlock.
 1.1.2.4 22-Mar-2002  thorpej Wrap the stuff that manipulates the guts of a mutex in __MUTEX_PRIVATE.
 1.1.2.3 22-Mar-2002  thorpej Add debug info structures if MUTEX_DEBUG or RWLOCK_DEBUG is
defined.

XXX Revisit, so that the structure doesn't change when debugging
is turned on; do it out-of-band?
 1.1.2.2 19-Mar-2002  thorpej Shuffle the mutex structure and change types such that the mutex
is now 8 bytes rather than 16.
 1.1.2.1 18-Mar-2002  thorpej First cut at mutex and rwlock implementation for SPARC.
 1.17 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 04-Mar-2006  uwe branches: 1.16.20;
De-__P.
 1.15 11-Dec-2005  christos branches: 1.15.4; 1.15.6;
merge ktrace-lwp.
 1.14 31-May-2005  christos branches: 1.14.2;
- sprinkle const
- remove parameter names from function declarations
 1.13 04-Dec-2001  darrenr branches: 1.13.16;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.12 14-Feb-1999  pk branches: 1.12.22; 1.12.26;
Adjust to functionality and changes introduced with <machine/promlib.h>
 1.11 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.10 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.9 22-Feb-1996  pk Correct some prototypes.
 1.8 13-Feb-1996  christos caddt_t -> caddr_t
 1.7 13-Feb-1996  christos - Fix setcxsegmap prototype.
- Cast ?TO? macros to NULL to avoid compiler warnings
 1.6 09-Feb-1996  christos A few prototype fixes
 1.5 03-Sep-1995  pk Add data structures used to interface to the monitor-resident drivers.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 02-Oct-1994  deraadt MONxx -> OLDMON_xx
 1.2 20-Aug-1994  deraadt repair a few rom call return values
 1.1 08-Aug-1994  deraadt first cuts
 1.12.26.1 08-Jan-2002  nathanw Catch up to -current.
 1.12.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.16.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.2 03-Sep-2007  yamt sync with head.
 1.14.2.1 21-Jun-2006  yamt sync with head.
 1.15.6.1 22-Apr-2006  simonb Sync with head.
 1.15.4.1 09-Sep-2006  rpaulo sync with head
 1.16.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.10 01-Apr-2016  palle sun4v: Workaround for OpenBoot feature where a 64-bit address is truncated to a 32-bit address. This happends when a write to the console (/virtual-devices@100/console@1) is done. Avoid this by using a static buffer that is mapped below 4GB. Thanks to Tarl Neustaedter for explaining how OpenBoot works. ok martin@
 1.9 06-Oct-2015  martin Do not use #ifdef SUN4U when testing for cpu features of post-v8 CPUs,
it is not good for SUN4V-only kernels. Instead use __sparc_v9__ (which
is also defined by the sparc compiler when called with cpu=ultrasparc).
ok: mrg@
 1.8 27-Mar-2015  nakayama Sync sparc64 kernel's OF_seek with ofwboot's one, but sparc version
is not changed.
 1.7 18-May-2009  nakayama branches: 1.7.22; 1.7.38; 1.7.40;
Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6 04-Mar-2006  uwe branches: 1.6.72; 1.6.82; 1.6.92; 1.6.96;
s/u_intN_t/uintN_t/
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.6;
merge ktrace-lwp.
 1.4 31-May-2005  christos branches: 1.4.2;
- sprinkle const
- remove parameter names from function declarations
 1.3 21-Mar-2004  pk Add sparc64 cell_t definitions.
Change OF_interpret() prototype to the unabridged version.
 1.2 15-Nov-2000  pk branches: 1.2.24;
OF_getproplen(), OF_nextprop() and OF_setprop() prototypes are now in
dev/ofw/openfirm.h
 1.1 14-Feb-1999  pk branches: 1.1.8;
Provide a uniform interface to most of the PROM functions.
Include an Openfirmware back-end (mostly copied from sparc64).
 1.1.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.2.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.4.2.1 21-Jun-2006  yamt sync with head.
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.96.1 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6.92.1 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6.82.1 19-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6.72.1 20-Jun-2009  yamt sync with head
 1.7.40.3 22-Apr-2016  skrll Sync with HEAD
 1.7.40.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.7.40.1 06-Apr-2015  skrll Sync with HEAD
 1.7.38.1 29-Mar-2015  martin Pull up following revision(s) (requested by nakayama in ticket #649):
sys/arch/sparc/sparc/openfirm.c: revision 1.20
sys/arch/sparc/include/openfirm.h: revision 1.8
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
Sync sparc64 kernel's OF_seek with ofwboot's one, but sparc version
is not changed.
 1.7.22.1 03-Dec-2017  jdolecek update from HEAD
 1.7 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.6 11-Dec-2005  christos branches: 1.6.122; 1.6.142;
merge ktrace-lwp.
 1.5 23-Apr-2004  hannken Protect against multiple inclusion.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 20-Jul-2002  mrg branches: 1.3.6;
sync these with the sparc64 versions.
 1.2 20-Nov-1994  deraadt branches: 1.2.46; 1.2.50; 1.2.58;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.58.1 31-Aug-2002  gehenna catch up with -current.
 1.2.50.1 01-Aug-2002  nathanw Catch up to -current.
 1.2.46.1 06-Sep-2002  jdolecek sync kqueue branch 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.6.142.1 22-Sep-2015  skrll Sync with HEAD
 1.6.122.1 03-Dec-2017  jdolecek update from HEAD
 1.76 20-Apr-2025  riastradh t_signal_and_sp: Add sparc support.

Seems fine! Would be nice if we had a well-known macro to abstract
PIC vs non-PIC `sethi/ori/(ld)' like I invented here, to reduce
needless #ifdef __PIC__ conditionals.

PR kern/59327: user stack pointer is not aligned properly
 1.75 02-Jun-2023  andvar branches: 1.75.6;
follow the steps of Andrew Doran (ad) commit and fix more s/loose/lose/ typos.
also s/beyound/beyond/ and few others along the way, mainly in comments.
 1.74 01-May-2020  isaki Move machine dependent AUDIO_BLK_MS default value to <machine/param.h>.
If the port has __AUDIO_BLK_MS in <machine/param.h>, it will be used.
Otherwise the default value (currently 10 msec) defined in audio.c will
be used. This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block. Currently hppa, m68k, sh3, sparc(!64) and vax are.

For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).
But please don't be eager to make the default value shorter.

<machine/param.h> was discussed in source-changes-d. It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this. Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html
 1.73 15-May-2019  christos branches: 1.73.2;
From: Tobias Ulmer. Unbreak zfs module build on sparc{,64} by hiding DELAY.
ZFS has a conflicting definition of delay() and tries to hide it by
defining __HIDE_DELAY.
 1.72 07-Jan-2019  jdolecek move DEV_BSIZE, DEV_BSHIFT out of MD param.h, they are same on all ports

also move BLKDEV_IOSIZE, MAXPHYS, but allow override since some ports
have different value (powerpc uses NBPG for BLKDEV_IOSIZE, sun2/sun3
have lower MAXPHYS)
 1.71 13-Feb-2017  skrll branches: 1.71.12; 1.71.14;
G/C VM_MAX_KERNEL_BUF
 1.70 10-Feb-2012  para branches: 1.70.6; 1.70.24; 1.70.28; 1.70.32;
proper sizing of kmem_arena on different ports

PR port-i386/45946: Kernel locks up in VMEM system
 1.69 24-Jan-2012  christos Use and define ALIGN() ALIGN_POINTER() and STACK_ALIGN() consistently,
and avoid definining them in 10 different places if not needed.
 1.68 20-Jan-2012  joerg Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.67 08-Feb-2010  joerg branches: 1.67.10; 1.67.14;
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.66 28-Aug-2006  yamt branches: 1.66.60; 1.66.80;
- remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
ctod
dtoc
ctob
btoc
dbtob
btodb
 1.65 04-Mar-2006  uwe branches: 1.65.2;
De-__P.
 1.64 13-Jan-2006  chs branches: 1.64.2; 1.64.4;
increase NKMEMPAGES_MAX_DEFAULT to 32 MB. this is needed on sun4m machines
with 512 MB of RAM, and it doesn't seem to cause any problems on sun4c.
 1.63 11-Dec-2005  christos branches: 1.63.2;
merge ktrace-lwp.
 1.62 12-Dec-2003  martin branches: 1.62.14; 1.62.16;
If compiling for JavaStations, modify kernal VA layout to not conflict
with the PROM. From Valeriy E. Ushakov. This is a hack, but as long as
we don't have a way to arrange for a proper VA layout on this machines
(i.e. beyound the PROM) it is needed.
 1.61 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.60 11-Apr-2003  jdc branches: 1.60.2;
Always include (new) cpuconf.h.

From Christopher SEKIYA in PR port-sparc/21093.
 1.59 09-Apr-2003  thorpej Move CPU configuration predicates to <machine/cpuconf.h>.
 1.58 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.57 17-Jul-2002  thorpej Add a macro to test if the system uses the SRMMU (Sun4M || Sun4D).
 1.56 17-Jul-2002  thorpej Handle the CPU_NTYPES == 0 case (as we would see in bootblocks)
in the CPU types predicates.
 1.55 17-Jul-2002  thorpej Add a CPU_ISSUN4D predicate.
 1.54 17-Jul-2002  thorpej Instead of using a matrix of configured CPU types, first count
how many CPU types are configured into the kernel. Then, use this
information to define the CPU predicate macros according to the
following rules:

1. If support for a CPU type is not configured into the kernel,
then the test is always false.

2. Otherwise, if only one CPU type is configured into the kernel,
then the test is always true.

3. Otherwise, we have to reference the cputyp variable.

Use a similar strategy for short-cutting the page size related
definitions.
 1.53 17-Jul-2002  thorpej Remote CPU_ISSUN4OR4C and CPU_ISSUN4COR4M, and instead express them
as (CPU_ISSUN4 || CPU_ISSUN4C) and (CPU_ISSUN4C || CPU_ISSUN4M),
respectively. The compiler can still optimize as desired by expressing
them this way, and it simplifies adding new tests.

While here, just remove CPU_ISSUN4MOR4U; it's not used by anything.
 1.52 17-Jul-2002  thorpej Add CPU_SUN4D.
 1.51 26-Feb-2002  simonb branches: 1.51.8;
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.50 11-Dec-2001  uwe microSPARC-IIep is a sun4m but with an integrated PCI controller.
In a lot of places (like pmap &c) we want it to be treated as SUN4M.
But since various low-level things are done very differently from
normal sparcs (and since for now it requires a relocated kernel
anyway), the MSIIEP kernels are not supposed to support any other
system. So when MSIIEP is defined - insist on SUN4M defined and SUN4
and SUN4C not defined.
 1.49 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.48 30-May-2001  mrg branches: 1.48.2; 1.48.8;
use _KERNEL_OPT
 1.47 10-May-2001  pk * reserve NBPG et.al. for kernel usage only.
* remove obsoleted comment on `physmap'.
 1.46 01-Mar-2001  pk branches: 1.46.2;
Drop MSGBUFSIZE; we don't use it and it can't currently be configured
to a different value anyway.
 1.45 30-Jun-2000  itojun raise MSIZE from 128 to 256.
- for sizeof(void *) == 8 arch, this is mandatory. MHLEN is too small
already (less than 80) and there are chances for unwanted packet loss due
to m_pullup restriction.
- for other cases, the change should avoid allocating clusters in most cases
(even when you have IPv4 IPsec tunnel, or IPv6 with moderate amount of
extension header)

portmasters: if your arch chokes with the change (high memory usage or
whatever), please backout the change for your arch.
 1.44 22-May-2000  mrg branches: 1.44.4;
add two new CPU_ISXXX versions: CPU_ISSUN4U, CPU_ISSUN4MOR4U
 1.43 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.42 26-Jan-2000  cjs Don't explode when we've got a lot of RAM. Limit our space for buffers
to 1/4 of the kernel VM map.
 1.41 04-Dec-1999  ragge CL* discarding.
 1.40 27-Nov-1999  mrg minor cosmetic merges; long way to go here.
 1.39 03-May-1999  christos branches: 1.39.2; 1.39.8;
move PROM_LOADADDR from promlib.h to param.h and remove its cast.
 1.38 14-Feb-1999  pk branches: 1.38.4;
Adjust to functionality and changes introduced with <machine/promlib.h>
 1.37 01-Feb-1999  mrg add CPU_SUN4U, to make libkvm compile.
 1.36 23-Aug-1998  pk Nuke phys_map & old dvmamap.
 1.35 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.34 29-Apr-1998  thorpej Pull in opt_gateway.h as appropriate.
 1.33 23-Sep-1997  pk Move KERNBASE to 0xf0000000.
 1.32 23-Sep-1997  pk MSGBUFSIZE needs no obscure adjustment; initmsgbuf() takes care of that.
 1.31 20-Sep-1997  leo Correct for the extra member in 'struct kern_msgbuf' when calculating
the number of bytes we want to allocate.
 1.30 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.29 10-Mar-1997  pk branches: 1.29.4;
Remove `cpumod' and `mmumod' and several related constants.
This functionality is now taken over by cpuvar.h
 1.28 24-Feb-1997  fvdl Define ALIGNED_POINTER
 1.27 22-Oct-1996  pk branches: 1.27.6;
If no specific kernel architecture is requested, define the CPU_* and
NBPG et.al. as in the generic case. This would be the expected thing to do
when compiling LKMs and such.
 1.26 20-Oct-1996  pk Regroup the definitions of NBPG, PGOFSET and PGSHIFT into the section that
enumerates the possible SUN? combinations.
 1.25 28-Aug-1996  mrg re-order to allow NBPG/PGSHIFT/PGOFSET to work always.
 1.24 15-May-1996  mrg remove some RCS id's we don't need.
 1.23 31-Mar-1996  pk Add sun4m CPU/MMU identifications.
 1.22 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.21 22-Feb-1996  pk An #ifndef _LOCORE to make this file safe to include in locore.s.
Introduce a couple of `CPU-type' helper macros to reduce the preprocessor
tangos in many a source file.
 1.20 16-Feb-1996  pk delay() prototype.
 1.19 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.18 11-Dec-1995  pk Prototype dvma helper functions `dvma_malloc()/dvma_free()'
 1.17 06-Dec-1995  pk DVMA space is described by the variables `dvma_start' and `dvma_end'.
Prototype dvma_map*() routines.
 1.16 28-Jun-1995  cgd kill user-land DELAY macro, as suggested by gwr.
 1.15 26-Jun-1995  pk Define variables and macros for DVMA allocation using rmaps.
 1.14 26-Jun-1995  cgd clean up definitions of ctod(), dtoc(), ctob(), btoc(), btodb(), and
dbtob(). remove unused definitions of ctos(), stoc(), and dtob().
 1.13 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.12 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.11 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.10 20-Nov-1994  deraadt copyright/Id cleanup
 1.9 02-Nov-1994  deraadt do not have UPAGES definition
 1.8 26-Oct-1994  deraadt vme interrupt support
 1.7 20-Aug-1994  deraadt regarding NBPG, PGOFSET, PGSHIFT, NPTESG, VA_VPG:
these are simple macros unless you build a combined sun4+(sun4c,sun4m)
kernel -- then they point to variables which are initialized early on.
 1.6 04-Jul-1994  deraadt goodbye BTOPKERNBASE
 1.5 19-May-1994  deraadt liten
 1.4 04-Dec-1993  cgd add MACHINE_ARCH
 1.3 03-Dec-1993  deraadt monster kludge! struct kinfo is very large, cause the pmap struct is
very large. this has to fit into struct user.. kern_kinfo.c should get
fixed (for the core dump case)
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.27.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.29.4.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.29.4.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.38.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.39.8.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.39.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.39.2.2 12-Mar-2001  bouyer Sync with HEAD.
 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.44.4.1 23-Jul-2000  itojun pullup from main trunc (approved by releng-1-5)

raise MSIZE from 128 to 256.
- for sizeof(void *) == 8 arch, this is mandatory. MHLEN is too small
already (less than 80) and there are chances for unwanted packet loss due
to m_pullup restriction.
- for other cases, the change should avoid allocating clusters in most cases
(even when you have IPv4 IPsec tunnel, or IPv6 with moderate amount of
extension header)

portmasters: if your arch chokes with the change (high memory usage or
whatever), please backout the change for your arch.

1.1 -> 1.2 syssrc/sys/arch/amigappc/include/param.h
1.13 -> 1.14 syssrc/sys/arch/arc/include/param.h
1.1 -> 1.2 syssrc/sys/arch/arm26/include/param.h
1.17 -> 1.18 syssrc/sys/arch/arm32/include/param.h
1.6 -> 1.7 syssrc/sys/arch/bebox/include/param.h
1.4 -> 1.5 syssrc/sys/arch/cobalt/include/param.h
1.4 -> 1.5 syssrc/sys/arch/evbsh3/include/param.h
1.2 -> 1.3 syssrc/sys/arch/hpcmips/include/param.h
1.40 -> 1.41 syssrc/sys/arch/i386/include/param.h
1.7 -> 1.8 syssrc/sys/arch/m68k/include/param.h
1.9 -> 1.10 syssrc/sys/arch/macppc/include/param.h
1.4 -> 1.5 syssrc/sys/arch/mmeye/include/param.h
1.6 -> 1.7 syssrc/sys/arch/newsmips/include/param.h
1.7 -> 1.8 syssrc/sys/arch/ofppc/include/param.h
1.23 -> 1.24 syssrc/sys/arch/pc532/include/param.h
1.32 -> 1.33 syssrc/sys/arch/pmax/include/param.h
1.7 -> 1.8 syssrc/sys/arch/powerpc/include/param.h
1.1 -> 1.2 syssrc/sys/arch/prep/include/param.h
1.1 -> 1.2 syssrc/sys/arch/sgimips/include/param.h
1.3 -> 1.4 syssrc/sys/arch/sh3/include/param.h
1.44 -> 1.45 syssrc/sys/arch/sparc/include/param.h
1.21 -> 1.22 syssrc/sys/arch/sparc64/include/param.h
1.43 -> 1.44 syssrc/sys/arch/vax/include/param.h
 1.46.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.48.8.6 16-Jan-2003  martin Backout previous - didn't mean to commit this file.
 1.48.8.5 16-Jan-2003  martin Fix typo.
 1.48.8.4 01-Aug-2002  nathanw Catch up to -current.
 1.48.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.48.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.48.8.1 30-May-2001  nathanw file param.h was added on branch nathanw_sa on 2002-01-08 00:27:39 +0000
 1.48.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.48.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.48.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.51.8.1 21-Jul-2002  gehenna catch up with -current.
 1.60.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.60.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.60.2.1 03-Aug-2004  skrll Sync with HEAD
 1.62.16.2 30-Dec-2006  yamt sync with head.
 1.62.16.1 21-Jun-2006  yamt sync with head.
 1.62.14.1 30-Jan-2006  tron Pull up following revision(s) (requested by chs in ticket #1147):
sys/arch/sparc/include/param.h: revision 1.64
increase NKMEMPAGES_MAX_DEFAULT to 32 MB. this is needed on sun4m machines
with 512 MB of RAM, and it doesn't seem to cause any problems on sun4c.
 1.63.2.1 15-Jan-2006  yamt sync with head.
 1.64.4.1 22-Apr-2006  simonb Sync with head.
 1.64.2.1 09-Sep-2006  rpaulo sync with head
 1.65.2.1 03-Sep-2006  yamt sync with head.
 1.66.80.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.66.60.1 11-Mar-2010  yamt sync with head
 1.67.14.1 18-Feb-2012  mrg merge to -current.
 1.67.10.1 17-Apr-2012  yamt sync with head
 1.70.32.1 21-Apr-2017  bouyer Sync with HEAD
 1.70.28.1 20-Mar-2017  pgoyette Sync with HEAD
 1.70.24.1 28-Aug-2017  skrll Sync with HEAD
 1.70.6.1 03-Dec-2017  jdolecek update from HEAD
 1.71.14.1 10-Jun-2019  christos Sync with HEAD
 1.71.12.1 18-Jan-2019  pgoyette Synch with HEAD
 1.73.2.1 18-May-2020  martin Pull up following revision(s) (requested by isaki in ticket #911):

sys/dev/audio/audiodef.h: revision 1.13
sys/dev/audio/audiodef.h: revision 1.14
sys/arch/sparc/include/param.h: revision 1.74
sys/arch/evbarm/conf/GENERIC64: revision 1.148
sys/arch/sh3/include/param.h: revision 1.25
sys/arch/evbarm/conf/GENERIC: revision 1.75
sys/arch/m68k/include/param.h: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.564
sys/arch/hppa/include/param.h: revision 1.27
sys/dev/audio/audio.c: revision 1.68
sys/arch/vax/include/param.h: revision 1.63
sys/dev/audio/audio.c: revision 1.69

Reduce default AUDIO_BLK_MS from 40msec to 10msec on all platform except m68k
(m68k uses 40msec default as before). And remove the option from GENERIC.

- It's not good idea to set such parameter in individual GENERICs.
- 4msec is (probably no problem for most modern real hardware but)
too aggressive to be default.
- 10msec is too severe for antique machines but it's hard to draw a line.

Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.

Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.


Move machine dependent AUDIO_BLK_MS default value to <machine/param.h>.
If the port has __AUDIO_BLK_MS in <machine/param.h>, it will be used.

Otherwise the default value (currently 10 msec) defined in audio.c will
be used. This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block. Currently hppa, m68k, sh3, sparc(!64) and vax are.

For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).

But please don't be eager to make the default value shorter.
<machine/param.h> was discussed in source-changes-d. It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this. Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html
 1.75.6.1 02-Aug-2025  perseant Sync with HEAD
 1.9 13-Oct-2009  pooka protect against multi-inclusion
 1.8 04-Mar-2007  christos branches: 1.8.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 11-Dec-2005  christos branches: 1.7.26;
merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 03-Mar-2001  pk branches: 1.5.24;
Remove unused declaration of `cpcb', which is no longer a global variable.
 1.4 28-Mar-1995  jtc branches: 1.4.32;
KERNEL -> _KERNEL
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 19-May-1994  deraadt liten
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.32.1 12-Mar-2001  bouyer Sync with HEAD.
 1.5.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 03-Sep-2007  yamt sync with head.
 1.7.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.44.1 11-Mar-2010  yamt sync with head
 1.12 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.11 29-Mar-2014  christos branches: 1.11.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.10 16-Apr-2013  jdc branches: 1.10.4;
Add PCI fixup for MicroSPARC-IIep.
Unconfigured PCI-PCI bridges and devices behind them are configured.
 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 04-Apr-2011  dyoung branches: 1.8.4; 1.8.14;
Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

For the most part, these changes add a 'const' where there was no
'const' before, however, some drivers and MD code used to modify
pci_attach_args. Now those drivers either copy their pci_attach_args
and modify the copy, or refrain from modifying pci_attach_args:

Xen: according to Manuel Bouyer, writing to pci_attach_args in
pci_intr_map() was a leftover from Xen 2. Probably a bug. I
stopped writing it. I have not tested this change.

siside(4): sis_hostbr_match() needlessly wrote to pci_attach_args.
Probably a bug. I use a temporary variable. I have not tested this
change.

slide(4): sl82c105_chip_map() overwrote the caller's pci_attach_args.
Probably a bug. Use a local pci_attach_args. I have not tested
this change.

viaide(4): via_sata_chip_map() and via_sata_chip_map_new() overwrote the
caller's pci_attach_args. Probably a bug. Make a local copy of the
caller's pci_attach_args and modify the copy. I have not tested
this change.

While I'm here, make pci_mapreg_submap() static.

With these changes in place, I have tested the compilation of these
kernels:

alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-eb NSLU2
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE GUMSTIX
HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321 IXDP425 IXM1200
KUROBOX_PRO LUBBOCK MARVELL_NAS NAPPI SHEEVAPLUG SMDK2800 TEAMASA_NPWR
TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sgimips GENERIC32_IP2x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC

As of Sun Apr 3 15:26:26 CDT 2011, I could not compile these kernels
with or without my patches in place:

### evbmips-el GDIUM

nbmake: nbmake: don't know how to make /home/dyoung/pristine-nbsd/src/sys/arch/mips/mips/softintr.c. Stop

### evbarm-el MPCSA_GENERIC
src/sys/arch/evbarm/conf/MPCSA_GENERIC:318: ds1672rtc*: unknown device `ds1672rtc'

### ia64 GENERIC

/tmp/genassym.28085/assym.c: In function 'f111':
/tmp/genassym.28085/assym.c:67: error: invalid application of 'sizeof' to incomplete type 'struct pcb'
/tmp/genassym.28085/assym.c:76: error: dereferencing pointer to incomplete type

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
 1.7 29-May-2008  mrg branches: 1.7.20; 1.7.26;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.6 04-Mar-2006  uwe branches: 1.6.68; 1.6.70; 1.6.72; 1.6.74;
s/u_intN_t/uintN_t/
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.6;
merge ktrace-lwp.
 1.4 29-Jul-2004  drochner branches: 1.4.12;
remove now unnecessary "pci_enumerate_bus" definitions
 1.3 15-May-2002  thorpej branches: 1.3.10;
Let machine-dependent code specify how to enumerate the bus.
Currently, everyone uses pci_enumerate_bus_generic().
 1.2 15-May-2002  thorpej Garbage-collect __PCI_DEV_FUNCORDER.
 1.1 11-Dec-2001  uwe branches: 1.1.2; 1.1.4;
microSPARC-IIep support.
 1.1.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 11-Dec-2001  thorpej file pci_machdep.h was added on branch kqueue on 2002-01-10 19:48:53 +0000
 1.1.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 11-Dec-2001  nathanw file pci_machdep.h was added on branch nathanw_sa on 2002-01-08 00:27:39 +0000
 1.3.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.10.1 03-Aug-2004  skrll Sync with HEAD
 1.4.12.1 21-Jun-2006  yamt sync with head.
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.74.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.72.1 04-May-2009  yamt sync with head.
 1.6.70.1 04-Jun-2008  yamt sync with head
 1.6.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.26.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.20.1 21-Apr-2011  rmind sync with head
 1.8.14.4 03-Dec-2017  jdolecek update from HEAD
 1.8.14.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.14.2 23-Jun-2013  tls resync from head
 1.8.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.8.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.8.4.1 30-Oct-2012  yamt sync with head
 1.10.4.1 18-May-2014  rmind sync with head
 1.11.6.1 09-Jul-2016  skrll Sync with HEAD
 1.98 23-Mar-2024  andvar s/ignorning/ignoring/ in comment.
 1.97 25-Jan-2021  mrg avoid needing <machine/promlib.h>. fixes sparc64 build.
 1.96 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.95 18-Dec-2020  mrg remove unused and #if 0'd since introduced in 1996 struct kvm_cpustate.
sparc kvm was handled differently for the sun4m port.
 1.94 06-Sep-2020  mrg branches: 1.94.2;
forward declare struct vm_page, and include uvm_prot.h and uvm_pmap.h.

fixes build, presumeably after uvm.h external rototill.
 1.93 14-Mar-2020  ad pmap_remove_all(): Return a boolean value to indicate the behaviour. If
true, all mappings have been removed, the pmap is totally cleared out, and
UVM can then avoid doing the work to call pmap_remove() for each map entry.
If false, either nothing has been done, or some helpful arch-specific voodoo
has taken place.
 1.92 19-Oct-2013  mrg branches: 1.92.30;
- remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.91 07-Jan-2013  chs branches: 1.91.2;
switch to __USE_TOPDOWN_VM.
 1.90 14-Feb-2011  he branches: 1.90.4; 1.90.14;
Provide a macro for pmap_mmap_flags() since we define PMAP_EXCLUDE_DECLS
here.
 1.89 14-Nov-2010  uebayasi branches: 1.89.2; 1.89.4;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.88 21-Nov-2009  rmind branches: 1.88.2; 1.88.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.87 07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.86 21-Oct-2009  rmind 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.85 16-Aug-2009  skrll s/int/u_int/ for flags in pmap_enter and deal with this in rump.

Hi cegger.
 1.84 09-Dec-2008  pooka Make pmap_kernel() a MI macro for struct pmap *kernel_pmap_ptr,
which is now the "API" provided by the pmap module. pmap_kernel()
remains as the syntactic sugar.

Bonus cosmetics round: move all the pmap_t pointer typedefs into
uvm_pmap.h.

Thanks to Greg Oster for providing cpu muscle for doing test builds.
 1.83 25-Oct-2008  mrg branches: 1.83.2;
include <sparc/pte.h> not <machine/pte.h> so this gets the right
version in 32 bit mode.
 1.82 02-Jan-2008  ad branches: 1.82.6; 1.82.10; 1.82.16;
Merge vmlocking2 to head.
 1.81 17-Oct-2007  garbled branches: 1.81.2; 1.81.4; 1.81.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.80 16-Jul-2007  macallan branches: 1.80.10;
turn pmap_phys_address() into a macro since all the function ever did was
to cast its parameter to paddr_t and return it
approved by mrg
 1.79 04-Mar-2007  mrg branches: 1.79.2; 1.79.10;
fix fall out from caddr_t changes.
 1.78 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.77 21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.76 11-Dec-2005  christos branches: 1.76.26;
merge ktrace-lwp.
 1.75 17-Jan-2005  atatat branches: 1.75.8;
Convert the PMAP_PREFER() macro from two arguments (offset and hint)
to four (adding size and direction).

In order for topdown uvm to be an option on ports using PMAP_PREFER,
they will need to "prefer" lower addresses if topdown is being used.
Additionally, at least one port also needs to know the size.
 1.74 16-Jan-2005  chs implement pmap_wired_count(). use more macros for determining MMU type.
 1.73 10-Apr-2004  pk branches: 1.73.4;
De-__P().
 1.72 10-Apr-2004  pk Do not maintain the number of valid pages per segment (`sg_npte') anymore
for the kernel map on SRMMU machines. This allows pmap_kenter() and
pmap_kremove() to update mappings without needing to lock the pmap
or raising the interrupt level.
 1.71 03-Apr-2004  pk Maintain pmap resident count as pages are mapped and unmapped instead
of traversing the page tables each time it's needed.
 1.70 16-Aug-2003  pk branches: 1.70.2;
sun4/sun4c MMU: keep `wired' status per page, implemented by defining a bit
in the PTE word that is not used by the hardware. Use it to unlock a `pmeg'
if the wired count in a segment drops to zero.
 1.69 12-Aug-2003  pk Use pmap_remove_all() to flush the cache by context and set a flag to
avoid subsequent user space cache flushes by page or segment in pmap_remove().
 1.68 10-May-2003  thorpej branches: 1.68.2;
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.67 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.66 02-Mar-2003  pk pmap_changeprot() is not a UVM <-> PMAP interface function; make it internal.
Provide pmap_kprotect() for MD code to change protection on a range of
kernel addresses (cuurent users: intr.c and mkclock.c).
 1.65 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.64 11-Jan-2003  mrg keep track of which cpu's have run a pmap and only broadcast tlb flushes to
cpu's who have done so. implement pmap_deactivate() for MULTIPROCESSOR and
call it from cpu_switch() when we are about to switch proces and when we
enter idle().

with this change, i see significantly reduced tlb IPI traffic and fork/exec
bound processes -- such as "configure" -- run significantly faster, upto
15%. i also obvserved a small (0-2%) benefit to CPU bound tasks as well.
 1.63 21-Dec-2002  pk tlb_flush_segment() and tlb_flush_region() now take a virtual address
argument instead of segment and region numbers.
 1.62 22-Sep-2002  chs it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.61 22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.60 17-Jul-2002  thorpej Add SUN4D ifdef cases. Use CPU_HAS_SRMMU where appropriate.
 1.59 04-Dec-2001  darrenr branches: 1.59.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.58 10-Sep-2001  chris branches: 1.58.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.57 18-Jun-2001  mrg branches: 1.57.2; 1.57.4;
copy tlb_flush*() #defines here, but rename them tlb_flush*_real(). this
allows for tlb_flush*() to be defined differently if MULTIPROCESSOR.
 1.56 26-May-2001  chs replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.55 23-Apr-2001  thorpej Don't need a prototype for pmap_bootstrap_alloc(); the function
does not exist in the pmap API anymore.
 1.54 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.53 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.52 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.51 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.50 26-Mar-2001  pk pmap_release(), pmap_pinit() and the `pm_regstore' field are obsolete.
 1.49 01-Mar-2001  pk branches: 1.49.2;
Drop the managed() macro; it is no longer used.
State the intended use of the vm_{first,last,num}_phys variables that are
still exported from pmap.c.
 1.48 31-May-2000  pk Remove obsolete function declarations.
Move switchexit() to cpu.h
 1.47 31-May-2000  pk Fix a couple of typos.
 1.46 01-May-2000  pk branches: 1.46.2;
Implement HyperSPARC specific pmap_{zero,copy}_page functions.
 1.45 30-Apr-2000  pk Allow for CPU specific page clear and page copy functions.
 1.44 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.43 14-Nov-1999  thorpej Update for pmap API change.
 1.42 04-Oct-1999  pk branches: 1.42.2; 1.42.4; 1.42.8;
Each process (i.e. each `pmap') needs a region table for each CPU.
Implement this by making the fields `pm_reg_ptp' and `pm_reg_ptp_pa'
pointers to an array of `ncpu' region table pointers and corresponding
physical addresses.

This is a somewhat unfortunate side effect of having the per-CPU data
addressable by the same virtual address on each CPU.
 1.41 12-Sep-1999  chs 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.40 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.39 28-Jun-1999  pk mmu_pagein() prototype: change address argument to `vaddr_t'.
 1.38 17-Jun-1999  thorpej pmap_change_wiring() -> pmap_unwire().
 1.37 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.36 26-Mar-1999  mycroft branches: 1.36.2; 1.36.4; 1.36.6;
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.35 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.34 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.33 02-Mar-1998  fvdl Make this compile again.
 1.32 08-Jan-1998  thorpej Update a comment relative to the vm_bootstrap_steal_memory() change, and
don't include pmap_free_pages() or pmap_next_page() in the new non-contig
case.
 1.31 02-Jan-1998  thorpej Implement pmap_activate().
 1.30 04-Aug-1997  pk Prototype pmap_writetext().
 1.29 06-Jul-1997  pk branches: 1.29.2;
Follow lock changes (DEBUG => LOCKDEBUG).
 1.28 06-Jul-1997  pk Adjust for generic lock changes.
 1.27 28-Jun-1997  pk Remove __VM_PMAP_HACK.
 1.26 24-May-1997  pk Define macros for encoding I/O space bits into the physical address
passed to pmap_enter().
 1.25 16-May-1997  gwr Add #define __VM_PMAP_HACK as a temporary measure.
 1.24 27-May-1996  pk prototype mmu_pagein4m() #if DEBUG is on.
 1.23 27-May-1996  pk No longer need to call mmu_pagein() through a pointer.
 1.22 20-May-1996  thorpej branches: 1.22.4;
RCS Id police.
 1.21 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.20 31-Mar-1996  pk Add SRMMU/sun4m support. Size and layout of `struct pmap' has changed.
 1.19 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.18 28-Feb-1996  gwr update PMAP_PREFER
 1.17 05-Jul-1995  pk Prototype pmap_dumpsize() and pmap_dumpmmu().
 1.16 13-Apr-1995  pk Make size of `struct pmap' independent of `MMU3_L', so libkvm is
usable on all machines.
 1.15 13-Apr-1995  pk 3-level MMU changes: software MMU data structures now display a VM model
consisting of `regions', `segments' and `page maps'.
 1.14 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.13 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.12 10-Mar-1995  pk Prototype for pmap_pa_exists().
 1.11 10-Jan-1995  pk pmap_init() already declared elsewhere.
 1.10 09-Jan-1995  mycroft Validate /dev/mem addresses again.
 1.9 10-Dec-1994  pk Introduce pmap_prefer() which is used to obtain a cache-friendly virtual
address.
 1.8 20-Nov-1994  deraadt copyright/Id cleanup
 1.7 14-Nov-1994  deraadt fixed rss code by charles
 1.6 06-Aug-1994  deraadt maintain resident_count and wired_count
 1.5 10-Jun-1994  pk branches: 1.5.2;
Allocate pmap's segmap separately.
Keep some tags on segment boundaries to optimise ctx_alloc().
 1.4 24-May-1994  deraadt for newish vm
 1.3 01-Feb-1994  pk pmap_t typedef outside `#ifdef KERNEL', as it is brought into user
scope by <vm/vm_map.h>
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.2.1 17-Aug-1994  deraadt update from trunk
 1.22.4.1 12-Jun-1996  pk Pull down from trunk:
> No longer need to call mmu_pagein() through a pointer.
 1.29.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.36.4.3 02-Aug-1999  thorpej Update from trunk.
 1.36.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.36.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.36.2.1 02-Jul-1999  perry pullup 1.38->1.39 (pk)
 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.4 23-Apr-2001  bouyer Sync with HEAD.
 1.42.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.42.2.2 12-Mar-2001  bouyer Sync with HEAD.
 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.46.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.49.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.49.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.57.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.57.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.57.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.57.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.57.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.58.4.7 15-Jan-2003  thorpej Sync with HEAD.
 1.58.4.6 29-Dec-2002  thorpej Sync with HEAD.
 1.58.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.58.4.4 01-Aug-2002  nathanw Catch up to -current.
 1.58.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.58.4.2 20-Nov-2001  pk Adjust prototypes for SA support.
 1.58.4.1 10-Sep-2001  pk file pmap.h was added on branch nathanw_sa on 2001-11-20 16:20:50 +0000
 1.59.8.1 21-Jul-2002  gehenna catch up with -current.
 1.68.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.68.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.68.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.68.2.1 03-Aug-2004  skrll Sync with HEAD
 1.70.2.2 24-Apr-2004  jdc Pull up revisions 1.72-1.73 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.70.2.1 08-Apr-2004  jdc Pull up revisions 1.71 (requested by pk in ticket #96)

Maintain pmap resident count as pages are mapped and unmapped instead
of traversing the page tables each time it's needed.
 1.73.4.1 29-Apr-2005  kent sync with -current
 1.75.8.3 21-Jan-2008  yamt sync with head
 1.75.8.2 03-Sep-2007  yamt sync with head.
 1.75.8.1 26-Feb-2007  yamt sync with head.
 1.76.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.76.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.79.10.1 03-Oct-2007  garbled Sync with HEAD
 1.79.2.1 20-Aug-2007  ad Sync with HEAD.
 1.80.10.2 09-Jan-2008  matt sync with HEAD
 1.80.10.1 06-Nov-2007  matt sync with HEAD
 1.81.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.81.4.1 01-Jan-2008  ad Locking changes for sparc.
 1.81.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.82.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.82.10.3 11-Mar-2010  yamt sync with head
 1.82.10.2 19-Aug-2009  yamt sync with head.
 1.82.10.1 04-May-2009  yamt sync with head.
 1.82.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.83.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.88.4.1 05-Mar-2011  rmind sync with head
 1.88.2.1 16-Nov-2010  uebayasi Sync with HEAD.
 1.89.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.89.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.90.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.90.14.1 25-Feb-2013  tls resync with head
 1.90.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.90.4.1 23-Jan-2013  yamt sync with head
 1.91.2.1 18-May-2014  rmind sync with head
 1.92.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.94.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.94.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 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:41:00 +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 14:52:18 +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:54 +0000
 1.20 06-Dec-2020  christos don't expose register_t
 1.19 14-Jan-2011  rmind branches: 1.19.72;
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.18 29-Jan-2010  mrg branches: 1.18.4;
make fpu_mtx visible only ifdef _KERNEL.
 1.17 26-Jan-2010  mrg convert fpulock into fpu_mtx.
 1.16 21-Nov-2009  rmind Include sys/proc.h for sparc/sparc64, which is required for now.
 1.15 11-Dec-2005  christos branches: 1.15.78;
merge ktrace-lwp.
 1.14 26-Oct-2005  uwe Move md_flags back to mdproc. MDP_FIXALIGN, the only flag we have, is
per-process, not per-lwp. We don't have per-lwp flags currently.
 1.13 10-Jul-2005  christos branches: 1.13.2;
- add syscall_{plain,fancy}
- make it use mi_userret
 1.12 07-Aug-2003  agc branches: 1.12.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 18-Jan-2003  thorpej branches: 1.11.2;
Merge the nathanw_sa branch.
 1.10 12-Jan-2003  pk fpulock: encapsulate required IPL raise in the FPU LOCK/UNLOCK macros.
 1.9 06-Jan-2003  pk Protect FPU context switching with its own lock.
 1.8 03-Jan-2003  pk Finish FPU context switching on SMP systems.
 1.7 26-May-2000  thorpej branches: 1.7.12;
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.6 26-Oct-1998  pk branches: 1.6.12;
Must protect user-land from cpuvar.h; noticed by Juergen Hannken-Illjes.
 1.5 21-Oct-1998  pk Pull in cpuvar.h to get definition of `curproc'.
 1.4 30-Sep-1998  pk Add a field to identify the processor that has a process' FPU context.
 1.3 26-Sep-1996  christos Add md_flags so that we can have a fix-misalign-accesses flag.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.6.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.12.4 15-Jan-2003  thorpej Sync with HEAD.
 1.7.12.3 06-Jan-2003  martin Catch up to -current.
 1.7.12.2 03-Jan-2003  thorpej Sync with HEAD (again).
 1.7.12.1 20-Nov-2001  pk Adjust prototypes for SA support.
 1.11.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.12.16.1 21-Jun-2006  yamt sync with head.
 1.13.2.1 02-Nov-2005  yamt sync with head.
 1.15.78.1 11-Mar-2010  yamt sync with head
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.19.72.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.17 31-May-2017  martin Fix __PIC__ profiled binaries
 1.16 12-Sep-2013  joerg branches: 1.16.6;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.15 24-Dec-2005  perry branches: 1.15.112; 1.15.122; 1.15.128;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 07-Aug-2003  agc branches: 1.13.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.12 20-Jul-2002  mrg branches: 1.12.6;
sync these with the sparc64 versions.
 1.11 03-Nov-2001  thorpej branches: 1.11.8;
Changes from Martin Husemann and myself:
- Make the 32-bit SPARC profile support work with the GCC 2.95.3
SPARC ELF compiler, which uses a different name for mcount.
- Make the 64-bit SPARC profile support header look more like the 32-bit
SPARC header (no functional change -- 64-bit SPARC already used the
correct mcount name).
 1.10 07-Feb-1999  christos branches: 1.10.22; 1.10.24; 1.10.26;
s/ELF/__ELF__/
 1.9 01-Jul-1998  tv Strip extra underscore on _mcount on ELF.
 1.8 01-Feb-1997  mrg no need to delcare mcount here; fixes warnings(errors) when compiling a kernel with profiling.
 1.7 27-Dec-1996  pk asm => __asm__
 1.6 08-Apr-1996  pk Undo unintended change in previous commit: _mcount is static.
 1.5 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.4 14-Aug-1995  pk Make MCOUNT() PIC-safe.
 1.3 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.26.2 01-Aug-2002  nathanw Catch up to -current.
 1.10.26.1 08-Jan-2002  nathanw Catch up to -current.
 1.10.24.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.10.22.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.10.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.8.1 31-Aug-2002  gehenna catch up with -current.
 1.12.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.6.1 03-Aug-2004  skrll Sync with HEAD
 1.13.16.1 21-Jun-2006  yamt sync with head.
 1.15.128.1 18-May-2014  rmind sync with head
 1.15.122.2 03-Dec-2017  jdolecek update from HEAD
 1.15.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.112.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.6.1 28-Aug-2017  skrll Sync with HEAD
 1.27 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.26 10-May-2021  thorpej sparc{,64} promlib -> devhandle_t glue
 1.25 11-Sep-2017  palle branches: 1.25.20; 1.25.22;
sun4v: Update code to retrieve CPU clock frequency so it can handle (future?) CPU clock frequencies above the 32-bit limit. ok mrg@
 1.24 21-Jan-2010  martin branches: 1.24.22;
Split the part out of prom_getether() that deals with the local
firmware device node into a new function.
 1.23 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.22 04-Mar-2007  christos branches: 1.22.40; 1.22.42; 1.22.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.21 11-Dec-2005  christos branches: 1.21.26;
merge ktrace-lwp.
 1.20 31-May-2005  christos branches: 1.20.2;
- sprinkle const
- remove parameter names from function declarations
 1.19 22-Mar-2004  pk Leverage the PROM's ability to identify the on-board location of a
physical memory address.
 1.18 21-Mar-2004  pk Turn members of `struct memarr' into long ints, to help sparc64 integration.
 1.17 18-Mar-2004  pk Remove unused `search_prom()' macro.
 1.16 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.15 17-Mar-2004  pk De-__P();
 1.14 17-Mar-2004  pk prom_getprop(): Make the `element size' argument a size_t (like sparc64).
 1.13 16-Mar-2004  pk Encapsulate retrieval of properties from the global `options' prom node.
 1.12 15-Mar-2004  pk prom_getether() now takes a `node' argument in order to support the
"local-mac-address" property.
 1.11 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.10 25-Jun-2003  martin branches: 1.10.2;
#ifdef _KERNEL_OPT police
 1.9 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.8 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.7 26-Feb-2003  pk Re-define `struct memarr' to have the same layout as the V2 ROM memory
property to avoid gratuitous copying in prom_makememarr().

Have prom_makememarr() accept a NULL pointer, in which case it will return
the size of the array needed to store the memory descriptors.
 1.6 18-Feb-2003  pk Move makememarr() into promlib.c.
 1.5 16-Jan-2003  pk Define a MP version of callrom().
 1.4 26-Sep-2001  eeh branches: 1.4.4;
getprop* -> PROM_getprop*
 1.3 15-Nov-2000  pk branches: 1.3.2; 1.3.4;
Adjust setprop() prototype to match the one in dev/ofw/openfirm.h
 1.2 03-May-1999  christos branches: 1.2.2;
move PROM_LOADADDR from promlib.h to param.h and remove its cast.
 1.1 14-Feb-1999  pk branches: 1.1.4;
Provide a uniform interface to most of the PROM functions.
Include an Openfirmware back-end (mostly copied from sparc64).
 1.1.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 22-Nov-2000  bouyer Sync with HEAD.
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.4.2 17-Jan-2003  thorpej Sync with HEAD.
 1.4.4.1 26-Sep-2001  thorpej file promlib.h was added on branch nathanw_sa on 2003-01-17 16:23:26 +0000
 1.10.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.2.1 03-Sep-2007  yamt sync with head.
 1.21.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.44.2 11-Mar-2010  yamt sync with head
 1.22.44.1 16-May-2008  yamt sync with head.
 1.22.42.1 18-May-2008  yamt sync with head.
 1.22.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.24.22.1 03-Dec-2017  jdolecek update from HEAD
 1.25.22.1 31-May-2021  cjep sync with head
 1.25.20.1 13-May-2021  thorpej Sync with HEAD.
 1.53 07-Apr-2024  rillig sparc: fix typos and omissions in PSTATE_BITS and ECC_AFR_BITS

Fixes PR 57869.
 1.52 11-Jul-2023  martin fix editor mishap in previous
 1.51 11-Jul-2023  martin Make ipl_cookie_t visible for _KMEMUSER userland applications.
 1.50 02-Nov-2021  ryo branches: 1.50.4;
In order to prevent _mcount() from being recursively called when built with COPTS=-O0,
sprinkle `__always_inline' to make _mcount() be generated as a single function.
 1.49 18-May-2016  nakayama Fix (unused) pstate mask bits in tstate and comment.
 1.48 28-Aug-2011  mrg branches: 1.48.12; 1.48.30;
apply some always_inline attribute to setpsr and spl*. while i am
not yet sure exactly why this is necessary, but does avoid crashes
seen on sparc INSTALL with gcc 4.5.
 1.47 16-Jul-2011  nakayama Bring some fixes and minor differences from sparc64 version.
 1.46 15-Jul-2011  riz BLOCK_SIZE->SPARC64_BLOCK_SIZE
BLOCK_ALIGN->SPARC64_BLOCK_ALIGN

XXX these values are unused in sparc; this is merely to keep the sparc
and sparc64 versions of psl.h in sync, and to allow sparc to build again.
 1.45 16-May-2009  martin Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.44 19-Feb-2007  mrg branches: 1.44.46; 1.44.56; 1.44.62;
remove a redundant variable from spl0().
 1.43 16-Feb-2007  ad branches: 1.43.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.42 26-Dec-2006  ad Define ipl_t as uint8_t so that it can be packed into a word with a lock
byte. Ok yamt@.
 1.41 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.40 04-May-2006  yamt branches: 1.40.8; 1.40.10; 1.40.12; 1.40.18;
implement splraiseipl() for sparc.
reviewed by Martin Husemann.

while i'm here, use macros for some MD constants (eg. IPL_ZS)
as suggested by Havard Eidnes.
 1.39 16-Feb-2006  perry branches: 1.39.2; 1.39.4; 1.39.6;
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.38 24-Dec-2005  perry branches: 1.38.2; 1.38.4; 1.38.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.37 11-Dec-2005  christos merge ktrace-lwp.
 1.36 19-Jun-2005  thorpej branches: 1.36.2;
Remove some unused definitions.
 1.35 19-Jun-2005  thorpej - Do away with the old _SPLRAISE() template macro. Instead, provide an
splraise() inline function, and define the various spl routines in terms
of splraise().
- Use ANSI function decls.
 1.34 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.33 16-Jun-2003  thorpej branches: 1.33.2;
Rename IPL_IMP -> IPL_VM.
 1.32 14-Jan-2003  pk Define spllowerschedclock().
To be used in the same spirit as spllowersoftclock().
 1.31 31-Dec-2002  pk Define IPL_SCHED at level 11 and make splsched() use it.
 1.30 06-Dec-2002  pk Start using IPL_* constants from intr.h; phase out PIL_* in psl.h
 1.29 08-Jun-2001  uwe branches: 1.29.8; 1.29.12;
Oops, missed in the previous commit: bump PIL_SER to 13 as well.
It seems to be unused...
 1.28 06-Jun-2001  uwe Bump splserial to 13 to support com port on Tadpole and JavaStations.
While I'm here - remove redefinition of PIL_TTY, move splnet
definition to keep the list sorted and sync its comment with reality.
 1.27 23-Apr-2001  pk Bump PIL_NET to 7; some sbus network boards use this interrupt level.
Nuke PIL_IMP.
 1.26 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.25 22-Mar-2001  mrg sync with sparc64.
 1.24 14-Jan-2001  thorpej branches: 1.24.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.23 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.22 21-Aug-2000  thorpej Make sure we provide splsched() as described in spl(9).
 1.21 09-Jun-2000  pk spl0() and spllowersoftclock() return void.
 1.20 21-Jan-2000  pk branches: 1.20.2;
Move several PIL_* definitions into the scope of LOCORE stuff.
 1.19 15-Dec-1999  garbled Add new spl level for tadpole devices splts102.
Device entrypoints for tctrl device (tadpole micro controller)
add header for direct-access ioctl to the tadpole microcontroller.
 1.18 05-Aug-1999  thorpej branches: 1.18.2; 1.18.8;
Change spl calls to always raise priority, except for the ones which are
specifically supposed to lower it.
 1.17 05-Aug-1999  thorpej 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.16 26-Nov-1998  pk Add splserial().
 1.15 06-Feb-1998  mrg backout previous change.
 1.14 06-Feb-1998  mrg put PIL_CLOCK and splclock together, like the rest..
 1.13 19-Nov-1997  pk splpmap() is again equivalent to splimp().
 1.12 10-Mar-1997  pk branches: 1.12.8;
Add getmid
 1.11 31-Mar-1996  pk branches: 1.11.8;
Add a non-interrupt-priority-lowering version of SPL(). Used by splpmap()
at the moment.
 1.10 09-Feb-1996  christos A few prototype fixes
 1.9 03-Feb-1996  pk Move splbio to level 5.
 1.8 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.7 13-Aug-1995  mycroft Replace splnet() with splsoftnet(). Add splnet().
 1.6 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.5 23-Feb-1995  pk floppy levels.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 22-Mar-1994  deraadt splimp >= (splnet or spltty)
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.11.8.1 12-Mar-1997  is Merge in changes from The Trunk
 1.12.8.1 20-Nov-1997  mellon Pull rev 1.13 up from trunk (pk)
 1.18.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.18.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.18.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.18.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.20.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.24.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.24.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.29.12.1 18-Mar-2002  thorpej Add splraiseipl() for use by kern_mutex.c
 1.29.8.4 15-Jan-2003  thorpej Sync with HEAD.
 1.29.8.3 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.29.8.2 11-Dec-2002  thorpej Sync with HEAD.
 1.29.8.1 08-Jun-2001  thorpej file psl.h was added on branch nathanw_sa on 2002-12-11 06:12:08 +0000
 1.33.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.2.3 26-Feb-2007  yamt sync with head.
 1.36.2.2 30-Dec-2006  yamt sync with head.
 1.36.2.1 21-Jun-2006  yamt sync with head.
 1.38.6.2 01-Jun-2006  kardel Sync with head.
 1.38.6.1 22-Apr-2006  simonb Sync with head.
 1.38.4.1 09-Sep-2006  rpaulo sync with head
 1.38.2.1 18-Feb-2006  yamt sync with head.
 1.39.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.39.4.1 11-May-2006  elad sync with head
 1.39.2.1 24-May-2006  yamt sync with head.
 1.40.18.1 18-May-2009  bouyer Pull up following revision(s) (requested by martin in ticket #1317):
sys/arch/sparc/include/psl.h: revision 1.45
Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.40.12.1 18-May-2009  bouyer Pull up following revision(s) (requested by martin in ticket #1317):
sys/arch/sparc/include/psl.h: revision 1.45
Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.40.10.1 19-Sep-2006  yamt implement new api for sparc.
 1.40.8.1 12-Jan-2007  ad Sync with head.
 1.43.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.44.62.1 18-May-2009  bouyer branches: 1.44.62.1.2;
Pull up following revision(s) (requested by martin in ticket #764):
sys/arch/sparc/include/psl.h: revision 1.45
Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.44.62.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.44.56.1 18-May-2009  bouyer Pull up following revision(s) (requested by martin in ticket #764):
sys/arch/sparc/include/psl.h: revision 1.45
Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.44.46.1 20-Jun-2009  yamt sync with head
 1.48.30.1 29-May-2016  skrll Sync with HEAD
 1.48.12.1 03-Dec-2017  jdolecek update from HEAD
 1.50.4.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.33 29-May-2022  andvar fix various typos in comments and log messages.
 1.32 01-Dec-2017  mrg - normalise some tab/space issues.
- fix (debugger-only useful) struct srmmu_pte::pg_pfnum to be the
right size.
- add SRMMU_TEPTERBO as a PTE type -- supersparc-II only feature
of mapping pages in reverse-byte-order (eg little endian by
default, but there's also a global RBO flag, that makes this
flag big-endian.) we don't use it (yet?)
 1.31 16-Feb-2006  perry branches: 1.31.116;
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.30 24-Dec-2005  perry branches: 1.30.2; 1.30.4; 1.30.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.29 11-Dec-2005  christos merge ktrace-lwp.
 1.28 17-Aug-2003  pk sun4/sun4c MMU: keep `wired' status per page, implemented by defining a bit
in the PTE word that is not used by the hardware. Use it to unlock a `pmeg'
if the wired count in a segment drops to zero.
 1.27 09-Aug-2003  pk Simplify the definitions of VA_VPG() and VA_OFF().
 1.26 16-Dec-2002  pk branches: 1.26.6;
Multiple inclusion protection.
 1.25 18-Jul-2002  thorpej Add checks for Sun4d. Use CPU_HAS_SRMMU as appropriate.
 1.24 04-Dec-2001  darrenr branches: 1.24.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.23 01-May-2001  kleink branches: 1.23.2; 1.23.8;
Re-add accidently removed line continuation in previous; noted by
"Valeriy E. Ushakow" <uwe@ptc.spbu.ru>.
 1.22 30-Apr-2001  kleink Don't let [gs]etcontext() and friends clash with userland.
 1.21 08-Oct-1998  pk branches: 1.21.24;
Move [gs]etcontext() and [gs]etpte() to pte.h
 1.20 12-Sep-1998  pk Define some bit-format strings.
 1.19 05-Aug-1997  pk Correct typo that has been lurking undetected for some time.
 1.18 15-May-1997  pk branches: 1.18.4;
Nuke old `mmu3l' references.
 1.17 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.16 15-May-1996  mrg remove some RCS id's we don't need.
 1.15 31-Mar-1996  pk Add SRMMU/sun4m definitions.
Cleanup (i.e. mostly delete) `#if defined (SUN4*)' in here.
 1.14 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.13 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.12 05-Jul-1995  pk typos.
 1.11 25-Jun-1995  pk Define IO-cache bit for sun 4/400 machines.
 1.10 25-Jun-1995  pk add a couple more sun4m bits.
 1.9 08-May-1995  pk #define VA_INHOLE() - to test a VA for being in an MMU hole
(and PG_VSHIFT should 29).
 1.8 13-Apr-1995  pk 3-level MMU changes: software MMU data structures now display a VM model
consisting of `regions', `segments' and `page maps'.
 1.7 20-Nov-1994  deraadt copyright/Id cleanup
 1.6 03-Nov-1994  deraadt bzzzttt wrong wrong wrong
 1.5 02-Nov-1994  deraadt VA_VSEG() should use NBPG
 1.4 26-Oct-1994  deraadt rearrangement
 1.3 25-Sep-1994  deraadt make pmeg_t always a u_short
 1.2 20-Aug-1994  deraadt regarding NBPG, PGOFSET, PGSHIFT, NPTESG, VA_VPG:
these are simple macros unless you build a combined sun4+(sun4c,sun4m)
kernel -- then they point to variables which are initialized early on.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.18.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.24.1 21-Jun-2001  nathanw Catch up to -current.
 1.23.8.4 19-Dec-2002  thorpej Sync with HEAD.
 1.23.8.3 01-Aug-2002  nathanw Catch up to -current.
 1.23.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.23.8.1 01-May-2001  nathanw file pte.h was added on branch nathanw_sa on 2002-01-08 00:27:40 +0000
 1.23.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.23.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.8.1 21-Jul-2002  gehenna catch up with -current.
 1.26.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.6.1 03-Aug-2004  skrll Sync with HEAD
 1.30.6.1 22-Apr-2006  simonb Sync with head.
 1.30.4.1 09-Sep-2006  rpaulo sync with head
 1.30.2.1 18-Feb-2006  yamt sync with head.
 1.31.116.1 03-Dec-2017  jdolecek update from HEAD
 1.16 14-Sep-2020  kamil Switch from register_t to unsigned long int

Removes dependency on _KERNTYPES.
 1.15 24-Dec-2019  kamil Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.
 1.14 18-Jun-2019  kamil Introduce PTRACE_REG_FP() a helper macro to retrieve the frame pointer

The macro is dummy for ia64 (the FP register is unknown and can change
freely) and sparc/sparc64 (not stored in struct reg).
 1.13 17-Apr-2019  martin Make the illegal instruction macro safe, so the compiler does not fear it
would be an illegal instruction when compiling with certain cpu options.
 1.12 16-Apr-2019  martin Add PTRACE_ILLEGAL_ASM
 1.11 12-Apr-2017  kamil branches: 1.11.12;
Add new macro PTRACE_BREAKPOINT_ASM in <sys/ptrace.h> MD part

This macro ships with a MD-specific assembly instruction triggering
a software breakpoint.

Missing instruction for powerpc targets.

This code is used in ATF tests (lib/libc/sys/t_ptrace_wait).

Original patch by Nick Hudson, thanks!
 1.10 25-Nov-2016  christos branches: 1.10.2;
cast to register_t because not all 'struct reg' members are the right type.
 1.9 25-Sep-2015  christos branches: 1.9.2;
For processors that have memory breakpoints, add macros for them to help
libproc
 1.8 15-Sep-2015  christos Provide access to pc/sp/syscall-return registers like we have for mcontext
 1.7 25-Jan-2008  skrll branches: 1.7.54; 1.7.74;
Define PT_MACHDEP_STRINGS
 1.6 11-Dec-2005  christos branches: 1.6.50; 1.6.56;
merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 20-Nov-1994  deraadt branches: 1.4.66;
copyright/Id cleanup
 1.3 11-Feb-1994  pk [GS]ETREG definitions for ptrace
 1.2 01-Feb-1994  deraadt sparc runs in current today
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.66.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 04-Feb-2008  yamt sync with head.
 1.6.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.6.50.1 23-Mar-2008  matt sync with HEAD
 1.7.74.4 28-Aug-2017  skrll Sync with HEAD
 1.7.74.3 05-Dec-2016  skrll Sync with HEAD
 1.7.74.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.7.74.1 22-Sep-2015  skrll Sync with HEAD
 1.7.54.1 03-Dec-2017  jdolecek update from HEAD
 1.9.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.9.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.10.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.11.12.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.11.12.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.11.12.1 10-Jun-2019  christos Sync with HEAD
 1.11 15-Jan-2018  martin Redo previous: apply the alignement to the whole struct fpstate - everything
in there is properly aligned, and we need to have fs_queue double aligned
as well.
 1.10 14-Jan-2018  martin Force explicit alignment for fpstate in the kernel, to match what our
asm code assumes.
We use a stack variable at least once (in fpu_init).
 1.9 30-Dec-2016  christos - allocate state if we did not have any in fpregs
- make fpstate explicitly start with fpregs for better type checking
- use c11 initializers
 1.8 11-Dec-2005  christos branches: 1.8.122; 1.8.142; 1.8.146;
merge ktrace-lwp.
 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 19-Jun-2001  wiz branches: 1.6.8; 1.6.24;
`accessible' only has one `a'.
 1.5 30-Dec-1999  pk branches: 1.5.6;
Remove private kernel members from `struct fpreg'; update accompanying comment.
 1.4 20-Nov-1994  deraadt branches: 1.4.32;
copyright/Id cleanup
 1.3 11-Feb-1994  pk [GS]ETREG definitions for ptrace
 1.2 01-Feb-1994  deraadt sparc runs in current today
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.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.5.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.24.1 03-Aug-2004  skrll Sync with HEAD
 1.6.8.2 19-Jun-2001  wiz `accessible' only has one `a'.
 1.6.8.1 19-Jun-2001  wiz file reg.h was added on branch nathanw_sa on 2001-06-19 12:59:16 +0000
 1.8.146.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.8.142.1 05-Feb-2017  skrll Sync with HEAD
 1.8.122.1 03-Dec-2017  jdolecek update from HEAD
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 05-Jan-2005  skrll Correct two reloc numbers/names
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 25-Aug-2001  mrg branches: 1.4.6; 1.4.22;
update a comment about R_UA_32 relocs.
 1.3 04-Dec-2000  mrg branches: 1.3.4;
sync relocs with sparc64.
 1.2 20-Nov-1994  deraadt branches: 1.2.32;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.32.1 08-Dec-2000  bouyer Sync with HEAD.
 1.3.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.4.22.4 17-Jan-2005  skrll Sync with HEAD.
 1.4.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.22.1 03-Aug-2004  skrll Sync with HEAD
 1.4.6.2 25-Aug-2001  mrg update a comment about R_UA_32 relocs.
 1.4.6.1 25-Aug-2001  mrg file reloc.h was added on branch nathanw_sa on 2001-08-25 15:03:20 +0000
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 20-Nov-1994  deraadt branches: 1.2.66;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.66.1 03-Aug-2004  skrll Sync with HEAD
 1.6 29-Nov-2019  riastradh Largely eliminate the MD rwlock.h header file.

This was full of definitions that have been obsolete for over a
decade. The file still remains for __HAVE_RW_STUBS but that's all.
Used only internally in kern_rwlock.c now, not by <sys/rwlock.h>.
 1.5 28-Apr-2008  martin branches: 1.5.88;
Remove clause 3 and 4 from TNF licenses
 1.4 14-Feb-2008  ad branches: 1.4.6; 1.4.8; 1.4.10;
Make sparc use atomic_cas_ulong() for mutex and rwlock operations, and
disable the custom mutex/rwlock code. PR port-sparc/37930. ok martin@
 1.3 21-Nov-2007  yamt make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.2 09-Feb-2007  ad branches: 1.2.4; 1.2.8; 1.2.24; 1.2.26; 1.2.30; 1.2.32;
Merge newlock2 to head.
 1.1 11-Jan-2007  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 11-Jan-2007  ad Checkpoint work in progress.
 1.2.32.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.32.1 08-Dec-2007  mjf Sync with HEAD.
 1.2.30.1 21-Nov-2007  bouyer Sync with HEAD
 1.2.26.2 23-Mar-2008  matt sync with HEAD
 1.2.26.1 09-Jan-2008  matt sync with HEAD
 1.2.24.1 21-Nov-2007  joerg Sync with HEAD.
 1.2.8.1 03-Dec-2007  ad Sync with HEAD.
 1.2.4.4 27-Feb-2008  yamt sync with head.
 1.2.4.3 07-Dec-2007  yamt sync with head
 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:08:17 +0000
 1.4.10.1 16-May-2008  yamt sync with head.
 1.4.8.1 18-May-2008  yamt sync with head.
 1.4.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 18-Mar-2002  thorpej branches: 1.1.2;
file rwlock_impl.h was initially added on branch newlock.
 1.1.2.2 22-Mar-2002  thorpej Add debug info structures if MUTEX_DEBUG or RWLOCK_DEBUG is
defined.

XXX Revisit, so that the structure doesn't change when debugging
is turned on; do it out-of-band?
 1.1.2.1 18-Mar-2002  thorpej First cut at mutex and rwlock implementation for SPARC.
 1.3 20-Jul-2002  mrg sync these with the sparc64 versions.
 1.2 01-Oct-1998  thorpej branches: 1.2.26; 1.2.30; 1.2.38;
Need 14 longs for jmp_buf now (sigcontext has 128-bit signal mask at the
end).
 1.1 20-Dec-1994  cgd make the definition of _JBLEN mach. dep. header-dependent.
 1.2.38.1 31-Aug-2002  gehenna catch up with -current.
 1.2.30.1 01-Aug-2002  nathanw Catch up to -current.
 1.2.26.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.26 28-Oct-2021  thorpej Making "struct sigcontext" visible only to _LIBC || _KERNEL is too
restrictive for sparc (it's accessed by libasan).
 1.25 27-Oct-2021  thorpej Make sigcontext13 visible only to _KERNEL. Make sigcontext visible only
to _LIBC and _KERNEL.
 1.24 26-Oct-2021  christos Merge all MD __sigaction14_sigtramp.c copies into one:
- sparc and sparc64 were not using version 0 sigcontext when there were
no arguments in the signal version. This was probably a bug.
- vax is using +1 the version numbers of the other archs.
- Only hppa was defining __LIBC12_SOURCE__ so it was getting a working
sigcontext before. all the other ports that supported sigcontext had
the compat code disabled.
[pointed out by thorpej, thanks!]
If we want to remove sigcontext support from userland at least now there
is less work to do so.
 1.23 29-Nov-2017  christos include <sys/sigtypes.h> for sigset_t
 1.22 19-Nov-2008  ad branches: 1.22.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.21 11-Dec-2005  christos branches: 1.21.74; 1.21.78; 1.21.84; 1.21.86;
merge ktrace-lwp.
 1.20 10-May-2004  drochner SIGTRAMP_VALID() should not pollute the user namespace
 1.19 26-Mar-2004  drochner nothing cares about __HAVE_SIGINFO anymore, so nuke it
 1.18 19-Jan-2004  martin How stupid can you borke a commit? I could *swear* I had tested the last
revision before commiting - but you ain't going to believe me anyway.
 1.17 18-Jan-2004  martin Only compare the trampoline version in SIGTRAMP_VALID as an unsigned value.
From Christos Zoulas.
 1.16 25-Nov-2003  christos bye, bye _MCONTEXT_TO_SIGCONTEXT and vice versa.
 1.15 26-Oct-2003  christos Sparc64 builds with __HAVE_SIGINFO
 1.14 11-Oct-2003  pk Define SIGTRAMP_VALID.
 1.13 05-Oct-2003  pk sparc kernel support for SA_SIGINFO.
 1.12 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 28-Apr-2003  bjh21 branches: 1.11.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.10 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.9 09-Jan-2003  thorpej Merge sparc and sparc64 <machine/signal.h>.
 1.8 27-Nov-1999  mrg branches: 1.8.12;
more sparc64 merging; these files are (basically) identical.
 1.7 17-Sep-1998  thorpej branches: 1.7.12; 1.7.18;
Minor cosmetic change.
 1.6 13-Sep-1998  pk New sigcontext.
 1.5 25-May-1998  kleink If any of _ANSI_SOURCE, _POSIX_C_SOURCE or _XOPEN_SOURCE are defined, don't
provide any identifiers other than sig_atomic_t.
 1.4 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.3 10-Jan-1995  jtc Only define sig_atomic_t when _ANSI_SOURCE is defined.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.7.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.12.3 16-Jan-2003  martin Fix typo.
 1.8.12.2 16-Jan-2003  thorpej * Include <sys/sigtypes.h> rather than <sys/signal.h> in <sys/ucontext.h>.
* Define _UCONTEXT_TO_SIGCONTEXT() and _SIGCONTEXT_TO_UCONTEXT()
macros for converting a ucontext -> sigcontext and back again.
These macros in turn use machine-dependent macros _MCONTEXT_TO_SIGCONTEXT()
and _SIGCONTEXT_TO_MCONTEXT() provided by <machine/signal.h>.

The conversion process is not 100% accurate, but should be close enough.

Also note that the mcontext conversion may not be enough for all platforms
(m68k is a good example of this). These macros should be used only if
you really know what you're doing.
 1.8.12.1 09-Jan-2003  thorpej 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.21.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.21.78.1 04-May-2009  yamt sync with head.
 1.21.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.22.26.1 03-Dec-2017  jdolecek update from HEAD
 1.2 30-May-2016  nakayama Adapt to new sljit.
 1.1 23-Jul-2014  alnsn branches: 1.1.2; 1.1.6; 1.1.8;
Rename sljitarch.h to sljit_machdep.h.
 1.1.8.1 09-Jul-2016  skrll Sync with HEAD
 1.1.6.3 03-Dec-2017  jdolecek update from HEAD
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 23-Jul-2014  tls file sljit_machdep.h was added on branch tls-maxphys on 2014-08-20 00:03:24 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 23-Jul-2014  tls file sljit_machdep.h was added on branch tls-earlyentropy on 2014-08-10 06:54:08 +0000
 1.4 23-Jul-2014  alnsn Rename sljitarch.h to sljit_machdep.h.
 1.3 22-Jul-2014  alnsn Cast to sparc_cache_flush() argument types. This change makes it clear
thatr sparc_cache_flush() is defined by sljit (unlike other ports).
 1.2 17-Nov-2013  alnsn branches: 1.2.2;
Always define SLJIT_CACHE_FLUSH(), start include guards with '_' and use _LP64 guard.
 1.1 05-Nov-2012  alnsn branches: 1.1.2; 1.1.4; 1.1.6;
Add sljitarch.h on sparc.
 1.1.6.1 18-May-2014  rmind sync with head
 1.1.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.1.4.2 16-Jan-2013  yamt sync with (a bit old) head
 1.1.4.1 05-Nov-2012  yamt file sljitarch.h was added on branch yamt-pagecache on 2013-01-16 05:33:04 +0000
 1.1.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.2.2 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.1.2.1 05-Nov-2012  tls file sljitarch.h was added on branch tls-maxphys on 2012-11-20 03:01:43 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.24 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.23 11-Dec-2005  christos merge ktrace-lwp.
 1.22 20-Apr-2005  matt For GCC3 and later, use the __builtin_va* constructs.
 1.21 30-Dec-2004  christos branches: 1.21.2; 1.21.8; 1.21.10;
- don't try to to lint the va_arg() macros, instead replace them.
- replace the va_start() macro for lint
 1.20 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.19 28-Apr-2003  bjh21 branches: 1.19.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.18 20-Jul-2002  mrg sync these with the sparc64 versions.
 1.17 13-Oct-2000  christos branches: 1.17.4; 1.17.8; 1.17.16;
void cast for lint.
 1.16 03-Feb-2000  kleink Add a C99-style va_copy macro.
 1.15 04-May-1999  christos branches: 1.15.2;
clean up old GCC.1 stuff.
 1.14 03-May-1999  christos Define __extension__ if __GNUC__ < 2
Define __builtin_* for lint.
 1.13 20-Feb-1999  kristerw branches: 1.13.4;
The recent simplification of the lint version of the va_arg macro broke
linting of vfprintf.c, where va_arg is used as
*va_arg(ap, quad_t *) = ret;
Make the macro slightly more complicated...
 1.12 13-Feb-1999  christos Avoid defining __extension__ if we don't need to. Breaks lint.
 1.11 27-Jul-1998  mycroft Delint.
 1.10 27-Dec-1996  pk branches: 1.10.14;
Annul `__builtin_classify_type' and `__extension__' if __lint__.
 1.9 29-Dec-1995  mycroft Make this work for GCC < 2.6.
 1.8 25-Dec-1995  mycroft Stylistic changes.
 1.7 25-Dec-1995  mycroft Update for GCC 2.7, and fix bugs.
 1.6 28-Jan-1995  jtc ANSI says that <stdarg.h>'s va_end macro must expand to a void expression.
For consistancy, I'm changing <varargs.h> too.
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 15-Oct-1994  cgd make <stdarg.h> a symlink, and clean up ports' stdarg.h and varargs.h files.
 1.3 25-May-1994  pk sync with 4.4-lite
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.14.1 01-Feb-1999  cgd pull up rev 1.11 from trunk (PR#6862). (mycroft)
 1.13.4.1 21-Jun-1999  thorpej Sync w/ -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.17.16.1 31-Aug-2002  gehenna catch up with -current.
 1.17.8.1 01-Aug-2002  nathanw Catch up to -current.
 1.17.4.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.19.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.10.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.21.8.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.21.2.1 29-Apr-2005  kent sync with -current
 1.8 20-Jun-1998  mrg moved to <dev/sun/disklabel.h>
 1.7 29-Jun-1996  pk Put native NetBSD disk label in a piece of wasteland within a SunOS label.
 1.6 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.5 26-Jun-1995  pk sl_xxx2 -> sl_pcylinder, for Chucks new xd driver.
 1.4 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 02-Nov-1994  deraadt ioctl u_long cmd
 1.1 17-Sep-1994  deraadt sunos disklabels are translated into netbsd disklabels.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.76; 1.2.78; 1.2.80;
merge ktrace-lwp.
 1.1 11-Jul-2005  christos branches: 1.1.6;
new file
 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:58:56 +0000
 1.2.80.1 16-May-2008  yamt sync with head.
 1.2.78.1 18-May-2008  yamt sync with head.
 1.2.76.1 02-Jun-2008  mjf Sync with HEAD.
 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:56:12 +0000
 1.14 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.13 28-Apr-2008  martin branches: 1.13.86; 1.13.88;
Remove clause 3 and 4 from TNF licenses
 1.12 04-Mar-2006  uwe branches: 1.12.68; 1.12.70; 1.12.72;
De-__P.
 1.11 11-Dec-2005  christos branches: 1.11.4; 1.11.6;
merge ktrace-lwp.
 1.10 10-Jul-2005  christos - add syscall_{plain,fancy}
- make it use mi_userret
 1.9 18-Jan-2003  thorpej branches: 1.9.2; 1.9.18;
Merge the nathanw_sa branch.
 1.8 21-Jan-1999  christos branches: 1.8.26;
Remove old prototypes (move to mi code), and add the xrs gunk!
 1.7 13-Sep-1998  mycroft Update these for signal handling changes.
XXX Not tested yet.
 1.6 13-Sep-1998  pk Sync function prototypes; remove unsed variables.
 1.5 05-Sep-1998  christos Assign copyright to TNF.
 1.4 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.3 26-Mar-1996  christos Make fpu_regs a union of doubles and ints to get the alignment of the
machine dependent portion of the context correct. Thanks pk [1 of 2]!
 1.2 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.1 31-Mar-1995  christos First pass at the ucontext stuff.
 1.8.26.1 20-Nov-2001  pk Adjust prototypes for SA support.
 1.9.18.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.6.1 22-Apr-2006  simonb Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.12.72.1 16-May-2008  yamt sync with head.
 1.12.70.1 18-May-2008  yamt sync with head.
 1.12.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.88.1 10-Jun-2019  christos Sync with HEAD
 1.13.86.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.5 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.4 28-Apr-2008  martin branches: 1.4.44; 1.4.64;
Remove clause 3 and 4 from TNF licenses
 1.3 04-Mar-2006  uwe branches: 1.3.68; 1.3.70; 1.3.72;
s/u_intN_t/uintN_t/
 1.2 14-Mar-2000  jdc branches: 1.2.6; 1.2.46; 1.2.60; 1.2.62;
Fix RCS ID.
Add port power management.
 1.1 15-Dec-1999  garbled branches: 1.1.2;
Add new spl level for tadpole devices splts102.
Device entrypoints for tctrl device (tadpole micro controller)
add header for direct-access ioctl to the tadpole microcontroller.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.62.1 22-Apr-2006  simonb Sync with head.
 1.2.60.1 09-Sep-2006  rpaulo sync with head
 1.2.46.1 21-Jun-2006  yamt 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-Mar-2000  bouyer file tctrl.h was added on branch thorpej_scsipi on 2000-11-20 20:25:40 +0000
 1.3.72.1 16-May-2008  yamt sync with head.
 1.3.70.1 18-May-2008  yamt sync with head.
 1.3.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.64.1 22-Sep-2015  skrll Sync with HEAD
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.20 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.19 19-Dec-2018  maxv branches: 1.19.12;
Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.18 27-Mar-2011  martin branches: 1.18.54; 1.18.56;
On second thought do not use bit 13 as a flag for syscall numbers, userland
typically sets those from a 13bit signed integer immediate field in the
instruction, so would need to jump through hoops (ok, small hoops) to
avoid sign extension.
Use a combination of the existing syscall flags instead.
 1.17 23-Mar-2011  martin Add a syscall variant passing the return address in %g5 (we need %g7 for
pthread_self and %g2 is an application register, so we can not use those
anymore).
 1.16 11-Dec-2005  christos branches: 1.16.100; 1.16.106;
merge ktrace-lwp.
 1.15 26-Oct-2005  uwe Comment change: Clarify meaning of some user traps.
 1.14 15-Oct-2003  pk branches: 1.14.16; 1.14.18;
sun4m_access_fault: Treat text/data error traps as if they were text/data
exception traps, except that they're logged on the console.
 1.13 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.12 23-Dec-2002  pk branches: 1.12.2;
xcallintr() receive a `clockframe *' argument, not a `trapframe *'.
Setup a DDB context for paused CPUs by defining a soft trap (T_DBPAUSE)
which uses the generic trap handler code to get the trapframe constructed
and then calls on a debugger-defined `suspend' routine.
 1.11 20-Jan-1999  pk branches: 1.11.26;
Catch `Unimplemented Flush' traps.
 1.10 01-Dec-1996  pk trap 0x2a: divide by zero for hardware [su]div instruction.
 1.9 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.8 15-May-1996  mrg remove some RCS id's we don't need.
 1.7 31-Mar-1996  pk Add SRMMU/sun4m support. Size and layout of `struct pmap' has changed.
 1.6 04-Jul-1995  christos Fix bug in the KGDB trap definition. Add svr4 software traps.
 1.5 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 22-Mar-1994  deraadt move defn of trapvec to cpu.h
 1.2 10-Nov-1993  deraadt use p_emul flag to indicate OS emulation
handle syscalls at standard sun place, ie. trap#80 not #89
add SunOS OMAGIC support
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.11.26.1 29-Dec-2002  thorpej Sync with HEAD.
 1.12.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.14.18.1 02-Nov-2005  yamt sync with head.
 1.14.16.1 21-Jun-2006  yamt sync with head.
 1.16.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.100.1 21-Apr-2011  rmind sync with head
 1.18.56.1 10-Jun-2019  christos Sync with HEAD
 1.18.54.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.19.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.73 20-Mar-2023  martin __HAVE_HASHLOCKED_ATOMICS needs to be visible to userland
 1.72 30-Jul-2022  riastradh sys/atomic.h: Fix atomic_store_* on sparcv7, sparcv8.

These did not cooperate with the hash-locked scheme of the other
atomic operations, with the effect that, for instance, a typical
naive spin lock based on atomic_*,

volatile unsigned locked = 0;
lock()
{
while (atomic_swap_uint(&locked, 1))
continue;
membar_acquire();
}
unlock()
{
membar_release();
atomic_store_relaxed(&locked, 0);
}

would fail to achieve mutual exclusion.

For this case, we need to use atomic_swap_* (or, for 8- or 16-bit
objects, atomic_cas_32 loops, since there is no atomic_swap_8 or
atomic_swap_16).

The new machine/types.h macro __HAVE_HASHLOCKED_ATOMICS says whether
these contortions are necessary.

Note that this _requires_ the use of atomic_store_*(p, v), not
regular stores *p = v, to work with the r/m/w atomic operations.
 1.71 23-Jan-2021  christos Document via __HAVE_BUS_SPACE_8 platforms that implement bus_space_*_8
 1.70 06-Dec-2020  christos undo previous; __register_t is already defined
 1.69 06-Dec-2020  christos don't expose register_t
 1.68 17-May-2020  martin branches: 1.68.2;
__HAVE_CPU_DATA_FIRST is still true for sparc64 (which shares this file)
 1.67 16-May-2020  ad PR port-sparc/55261: sparc still panics running ATF tests

Reinstate the cpu_info change and remove __HAVE_CPU_DATA_FIRST to fix
build failure.
 1.66 23-Jan-2016  christos expose the kernel types for standalone code.
 1.65 23-Jan-2016  christos Hide {p,v}{addr,size}_t and register_t (and a couple more types that
are machine-specific) from userland unless _KERNEL/_KMEMUSER and a
new _KERNTYPES variables is defined. The _KERNTYPES should be fixed
for many subsystems that should not be using it (rump)...
 1.64 06-Oct-2015  martin Do not use #ifdef SUN4U when testing for cpu features of post-v8 CPUs,
it is not good for SUN4V-only kernels. Instead use __sparc_v9__ (which
is also defined by the sparc compiler when called with cpu=ultrasparc).
ok: mrg@
 1.63 27-Aug-2015  pooka Fix PTHREAD_FOO_INITIALIZER for C++ by not using volatile in the relevant
pthread types in C++ builds, attempt 2.

The problem with attempt 1 was making assumptions of what the MD
__cpu_simple_lock_t (declared volatile) looks like. To get a same type
except non-volatile, we change the MD type to __cpu_simple_lock_nv_t
and typedef __cpu_simple_lock_t as a volatile __cpu_simple_lock_nv_t.
IMO, __cpu_simple_lock_t should not be volatile at all, but changing it
now is too risky.

Fixes at least Rumprun w/ gcc 5.1/5.2. Furthermore, the mpd application
(and possibly others) will no longer require NetBSD-specific patches.

Tested: build.sh for i386, Rumprun for x86_64 w/ gcc 5.2.

Based on the patch from Christos in lib/49989.
 1.62 02-Nov-2012  chs branches: 1.62.14;
Add RAS support for sparc.
 1.61 30-Jul-2011  martin branches: 1.61.2; 1.61.12;
Get rid of #ifdef __sparc__ in uvm code - as noted by cgd back 1996,
now that we have __HAVE_CPU_VMSPACE_EXEC/cpu_vmspace_exec().
 1.60 17-Jul-2011  dyoung Switch sparc and sparc64 to new-style <sys/bus.h>.
 1.59 18-Jun-2011  nakayama Add fast softint(9) support for sparc64.

Reviewed on port-sparc64.
 1.58 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.57 30-Mar-2011  martin branches: 1.57.2;
Enable TLS on sparc and sparc64
 1.56 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.55 26-Dec-2010  martin branches: 1.55.2; 1.55.4;
Move ci_data first in struct cpu_info
 1.54 26-Dec-2010  martin sparc64 currently does not have ci_data as first member in cpu_info!
 1.53 22-Dec-2010  christos Add a define __HAVE_CPU_DATA_FIRST which means that cpu_data is the first
member in struct cpu_info.
 1.52 10-Jan-2010  martin branches: 1.52.4;
Better support for FC-AL controllers/boot disks:
- on FC-AL disks, use wwn instead of target index to match a particular drive
- use the new device_register_post_config() to match "sd" device against
the bootpath after they have gained their wwn device property
- supply firmwares notion of port and node wwn for FC controllers
as device properties (the builtin ones don't see to have a separate nvram)
 1.51 11-Dec-2009  matt Add PRIx{P,V}{ADDR,SIZE}, PRIu{P,V}SIZE, and PRIxREGISTER{,32,64} for all
(except where they will be added via merge). These should be used to print
{p,v}{addr,size}_t and register*_t as appropriate.
 1.50 20-Jan-2008  joerg branches: 1.50.10;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.49 29-Nov-2007  ad branches: 1.49.6;
__HAVE_ATOMIC64_OPS for SUN4U.
 1.48 17-Oct-2007  garbled branches: 1.48.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.47 14-Jul-2007  ad branches: 1.47.8; 1.47.10;
Generic soft interrupts are mandatory.
 1.46 09-Feb-2007  ad branches: 1.46.6; 1.46.14;
Merge newlock2 to head.
 1.45 03-Sep-2006  gdamore branches: 1.45.2;
Convert both sparc and sparc64 to MI todr.
 1.44 03-Sep-2006  bjh21 Nothing in the kernel now tests __HAVE_NWSCONS, so stop defining it everywhere.
 1.43 28-Jun-2006  martin Align the size and alignment of label_t (kernel jmp_buf equivalent)
with the use in setjmp/longjmp. Duh!
This makes DDB work again on sparc kernels compiled with gcc4.
 1.42 07-Jun-2006  kardel branches: 1.42.2;
convert to timecounters (from branch simonb-timecounters)
 1.41 24-Dec-2005  perry branches: 1.41.4; 1.41.6; 1.41.8; 1.41.14;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.40 11-Dec-2005  christos merge ktrace-lwp.
 1.39 10-Jul-2005  christos - add syscall_{plain,fancy}
- make it use mi_userret
 1.38 10-Feb-2004  bjh21 branches: 1.38.16;
__HAVE_NWSCONS seems to mean, "If this port uses pckbc(4), it also uses
sys/dev/pckbc/files.pckbc." This is true of sparc, so define __HAVE_NWSCONS,
and remove the code in pckbc_machdep_cnattach() that was conditional on its
not being defined and that is no longer needed (since with __HAVE_NWSCONS,
pckbc_cnattach() will call pckbd_cnattach() itself if necessary).
 1.37 18-Jan-2004  martin Do not export __HAVE_RAS to userland. Applications are supposed to try
rasctl() and detect failure with EOPNOTSUPP.
 1.36 06-Jan-2004  martin Implement restartable atomic sequences (RAS) for sparc64.
 1.35 26-Sep-2003  nathanw Move __cpu_simple_lock_t and __SIMPLELOCK_{UN,}LOCKED to machine/types.h
so that they can be used in a namespace-friendly way.
 1.34 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.33 06-Aug-2003  bsh add __GENERIC_SOFT_INTERRUPTS_ALL_LEVELS to machine/types.h for
following ports:

acorn26, amiga, hpcarm, sparc, sparc64

This was proposed by Martin Husemann at teck-kern@ in May to properly
test whether softintr can be established for all IPL, or only for
IPL_SOFT*. OKed by acorn26, hpcarm and sparc port masters.
 1.32 28-Apr-2003  bjh21 branches: 1.32.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.31 07-Dec-2002  pk Use MI versions of {set,rem}runqueue().
 1.30 07-Oct-2002  martin All sparc64 CPUs do __HAVE_CPU_COUNTER (aka %tick).
 1.29 22-Sep-2002  simonb Use "#define\t" instead of "#define ".
 1.28 22-Sep-2002  gmcgarry Add __HAVE_MD_RUNQUEUE flag for MD code to override MI run queue primitives.
 1.27 28-Feb-2002  simonb branches: 1.27.10;
Use "#define<tab>".
 1.26 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.25 27-Sep-2001  mrg branches: 1.25.4;
implement generic soft interrupts as described in softintr(9). convert
the network, clock & serial softint's to use them.
 1.24 12-May-2001  kleink branches: 1.24.2; 1.24.4;
Delint my previous change.
 1.23 28-Apr-2001  kleink * Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.22 03-Jan-2001  takemura branches: 1.22.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.21 04-Dec-2000  mrg sync a comment with sparc64/include/types.h
 1.20 19-Mar-2000  pk Remove __BROKEN_CONFIG_UNIT_USAGE.
 1.19 05-Feb-2000  cgd add __BROKEN_CONFIG_UNIT_USAGE #define, becuase these ports do very
wrong things with device configuration data "cf_unit" information.
 1.18 01-Feb-2000  danw #define __HAVE_DEVICE_REGISTER on ports that have it, and check for
that, rather than a list of architecture defines, in config_attach
 1.17 30-Nov-1999  mrg oops; remove part of the previous that was not intended (yet).
 1.16 27-Nov-1999  mrg merge sparc64 types.h; these files are now identical.
 1.15 21-Aug-1998  pk branches: 1.15.12; 1.15.18;
Remove vm_offset_t & vm_size_t.
 1.14 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.13 14-Jun-1998  kleink branches: 1.13.2;
GC the unused `physadr' type, which was not able to hold a complete physical
address on 2 architectures anyhow. Also, move the definition of the `label_t'
type inside _KERNEL protection, since it is specific to the in-kernel
setjmp()/longjmp() implementations.
 1.12 05-Nov-1997  thorpej Mark uses of long long with /* LONGLONG */ for lint. From
Chris Demetriou <cgd@pa.dec.com>.
 1.11 10-Dec-1996  pk branches: 1.11.14;
Kill __BROKEN_INDIRECT_CONF.
 1.10 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.9 14-Mar-1996  pk Remove __FORK_BRAINDAMAGE.
 1.8 09-Dec-1995  mycroft Define __FORK_BRAINDAMAGE.
 1.7 05-Jul-1995  pk remove __BDEVSW_DUMP_OLD_TYPE
#include <sys/cdefs.h>.
 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 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 20-Oct-1994  cgd update for new syscall args description mechanism
 1.3 20-Jul-1994  cgd define __BIT_TYPES_DEFINED__ for compatibility with things like BIND and nvi
 1.2 24-May-1994  deraadt branches: 1.2.2;
liten
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.2.1 20-Jul-1994  cgd update from trunk.
 1.11.14.1 05-Nov-1997  thorpej Update from trunk: Mark usese of long long with /* LONGLONG */ for lint.
 1.13.2.2 12-Aug-1998  eeh Protect XOPEN and POSIX code from vm_offset_t, paddr_t, vaddr_t, vm_size_t, psize_t, and vsize_t.
 1.13.2.1 30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.15.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.12.3 05-Jan-2001  bouyer Sync with HEAD
 1.15.12.2 08-Dec-2000  bouyer Sync with HEAD.
 1.15.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.22.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.24.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.24.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.24.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.24.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.25.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.25.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.25.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.25.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.25.4.1 27-Sep-2001  nathanw file types.h was added on branch nathanw_sa on 2002-01-08 00:27:40 +0000
 1.27.10.1 07-Dec-2002  he Pull up revision 1.30 (requested by martin in ticket #907):
All sparc64 CPUs do __HAVE_CPU_COUNTER (aka %tick).
 1.32.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.32.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.32.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.32.2.1 03-Aug-2004  skrll Sync with HEAD
 1.38.16.6 21-Jan-2008  yamt sync with head
 1.38.16.5 07-Dec-2007  yamt sync with head
 1.38.16.4 03-Sep-2007  yamt sync with head.
 1.38.16.3 26-Feb-2007  yamt sync with head.
 1.38.16.2 30-Dec-2006  yamt sync with head.
 1.38.16.1 21-Jun-2006  yamt sync with head.
 1.41.14.1 19-Jun-2006  chap Sync with head.
 1.41.8.3 14-Sep-2006  yamt sync with head.
 1.41.8.2 11-Aug-2006  yamt sync with head
 1.41.8.1 26-Jun-2006  yamt sync with head.
 1.41.6.1 27-May-2006  kardel sparc has grown timecounter support
 1.41.4.1 09-Sep-2006  rpaulo sync with head
 1.42.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.45.2.1 29-Dec-2006  ad Checkpoint work in progress.
 1.46.14.1 03-Oct-2007  garbled Sync with HEAD
 1.46.6.2 03-Dec-2007  ad Sync with HEAD.
 1.46.6.1 15-Jul-2007  ad Sync with head.
 1.47.10.3 23-Mar-2008  matt sync with HEAD
 1.47.10.2 09-Jan-2008  matt sync with HEAD
 1.47.10.1 06-Nov-2007  matt sync with HEAD
 1.47.8.1 03-Dec-2007  joerg Sync with HEAD.
 1.48.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.48.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.49.6.1 23-Jan-2008  bouyer Sync with HEAD.
 1.50.10.1 11-Mar-2010  yamt sync with head
 1.52.4.4 21-Apr-2011  rmind sync with head
 1.52.4.3 05-Mar-2011  rmind sync with head
 1.52.4.2 24-Mar-2010  mrg only define __HAVE_MM_MD_READWRITE for !SUN4U builds.
 1.52.4.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.55.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.55.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.57.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.61.12.2 03-Dec-2017  jdolecek update from HEAD
 1.61.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.61.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.62.14.3 19-Mar-2016  skrll Sync with HEAD
 1.62.14.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.62.14.1 22-Sep-2015  skrll Sync with HEAD
 1.68.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.68.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.11 29-Nov-2019  ad PR port-sparc/54718 (sparc install hangs since recent scheduler changes)

- userret() must be called every time we return to user, it's not optional.
- If clearing the AST with interrupts off, you must loop over userret().
 1.10 23-Nov-2019  ad Looks like sparc clears want_ast with interrupts enabled, so check+clear it
and call mi_userret() in a loop.
 1.9 21-Nov-2019  ad mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.
 1.8 05-Nov-2007  ad branches: 1.8.108;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.7 17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.6 17-May-2007  yamt branches: 1.6.8; 1.6.10; 1.6.14;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.5 09-Feb-2007  ad branches: 1.5.2; 1.5.6; 1.5.8; 1.5.14;
Merge newlock2 to head.
 1.4 16-Feb-2006  perry branches: 1.4.12; 1.4.16;
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.3 24-Dec-2005  perry branches: 1.3.2; 1.3.4; 1.3.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 10-Jul-2005  christos branches: 1.1.6;
- add syscall_{plain,fancy}
- make it use mi_userret
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 10-Jul-2005  skrll file userret.h was added on branch ktrace-lwp on 2005-11-10 13:58:56 +0000
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.4.16.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.4.16.1 12-Jan-2007  ad sparc MD changes.
 1.4.12.5 15-Nov-2007  yamt sync with head.
 1.4.12.4 03-Sep-2007  yamt sync with head.
 1.4.12.3 26-Feb-2007  yamt sync with head.
 1.4.12.2 21-Jun-2006  yamt sync with head.
 1.4.12.1 16-Feb-2006  yamt file userret.h was added on branch yamt-lazymbuf on 2006-06-21 14:56:12 +0000
 1.5.14.1 22-May-2007  matt Update to HEAD.
 1.5.8.1 11-Jul-2007  mjf Sync with head.
 1.5.6.2 03-Dec-2007  ad Sync with HEAD.
 1.5.6.1 27-May-2007  ad Sync with head.
 1.5.2.1 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.6.14.1 13-Nov-2007  bouyer Sync with HEAD
 1.6.10.1 06-Nov-2007  matt sync with HEAD
 1.6.8.1 06-Nov-2007  joerg Sync with HEAD.
 1.8.108.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.13 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.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 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.10 29-Dec-1995  mycroft branches: 1.10.64;
Make this work for GCC < 2.6.
 1.9 26-Dec-1995  mycroft Make the type of __builtin_va_list a long.
 1.8 26-Dec-1995  mycroft Use __builtin_va_alist.
 1.7 25-Dec-1995  mycroft Update for GCC 2.7, and fix bugs.
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 15-Oct-1994  cgd make <stdarg.h> a symlink, and clean up ports' stdarg.h and varargs.h files.
 1.4 25-May-1994  pk sync with 4.4-lite
 1.3 27-Jan-1994  pk move varargs stuff to arch/<machine>/include.
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.64.1 03-Aug-2004  skrll Sync with HEAD
 1.48 29-Mar-2019  christos remove extra token
 1.47 29-Mar-2019  christos Go back to not always defining PAGE_{SIZE,SHIFT,MASK}
 1.46 29-Mar-2019  christos add more exceptions for standalone and modules
 1.45 28-Mar-2019  christos make rump work again..
 1.44 27-Mar-2019  christos provide the max page size for userland
 1.43 07-Jan-2013  chs branches: 1.43.38;
switch to __USE_TOPDOWN_VM.
 1.42 14-Nov-2010  uebayasi branches: 1.42.8; 1.42.18;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.41 06-Nov-2010  uebayasi Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)). This functionality will be re-added later.
 1.40 06-Mar-2009  joerg branches: 1.40.2; 1.40.4;
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.39 02-Jan-2008  ad branches: 1.39.10; 1.39.18; 1.39.24;
Merge vmlocking2 to head.
 1.38 07-Feb-2006  chs branches: 1.38.44; 1.38.50; 1.38.54; 1.38.58;
reduce MAXSSIZ to 32 MB, like most other ports. fixes PR 30918.
 1.37 11-Dec-2005  christos branches: 1.37.2; 1.37.4; 1.37.6;
merge ktrace-lwp.
 1.36 03-Apr-2004  pk branches: 1.36.10; 1.36.12;
Max data size -> 512MB; default stack size -> 8MB.
 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 09-Apr-2003  thorpej branches: 1.34.2;
Don't define PAGE_SIZE, etc. in terms of NBPG, rather use the same
logic as used by <machine/param.h> to define constant PAGE_SIZE if
possible.

Also define the minimum and maximum PAGE_SIZE that might appear in
any given configuration (4K and 8K, respectively).
 1.33 13-Feb-2003  pk Move the PV list header into the VM page vm_page_md structure.
Also, start using a spin lock to protect PV list operations.
 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 03-Sep-2002  thorpej Increase the default stack limit to 2M (from 512K on sparc and 1M
on sparc64).
 1.30 15-Nov-2001  soren branches: 1.30.10;
MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.29 02-Jun-2001  chs branches: 1.29.2; 1.29.8;
remove bogus curly braces from a structure forward-declaration.
 1.28 01-May-2001  thorpej 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.27 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.26 27-Feb-2001  pk branches: 1.26.2;
* Make PAGE_SIZE et.al. constants, if possible.
* Add pvlist pointer to `struct pmap_physseg'
* Because of the above, add guard against multiple inclusions.
 1.25 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.24 26-Jan-2000  tsutsui Remove obsoleted macros.
 1.23 26-Jan-2000  cjs Don't explode when we've got a lot of RAM. Limit our space for buffers
to 1/4 of the kernel VM map.
 1.22 04-Dec-1999  ragge CL* discarding.
 1.21 27-Nov-1999  mrg MNN has been standard for a Long Time.
 1.20 26-Apr-1999  thorpej branches: 1.20.2; 1.20.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.19 18-Apr-1999  mrg fix some comments.
 1.18 16-Jan-1999  chuck branches: 1.18.4;
MNN is no longer optional, remove dead code
 1.17 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.16 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.15 13-Jan-1998  pk Commit to MACHINE_NEW_NONCONFIG.
 1.14 08-Jan-1998  mrg add new version of non contiguous memory code, written by chuck cranor,
called "MACHINE_NEW_NONCONGIG". this is required for UVM, the new VM
system (also written by chuck) that is coming soon. adds new functions:
vm_page_physload() -- tell the VM system about an area of memory.
vm_physseg_find() -- returns index in vm_physmem array that this
address is in.
and several new versions of old functions/macros defined in vm_page.h.


this is the sparc portion.
 1.13 12-Jul-1997  perry update comment from 1981 on memory and disk prices -- pr-2754 from Curt Sampson
 1.12 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainilne.
 1.11 12-Nov-1996  pk branches: 1.11.4; 1.11.8;
Allow larger text (64MB) and data (256MB) segments.
On sun4/sun4c with a virtual address hole (starting at 512MB), this seems
like a reasonable compromise: about 196MB left for shared libs and sysv-style
shared memory segments.
On the sun4m the limits can easily be made larger: consider turning
MAXTSIZ and MAXDSIZ into tunable variables..
 1.10 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.9 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.8 11-Dec-1995  pk Prototype dvma helper functions `dvma_malloc()/dvma_free()'
 1.7 06-Dec-1995  pk DVMA space is described by the variables `dvma_start' and `dvma_end'.
Prototype dvma_map*() routines.
 1.6 05-Jul-1995  pk #define MACHINE_NONCONTIG here, so all vm_*.c files see it timely.
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 02-Oct-1994  deraadt sun4/300 support works
 1.3 18-Apr-1994  deraadt decl SHMMAXPGS
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.11.8.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.11.4.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.18.4.2 04-Jul-1999  chs add UBC parameters.
 1.18.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.20.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.20.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.20.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.26.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.29.8.4 11-Dec-2002  thorpej Sync with HEAD.
 1.29.8.3 17-Sep-2002  nathanw Catch up to -current.
 1.29.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.29.8.1 02-Jun-2001  nathanw file vmparam.h was added on branch nathanw_sa on 2002-01-08 00:27:40 +0000
 1.29.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.29.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.10.1 30-Nov-2002  he Pull up revision 1.31 (requested by thorpej in ticket #763):
Increase the default stack limit to 2M (from 512K on sparc
and 1M on sparc64).
 1.34.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.34.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.34.2.1 03-Aug-2004  skrll Sync with HEAD
 1.36.12.2 21-Jan-2008  yamt sync with head
 1.36.12.1 21-Jun-2006  yamt sync with head.
 1.36.10.1 14-Feb-2006  tron Pull up following revision(s) (requested by chs in ticket #1165):
sys/arch/sparc/include/vmparam.h: revision 1.38
reduce MAXSSIZ to 32 MB, like most other ports. fixes PR 30918.
 1.37.6.1 22-Apr-2006  simonb Sync with head.
 1.37.4.1 09-Sep-2006  rpaulo sync with head
 1.37.2.1 18-Feb-2006  yamt sync with head.
 1.38.58.1 02-Jan-2008  bouyer Sync with HEAD
 1.38.54.1 01-Jan-2008  ad Locking changes for sparc.
 1.38.50.1 18-Feb-2008  mjf Sync with HEAD.
 1.38.44.1 09-Jan-2008  matt sync with HEAD
 1.39.24.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39.18.1 28-Apr-2009  skrll Sync with HEAD.
 1.39.10.1 04-May-2009  yamt sync with head.
 1.40.4.1 05-Mar-2011  rmind sync with head
 1.40.2.4 16-Nov-2010  uebayasi Sync with HEAD.
 1.40.2.3 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.40.2.2 25-Feb-2010  uebayasi Use VM_PAGE_TO_MD(). Only compile tested.
 1.40.2.1 23-Feb-2010  uebayasi Convert all VM_MDPAGE_INIT()'s to take struct vm_page_md * and paddr_t.
 1.42.18.1 25-Feb-2013  tls resync with head
 1.42.8.1 23-Jan-2013  yamt sync with head
 1.43.38.1 10-Jun-2019  christos Sync with HEAD
 1.3 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.2 20-Nov-1994  deraadt branches: 1.2.46; 1.2.50; 1.2.58;
copyright/Id cleanup
 1.1 21-Jul-1994  deraadt branches: 1.1.2;
make X11R5 compile easier
 1.1.2.2 21-Jul-1994  deraadt make X11R5 compile easier
 1.1.2.1 21-Jul-1994  deraadt file vuid_event.h was added on branch netbsd-1-0 on 1994-07-21 22:06:21 +0000
 1.2.58.1 31-Aug-2002  gehenna catch up with -current.
 1.2.50.1 27-Aug-2002  nathanw Catch up to -current.
 1.2.46.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.74; 1.2.76; 1.2.78;
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:40:56 +0000
 1.2.78.1 16-May-2008  yamt sync with head.
 1.2.76.1 18-May-2008  yamt sync with head.
 1.2.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.11 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.10 26-Jun-2010  tsutsui Forgot to commit this one that should have been done with zs.c rev 1.119:
> Establish interrupt handlers with proper softc per each zs device
> rather than sharing them among all zs devices and searching softc
> in handlers.
>
> The latter method is derived from ancient sun3 zs driver which tried
> to reduce overhead on autovectored interrupts, but nowadays such hack
> might cause recursive global locks on modern SMP capable framework.
>
> Fixes "5.99.30 sparc panic during startup" reported by Hauke Fath
> on tech-kern@:
> http://mail-index.NetBSD.org/tech-kern/2010/06/19/msg008374.html
> and also tested by Jochen Kunz on SS20 with both serial and kbd console.
>
> Ok'ed by mrg@ and dyoung@.

Noticed by martin@.
 1.9 29-Mar-2008  tsutsui branches: 1.9.4; 1.9.14; 1.9.24; 1.9.26;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.8 04-Mar-2006  uwe branches: 1.8.68;
De-__P.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6;
merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 03-May-2003  wiz branches: 1.5.2;
DMA, not dma nor Dma.
 1.4 11-Mar-2002  chs override cn_trap() with zs_abort() so we can drop to the monitor
if there's no DDB. fixes PR 12547.
 1.3 19-Mar-2000  pk branches: 1.3.8; 1.3.12;
Add fields to hold PROM info to be used in console device matching.
 1.2 21-Mar-1998  pk branches: 1.2.14;
Add bus tags to softc.
 1.1 18-Oct-1997  gwr Use common zs code.
 1.2.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.12.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.68.1 03-Apr-2008  mjf Sync with HEAD.
 1.9.26.1 03-Jul-2010  rmind sync with head
 1.9.24.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.14.1 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.9.4.1 11-Aug-2010  yamt sync with head.
 1.24 12-Sep-2020  isaki Improve am7930 family drivers to share more code.
audioamd(4) on sparc, vsaudio(4) on vax, and bba(4) are.
- Remove complex and useless callbacks: onopen, onclose, and
indirect_{read,write}. This makes audioamd and vsaudio almost the same.
- Remove (already disabled) assembly fast interrupt path from audioamd(4).
cf. http://mail-index.netbsd.org/source-changes/2009/12/19/msg004585.html
- Use trigger_* method rather than start_* method. It's more suitable.
vsaudio(4) was tested by naru@, bba(4) was tested by tsutsui@.
 1.23 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.22 11-Dec-2005  christos branches: 1.22.100;
merge ktrace-lwp.
 1.21 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.20 06-Dec-2002  pk branches: 1.20.6;
Use IPL_SOFTAUDIO.
 1.19 24-Jun-2002  pk Comments update: indicate which counters are being incremented.
 1.18 13-Jun-2002  gmcgarry Fix for 64-bit event counters. Fixes PR17207.
 1.17 08-May-2000  mycroft branches: 1.17.8; 1.17.12; 1.17.20; 1.17.22;
Make the audioamd assembler code compile again.
 1.16 24-Mar-1999  mrg branches: 1.16.8;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.15 14-Mar-1999  jonathan Use bus_space tags and handles, embedded in MD hooks AM7930_{READ_WRITE}_REG
to handle MD delay and bus padding. Tested on sparc2 by David Brownlee.

Should use regmaps, but that breaks sparc pDMA assembly code.
 1.14 07-Mar-1999  pk _C_LABEL() is not implied by _ENTRY().
 1.13 05-Mar-1999  pk Use macros from <machine/asm.h> to construct C labels.
 1.12 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.11 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.10 11-Mar-1997  pk Insert RCS Id.
 1.9 10-Mar-1997  pk New location of Interrupt Enable register on sun4/sun4c.
 1.8 11-Nov-1996  pk branches: 1.8.6;
Need to include <machine/param.h>
 1.7 01-Nov-1996  pk Take care of the sun4m way of raising soft interrupts.
 1.6 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.5 02-Feb-1996  mycroft Don't define _LOCORE here.
 1.4 02-Feb-1996  mycroft assym.s -> assym.h
(Some ports did this already.)
 1.3 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.2 04-May-1995  pk Tally interrupts.
 1.1 25-Apr-1995  pk New audio driver from Rolf Grossmann.
 1.8.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.16.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.17.22.1 24-Jun-2002  lukem Pull up revisions 1.18-1.19 (requested by pk in ticket #357):
revision 1.19
Comments update: indicate which counters are being incremented.
revision 1.18
Fix for 64-bit event counters. Fixes PR17207.
 1.17.20.2 17-Jul-2002  gehenna catch up with -current.
 1.17.20.1 15-Jul-2002  gehenna catch up with -current.
 1.17.12.3 11-Dec-2002  thorpej Sync with HEAD.
 1.17.12.2 01-Aug-2002  nathanw Catch up to -current.
 1.17.12.1 20-Jun-2002  nathanw Catch up to -current.
 1.17.8.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.17.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.20.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.6.1 03-Aug-2004  skrll Sync with HEAD
 1.22.100.1 05-Mar-2011  rmind sync with head
 1.11 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 07-Aug-2003  agc branches: 1.9.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 05-Mar-1999  pk branches: 1.8.42;
Have pseudo function return a value.
 1.7 19-Jan-1999  pk Define macros to read & write Ancillary State registers.
 1.6 27-Sep-1998  pk Add `ldstub()'.
 1.5 14-Sep-1998  pk Define `swap'.
 1.4 01-Jul-1996  abrown Implement asm macros to allow 64-bit load/store to alternate address space.

Use new ldda() and stda() to make MultiCache initialization work on
SuperSparc-II machines (these machines require 64-bit access, even
to a 32-bit register).
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 12-Aug-1994  deraadt add lduha & stha
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.42.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.273 13-Oct-2025  thorpej Implememt ether-get-mac-address as a system default device call, and get
completely out of the business of examining bus types and setting properties
in dictionaries when dealing with Ethernet MAC addresses.
 1.272 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.271 30-Sep-2022  jdc Make this compile for SUN4-only kernels
(move namebuf inside the SUN4C/SUN4M/SUN4D ifdef to match where it's used).
 1.270 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.269 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.268 31-Jul-2021  andvar branches: 1.268.2;
s/propective/prospective
 1.267 31-Jul-2021  andvar fix typos in comments
 1.266 10-May-2021  thorpej Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.265 24-Apr-2021  thorpej branches: 1.265.2; 1.265.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.264 24-Jan-2021  mrg branches: 1.264.2;
avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.263 17-Jan-2021  mrg note that find_cpus() also sets cpu_arch.
 1.262 17-Jan-2021  mrg set machine_model[] earlier, so that bootstrap can use it.

also, avoid "extern <variable>" in .c files, and add
idempotency to autoconf.h.
 1.261 14-Aug-2020  martin branches: 1.261.2;
Adapt to new proplib api
 1.260 08-Jun-2020  mrg make find_cpus() static.
 1.259 04-Oct-2015  joerg Panic takes a format string.
 1.258 12-Aug-2014  martin branches: 1.258.2;
PR port-sparc/49103: add device name mapping for "qfe" (quad hme) cards.
From MOCHIDA Shuji.
 1.257 25-Jul-2014  nakayama branches: 1.257.2;
Backout using humanize_number(9) in clockfreq().
humanize_number(9) cannot handle a fraction part and doesn't
match the intention of clockfreq().

Also backout the changes caused by the fallout of clockfreq().

Fixed outputs:

-cpu0 at mainbus0: MB86904 @ 170 MHz, MB86910 or WTL1164/5 FPU
+cpu0 at mainbus0: MB86904 @ 170 MHz, MB86910 or WTL1164/5 FPU

-sbus0 at iommu0: clock = 21250 MHz
+sbus0 at iommu0: clock = 21.250 MHz

-cpu0 at mainbus0: SUNW,UltraSPARC-II @ 449 MHz, CPU id 0
+cpu0 at mainbus0: SUNW,UltraSPARC-II @ 449.971 MHz, CPU id 0
 1.256 23-Apr-2014  macallan if a device is marked as BS_EARLY but no driver is present don't panic()
when the device is also BS_OPTIONAL
now kernels without the sx driver will boot again on hardware that has SX
 1.255 26-Mar-2014  christos branches: 1.255.2;
return something
 1.254 26-Mar-2014  christos use humanize_number per gimpy.
 1.253 26-Mar-2014  christos fix fraction part of printing (from apb)
 1.252 26-Mar-2014  christos simplify snprintf.
 1.251 16-Apr-2013  jdc branches: 1.251.4;
Add PCI fixup for MicroSPARC-IIep.
Unconfigured PCI-PCI bridges and devices behind them are configured.
 1.250 14-Feb-2013  martin Fix thinko in previous (and misleading comment): stop ignoring table
entries for to be ignored devices.
 1.249 14-Feb-2013  martin Rearrange the special mainbus device list to allow for optional entries.
Fixes a panic on all SUN4M machines w/o an sx graphics adapter.
XXX the "ignore devices at mainbus" list seems to be ignored - or am I
missing something?
 1.248 05-Feb-2013  macallan attach SUNW,sx early so cgfourteen can grab it right away and doesn't have
to play games waiting for it
 1.247 05-Feb-2013  macallan don't skip SUNW,sx - we've got a driver now
 1.246 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.245 31-Jul-2012  martin branches: 1.245.2;
Move cn_tab initialization to bootstrap()
 1.244 29-Jul-2012  mlelstv 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.243 28-May-2012  martin Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.
 1.242 17-Jul-2011  mrg branches: 1.242.2; 1.242.6; 1.242.8;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.241 06-Jul-2011  dyoung Missed another one: #include <sys/bus.h> instead of <machine/bus.h>.
 1.240 14-Jan-2011  rmind 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.239 22-Jan-2010  martin branches: 1.239.4;
Recognize ie @ vme as a network device.
 1.238 20-Jan-2010  martin Add the mac-address as device property for all network devices
 1.237 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.236 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.235 07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.234 18-Mar-2009  cegger bzero -> memset
 1.233 10-Mar-2009  martin Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:

Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.

The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.232 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.231 30-Nov-2008  martin branches: 1.231.4;
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.230 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.229 17-Jul-2008  cegger branches: 1.229.2; 1.229.4; 1.229.8;
devive_private -> device_private
 1.228 16-Jul-2008  drochner split device/softc for scsibus
 1.227 12-Feb-2008  joerg branches: 1.227.6; 1.227.10; 1.227.12; 1.227.14; 1.227.16;
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.226 05-Dec-2007  tsutsui Use TAILQ_FIRST(3) and TAILQ_NEXT(3) macro.
 1.225 03-Dec-2007  ad branches: 1.225.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.224 17-Oct-2007  garbled branches: 1.224.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.223 17-May-2007  yamt branches: 1.223.8; 1.223.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.222 04-Mar-2007  christos branches: 1.222.2; 1.222.4; 1.222.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.221 29-Mar-2006  thorpej branches: 1.221.14;
Use device_cfdata().
 1.220 28-Mar-2006  thorpej Use device_unit().
 1.219 28-Feb-2006  thorpej branches: 1.219.2; 1.219.4; 1.219.6;
Use device_is_a() even more.
 1.218 27-Feb-2006  thorpej Use device_is_a() more.
 1.217 26-Feb-2006  thorpej Use device_is_a().
 1.216 25-Feb-2006  wiz Fix typos, reported by Alexey Dobriyan ("Gathered from Linux"),
forwarded by jmc@openbsd.
 1.215 23-Feb-2006  thorpej Use device_parent().
 1.214 16-Nov-2005  uwe branches: 1.214.2; 1.214.4; 1.214.6;
Use uint<N>_t.
 1.213 14-Nov-2005  uwe branches: 1.213.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.212 24-Sep-2005  macallan Run the MicroSPARC IIep PCI bus without endianness translation.
This allows us to run X without any additional code changes.
 1.211 23-Sep-2005  uwe Introduce mspcic_{read,write}_N instead of using struct syntax. This
is the first step to make PCIC run without byteswapping - which is
necessary for X server support. Current macros are still just a
kludgy shim over struct syntax, but accesses to PCIC in the .c files
are now marked up properly.
 1.210 16-Jun-2005  briggs branches: 1.210.2;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.209 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.208 23-Oct-2004  thorpej Centralize the declaration of booted_device and booted_partition.
 1.207 23-Apr-2004  tsutsui Increase buffer size for s[dt]-targets PROM property
otherwise some machines (including my SS1+) with old PROM fails to get it.
 1.206 04-Apr-2004  mrg redo previous slightly; move the "int unode;" decl inside the
if (CPU_ISSUN4D) code block, reducing #ifdef/#endif count by one.
 1.205 04-Apr-2004  gson Unused variable "unode" caused compiler warning when !defined(SUN4D).
 1.204 03-Apr-2004  chs fix find_cpus() for SUN4D. from Stephen Sukovich in PR 24198.
 1.203 17-Mar-2004  pk branches: 1.203.2;
Rename PROM_getprop*() => prom_getprop*().
 1.202 16-Mar-2004  pk Encapsulate retrieval of properties from the global `options' prom node.
 1.201 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.200 25-Aug-2003  uwe Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.199 24-Aug-2003  uwe #include "opt_rcons.h"
 1.198 01-Aug-2003  pk mainbus_attach: declare appropriate variables for SUN4D too.
 1.197 15-Jul-2003  lukem __KERNEL_RCSID()
 1.196 18-Jun-2003  drochner branches: 1.196.2;
don't #include <sys/dkstat.h> where it is (appearently) unused
 1.195 26-Apr-2003  ragge #ifdef around end[].
 1.194 26-Apr-2003  ragge Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)
 1.193 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.192 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.191 21-Feb-2003  pk Allow the kernel to be loaded at its link address (aka KERNBASE) by the
boot program.
 1.190 18-Feb-2003  pk Move makememarr() into promlib.c.
 1.189 20-Jan-2003  pk Remove the restriction that the boot CPU must be the first CPU in the order
as it is presented by the PROM. This is actually amazingly less trivial
than it looks at first, since the finding the Module ID that's currently
executing your code is specific for each module type and/or manufacture.
 1.188 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.187 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.186 22-Dec-2002  mrg change what 'hw.model' reports to be more inline with other netbsd ports, as
well as reporting the actual machine model & cpu, rather than first configured
CPU. changes for two machines are:

old:
hw.model = TMS390Z50 v0 or TMS390Z55 @ 75 MHz, on-chip FPU
hw.model = SUNW,UltraSPARC @ 143.002 MHz, version 0 FPU

new:
hw.model = SUNW,SPARCstation-20 (TMS390Z50 v0 or TMS390Z55 @ 75 MHz, on-chip FPU)
hw.model = SUNW,Ultra-1 (SUNW,UltraSPARC @ 143.002 MHz, version 0 FPU)

as per discussion on port-sparc & port-sparc64.
 1.185 18-Dec-2002  pk Install the sparc V8 multiply/divide routines after we've collected some
basic information on the CPUs.
 1.184 06-Dec-2002  pk ienab_bi[cs] are never used in a context common to both sun4/4c and sun4m,
so there's no point in constructing common entry points for them in locore.s.
 1.183 29-Nov-2002  pk Find the CPU architecture version early in the bootstrap phase, and switch
to the V8 specific .mul/.div/.rem routines while we still have a writable
.text section.
 1.182 27-Oct-2002  chs make this compile with DEBUG (name changes missed in rev. 1.172).
 1.181 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.180 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.179 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.178 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.177 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.176 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.175 24-Sep-2002  thorpej Fix some const warnings.
 1.174 25-Aug-2002  thorpej Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.173 25-Aug-2002  thorpej Add a generic function to translate a device address using a
parent's "ranges" property, and use it.
 1.172 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.171 18-Jul-2002  thorpej Add Sun4d "special nodes".
 1.170 17-Jul-2002  thorpej Remote CPU_ISSUN4OR4C and CPU_ISSUN4COR4M, and instead express them
as (CPU_ISSUN4 || CPU_ISSUN4C) and (CPU_ISSUN4C || CPU_ISSUN4M),
respectively. The compiler can still optimize as desired by expressing
them this way, and it simplifies adding new tests.

While here, just remove CPU_ISSUN4MOR4U; it's not used by anything.
 1.169 21-Jun-2002  lukem add "SUNW,hme" as an an alias for "hme".
my ss5 that netboots off an sbus swift card now autodetects the root device.
 1.168 02-Apr-2002  chs branches: 1.168.2; 1.168.4;
make this compile with DEBUG.
 1.167 28-Mar-2002  uwe Move ms-IIep PCIC driver into mspcic0 at msiiep0. msiiep0 now serves
as a stub bus that knows how to attach drivers for various functions
of PCIC.

This change is a follow up to timer0 at msiiep0 change, since all
children must share same attach arguments and so we no longer can
attach pci0 directly under msiiep0.
 1.166 28-Mar-2002  pk bootinfo_relocate(): don't forget to copy the terminating empty record
of the bootinfo[] array.
 1.165 27-Mar-2002  pk Include "scsibus.h" to see whether we can query the scsi subsystem.
 1.164 12-Mar-2002  uwe Do not pass bus type argument (R.I.P.) to bus_space_map2.
 1.163 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.162 05-Feb-2002  pk bootpath_build(): parse boot path correctly if the boot device arguments
consists of more than one character (we still pay attention to the first
argument character only). From bt@csfps.de; PR#15495.
 1.161 04-Feb-2002  pk Rename `esym' to `kernel_top' and always initialize it in locore from
the information provided by the loader if possible (defaulting to `end').
If the DDB symbols aren't needed, `kernel_top' is adjusted in
autoconf:bootstrap() before calling pmap_bootstrap(). It will also
preserve the bootinfo data (if passed by the loader) for non-DDB kernels.
 1.160 14-Dec-2001  chs make this compile with DEBUG.
 1.159 11-Dec-2001  uwe Add microSPARC-IIep support. Move sun4m bootstrap into separate
functions (for normal 4m and for IIep).
 1.158 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.157 13-Oct-2001  mrg branches: 1.157.4;
when comparing bp->val[] against other types, cast the bp->val[] value to
other type. this avoids sign extension lossage as "val" is (signed) int.
PR#14212.
 1.156 03-Oct-2001  bouyer In cpu_rootconf() use booted_device instead of rebuilding it from bp->dev,
so that a RAID device confgiured with -A root will really be used as root
device.
Discussed on port-sparc s few days ago.
 1.155 03-Oct-2001  chs use pmap_k{enter_pa,remove}() where appropriate.
 1.154 28-Sep-2001  chs don't depend on other headers to include sys/proc.h for us.
 1.153 27-Sep-2001  mrg implement generic soft interrupts as described in softintr(9). convert
the network, clock & serial softint's to use them.
 1.152 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.151 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.150 26-Jun-2001  uwe branches: 1.150.2; 1.150.4;
OF_finddevice uses -1 to signal error. Make it zero to match what
the rest of the code expects the error value to be.
 1.149 26-May-2001  pk Pull in "opt_kgdb.h"; see PR#13036.
 1.148 21-May-2001  uwe There is no iommu prom node on JavaStation 1 and sbus node is directly
under root. If /sbus is encountered on sun4m - attach implied iommu
first and attach /sbus under it. Adjust bootpath accordingly to match
the attachment.
 1.147 21-May-2001  petrov PR#12885, added PROM name translations for fas, from John Heasley <heas@shrubbery.net>
 1.146 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.145 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.144 01-Mar-2001  pk branches: 1.144.2;
* Correct the `flags' argument in call to pmap_enter().
* Enable the message buffer at a temporary virtual address (KERNBASE)
in bootstrap(), if that can be done.
 1.143 22-Jan-2001  jdolecek Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.
 1.142 24-Sep-2000  jdolecek add new macro BOOT_FLAG() (defined in <sys/boot_flag.h>) - this
maps standard boot flags to corresponding RB_* values
use BOOT_FLAG() in port's MD code as appropriate

as discussed on tech-kern, add new boot flags -v, -q for booting
verbosely or quietly, and corresponding AB_VERBOSE/AB_QUIET
boot flags; also add FreeBSD-compatible bootverbose macro and
NetBSD-specific bootquiet macro

for hpcmips, use new bootverbose instead of it's own hpcmips_verbose

Tested on i386, and to limited extend (compile of affected files) also for
mvme68k, hp300, luna68k, sun3.
 1.141 29-Jul-2000  jdolecek g/c RB_DFLTROOT

I've tried hard to find also various usage() messages and remove the
appropriate flag from there as well, hopefully all occurences are covered.
 1.140 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.139 09-Jun-2000  pk branches: 1.139.2;
No need to cast return value of spl0().
 1.138 08-Jun-2000  pk GC unused `autoconf_nzs'.
 1.137 21-Mar-2000  pk branches: 1.137.2;
The global `mmu_3l' has been obsolete for a long time already.
 1.136 21-Mar-2000  pk Nuke global `fbnode'.
 1.135 21-Mar-2000  pk findzs() is now used only by the kgbd initialision code.
 1.134 05-Mar-2000  mrg add a "struct device *booted_device" so that raidframe can link.
 1.133 31-Jan-2000  pk Add `si' and `sw' controllers to device_register() tables.
 1.132 14-Jan-2000  pk Add missing `break'.
 1.131 12-Jan-2000  pk When matching scsi disks, check for the scsibus parent in the previous
entry in the boot path. Noted by Matthew Jacob.
 1.130 12-Jan-2000  mjacob no need to guess about tgt/lun bounds- we know what they are
 1.129 11-Jan-2000  pk Use a table to detect device aliases and add various `isp' and floppy
controllers to it. Also use a table lookup when matching busses/controllers.
 1.128 11-Jan-2000  pk Remove old-style boot device recognition.
 1.127 09-Jan-2000  pk Add special code for recognising a floppy drive as the boot device.
Sun's PROMs don't co-operate here, so there are _hacks_ involved...
 1.126 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.125 04-Oct-1999  pk branches: 1.125.2; 1.125.4; 1.125.8;
Call find_cpus() much earlier so we can use the result while bootstrapping
all that pmap stuff.
 1.124 30-Sep-1999  thorpej The old dk_establish() hack doens't work anymore, and should be
garbage-collected. device_register() is the One True Way.
 1.123 17-Sep-1999  thorpej Centralize the declaration and clearing of `cold'.
 1.122 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.121 23-Aug-1999  thorpej Garbage-collect reference to <sys/dmap.h>.
 1.120 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.119 27-May-1999  pk Casts to match `%d' in printf format.
 1.118 30-Apr-1999  christos Add bootinfo support for loading symbol tables.
 1.117 14-Apr-1999  pk - try to identify multi-processor machines only on sun4m.
- mainbus_attach: on sun4's do not fall through to sun4c/sun4m configuration.
 1.116 26-Mar-1999  mycroft branches: 1.116.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.115 18-Feb-1999  christos && || confusion.
 1.114 14-Feb-1999  pk Add size arg to getpropstringA
 1.113 14-Feb-1999  pk Use the PROMLIB interface.
 1.112 08-Feb-1999  fvdl Make this compile for SUN4 only.
 1.111 14-Jan-1999  pk device_register: recognize `lebuffer' and `isp' as controllers.
 1.110 21-Dec-1998  pk Make sure we don't spuriously detect more than one boot device (as the
previous patch but extended to all devices).
 1.109 05-Dec-1998  mjacob What was missing here is the mapping between our booting SCSI bus number
and the parent (hba) path from which we booted from. As a temp fix,
we'll only go with the first match to set altbootdev- not additional matches.
The problem was further exacerbated by the fact that cnpoll doesn't seem
to work on serial consoles.
 1.108 03-Dec-1998  pk Add a device_register() function to determine the boot device.
Use it in addition to the old method for a while, so we can take note
of any glitches easilier.
 1.107 13-Oct-1998  pk We use MULTIPROCESSOR explicitly here, so pull in "opt_multiprocessor.h".
 1.106 12-Oct-1998  pk `cpuinfo' is now cleared in locore.
 1.105 09-Oct-1998  pk More `#if defined(MULTIPROCESSOR)'s.
 1.104 08-Oct-1998  pk Find out about the number of CPUs in the system before starting device
configuration, so we can build a cpus[] array without "holes".
 1.103 08-Oct-1998  pk Move [gs]etcontext and [gs]etpte() to pte.h
 1.102 06-Oct-1998  thorpej Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.
 1.101 26-Sep-1998  pk fix typo
 1.100 26-Sep-1998  pk Move PROM interface routines into their own file.
 1.99 25-Sep-1998  pk `eccmemctl' inadvertently got into the `mandatory' list.
 1.98 24-Sep-1998  pk Initialize pointer to the boot CPU's interrupt register.
 1.97 07-Sep-1998  pk Adapt to cpuvar.h changes.
 1.96 30-Aug-1998  pk Erase sparc_nam2blk[].
 1.95 30-Aug-1998  pk Nuke old getprop() function and put its successor in place.
 1.94 20-Aug-1998  pk Some machines (Voyagers) apparently have zs devices with multi-valued
register properties in the PROM.
 1.93 04-Jul-1998  jonathan defopt DDB.
 1.92 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.91 06-Jun-1998  mrg add md to the "sparc_nam2nlk" and "chr2blk" arrays. the former fixes
panics seen on a floppy boot in setroot() as it could not properly
determine the root device.
 1.90 01-Apr-1998  pk Move initialization of `proc0.p_addr' from cpu_startup() to bootstrap().
 1.89 30-Mar-1998  pk mainbus `pa_addr' is now a `bus_addr_t'.
 1.88 29-Mar-1998  pk Use `obio_find_rom_map()' explicitly instead of using `obio_bus_map()'
without a proper bus tag.
 1.87 26-Mar-1998  pk Typo in initial interrupt register mapping code.
 1.86 23-Mar-1998  pk Restore initialization of `par_err_reg' (sun4).
 1.85 21-Mar-1998  pk Transform `mainbus' attach code to use its own attach arguments.
Add a couple rom-property helper functions; some overlapping functionality
with existing function, but hold on to the latter for just a while.
 1.84 28-Jan-1998  pk It's no longer necessary to deal with the timers early.
 1.83 25-Jan-1998  pk The VME bus is now called `vme'.
 1.82 12-Jan-1998  thorpej Update for changes to config.
 1.81 08-Jan-1998  mrg do not use fb_unblank unless NFB > 0
 1.80 18-Oct-1997  gwr branches: 1.80.2;
Use common zs code.
 1.79 27-Sep-1997  pk Move the per-processor counter register into cpuinfo.
 1.78 23-Sep-1997  pk Fix some lossage resulting from changed message buffer initialization:
don't buck the trend and move the call to initmsgbuf() to cpu_startup()
in machdep.c (like most other ports do) where we can setup things right
in one go. (This means that the CSRG copyright will no longer be in
the kernel logs).
 1.77 22-Sep-1997  christos Remove duplicate declaration
 1.76 22-Sep-1997  leo Fix (hopefully) the compile errors introduced by the msgbuf changes.
 1.75 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.74 18-Sep-1997  pk Add a function to stop sun4m counters and call it early during
auto-configuration.
 1.73 29-Jul-1997  fair branches: 1.73.2;
%x -> 0x%x
 1.72 24-May-1997  pk Remove `bustype' argument from bus_tmp().
 1.71 08-Apr-1997  pk Move "range" property description out of generic `romaux'.
Add getproplen() function.
 1.70 31-Mar-1997  mycroft Fix formatting error in Sun 4 printf().
 1.69 26-Mar-1997  gwr Move findroot/setroot stuff from configure() to cpu_rootconf().
 1.68 12-Mar-1997  pk Make sure to disable interrupts in the Interrupt Enable register as soon
as we've mapped it.
 1.67 11-Mar-1997  pk Move some parts of CP detection to cpu_attach() in cpu.c.
Call get_cpuinfo() for the boot CPU to collect the minimum information
to get the bootstrap rolling.
sun4/sun4c: the Interrupt Enable register is now mapped here after pmap
is initialized (was in locore).
Replace `cpumod' and `mmumod' with `cpuinfo.*' equivalents.
Allow more than one CPU to be configured in mainbus_attach().
 1.66 31-Jan-1997  thorpej branches: 1.66.2; 1.66.4;
Use new machine-independent setroot() and mountroothook code.
 1.65 21-Jan-1997  pk Drop strchr(), it's in libkern now; we didn't use it anyway.
 1.64 10-Dec-1996  pk branches: 1.64.2;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.63 13-Oct-1996  christos backout previous kprintf change
 1.62 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.61 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.60 29-Jun-1996  pk Need to add another `if defined(SUN4M)'; noticed by David Gilbert.
 1.59 12-Jun-1996  pk Turn on RB_ASKNAME if a `swap generic' kernel was not able to determine
the boot device. Also, call boot device hooks for all types of kernel
configurations.

Print "mainbus" name on sun4m machines.
 1.58 20-May-1996  pk branches: 1.58.2;
Put a `return' back that went missing in rev 1.56
 1.57 19-May-1996  mrg disable prom sync in romboot() and romhalt(), rather than before calling them.
 1.56 18-May-1996  mrg put promdev definition into <machine/bsd_openprom.h>.
also, minor KNF.
 1.55 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.54 10-Apr-1996  pk Use extra value in `struct bootpath' to describe the PROM's bootpath better.
Use the bootpath[] array in setroot() to determine partition info in case
of boot devices of type DV_DISK. Also, precook more SCSI device info in
fake_bootpath() to simplify dk_establish().
 1.53 09-Apr-1996  pk Initialize relevant elements of the `romaux' structure in romprop().
 1.52 07-Apr-1996  thorpej Fix oversight in sun4m changes: the CPU attach code moved, so the CPU
was never getting attached on a sun4 machine. Fix this so that the
cache and FPU get enabled on sun4 machines. (Believe me, a 4/260 is
slot enough, *with* the cache...)
 1.51 05-Apr-1996  chuck make netbsd/sparc boot on sun4 once again. the sun4m changes introduced
config lines for obio0 devices without addresses (thus cf->cf_loc[0] took
the default value of -1). this caused autoconf.c to map memreg0 to
obio physical address -1 (invalid). as soon as we took a memory fault
the code in memfault_sun4 [locore] would get a Watchdog timeout when trying to
read memreg0 (a.k.a. par_err_reg).
 1.50 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.49 04-Apr-1996  cgd update for the fact that 'alldevs' is now a TAILQ.
 1.48 31-Mar-1996  pk Accomodate sun4m device layout (v3 PROM) and special 4m startup goo.
Heavily cleaned from most `#if defined(SUN4*)' stuff in favour of
CPU_ISSUN4* macros.
 1.47 26-Mar-1996  pk Bitfields are unsigned.
 1.46 25-Mar-1996  pk PROM does not like %p's..
 1.45 17-Mar-1996  christos Remove 'volatile' from the romhalt and romboot routines, and local prototype
declarations.
 1.44 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.43 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.42 15-Jan-1996  thorpej Add a "mountroot hook" mechanism so that devices can take care of
special needs before being used in (*mountroot)().
 1.41 11-Jan-1996  pk Should pass suitable arguments bus_map(); as noted by Chuck.
 1.40 28-Dec-1995  thorpej Move the old-style disk instrumentation "structures" to a central location
(sys/kern/subr_disk.c) and note that they should/will be deperecated.
 1.39 18-Oct-1995  pk Merge from netbsd-1-1 branch: kgdb_debug_panic decl; PR1633
 1.38 09-Oct-1995  pk branches: 1.38.2;
Add `fd' to list of possible boot devices.
 1.37 04-Oct-1995  pk RCONSOLE => RASTERCONSOLE
 1.36 25-Sep-1995  chuck add config info for "xy" xylogics 450/451 driver
 1.35 12-Sep-1995  chuck cleaned up bootpath code:
- v2 openprom disk boot generates "/sbus/esp/sd@3,0" which we translated
into "/sbus@0,0/esp@0,0/sd@3,0"... this caused esp.c to reject
the bootpath because it was looking for sbus slot/offset 0,0.
changed the code to generate "/sbus0/esp0/sd@3,0" to fix this
panic.
- when generating fake boot paths, generate them with unit numbers
rather than slot/offsets (thus, /obio@0,0 becomes /obio0, as
does vmel and vmes).
- fixed up comments to reflect these changes
tested new code on: 4/280 (diskless), 4/360 (diskless), 4/360 ("xd" disk),
4/370 (scsi disk), ss1 w/v1 openprom (diskless),
ss1 w/v1 openprom (scsi disk), ss2 w/v2 openprom (diskless),
ss2 w/v2 openprom (scsi disk).
 1.34 05-Sep-1995  pk Fix `le' faked bootpath (PR#1438, Rolf Grossmann).
 1.33 29-Aug-1995  pk Check for absent boot device where it matters.
 1.32 27-Aug-1995  pk minor tweaks from Matthew Green (PR#1410)
 1.31 18-Aug-1995  pk Bootpath construction code and associated SCSI target mapping to aid
the search for the boot-device in `swap generic' kernels.
From Chuck, munched by me.
 1.30 13-Jul-1995  pk Move SUN4 console echo hack cnget() (from Chuck Cranor).
 1.29 26-Jun-1995  pk xd driver entries, from Chuck Cranor.
 1.28 10-Jun-1995  pk Deal with unrecovered boot devices.
 1.27 13-Apr-1995  pk Leave `swapdev' alone; it's not really on par with `rootdev' & `dumpdev'.
 1.26 13-Apr-1995  pk 3-level MMU changes: variable `mmu_3l' is set for SUN4_400 models.
 1.25 08-Mar-1995  pk Allow for multiple virtual PROM addresses.
 1.24 01-Mar-1995  pk Better 4/100 support.
 1.23 16-Feb-1995  pk Working "config generic" support; from Theo.
 1.22 16-Feb-1995  pk minor clean
add "auxiliary-io" to list of openboot-specials; needed for floppy driver.
 1.21 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.20 16-Dec-1994  deraadt increase getprop buffer size
 1.19 06-Dec-1994  deraadt place message buffer in low physical memory, so that it can survive a
warm boot. the sun4 boot program corrupts some memory there so adjust
upwards on the sun4. (from chuck)
 1.18 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.17 20-Nov-1994  deraadt copyright/Id cleanup
 1.16 20-Oct-1994  deraadt better #ifdef's
 1.15 15-Oct-1994  deraadt mapiodev takes a bustype argument now
attempt to configure vmel/vmes
 1.14 02-Oct-1994  deraadt sun4/300 support works
 1.13 18-Sep-1994  deraadt generalize bus support for match/attach
sun4 code for mapping zs chips
 1.12 20-Aug-1994  deraadt on the sun4:
fake-up an openprom vector
ask oldmon for physical memory count.
unblank frame buffer (because most oldmon's forgot to)
 1.11 27-May-1994  pk call dumpconf()
 1.10 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.9 17-Apr-1994  deraadt call swapconf(): it's not just a good idea, it's the law!
 1.8 20-Mar-1994  pk DDB support
 1.7 03-Mar-1994  deraadt delete unneeded printf
 1.6 01-Feb-1994  deraadt sparc runs in current today
 1.5 25-Nov-1993  deraadt setroot & friends now done in init_main.c
 1.4 24-Nov-1993  deraadt clear "cold boot" flag later on
ask rom about "memory-error" earlier
and cleanup
 1.3 16-Oct-1993  deraadt mountroot is defined in vfs_conf.c
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.38.2.1 18-Oct-1995  pk Move `kgdb_debug_panic' up to file scope (from Alain Durand; PR#1633).
 1.58.2.2 02-Jul-1996  jtc merge in rev 1.59=>1.60
> Need to add another `if defined(SUN4M)'
 1.58.2.1 12-Jun-1996  pk Pull down from trunk:
>rev 1.59: Turn on RB_ASKNAME if a `swap generic' kernel was not able to
> determine the boot device (from cgd).
> Print "mainbus" name on sun4m machines.
 1.64.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.66.4.1 12-Mar-1997  is Merge in changes from The Trunk
 1.66.2.1 02-Mar-1997  mrg swapconf() is no more.
 1.73.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.73.2.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.73.2.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.80.2.1 23-Nov-1998  cgd fix to allow the sparc code to work on Sparc Voyager portable systems.
The revisions on the trunk to do this don't apply cleanly. (pk)
 1.116.2.1 14-Apr-1999  pk branches: 1.116.2.1.2;
Pull up rev 1.117 from trunk.
 1.116.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.125.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.125.4.1 15-Nov-1999  fvdl Sync with -current
 1.125.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.125.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.125.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.125.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.137.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.139.2.2 09-Feb-2002  he Pull up revision 1.162 (requested by pk):
Parse boot path correctly if boot device arguments consists of
more than one character (we still only pay attention to the first
argument character). Fixes PR#15495.
 1.139.2.1 13-Aug-2000  jdolecek pullup from trunk (approved by thorpej):
retire RB_DFLTROOT, it's no longer used

revisions pulled up:
arch/i386/stand/lib/netbsd_opts.c 1.3
arch/i386/stand/biosboot/main.c 1.23
arch/i386/stand/dosboot/main.c 1.15
arch/i386/stand/netboot/main.c 1.6
arch/arc/arc/machdep.c 1.42
arch/bebox/stand/boot/boot.c 1.11
arch/hpcmips/hpcmips/machdep.c 1.32
arch/newsmips/newsmips/machdep.c 1.45
arch/pc532/stand/boot/boot.c 1.2
arch/pmax/pmax/machdep.c 1.178
arch/prep/stand/boot/boot.c 1.2
arch/sparc/sparc/autoconf.c 1.141
arch/sparc64/sparc64/autoconf.c 1.38
arch/x68k/stand/loadbsd/loadbsd.c 1.5
arch/mvme68k/stand/libsa/parse_args.c 1.6
compat/osf1/osf1_cvt.c 1.9
sys/reboot.h 1.17
 1.144.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.150.4.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.150.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.150.2.7 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.150.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.150.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.150.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.150.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.150.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.150.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.157.4.14 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.157.4.13 29-Dec-2002  thorpej Sync with HEAD.
 1.157.4.12 19-Dec-2002  thorpej Sync with HEAD.
 1.157.4.11 11-Dec-2002  thorpej Sync with HEAD.
 1.157.4.10 11-Nov-2002  nathanw Catch up to -current
 1.157.4.9 18-Oct-2002  nathanw Catch up to -current.
 1.157.4.8 27-Aug-2002  nathanw Catch up to -current.
 1.157.4.7 01-Aug-2002  nathanw Catch up to -current.
 1.157.4.6 17-Apr-2002  nathanw Catch up to -current.
 1.157.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.157.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.157.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.157.4.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.157.4.1 13-Oct-2001  pk file autoconf.c was added on branch nathanw_sa on 2001-11-20 16:31:53 +0000
 1.168.4.3 11-Feb-2003  jmc Apply hand patch from martin (ticket 1163)
Make this compile with DEBUG.
 1.168.4.2 22-Nov-2002  tron Pull up revision 1.172 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.168.4.1 21-Jun-2002  lukem Pull up revision 1.169 (requested by lukem in ticket #342):
add "SUNW,hme" as an an alias for "hme".
my ss5 that netboots off an sbus swift card now autodetects the root device.
 1.168.2.3 31-Aug-2002  gehenna catch up with -current.
 1.168.2.2 21-Jul-2002  gehenna catch up with -current.
 1.168.2.1 17-Jul-2002  gehenna catch up with -current.
 1.196.2.6 11-Dec-2005  christos Sync with head.
 1.196.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.196.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.196.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.196.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.196.2.1 03-Aug-2004  skrll Sync with HEAD
 1.203.2.1 30-May-2004  tron Pull up revision 1.207 (requested by tsutsui in ticket #423):
Increase buffer size for s[dt]-targets PROM property
otherwise some machines (including my SS1+) with old PROM fails to get it.
 1.210.2.4 27-Feb-2008  yamt sync with head.
 1.210.2.3 07-Dec-2007  yamt sync with head
 1.210.2.2 03-Sep-2007  yamt sync with head.
 1.210.2.1 21-Jun-2006  yamt sync with head.
 1.213.2.2 22-Nov-2005  yamt sync with head.
 1.213.2.1 14-Nov-2005  yamt file autoconf.c was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.214.6.1 22-Apr-2006  simonb Sync with head.
 1.214.4.1 09-Sep-2006  rpaulo sync with head
 1.214.2.1 01-Mar-2006  yamt sync with head.
 1.219.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.219.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.219.2.1 01-Apr-2006  yamt sync with head.
 1.221.14.2 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.221.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.222.10.1 22-May-2007  matt Update to HEAD.
 1.222.4.1 11-Jul-2007  mjf Sync with head.
 1.222.2.2 03-Dec-2007  ad Sync with HEAD.
 1.222.2.1 27-May-2007  ad Sync with head.
 1.223.10.3 23-Mar-2008  matt sync with HEAD
 1.223.10.2 09-Jan-2008  matt sync with HEAD
 1.223.10.1 06-Nov-2007  matt sync with HEAD
 1.223.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.224.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.224.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.225.2.1 08-Dec-2007  ad Sync with head.
 1.227.16.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.227.16.1 19-Oct-2008  haad Sync with HEAD.
 1.227.14.1 18-Jul-2008  simonb Sync with head.
 1.227.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.227.10.2 11-Mar-2010  yamt sync with head
 1.227.10.1 04-May-2009  yamt sync with head.
 1.227.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.227.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.229.8.1 21-Apr-2010  matt sync to netbsd-5
 1.229.4.1 30-May-2009  snj Pull up following revision(s) (requested by mrg in ticket #776):
sys/arch/sparc/sparc/autoconf.c: revision 1.233 via patch
sys/arch/sparc/sparc/cpu.c: revision 1.213 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.76 via patch
sys/arch/sparc/sparc/db_interface.c: revision 1.83 via patch
sys/arch/sparc/sparc/intr.c: revision 1.102 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.325 via patch
sys/arch/sparc/sparc/timer_sun4m.c: revision 1.17 via patch
Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:
Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.
The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.229.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.229.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.229.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.231.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.239.4.1 05-Mar-2011  rmind sync with head
 1.242.8.3 09-Sep-2014  msaitoh Pull up following revision(s) (requested by martin in ticket #1110):
sys/arch/sparc/sparc/autoconf.c: revision 1.258
PR port-sparc/49103: add device name mapping for "qfe" (quad hme) cards.
From MOCHIDA Shuji.
 1.242.8.2 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.242.8.1 05-Jun-2012  jdc Pull up revisions:
src/sys/arch/sparc/include/bootinfo.h revision 1.6
src/sys/arch/sparc/sparc/autoconf.c revision 1.243
src/sys/arch/sparc/stand/boot/boot.c revision 1.28
src/sys/arch/sparc/stand/ofwboot/boot.c revision 1.29
src/sys/arch/sparc64/include/bootinfo.h revision 1.6-1.7
src/sys/arch/sparc64/sparc64/autoconf.c revision 1.186
(requested by martin in ticket #289).

Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.

Ooops, remove definitions duplicated in <sparc/bootinfo.h>
 1.242.6.1 02-Jun-2012  mrg sync to latest -current.
 1.242.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.242.2.1 30-Oct-2012  yamt sync with head
 1.245.2.5 03-Dec-2017  jdolecek update from HEAD
 1.245.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.245.2.3 23-Jun-2013  tls resync from head
 1.245.2.2 25-Feb-2013  tls resync with head
 1.245.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.251.4.1 18-May-2014  rmind sync with head
 1.255.2.1 10-Aug-2014  tls Rebase.
 1.257.2.1 12-Aug-2014  riz Pull up following revision(s) (requested by martin in ticket #7):
sys/arch/sparc/sparc/autoconf.c: revision 1.258
PR port-sparc/49103: add device name mapping for "qfe" (quad hme) cards.
From MOCHIDA Shuji.
 1.258.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.261.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.264.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.265.4.1 31-May-2021  cjep sync with head
 1.265.2.2 01-Aug-2021  thorpej Sync with HEAD.
 1.265.2.1 13-May-2021  thorpej Sync with HEAD.
 1.268.2.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.11 29-Jul-2012  matt Fix more -fno-common fallout.
 1.10 17-Jul-2011  mrg branches: 1.10.2;
convert all the "empty softc" (just "struct device") drivers to using
device_t/cfdata_t and CFATTACH_DECL_NEW().

the mspcic driver was also converted since it does not ever touch the
sc_dev it used to have in there.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 14-Nov-2005  uwe branches: 1.8.2; 1.8.76; 1.8.78; 1.8.80;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.7 15-Jul-2003  lukem branches: 1.7.16;
__KERNEL_RCSID()
 1.6 02-Oct-2002  thorpej branches: 1.6.6;
Add trailing ; to CFATTACH_DECL.
 1.5 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.2 14-Mar-2000  jdc branches: 1.2.6; 1.2.10; 1.2.14;
Add enable/disable and power management hooks for serial ports.
Port states : always on / on when open (default) / always off
 1.1 25-Feb-2000  jdc Driver for Tadpole 3GX "Power Down Control (Aux 2) Register".
Based on existing auxreg.[ch] (Sparc Aux Register driver).
 1.2.14.2 18-Oct-2002  nathanw Catch up to -current.
 1.2.14.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.10.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.10.1 16-Mar-2002  jdolecek Catch up with -current.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 14-Mar-2000  bouyer file auxiotwo.c was added on branch thorpej_scsipi on 2000-11-20 22:35:44 +0000
 1.6.6.4 11-Dec-2005  christos Sync with head.
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.8.80.1 16-May-2008  yamt sync with head.
 1.8.78.1 18-May-2008  yamt sync with head.
 1.8.76.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.8.2.1 14-Nov-2005  uwe file auxiotwo.c was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 1.10.2.1 30-Oct-2012  yamt sync with head
 1.5 29-Jul-2012  matt Fix more -fno-common fallout.
 1.4 28-Apr-2008  martin branches: 1.4.34;
Remove clause 3 and 4 from TNF licenses
 1.3 14-Nov-2005  uwe branches: 1.3.2; 1.3.76; 1.3.78; 1.3.80;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.2 14-Mar-2000  jdc branches: 1.2.6; 1.2.30; 1.2.46;
Add enable/disable and power management hooks for serial ports.
Port states : always on / on when open (default) / always off
 1.1 25-Feb-2000  jdc Driver for Tadpole 3GX "Power Down Control (Aux 2) Register".
Based on existing auxreg.[ch] (Sparc Aux Register driver).
 1.2.46.1 21-Jun-2006  yamt sync with head.
 1.2.30.1 11-Dec-2005  christos 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-Mar-2000  bouyer file auxiotwo.h was added on branch thorpej_scsipi on 2000-11-20 22:35:44 +0000
 1.3.80.1 16-May-2008  yamt sync with head.
 1.3.78.1 18-May-2008  yamt sync with head.
 1.3.76.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.3.2.1 14-Nov-2005  uwe file auxiotwo.h was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 1.4.34.1 30-Oct-2012  yamt sync with head
 1.40 29-Jul-2012  matt Fix more -fno-common fallout.
 1.39 17-Jul-2011  mrg branches: 1.39.2;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.38 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.37 09-Jul-2007  ad branches: 1.37.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.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 14-Nov-2005  uwe branches: 1.35.2; 1.35.28;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.34 07-Aug-2003  agc branches: 1.34.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.33 15-Jul-2003  lukem __KERNEL_RCSID()
 1.32 02-Oct-2002  thorpej branches: 1.32.6;
Add trailing ; to CFATTACH_DECL.
 1.31 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.30 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.29 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.28 14-Nov-2000  kleink branches: 1.28.4; 1.28.8;
Defopt BLINK.
 1.27 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.26 28-Jan-2000  pk standard nomencature: bp -> bh
 1.25 11-Mar-1999  fair branches: 1.25.8;
Apply patch from PR#6443 to set LED properly when BLINK option is
not set.
 1.24 30-Mar-1998  pk Replace direct `sparc_bus_map()' calls with bus space map method.
 1.23 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.22 12-Jan-1998  thorpej Update for changes to config.
 1.21 24-May-1997  pk Remove `bustype' argument from map[io]dev().
 1.20 17-May-1997  pk Keep a shadow copy of the aux register's contents.
 1.19 07-Apr-1997  pk sun4c and sun4m `aux' register bits differ slightly.
 1.18 11-Dec-1996  pk Panic if `auxreg' is requested but is not there. Not much we can do about
users of AUXIO_REG; they'll die with a data fault.
 1.17 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.16 13-Oct-1996  christos backout previous kprintf change
 1.15 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.14 13-Apr-1996  abrown Add prototype and fix return type of blink() so "options BLINK" works
with -Wall -Werror
 1.13 31-Mar-1996  pk The sun4m name for this device is "auxio".
 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 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.10 19-Feb-1996  pk Adapt to changed kernel data structures (PR#2100).
 1.9 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.8 22-Feb-1995  pk Have a variable point at the auxiliary-io register.
 1.7 18-Feb-1995  pk Little routine to manipulate auxreg bits.
 1.6 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.3 02-Oct-1994  deraadt sun4/300 support works
 1.2 18-Sep-1994  deraadt generalize bus support for match/attach
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.25.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.25.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.28.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.28.8.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.28.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.28.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.32.6.4 11-Dec-2005  christos Sync with head.
 1.32.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.32.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.32.6.1 03-Aug-2004  skrll Sync with HEAD
 1.34.16.2 03-Sep-2007  yamt sync with head.
 1.34.16.1 21-Jun-2006  yamt sync with head.
 1.35.28.1 12-Mar-2007  rmind Sync with HEAD.
 1.35.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.35.2.1 14-Nov-2005  uwe file auxreg.c was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 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.1 15-Jul-2007  ad Sync with head.
 1.37.10.1 06-Nov-2007  matt sync with HEAD
 1.39.2.1 30-Oct-2012  yamt sync with head
 1.14 29-Jul-2012  matt Fix more -fno-common fallout.
 1.13 13-Jan-2010  tsutsui branches: 1.13.12;
Explicitly clear AUXIO4M_FTC bit in FTC_FLIP macro used on
pseudo-dma for floppy, as well as AUXIO4C_FTC bit for sun4c.
A comment in the macro says AUXIO4M_FTC bit is auto-clear,
but my two SS20s (including compatible) with 150MHz hyperSPARCs
get data_overrun without it, and no bad side effect on SS5
(works with and without this change).

Closes PR port-sparc/42516, which is the last one of a bunch of
floppy issue on NetBSD/sparc since NetBSD 2.0 days. See
http://mail-index.NetBSD.org/port-sparc/2009/12/20/msg000484.html
for details.
 1.12 16-Nov-2005  uwe branches: 1.12.24; 1.12.78; 1.12.88; 1.12.96;
Drop trailing whitespace.
 1.11 14-Nov-2005  uwe branches: 1.11.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.10 25-Sep-2005  macallan Added comments about (ab)use of auxreg bits in SPARCbooks
 1.9 07-Aug-2003  agc branches: 1.9.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 21-Jan-2000  pk branches: 1.8.28;
Simplify toggling the FTP bit on sun4m machines.
 1.7 17-May-1997  pk branches: 1.7.16; 1.7.22;
Keep a shadow copy of the aux register's contents.
 1.6 07-Apr-1997  pk sun4c and sun4m `aux' register bits differ slightly.
 1.5 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.4 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.3 22-Feb-1995  pk Have a variable point at the auxiliary-io register.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.7.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.16.1 08-Feb-2000  he Pull up revision 1.8 (requested by pk):
Fix several problems:
o Floppy driver dislikes being accessed with no floppy inserted
(PR#5740)
o Floppy drive being detected even though there is none (PR#5760)
o Panic when fdformat is used (PR#9251)
 1.8.28.5 11-Dec-2005  christos Sync with head.
 1.8.28.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.28.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.11.2.2 22-Nov-2005  yamt sync with head.
 1.11.2.1 14-Nov-2005  yamt file auxreg.h was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.12.96.1 21-Apr-2010  matt sync to netbsd-5
 1.12.88.1 23-Jan-2010  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1251):
sys/arch/sparc/sparc/auxreg.h: revision 1.13
distrib/sparc/ramdisk/dot.profile: revision 1.20
sys/arch/sparc/dev/audioamd.c: revision 1.25
sys/arch/sparc/dev/fd.c: revision 1.147
sys/arch/sparc/stand/common/promdev.c: revision 1.23
distrib/sparc/miniroot/Makefile.inc: revision 1.16
Build miniroot binaries for sparc with -Os to shrink instfs.tgz
for the second boot floppy which use miniroot objects.
This is workaround for PR install/42146, and ok'ed by mrg@.
Don't try to read disklabel to check FS_RAID on floppy boot since
reopening floppy could cause Data Access Exception later.
Fixes PR port-sparc/42186, ok'ed by mrg@.
Disable "fast trap" handlers which invoke software interrupts
in sparc/amd7930intr.s and sparc/bsd_fdintr.s until they are
rewritten to adapt new MI softint(9) API.
No particular comments on PR port-sparc/42192, but
this fixes timeout problem on floppy access on my SPARCstation 1+.
XXX: floppy support on sun4m seems to have another problem (data overrun).
Use /dev/fd0a rather than /dev/rfd0a to read instfs.tgz image from floppy.
It looks newer (appearred after 1.6) gzip tries to read less than DEV_BSIZE
(to check header?) so we can't use raw device directly.
(note sparc bootfs ramdisk doesn't have dd(1))
Workaround for PR port-sparc/42193, and would also fix PR install/28734.
Explicitly clear AUXIO4M_FTC bit in FTC_FLIP macro used on
pseudo-dma for floppy, as well as AUXIO4C_FTC bit for sun4c.
A comment in the macro says AUXIO4M_FTC bit is auto-clear,
but my two SS20s (including compatible) with 150MHz hyperSPARCs
get data_overrun without it, and no bad side effect on SS5
(works with and without this change).
Closes PR port-sparc/42516, which is the last one of a bunch of
floppy issue on NetBSD/sparc since NetBSD 2.0 days. See
http://mail-index.NetBSD.org/port-sparc/2009/12/20/msg000484.html
for details.
 1.12.78.1 11-Mar-2010  yamt sync with head
 1.12.24.1 27-Jan-2010  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1379):
sys/arch/sparc/sparc/auxreg.h: revision 1.13
distrib/sparc/ramdisk/dot.profile: revision 1.20
sys/arch/sparc/stand/common/promdev.c: revision 1.23
Don't try to read disklabel to check FS_RAID on floppy boot since
reopening floppy could cause Data Access Exception later.
Fixes PR port-sparc/42186, ok'ed by mrg@.
Use /dev/fd0a rather than /dev/rfd0a to read instfs.tgz image from floppy.
It looks newer (appearred after 1.6) gzip tries to read less than DEV_BSIZE
(to check header?) so we can't use raw device directly.
(note sparc bootfs ramdisk doesn't have dd(1))
Workaround for PR port-sparc/42193, and would also fix PR install/28734.
Explicitly clear AUXIO4M_FTC bit in FTC_FLIP macro used on
pseudo-dma for floppy, as well as AUXIO4C_FTC bit for sun4c.
A comment in the macro says AUXIO4M_FTC bit is auto-clear,
but my two SS20s (including compatible) with 150MHz hyperSPARCs
get data_overrun without it, and no bad side effect on SS5
(works with and without this change).
Closes PR port-sparc/42516, which is the last one of a bunch of
floppy issue on NetBSD/sparc since NetBSD 2.0 days. See
http://mail-index.NetBSD.org/port-sparc/2009/12/20/msg000484.html
for details.
 1.13.12.1 30-Oct-2012  yamt sync with head
 1.3 25-Apr-1995  pk New audio driver from Rolf Grossmann.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.28 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.27 17-Oct-2007  garbled branches: 1.27.42;
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 21-Jun-2007  jnemeth branches: 1.26.10;
Make this match how the C version of the interrupt handler does
pseudo DMA. Thanks to uwe@ for assistance with sparc assembly
language and tnn@ for testing.
 1.25 11-Dec-2005  christos branches: 1.25.24; 1.25.30; 1.25.32; 1.25.38; 1.25.40;
merge ktrace-lwp.
 1.24 13-Feb-2004  wiz branches: 1.24.16;
Uppercase CPU, plural is CPUs.
 1.23 31-Jan-2003  mrg branches: 1.23.2;
clean up a couple of SMP comments.
 1.22 06-Dec-2002  pk Use IPL_SOFTFDC.
 1.21 24-Jun-2002  pk `fdcio_intrcnt.ev_count' is a 64-bit variable.
 1.20 31-May-2002  thorpej Use C-style comments in a few places where ' appears in the comment,
so that this works with GCC 2.95.3's ISO C preprocessor.
 1.19 15-Mar-2001  mrg branches: 1.19.2; 1.19.8; 1.19.16; 1.19.18;
sprinkle KERNEL_LOCK() and KERNEL_PROC_LOCK() where they're missing. add
SYSCALL_DEBUG support to trap.c.
 1.18 21-Jan-2000  pk branches: 1.18.6;
Medium sized code overhaul:
* Improve communication between the `hard' and `soft' interrupt handlers
to better distinguish various interrupt sources.
* Eliminate several race conditions where we would set a time out handler
only after starting the command on the hardware.
* Handle most timeouts by resetting the controller; there isn't much chance
of recovery in any other way. Currently, the exception is a timeout
on I/O, in which case we first try to pulse the controller's TC line
in order to abort the pseudo-dma sequence. Apparently, "normal"
conditions can induce such a timeout when there's no disk in the drive.
* Reduce the formatting gap parameter to 0x54.
* On the obio bus, interpret the `status' attribute.
* Minimize console diagnostic output if the errors we get appear to be
caused by the absence of a disk.
 1.17 17-Jan-2000  pk Use bus handle to in `struct fdio' to read the chip registers.
 1.16 24-Mar-1999  mrg branches: 1.16.2; 1.16.8;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.15 07-Mar-1999  pk _C_LABEL() is not implied by _ENTRY().
 1.14 05-Mar-1999  pk Use macros from <machine/asm.h> to construct C labels.
 1.13 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.12 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.11 07-Apr-1997  pk sun4c and sun4m `aux' register bits differ slightly.
 1.10 10-Mar-1997  pk New location of Interrupt Enable register on sun4/sun4c.
 1.9 08-Dec-1996  pk branches: 1.9.6;
Revise communication between hw & sw interrupt handler.
Deal with sun4m software interrupt mechanism.
 1.8 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.7 02-Feb-1996  mycroft Don't define _LOCORE here.
 1.6 02-Feb-1996  mycroft assym.s -> assym.h
(Some ports did this already.)
 1.5 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.4 25-Apr-1995  pk NetBSD RCSid
 1.3 07-Apr-1995  pk Add evcnt_attach().
 1.2 02-Mar-1995  pk Tally interrupts.
 1.1 22-Feb-1995  pk Floppy trap handler.
 1.9.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.16.8.2 27-Mar-2001  bouyer Sync with HEAD.
 1.16.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.16.2.1 08-Feb-2000  he Apply patch (requested by pk):
Fix several problems:
o Floppy driver dislikes being accessed with no floppy inserted
(PR#5740)
o Floppy drive being detected even though there is none (PR#5760)
o Panic when fdformat is used (PR#9251)
 1.18.6.1 09-Apr-2001  nathanw Catch up with -current.
 1.19.18.1 24-Jun-2002  lukem Pull up revision 1.20 (requested by pk in ticket #357),
and revision 1.19 (requested by me, to make the former cleaner):

revision 1.21
`fdcio_intrcnt.ev_count' is a 64-bit variable.
revision 1.20
Use C-style comments in a few places where ' appears in the comment,
so that this works with GCC 2.95.3's ISO C preprocessor.
 1.19.16.2 17-Jul-2002  gehenna catch up with -current.
 1.19.16.1 15-Jul-2002  gehenna catch up with -current.
 1.19.8.4 11-Dec-2002  thorpej Sync with HEAD.
 1.19.8.3 01-Aug-2002  nathanw Catch up to -current.
 1.19.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.19.8.1 15-Mar-2001  nathanw file bsd_fdintr.s was added on branch nathanw_sa on 2002-06-20 03:41:05 +0000
 1.19.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 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.24.16.1 03-Sep-2007  yamt sync with head.
 1.25.40.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 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.25.24.1 25-Jun-2007  liamjfoy Pull up following revision(s) (requested by 743 in ticket #jnemeth):
sys/arch/sparc/sparc/bsd_fdintr.s: revision 1.26
Make this match how the C version of the interrupt handler does
pseudo DMA. Thanks to uwe@ for assistance with sparc assembly
language and tnn@ for testing.
 1.26.10.1 06-Nov-2007  matt sync with HEAD
 1.27.42.1 05-Mar-2011  rmind sync with head
 1.102 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.101 03-Sep-2018  riastradh branches: 1.101.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.100 16-Jan-2018  mrg branches: 1.100.2; 1.100.4;
implement cpuctl identify for sparc and sparc64.

sparc:
- move enum vactype and struct cacheinfo into cpu.h
- move the cache flags from cpuinfo.flags into CACHEINFO.c_flags
(this allows the new cache_printf_backend() to see them.)
remove unused CPUFLG_CACHEIOMMUTABLES and CPUFLG_CACHEDVMA.
- align xmpsg to 64 bytes
- move cache_print() into cache_print.h so it can be shared with
cpuctl. it only depends upon a working printf().
- if found, store the CPU node's "name" into cpu_longname. this
changes the default output to show the local CPU not the
generic CPU family. eg:
cpu0 at mainbus0: mid 8: Ross,RT625 @ 90 MHz, on-chip FPU
vs the generic "RT620/625" previously shown.
- for each CPU export these things:
- name
- fpuname
- mid
- cloc
- freq
- psr impl and version
- mmu impl, version, and number of contexts
- cacheinfo structure (which changed for the first time ever
with this commit.)

sparc64:
- add a minimal "cacheinfo" structure to export the i/d/e-cache
size and linesize.
- store %ver, cpu node "name" and cacheinfo in cpu_info.
- set cpu_info ver, name and cacheinfo in cpu_attach(), and
export them via sysctl, as well as CPU ID and clock freq

cpuctl:
- add identifycpu_bind() that returns false on !x86 as their
identify routines do not need to run on a particular CPU to
obtain its information, and use it to avoid trying to set
affinity when not needed.
- add sparc and sparc64 cpu identify support using the newly
exported values.
 1.99 15-Jan-2018  mrg vcache_flush_* event counters are not interrupt type. mark them misc.
 1.98 01-Dec-2017  mrg note some bits no longer present in SuperSPARC-II.
 1.97 04-Mar-2007  macallan branches: 1.97.88;
shutup a compiler warning about pointer arithmetics on void *
 1.96 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.95 16-Nov-2005  uwe branches: 1.95.26;
Use uint<N>_t.
 1.94 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.93 16-Jun-2005  briggs branches: 1.93.2; 1.93.8;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.92 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.91 06-Feb-2005  pk turbosparc_cache_enable: record the external cache size for informational
puposes.
 1.90 27-Apr-2004  pk branches: 1.90.4; 1.90.6;
Replace home-grown cachestats with event counters.
 1.89 19-Apr-2004  pk Drop spurious variable.
 1.88 18-Apr-2004  pk srmmu_vcache_flush_page/range: cover the case where we're called during
bootstrap before the cache parameters are setup.
 1.87 18-Apr-2004  pk Code srmmu_vcache_flush_range & srmmu_vcache_flush_page more efficiently.
 1.86 17-Apr-2004  pk Remove the cache_flush() trampoline; it's no longer directly cross-called.
Instead, implement the MP parts in terms of cross-callable vcache_flush_range()
function.
 1.85 17-Apr-2004  pk Use fast cross calls for MP cache flush ops.
 1.84 13-Apr-2004  pk Re-enable the HyperSPARC on-board instruction cache on multi-processor machines.
 1.83 04-Apr-2004  pk For now, disable Hypersparc instruction cache on MP machines.
 1.82 07-Nov-2003  pk branches: 1.82.2;
swift_cache_enable: set cache enable bits after resetting the cache tags.
 1.81 24-Aug-2003  mrg 64 bit number literals need a "ULL" suffix
 1.80 15-Jul-2003  lukem __KERNEL_RCSID()
 1.79 23-Jun-2003  pk branches: 1.79.2;
Use pre-computed `# of cache lines' where appropriate.
 1.78 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.77 20-Jan-2003  pk srmmu_cache_flush: when flushing per-page and doing more than one page,
we might be crossing a segment boundary.
 1.76 20-Jan-2003  pk Set the system-wide cache aliasing distance according to the largest cache
found on the CPU modules (hypersparc & cypress).

Vikings have a physically indexed cache, so don't bother with computing an
aliasing distance (leaving cache_alias_dist zero disables the BAD_ALIAS macro).
 1.75 15-Jan-2003  pk On Hypersparc MP machines, we need to flush the TLB after a page cache flush.
While the pmap functions take care of properly ordering cache and TLB flushes,
not all TLB flush requests are sent to all CPUs (due to per CPU pmap tracking)
while cache flushes are always broadcast.

XXX: need to investigate pmap tracking for cache flush operation as well.
 1.74 15-Jan-2003  pk srmmu_cache_flush: switch MMU contexts in all places where it matters.
(incidentally, this also makes Hypersparc MP machines mostly go).
 1.73 09-Jan-2003  pk It's now required to turn off traps in the srmmu cache flush ops in
non-MULTIPROCESSOR kernels too.
 1.72 07-Jan-2003  mrg revert (most of) previous
 1.71 07-Jan-2003  mrg don't do the xcall() dance on sun4d for the cache flushing, but do make
sure we're only doing one flush at a time...
 1.70 03-Jan-2003  pk Define a few XCALL? shorthand macros to avoid clutter.
 1.69 03-Jan-2003  pk srmmu cache flush: use to the CPU context parameter; this is now required.
 1.68 01-Jan-2003  mrg fix a comment.
 1.67 19-Dec-2002  pk Brush-up the generic cross-call routine and use it to implement the SMP
cache flush ops.
Also a standard soft interrupt handler for standard cross-call notification
reserving the NMI level 15 softint for urgent cross calls.
 1.66 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.65 15-Dec-2002  martin Fix pasto - make it compile for !MULTIPROCESSOR
 1.64 15-Dec-2002  pk Disable `unimplemented flush' traps during boot. Keep it disabled on
non-MULTIPROCESSOR kernels.
 1.63 29-Jul-2002  grant "DVMA coherent" -> ": DVMA coherent"

noted by Matt Thomas on icb.
 1.62 17-Jul-2002  thorpej More cache/cpu stuff common to sun4m and sun4d. Note the sun4d
machines always use the Viking CPU, and cache info is not available
from the PROM, so we have to hard-code it in that case.

Rearrange some stuff to make it easier to share.
 1.61 25-Jan-2002  tsutsui branches: 1.61.8;
Remove extra brace.
 1.60 25-Jan-2002  pk Implement the sun4c hardware-assisted page flush operation in a separate
function.
 1.59 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.58 13-Nov-2001  uwe Move dvma_cachealign to cache.c where it belongs and declare it in
cache.h, so that kernel can be linked without iommu support (for the
sake of microSPARC-IIep that has a very different iotlb).
 1.57 10-Jul-2001  mrg branches: 1.57.6;
use CPU_READY()
 1.56 07-Jul-2001  mrg branches: 1.56.2;
- replace CPUFLG_STARTUP with new CPUFLG_READY scheme, used after startup has
occured. cpus now spin waiting for new `go_smp_cpus' variable to go non-zero.
- new xpmsg_lock that must held around all cross call activity. new macros:
LOCK_XPMSG() and UNLOCK_XPMSG().
- delete delay(1)/cache_flush gone from raise_ipi_wait_and_unlock(), it incurred
a stupid performance penalty.
 1.55 08-Jun-2001  mrg don't run SMP flush routines if (cold); be sure cpus[n] is valid.
 1.54 08-Jun-2001  mrg use raise_ipi_wait_and_unlock().
 1.53 08-Jun-2000  pk branches: 1.53.4;
viking_pcache_flush_page: use entire PA tag field.
 1.52 06-Jun-2000  pk viking_cache_flush_page: spell bitmasks in hex, not octal.
 1.51 05-Jun-2000  pk Re-arrange code to flush physically indexed caches:

* replace `flush by line' function with a `flush by page' funtion, which
also takes an argument to indicate that write-back caches need not
validate its backing memory.

* use this function when allocating page table memory to flush the cache
before mapping it into kernel virtual space.

* also use it in pmap_{zero,copy}_page(), so we can safely use non-cacheable
access in there.
 1.50 22-May-2000  pk branches: 1.50.2;
MicroSPARC 1 cache issues:

- mark as CPUFLG_CACHE_MANDATORY to avoid cache inconsistencies in
pmap_{zero,copy}_page().
- compute caching alias bits correctly
- add experimental optimisation in ms1_cache_flush().
 1.49 30-Apr-2000  pk Remove not-so-useful `#if DEBUG' code.
 1.48 30-Apr-2000  pk Rename MXCC control register.
 1.47 27-Feb-1999  pk branches: 1.47.8;
Do not call printf() from a CPU that is spinning up; defer the probe
messages to cpu_attach() where the boot processor takes care of them.
This also necessitates a slight change in the way the FPU name is stored.
 1.46 24-Jan-1999  pk Don't tread on cache tags if the cache is already enabled.
 1.45 20-Jan-1999  pk Fix think-o in srmmu_cache_flush().
 1.44 19-Jan-1999  pk Set the Hypersparc ICCR bits.
 1.43 08-Jan-1999  pk * hypersparc support:
get cache size from PROM info like the others
reset the cache type bits before setting our desired values
* smp cache flushing:
protect the cpu message bits with splhigh().
 1.42 13-Oct-1998  pk We use MULTIPROCESSOR explicitly here, so pull in "opt_multiprocessor.h".
 1.41 13-Oct-1998  pk srmmu_cache_flush(): handle small (< NBPG) ranges more efficiently.
 1.40 09-Oct-1998  pk Construct a `flush_cache_all()' for Cypress CPUs.
 1.39 08-Oct-1998  pk Define SMP versions of some cache flush methods.
 1.38 22-Sep-1998  pk Introduce a `flush entire cache' method.
 1.37 12-Sep-1998  pk Set cache control bits according to configured preference (if any).
 1.36 09-Aug-1998  mrg make this compile in a not SUN4M world.
 1.35 10-Nov-1997  pk Set `dvma_cachealign' on Hypersparc.
 1.34 26-Sep-1997  pk branches: 1.34.2;
Do not set CPUFLG_CACHEPAGETABLES inappropriately on microsparcs
 1.33 29-Jul-1997  fair branches: 1.33.2;
%x -> 0x%x
 1.32 20-Jul-1997  pk Invalidate cache tags before enabling the cache, if appropriate.
 1.31 06-Jul-1997  pk Turn off microsparc II compatibility bit in Fujitsu turbosparc processors.
 1.30 06-Jul-1997  pk Use the module info fields `cputype' and `vactype' to hold a processor
family's type and cache information. This can be optionally modified
by the associated `match' routine.
 1.29 02-Jul-1997  pk Defer setting the CACHEPAGETABLES flag until cache_enable().
 1.28 15-May-1997  pk Actually use the passed physical address in viking_cache_flush(). Also,
use hardcoded cache parameters for now.
 1.27 06-May-1997  pk turbosparc: 256 contexts, page tables cannot be cached.
 1.26 11-Apr-1997  pk Fix obvious bug: missing `return'.
viking_flush: make sure to really expunge all entries in a cache bucket
by poking it (2 * `associativity' - 1) times; noted by Chris Torek.
 1.25 27-Mar-1997  pk viking_cache_enable: clear caches only if not yet on.
viking_pcache_flush: don't use flash-clear; use hard-coded parms instead(XXX)
 1.24 24-Mar-1997  pk Move `#endif /* SUN4M */' downward.
 1.23 22-Mar-1997  pk Add a `[ide]c_ncachelines' field to cacheinfo structure; initialize
and use it where appropriate.
Add `swift' and `turbosparc' cache enable function.
 1.22 22-Mar-1997  pk For each major "module", define a separate set of MMU control register bits.
 1.21 21-Mar-1997  pk cypress_cache_enable: clear bits explicitly before setting.
 1.20 21-Mar-1997  pk viking: flush cache before enabling MMU.
 1.19 21-Mar-1997  pk Compute a cache attribute correctlier.
 1.18 21-Mar-1997  pk In viking_pcache_flush(), use a "flash flush" during boot-strapping.
 1.17 21-Mar-1997  pk Store cache associativities in the `cacheinfo' structure, and use it
in computing the cache "alias distance" and in the viking cache line
flush function.
 1.16 20-Mar-1997  pk Remove a bunch of no-ops.
 1.15 12-Mar-1997  pk Use `mcxx' from cpuinfo instead of re-consulting the MMU registers
 1.14 11-Mar-1997  pk Re-write of CPU/MMU detection code.

Use a table driven classification based on CPU and MMU implementation/version
fields. Each CPU class or module defines a collection of routines that
implement CPU or MMU specific operations that can collect detailed setup
information.

All information is collected in a `cpu_softc' structure provided by the
auto-configuration code. However, in the interest of SMP support this
structure is located at a fixed virtual address identified by the
symbol `cpuinfo'. The `boot' CPU currently uses the the physical page(s) at
address 0x2000 for its cpuinfo. Consequently, the fixed virtual address
will be `KERNBASE+0x2000'.

The cache flush routines for several systems (sun4/4c vs. sun4m;
virtual vs. physical tags) have been factored out. Function pointers
to an appropriate set are located in `cpuinfo'. The former global
`cacheinfo' structure is now also a part of `cpuinfo'. Because of the
fixed virtual address of `cpuinfo' no extra performance penalties
are incurred by this move. In multi-architecture kernels, there's
no longer the need for run-time `cputyp' tests in this part of the system.
 1.13 18-Nov-1996  pk branches: 1.13.6;
Initialize cache aliasing bits for MicrosparcIIs.
 1.12 13-Oct-1996  christos backout previous kprintf change
 1.11 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10 01-Jul-1996  abrown Implement asm macros to allow 64-bit load/store to alternate address space.

Use new ldda() and stda() to make MultiCache initialization work on
SuperSparc-II machines (these machines require 64-bit access, even
to a 32-bit register).
 1.9 12-Jun-1996  pk Use `ic_*' cacheinfo fields, and in the split-I&D case, derive `c_linesize[l2]'
from from the corresponding `ic_*' and `dc_*' values. This is not perfect,
but it makes SS4s and SS5s run until we have proper per-cpu cache handling.
 1.8 16-May-1996  abrown branches: 1.8.4;
Copyright police (s/Harvard University/Harvard College/).
 1.7 31-Mar-1996  pk Accomodate sun4m CPUs and caches (Aaron). Cache handling needs to be
revised.
 1.6 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.5 13-Apr-1995  pk 3-level MMU changes.
 1.4 09-Feb-1995  pk Two more VAC_NONE checks.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 24-Nov-1993  deraadt update to match torek's code-base
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.4.1 12-Jun-1996  pk Pull down from trunk:
>rev 1.9: [...] handle cache on SS4 & SS5 [...]
 1.13.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.33.2.1 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.34.2.1 14-Nov-1997  mellon Pull rev 1.35 up from trunk (pk)
 1.47.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.50.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.53.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.56.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.56.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.56.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.56.2.1 03-Aug-2001  lukem update to -current
 1.57.6.11 17-Jan-2003  thorpej Sync with HEAD.
 1.57.6.10 15-Jan-2003  thorpej Sync with HEAD.
 1.57.6.9 07-Jan-2003  thorpej Sync with HEAD.
 1.57.6.8 03-Jan-2003  thorpej Sync with HEAD (again).
 1.57.6.7 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.57.6.6 29-Dec-2002  thorpej Sync with HEAD.
 1.57.6.5 19-Dec-2002  thorpej Sync with HEAD.
 1.57.6.4 01-Aug-2002  nathanw Catch up to -current.
 1.57.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.57.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.57.6.1 10-Jul-2001  nathanw file cache.c was added on branch nathanw_sa on 2002-01-08 00:27:41 +0000
 1.61.8.2 31-Aug-2002  gehenna catch up with -current.
 1.61.8.1 21-Jul-2002  gehenna catch up with -current.
 1.79.2.6 11-Dec-2005  christos Sync with head.
 1.79.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.79.2.4 07-Feb-2005  skrll Sunc with HEAD.
 1.79.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.79.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.79.2.1 03-Aug-2004  skrll Sync with HEAD
 1.82.2.2 24-Apr-2004  jdc Pull up revisions 1.84-1.89 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.82.2.1 08-Apr-2004  jdc Pull up revisions 1.83 (requested by pk in ticket #97)

For now, disable Hypersparc instruction cache on MP machines.
 1.90.6.1 12-Feb-2005  yamt sync with head.
 1.90.4.1 29-Apr-2005  kent sync with -current
 1.93.8.1 22-Nov-2005  yamt sync with head.
 1.93.2.2 03-Sep-2007  yamt sync with head.
 1.93.2.1 21-Jun-2006  yamt sync with head.
 1.95.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.97.88.1 03-Dec-2017  jdolecek update from HEAD
 1.100.4.1 10-Jun-2019  christos Sync with HEAD
 1.100.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.101.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.36 16-Jan-2018  mrg implement cpuctl identify for sparc and sparc64.

sparc:
- move enum vactype and struct cacheinfo into cpu.h
- move the cache flags from cpuinfo.flags into CACHEINFO.c_flags
(this allows the new cache_printf_backend() to see them.)
remove unused CPUFLG_CACHEIOMMUTABLES and CPUFLG_CACHEDVMA.
- align xmpsg to 64 bytes
- move cache_print() into cache_print.h so it can be shared with
cpuctl. it only depends upon a working printf().
- if found, store the CPU node's "name" into cpu_longname. this
changes the default output to show the local CPU not the
generic CPU family. eg:
cpu0 at mainbus0: mid 8: Ross,RT625 @ 90 MHz, on-chip FPU
vs the generic "RT620/625" previously shown.
- for each CPU export these things:
- name
- fpuname
- mid
- cloc
- freq
- psr impl and version
- mmu impl, version, and number of contexts
- cacheinfo structure (which changed for the first time ever
with this commit.)

sparc64:
- add a minimal "cacheinfo" structure to export the i/d/e-cache
size and linesize.
- store %ver, cpu node "name" and cacheinfo in cpu_info.
- set cpu_info ver, name and cacheinfo in cpu_attach(), and
export them via sysctl, as well as CPU ID and clock freq

cpuctl:
- add identifycpu_bind() that returns false on !x86 as their
identify routines do not need to run on a particular CPU to
obtain its information, and use it to avoid trying to set
affinity when not needed.
- add sparc and sparc64 cpu identify support using the newly
exported values.
 1.35 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 16-Nov-2005  uwe branches: 1.34.26;
Drop trailing whitespace.
 1.33 25-Oct-2005  uwe branches: 1.33.2;
Sync c_linesize and c_nlines comments with reality.
 1.32 27-Apr-2004  pk branches: 1.32.12; 1.32.14;
Replace home-grown cachestats with event counters.
 1.31 17-Apr-2004  pk Remove the cache_flush() trampoline; it's no longer directly cross-called.
Instead, implement the MP parts in terms of cross-callable vcache_flush_range()
function.
 1.30 17-Apr-2004  pk Use fast cross calls for MP cache flush ops.
 1.29 15-Apr-2004  pk De-__P().
 1.28 20-Jan-2003  pk branches: 1.28.2; 1.28.4;
Add SUN4D case for cache alias macros.
 1.27 19-Dec-2002  pk smp_cache_flush() also takes a context parameter.
 1.26 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.25 25-Jan-2002  pk Implement the sun4c hardware-assisted page flush operation in a separate
function.
 1.24 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.23 13-Nov-2001  uwe Move dvma_cachealign to cache.c where it belongs and declare it in
cache.h, so that kernel can be linked without iommu support (for the
sake of microSPARC-IIep that has a very different iotlb).
 1.22 06-Jun-2000  pk branches: 1.22.6; 1.22.10;
Make the address argument of pcache_flush_page() a `paddr_t'.
 1.21 05-Jun-2000  pk Re-arrange code to flush physically indexed caches:

* replace `flush by line' function with a `flush by page' funtion, which
also takes an argument to indicate that write-back caches need not
validate its backing memory.

* use this function when allocating page table memory to flush the cache
before mapping it into kernel virtual space.

* also use it in pmap_{zero,copy}_page(), so we can safely use non-cacheable
access in there.
 1.20 09-Oct-1998  pk branches: 1.20.12; 1.20.20;
Construct a `flush_cache_all()' for Cypress CPUs.
 1.19 08-Oct-1998  pk Define SMP versions of some cache flush methods.
 1.18 22-Sep-1998  pk Introduce a `flush entire cache' method.
 1.17 26-Jul-1998  pk Add a cpu-specific function to flush a pure virtually-indexed/virtually-tagged
cache, which needs to be flushed at context switch.
 1.16 06-Jul-1997  pk Add VAC_UNKNOWN to `enum vactype'.
 1.15 06-May-1997  pk turbosparc: 256 contexts, page tables cannot be cached.
 1.14 24-Mar-1997  pk Add `c_associativity' field.
 1.13 22-Mar-1997  pk Add a `[ide]c_ncachelines' field to cacheinfo structure; initialize
and use it where appropriate.
Add `swift' and `turbosparc' cache enable function.
 1.12 21-Mar-1997  pk Store cache associativities in the `cacheinfo' structure, and use it
in computing the cache "alias distance" and in the viking cache line
flush function.
 1.11 20-Mar-1997  pk Add declaration.
 1.10 20-Mar-1997  pk Define various no-op functions.
 1.9 11-Mar-1997  pk Re-write of CPU/MMU detection code.

Use a table driven classification based on CPU and MMU implementation/version
fields. Each CPU class or module defines a collection of routines that
implement CPU or MMU specific operations that can collect detailed setup
information.

All information is collected in a `cpu_softc' structure provided by the
auto-configuration code. However, in the interest of SMP support this
structure is located at a fixed virtual address identified by the
symbol `cpuinfo'. The `boot' CPU currently uses the the physical page(s) at
address 0x2000 for its cpuinfo. Consequently, the fixed virtual address
will be `KERNBASE+0x2000'.

The cache flush routines for several systems (sun4/4c vs. sun4m;
virtual vs. physical tags) have been factored out. Function pointers
to an appropriate set are located in `cpuinfo'. The former global
`cacheinfo' structure is now also a part of `cpuinfo'. Because of the
fixed virtual address of `cpuinfo' no extra performance penalties
are incurred by this move. In multi-architecture kernels, there's
no longer the need for run-time `cputyp' tests in this part of the system.
 1.8 12-Jun-1996  pk branches: 1.8.6;
Introduce separate ic_* fields for instruction caches.
 1.7 16-May-1996  abrown branches: 1.7.4;
Copyright police (s/Harvard University/Harvard College/).
 1.6 31-Mar-1996  pk Accomodate sun4m CPUs and caches (Aaron). Cache handling needs to be
revised.
 1.5 13-Apr-1995  pk 3-level MMU support: interface to cache_flush_segment() changed.
 1.4 15-Dec-1994  deraadt typo
 1.3 14-Dec-1994  deraadt make BADALIAS() and CACHE_ALIAS_DIST sun4-safe
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.7.4.1 12-Jun-1996  pk Pull down from trunk:
>rev 1.8: [...] handle cache on SS4 & SS5 [...]
 1.8.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.20.20.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.20.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.22.10.4 29-Dec-2002  thorpej Sync with HEAD.
 1.22.10.3 19-Dec-2002  thorpej Sync with HEAD.
 1.22.10.2 28-Feb-2002  nathanw Catch up to -current.
 1.22.10.1 08-Jan-2002  nathanw Catch up to -current.
 1.22.6.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.22.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.28.4.1 24-Apr-2004  jdc Pull up revisions 1.29-1.31 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.28.2.5 11-Dec-2005  christos Sync with head.
 1.28.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.28.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.14.1 26-Oct-2005  yamt sync with head
 1.32.12.2 03-Sep-2007  yamt sync with head.
 1.32.12.1 21-Jun-2006  yamt sync with head.
 1.33.2.1 22-Nov-2005  yamt sync with head.
 1.34.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.1 16-Jan-2018  mrg implement cpuctl identify for sparc and sparc64.

sparc:
- move enum vactype and struct cacheinfo into cpu.h
- move the cache flags from cpuinfo.flags into CACHEINFO.c_flags
(this allows the new cache_printf_backend() to see them.)
remove unused CPUFLG_CACHEIOMMUTABLES and CPUFLG_CACHEDVMA.
- align xmpsg to 64 bytes
- move cache_print() into cache_print.h so it can be shared with
cpuctl. it only depends upon a working printf().
- if found, store the CPU node's "name" into cpu_longname. this
changes the default output to show the local CPU not the
generic CPU family. eg:
cpu0 at mainbus0: mid 8: Ross,RT625 @ 90 MHz, on-chip FPU
vs the generic "RT620/625" previously shown.
- for each CPU export these things:
- name
- fpuname
- mid
- cloc
- freq
- psr impl and version
- mmu impl, version, and number of contexts
- cacheinfo structure (which changed for the first time ever
with this commit.)

sparc64:
- add a minimal "cacheinfo" structure to export the i/d/e-cache
size and linesize.
- store %ver, cpu node "name" and cacheinfo in cpu_info.
- set cpu_info ver, name and cacheinfo in cpu_attach(), and
export them via sysctl, as well as CPU ID and clock freq

cpuctl:
- add identifycpu_bind() that returns false on !x86 as their
identify routines do not need to run on a particular CPU to
obtain its information, and use it to avoid trying to set
affinity when not needed.
- add sparc and sparc64 cpu identify support using the newly
exported values.
 1.7 20-Apr-2022  macallan the register is only one byte, act like it
 1.6 30-Dec-2019  ad PR port-sparc/54789: Sparc boot fails with "Trap 0x21 while interrupts disabled"

Remove assumption that cpu_info is smaller than 1kB.
 1.5 17-Jul-2011  mrg branches: 1.5.54;
convert all the "empty softc" (just "struct device") drivers to using
device_t/cfdata_t and CFATTACH_DECL_NEW().

the mspcic driver was also converted since it does not ever touch the
sc_dev it used to have in there.
 1.4 08-May-2008  macallan nuke clause 3 & 4
 1.3 16-Nov-2005  uwe branches: 1.3.18; 1.3.76; 1.3.78; 1.3.80; 1.3.82;
Drop trailing whitespace.
 1.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.1 25-Sep-2005  macallan branches: 1.1.6; 1.1.8;
Put the SPARCbook 3GX and 3GS CPU to sleep when idle
 1.1.8.1 22-Nov-2005  yamt sync with head.
 1.1.6.3 11-Dec-2005  christos Sync with head.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 25-Sep-2005  skrll file clkctrl.c was added on branch ktrace-lwp on 2005-11-10 13:59:08 +0000
 1.3.82.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.3.80.1 16-May-2008  yamt sync with head.
 1.3.78.1 18-May-2008  yamt sync with head.
 1.3.76.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.18.2 21-Jun-2006  yamt sync with head.
 1.3.18.1 16-Nov-2005  yamt file clkctrl.c was added on branch yamt-lazymbuf on 2006-06-21 14:56:12 +0000
 1.5.54.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3 08-May-2008  macallan nuke clause 3 & 4
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.76; 1.2.78; 1.2.80; 1.2.82;
merge ktrace-lwp.
 1.1 25-Sep-2005  macallan branches: 1.1.6;
Put the SPARCbook 3GX and 3GS CPU to sleep when idle
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 25-Sep-2005  skrll file clkctrl.h was added on branch ktrace-lwp on 2005-11-10 13:59:08 +0000
 1.2.82.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.2.80.1 16-May-2008  yamt sync with head.
 1.2.78.1 18-May-2008  yamt sync with head.
 1.2.76.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file clkctrl.h was added on branch yamt-lazymbuf on 2006-06-21 14:56:12 +0000
 1.104 22-Nov-2020  thorpej malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.103 01-Jul-2011  dyoung branches: 1.103.66;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.102 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.101 17-May-2007  yamt branches: 1.101.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.100 04-Mar-2007  mrg branches: 1.100.2; 1.100.4; 1.100.10;
fix fall out from caddr_t changes.
 1.99 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.98 03-Sep-2006  gdamore branches: 1.98.8;
Convert both sparc and sparc64 to MI todr.
 1.97 07-Jun-2006  kardel convert to timecounters (from branch simonb-timecounters)
 1.96 14-Nov-2005  uwe branches: 1.96.4; 1.96.6; 1.96.8; 1.96.14;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.95 04-Jun-2005  he branches: 1.95.2; 1.95.8;
Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*". Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>. This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
 1.94 03-Jun-2005  martin Sprinkle some const
 1.93 15-Jul-2003  lukem __KERNEL_RCSID()
 1.92 26-Feb-2003  pk branches: 1.92.2;
Move all `ID prom' stuff into the prom library.
 1.91 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.90 06-Jan-2003  pk Move schedintr() to clock.c and initialise schedhz in initclocks(), so
these are available to all timer implementations.
 1.89 02-May-2002  martin Remove a local declaration shadowing the global "int statint", thus
preventing the latter to be initialized properly.

Patch from adam@lebsack.com in PR 16608.
 1.88 28-Mar-2002  pk Untangle clock.c:
* put various time-of-day clock, timer and eeprom drivers in separate files
* avoid unnecessary overhead in interrupt handlers
* make the MSIIEP timer attach through the regular autoconf mechanisms
 1.87 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.86 25-Feb-2002  kleink Typo in comments.
 1.85 23-Feb-2002  scw Allow MD code to provide functions for reading/writing NVRAM/RTC
locations. If passed NULL, the old behaviour using bus_space_{read,write}_1()
is used. Otherwise, all access to the chip goes via the MD functions.

This is necessary for mvmeppc boards where the mk48txx NVRAM/RTC is not
directly addressable.
 1.84 11-Dec-2001  uwe tabify
 1.83 11-Dec-2001  uwe Add microSPARC-IIep support. Protect mostek clock code with NMK48TXX
so that this file doesn't require obio, iommu and sbus to link the kernel.
Make todr_handle and establish_hostid() non-static.
 1.82 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.81 26-Sep-2001  eeh branches: 1.81.4;
getprop* -> PROM_getprop*
 1.80 02-Aug-2001  matt branches: 1.80.2;
Fix non-properly ifdef'ed SUN4 only code.
 1.79 09-Apr-2001  pk branches: 1.79.2;
Account for the number of counter ticks that elapse while statintr()
processing takes place. This prevents stat clock skew by a factor
approximately proportional to stathz (not a serious problem if stathz==100;
but considerable already if stathz==1000).
 1.78 20-Jan-2001  pk branches: 1.78.2;
In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.
 1.77 12-Nov-2000  pk Remove left-over turds from previous __P() cleanup.
 1.76 11-Nov-2000  pk Print host ID in hex.
 1.75 11-Nov-2000  pk De-__P() this file.
 1.74 11-Nov-2000  pk Switch to MI mk48xx and intersil7170 time-of-day clock drivers.
 1.73 26-Jul-2000  pk Pull in <dev/clock_subr.h>.
 1.72 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.71 19-Mar-2000  pk Nuke dead code.
 1.70 05-Feb-2000  pk Ensure uniqueness of EEPROM device without reference to cf_unit.
 1.69 14-Oct-1998  pk branches: 1.69.12;
Turn on the counter at each CPU (we fear nothing..)
 1.68 12-Oct-1998  pk Take care of a MID not present when matching timer register sets.
 1.67 09-Oct-1998  pk Init a variable.
 1.66 08-Oct-1998  pk Adapt to changes to the cpus[] array.
 1.65 22-Sep-1998  pk Dup header.
 1.64 16-Sep-1998  pk Map the per-CPU counter registers into each cpu info area.
 1.63 30-Aug-1998  pk getpropA() => getprop()
 1.62 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.61 30-Mar-1998  pk Replace direct `sparc_bus_map()' calls with bus space map method.
 1.60 29-Mar-1998  pk obio_bus_probe() => bus_space_probe()
 1.59 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.58 12-Jan-1998  thorpej Update for changes to config.
 1.57 19-Dec-1997  pk Establish the interrupt handlers on sun4 `oclocks'; pointed out
by Chuck Cranor.
 1.56 03-Dec-1997  mjacob handle case of no keyboard configured
 1.55 19-Nov-1997  pk Use intr_establish() to install the timer interrupt handlers.
 1.54 27-Sep-1997  pk branches: 1.54.2;
Move the per-processor counter register into cpuinfo.
 1.53 18-Sep-1997  pk Add a function to stop sun4m counters and call it early during
auto-configuration.
 1.52 24-May-1997  pk branches: 1.52.4;
Remove `bustype' argument from map[io]dev().
 1.51 02-May-1997  pk Switch to copy of file in /sys/dev/ic.
 1.50 10-Mar-1997  pk Replace `cpumod' with `cpuinfo.cpu_type' equivalent.
 1.49 10-Dec-1996  pk branches: 1.49.6;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.48 28-Oct-1996  abrown Fix timer initialization so that we don't gain one extra microsecond per
second on Sun4m machines. Although this was in the noise of the unstable
Sun clock crystals before, the discrepancy amounted to about 100 ppm, and
thus made NTP perform poorly. NTP now works happily on my SS20...
 1.47 13-Oct-1996  christos backout previous kprintf change
 1.46 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.45 12-Jun-1996  pk Remove unneeded header file.
 1.44 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.43 13-May-1996  thorpej Remove some comments in eeprom_uio() now that they're no longer relevant.
Add some whitespace to eeprom_take().
 1.42 02-May-1996  pk Various simplifications and corrections from Chuck Cranor (makes `oclock'
calibration work.. thanks!).
 1.41 30-Apr-1996  thorpej Fix apparent paste-o ... spurious "}"
 1.40 29-Apr-1996  pk Move delay() to locore, so we control code generation and can avoid
touching memory locations whose caching disposition can perturb timings.
 1.39 23-Apr-1996  pk Turn delay() into a calibrated loop. It's more accurate and compiles into
a `leaf' routine, avoiding unexpected large delays by overflowing the
register windows.
 1.38 22-Apr-1996  christos remove include of <sys/cpu.h>
 1.37 04-Apr-1996  pk Probe clock registers on sun4s to make sure we attach the correct device
(sun4m has clocks at obio too).
 1.36 31-Mar-1996  pk Include support for sun4m timers and counters: hardware register layout
has changed. There is a counter for each CPU (currently, just one supported).
 1.35 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.34 17-Mar-1996  mrg comment: LEAPYEAR is not entirely correct
 1.33 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.32 18-Feb-1996  pk Correct timetochip() prototype.
Cleanup microtime() a bit.
 1.31 17-Feb-1996  pk delay() takes an unsigned int; get the code to match.
 1.30 17-Feb-1996  pk Bring prototypes into scope.
Fix a few bogus `return's.
 1.29 16-Feb-1996  pk Account for the fact that `clockreg' might not be page-aligned.
Misc prototype goo.
 1.28 13-Feb-1996  pk Make sure we assign a value to variables we use.
Don't express size of NVRAM in terms of machine page size.
 1.27 06-Feb-1996  thorpej Protect clearing the Intersil chip's interrupt with splhigh(). If this
gets interrupted (by the higher priority zs hardware, for example),
the clock can come to a dead stop!
 1.26 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.25 08-Oct-1995  pk eeprom_match: account for differing physical addresses (per Jason Thorpe).
 1.24 03-Sep-1995  pk Update from Jason: eeprom device needs 8-bit access.
 1.23 29-Aug-1995  pk Export `eeprom_va' (from Jason Thorpe).
 1.22 29-May-1995  pk eeprom device for Sun4 from Jason Thorpe.
 1.21 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.20 16-Feb-1995  pk Working "config generic" support; from Theo.
 1.19 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.18 05-Jan-1995  pk void microtime().
 1.17 17-Dec-1994  deraadt microtime botch
 1.16 17-Dec-1994  deraadt ... but we still want the sun4c/sun4m case to work
 1.15 16-Dec-1994  deraadt oclock support for the 4/100 and 4/200
 1.14 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.13 20-Nov-1994  deraadt copyright/Id cleanup
 1.12 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.11 02-Oct-1994  deraadt sun4/300 support works
 1.10 18-Sep-1994  deraadt generalize bus support for match/attach
 1.9 20-Aug-1994  deraadt deal with sun4 idprom
 1.8 01-Jul-1994  deraadt add support for the Mostek MK48T08 (found in sun4m)
 1.7 05-May-1994  deraadt revert to dual clocks
 1.6 01-Feb-1994  deraadt sparc runs in current today
 1.5 09-Dec-1993  pk Really suppress clock warning message, even if celebrating.
 1.4 08-Dec-1993  pk Suppress `preposterous time' message if the time base equals zero, as
is the case with NFS mounted root filesystems.
 1.3 28-Nov-1993  deraadt fixed: hostid was incorrectly read from register
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.49.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.52.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.4.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.54.2.2 20-Dec-1997  perry pullup from trunk (pk)
 1.54.2.1 20-Nov-1997  mellon Pull rev 1.55 up from trunk (pk)
 1.69.12.4 21-Apr-2001  bouyer Sync with HEAD
 1.69.12.3 11-Feb-2001  bouyer Sync with HEAD.
 1.69.12.2 22-Nov-2000  bouyer Sync with HEAD.
 1.69.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.78.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.79.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.79.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.79.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.79.2.1 03-Aug-2001  lukem update to -current
 1.80.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.81.4.6 06-Jan-2003  martin Catch up to -current.
 1.81.4.5 20-Jun-2002  nathanw Catch up to -current.
 1.81.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.81.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.81.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.81.4.1 26-Sep-2001  nathanw file clock.c was added on branch nathanw_sa on 2002-01-08 00:27:42 +0000
 1.92.2.5 11-Dec-2005  christos Sync with head.
 1.92.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.92.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.92.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.92.2.1 03-Aug-2004  skrll Sync with HEAD
 1.95.8.1 22-Nov-2005  yamt sync with head.
 1.95.2.3 03-Sep-2007  yamt sync with head.
 1.95.2.2 30-Dec-2006  yamt sync with head.
 1.95.2.1 21-Jun-2006  yamt sync with head.
 1.96.14.1 19-Jun-2006  chap Sync with head.
 1.96.8.2 14-Sep-2006  yamt sync with head.
 1.96.8.1 26-Jun-2006  yamt sync with head.
 1.96.6.2 30-May-2006  kardel use TOY chip time instead of fs time when available
 1.96.6.1 27-May-2006  kardel convert to timecounters
 1.96.4.1 09-Sep-2006  rpaulo sync with head
 1.98.8.2 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.98.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.100.10.1 22-May-2007  matt Update to HEAD.
 1.100.4.1 11-Jul-2007  mjf Sync with head.
 1.100.2.1 27-May-2007  ad Sync with head.
 1.101.10.1 06-Nov-2007  matt sync with HEAD
 1.103.66.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.6 11-Nov-2000  pk This file is no longer needed; it's superseded by the MI mk48xx driver.
 1.5 20-Nov-1994  deraadt branches: 1.5.32;
copyright/Id cleanup
 1.4 20-Aug-1994  deraadt idprom moved to seperate file; must be accessable before clock driver starts, on a sun4
 1.3 01-Jul-1994  deraadt add support for the Mostek MK48T08 (found in sun4m)
 1.2 01-Jul-1994  deraadt document field
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.32.1 22-Nov-2000  bouyer Sync with HEAD.
 1.12 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.11 22-Nov-2008  he Wrap opt* include in #ifdef _KERNEL_OPT.
 1.10 28-Apr-2008  martin branches: 1.10.2; 1.10.6; 1.10.8;
Remove clause 3 and 4 from TNF licenses
 1.9 24-Apr-2008  ad branches: 1.9.2;
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.8 20-Dec-2007  dsl branches: 1.8.6; 1.8.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.7 09-Feb-2007  ad branches: 1.7.24; 1.7.32; 1.7.36;
Merge newlock2 to head.
 1.6 14-Nov-2005  uwe branches: 1.6.20;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.5 14-Sep-2005  he branches: 1.5.6;
We need <compat/sys/signal.h> and <compat/sys/signalvar.h> here
for native_sigset13_to_sigset, sigset13_t, and sigvec.
The includes in sparc's machdep.c is conditional on COMPAT_13, as is
the use of native_sigset13_to_sigset.
 1.4 15-Jul-2003  lukem branches: 1.4.16;
__KERNEL_RCSID()
 1.3 18-Jan-2003  thorpej branches: 1.3.2;
Merge the nathanw_sa branch.
 1.2 22-Dec-2000  jdolecek branches: 1.2.8;
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.1 13-Sep-1998  pk branches: 1.1.12;
Move compat_13 sigreturn() into its own file.
 1.1.12.1 05-Jan-2001  bouyer Sync with HEAD
 1.2.8.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.2.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.2.8.1 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.3.2.5 11-Dec-2005  christos Sync with head.
 1.3.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.3 21-Jan-2008  yamt sync with head
 1.4.16.2 26-Feb-2007  yamt sync with head.
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.5.6.1 22-Nov-2005  yamt sync with head.
 1.6.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.6.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.7.36.1 02-Jan-2008  bouyer Sync with HEAD
 1.7.32.1 26-Dec-2007  ad Sync with head.
 1.7.24.1 09-Jan-2008  matt sync with HEAD
 1.8.8.1 18-May-2008  yamt sync with head.
 1.8.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.2.3 11-Mar-2010  yamt sync with head
 1.9.2.2 04-May-2009  yamt sync with head.
 1.9.2.1 16-May-2008  yamt sync with head.
 1.10.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.10.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.2.3 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.10.2.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.10.2.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.7 24-Apr-2025  riastradh sparc: Use STACK_ALIGNBYTES macro when aligning stack pointer.

Prompted by:

PR kern/59327: user stack pointer is not aligned properly
 1.6 27-Oct-2021  thorpej branches: 1.6.10;
Use the signal trampoline version constants from <sys/signal.h>.
 1.5 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.4 21-Nov-2009  rmind branches: 1.4.64;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.3 28-Nov-2008  he branches: 1.3.4; 1.3.6; 1.3.8; 1.3.12;
Copy the sigdebug and sigpid declarations and associated defines
for the DEBUG define from machdep.c, so that this builds again.
 1.2 22-Nov-2008  he If COMPAT_13 is defined, be sure to include compat signal
headers to get the native_sigset_to_sigset13() prototype and
related types in scope.
 1.1 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.3.12.3 11-Mar-2010  yamt sync with head
 1.3.12.2 04-May-2009  yamt sync with head.
 1.3.12.1 28-Nov-2008  yamt file compat_16_machdep.c was added on branch yamt-nfs-mp on 2009-05-04 08:11:55 +0000
 1.3.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.3.8.1 28-Nov-2008  skrll file compat_16_machdep.c was added on branch nick-hppapmap on 2009-01-19 13:16:46 +0000
 1.3.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.6.1 28-Nov-2008  mjf file compat_16_machdep.c was added on branch mjf-devfs2 on 2009-01-17 13:28:30 +0000
 1.3.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.3.4.1 28-Nov-2008  haad file compat_16_machdep.c was added on branch haad-dm on 2008-12-13 01:13:26 +0000
 1.4.64.1 10-Jun-2019  christos Sync with HEAD
 1.6.10.1 02-Aug-2025  perseant Sync with HEAD
 1.78 26-Oct-2002  jdolecek 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.77 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.76 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.75 17-Jun-2002  christos MD systrace gluons.
 1.74 16-Mar-2002  martin branches: 1.74.4;
Rename ISDN devices, per discussion on tech-kern. The network devices
become ippp (ISDN ppp) and irip (ISDN raw IP). The character device now
are called: /dev/isdn (isdnd <-> kernel communication), /dev/isdnctl (dialing
and other control), /dev/isdntrc* (tracing), /dev/isdnbchan* (raw B channel
access, i.e. for user land PPP) and /dev/isdntel* (telephone devices, i.e.
for answering machines).
 1.73 12-Jan-2002  manu Added clockctl
 1.72 11-Dec-2001  uwe enable pci bus device. (hi matt!)
fix a whitespace nit while I'm here.
 1.71 22-Oct-2001  mrg branches: 1.71.4;
add a note about keeping this file in sync with the sparc64 conf.c. also
add some unused code for the pci bus device. (hi uwe!)
 1.70 05-Oct-2001  mrg add sio16 support.
 1.69 26-Mar-2001  lukem branches: 1.69.2; 1.69.4;
- add dev_noimpl(xxx,yyy) macro to replace "(dev_type_xxx((*))) yyy",
and use appropriately

- create more helper macros:
. cdev__xyz_init(c,n), such as cdev__ocri_init() for
/* open, close, read, ioctl */, etc.
. cdev__xRy_init(c,n), where nullop is used instead of enodev to dummy out
method `R' and the comments now read /* xxx (read) yyy */ instead
. cdev__xyz_t_init(c,n,t) - as per cdev__xyz_init, but sets d_type = t
as well

- use seltrue instead of dev_noimpl(poll,*), as (IIRC) cdevsw.d_poll should
always DTRT WRT returning a valid result. (a few devices previously
incorrectly returned ENODEV)

- use dev_noimpl(stop,enodev) instead of dev_noimpl(stop,nullop) if tty
== 0, because it doesn't matter if dev_type_stop isn't implemented in that
case, and it allows the use of the cdev__xyz_init macros. certain ports
(sparc,sparc64,x68k) used the nullop method for dev_type_stop in a few
drivers, whereas everything else uses enodev

- ensure that the comments are accurate WRT the behaviour of a given entry
 1.68 21-Mar-2001  lukem move duplicate definitions for:
pc, lpt, joy, ocis, apm, satlink, i4bctl, i4brbch, i4btel, i4btrc, i4b
from the port-specific arch/*/*/conf.c files into sys/conf.h
 1.67 28-Feb-2001  mjacob branches: 1.67.2;
add SES device (unused #4)
 1.66 14-Jan-2001  martin The i4b raw b-channel devices actually do have an ioctl routine,
so better add this to the cdevsw entry.
Noted by Bruno Achauer.
 1.65 08-Jan-2001  martin Add isdn devices to all archs that seem to support at least one of the
necessary busses. Sync comments with reality for archs that already had
the devices.
 1.64 14-Apr-2000  tsutsui Typo in comments. (Zilog 8350 -> 8530)
 1.63 19-Mar-2000  pk kd.c should not depend on NKBD.
 1.62 15-Dec-1999  garbled add entrypoint for tctrl device, and add <machine/tctrl.h> to includes for
machdep.c
 1.61 14-Oct-1999  phil branches: 1.61.2;
Add a psuedo-device for coda.
 1.60 01-Aug-1999  matt branches: 1.60.2;
Initial stab at a P9100 console FB driver for the Tadpole 3GX.
It supports RASTERCONSOLE only and the colormap support is
broken (the hardware doesn't seem to be doing what the tech.
docs. say it should be doing). But it is usable as a console
(but with blue on white as the only color choice). I figured
I'd check it in since it is somewhat usable and someone else
might figure what I screwed up in the color map support.
 1.59 30-Jul-1999  matt Add preliminary support for the built-in modem on Tadpole 3GX/S
laptops. There is currently something wrong with the interrupt
code but it does attach and sense a 16550a. (anyways the built
in modem is only a 14.4Kb and you'd really want to use a PCMCIA
modem to get faster dialup rates).
 1.58 18-Dec-1998  drochner branches: 1.58.2; 1.58.4;
get "opt_compat_svr4.h" out of <sys/conf.h>
 1.57 13-Nov-1998  oster Updating of bdev's and cdev's to support RAIDframe.
 1.56 10-Oct-1998  thorpej Add scsibus entry points to the cdevsw[].
 1.55 21-Sep-1998  pk Fill the `bpp' slot.
 1.54 06-Jun-1998  mrg add md to the "sparc_nam2nlk" and "chr2blk" arrays. the former fixes
panics seen on a floppy boot in setroot() as it could not properly
determine the root device.
 1.53 20-May-1998  pk Add `mtty' and `mbpp' entries for the magma driver by Iain Hibbert.
 1.52 23-Dec-1997  tv Exclude /dev/fb code if no framebuffer is compiled into the system.
Adds a fb.h flag file with '#define NFB 1' if any such card is configured
in to the kernel.
 1.51 18-Oct-1997  gwr Use common zs code.
 1.50 16-Oct-1997  christos fix chrtoblk declaration
 1.49 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.48 07-Jan-1997  mrg branches: 1.48.10;
use pseudo-device ipfilter, not ipl.
 1.47 05-Jan-1997  mrg use NIPL.
 1.46 05-Jan-1997  mrg add ipl device.
 1.45 28-Dec-1996  pk rename: ramdisk => md
 1.44 11-Nov-1996  pk Add missing entries: cgtwo, uk, ss
 1.43 30-Sep-1996  abrown Add cgfourteen frame buffer at device major number 99. This is what Solaris
uses; I don't have access to a SunOS system with a cg14 to tell what
it uses.
 1.42 20-Jun-1996  pk Declare a memory disk at block device #5.
 1.41 19-Jun-1996  pk add tcx device at major number 109
 1.40 11-Apr-1996  thorpej Include fdc.h, not fd.h, due to change in files.sparc.
 1.39 30-Mar-1996  christos Deprecate use of *_conf.h and use only <machine/conf.h> and <sys/conf.h>
 1.38 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.37 01-Mar-1996  thorpej "oops", forgot to check this in...add entries for the cgfour and cgeight.
 1.36 25-Sep-1995  chuck add config info for "xy" xylogics 450/451 driver
 1.35 24-Sep-1995  pk Move pseudo swap block device to major 4 to make way for `xy'.
 1.34 17-Aug-1995  thorpej Add entries for the ccd.
 1.33 05-Jul-1995  pk xd declarations.
 1.32 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.31 02-Jul-1995  christos Add the svr4 network cloning devices. Now telnet(1) works too. There are
still problems with X-windows programs.
 1.30 26-Jun-1995  pk xd driver entries, from Chuck Cranor.
 1.29 25-Apr-1995  pk New audio driver.
 1.28 21-Apr-1995  pk sync with sys/conf.h
 1.27 10-Apr-1995  pk clear out two typos.
 1.26 10-Apr-1995  mycroft Minor consistency nits.
 1.25 10-Apr-1995  mycroft Update for conf.h, and add a real chrtoblktbl[].
 1.24 02-Mar-1995  pk Rename audio*() functions to avoid conflicts with sys/dev/audio.c; this is an
emergency measure, driver needs to be converted to generic audio subsystem.
 1.23 18-Feb-1995  pk fd declarations.
 1.22 15-Feb-1995  pk missing entry in bdevsw[]
 1.21 25-Jan-1995  cgd vn -> vnd renaming, for consistency
 1.20 14-Dec-1994  mycroft Remove extra arg to d_open.
 1.19 06-Dec-1994  deraadt changer fix
 1.18 06-Dec-1994  deraadt bdev for st
 1.17 05-Dec-1994  deraadt scsi changer
 1.16 20-Nov-1994  deraadt copyright/Id cleanup
 1.15 14-Nov-1994  christos changed open prototype
 1.14 02-Nov-1994  deraadt ioctl u_long cmd
 1.13 18-Sep-1994  deraadt add tape/cdrom
 1.12 21-May-1994  deraadt iszerodev
 1.11 12-May-1994  deraadt do vn the correct way
 1.10 02-Mar-1994  deraadt make vn driver work either way
 1.9 27-Feb-1994  deraadt support vn/lkm/tun. do not prototype dump routine
 1.8 08-Feb-1994  deraadt use normal major numbers for ptys
 1.7 01-Feb-1994  deraadt sparc runs in current today
 1.6 11-Nov-1993  deraadt new from torek:
add cgsix
 1.5 10-Nov-1993  deraadt s/cntty/cn_tty/
 1.4 13-Oct-1993  deraadt fix typos
 1.3 13-Oct-1993  deraadt initialize d_ttys and d_stop properly
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.48.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.58.4.1 02-Aug-1999  thorpej Update from trunk.
 1.58.2.1 05-Jan-2000  he Pull up revision 1.61 (requested by phil):
Add coda to the sparc port and enable in GENERIC.
 1.60.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.61.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.61.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.61.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.61.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.67.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.69.4.1 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.69.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.69.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.69.2.4 28-Jun-2002  jdolecek g/c mbpp poll(), it returned ENODEV anyway
 1.69.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.69.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.69.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.71.4.8 11-Nov-2002  nathanw Catch up to -current
 1.71.4.7 17-Sep-2002  nathanw Catch up to -current.
 1.71.4.6 01-Aug-2002  nathanw Catch up to -current.
 1.71.4.5 20-Jun-2002  nathanw Catch up to -current.
 1.71.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.71.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.71.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.71.4.1 22-Oct-2001  nathanw file conf.c was added on branch nathanw_sa on 2002-01-08 00:27:42 +0000
 1.74.4.3 21-Jul-2002  gehenna catch up with -current.
 1.74.4.2 15-Jul-2002  gehenna catch up with -current.
 1.74.4.1 16-May-2002  gehenna Bye block/character device swicth tables.
 1.9 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.8 20-Nov-2019  pgoyette Move all non-emulation-specific coredump code into the coredump module,
and remove all #ifdef COREDUMP conditional compilation. Now, the
coredump module is completely separated from the emulation modules, and
they can all be independently loaded and unloaded.

Welcome to 9.99.18 !
 1.7 28-Feb-2014  skrll branches: 1.7.30;
G/C sys/simplelock.h includes
 1.6 01-Jan-2014  dsl Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.
 1.5 14-Jan-2011  rmind branches: 1.5.8; 1.5.18; 1.5.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.4 21-Nov-2009  rmind branches: 1.4.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.3 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.2 18-Mar-2009  cegger branches: 1.2.2;
bzero -> memset
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.10;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.8.3 28-Apr-2009  skrll Sync with HEAD.
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 19-Nov-2008  skrll file core_machdep.c was added on branch nick-hppapmap on 2009-01-19 13:16:46 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 19-Nov-2008  mjf file core_machdep.c was added on branch mjf-devfs2 on 2009-01-17 13:28:30 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file core_machdep.c was added on branch haad-dm on 2008-12-13 01:13:26 +0000
 1.2.2.4 11-Mar-2010  yamt sync with head
 1.2.2.3 19-Aug-2009  yamt sync with head.
 1.2.2.2 04-May-2009  yamt sync with head.
 1.2.2.1 18-Mar-2009  yamt file core_machdep.c was added on branch yamt-nfs-mp on 2009-05-04 08:11:55 +0000
 1.4.4.1 05-Mar-2011  rmind sync with head
 1.5.22.1 18-May-2014  rmind sync with head
 1.5.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.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.7.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.260 29-May-2021  mrg report to the scheduler if we have different speed cpus.
 1.259 24-Jan-2021  mrg branches: 1.259.4; 1.259.6;
avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.258 17-Jan-2021  mrg set machine_model[] earlier, so that bootstrap can use it.

also, avoid "extern <variable>" in .c files, and add
idempotency to autoconf.h.
 1.257 05-Dec-2020  mrg for boot -1, don't attach more than the boot CPU most others
 1.256 13-Jun-2020  ad branches: 1.256.2;
g/c vm_page_zero_enable
 1.255 01-Oct-2019  chs in many device attach paths, allocate memory with KM_SLEEP instead of KM_NOSLEEP
and remove code to handle failures that can no longer happen.
 1.254 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.253 01-Feb-2018  mrg branches: 1.253.2; 1.253.4;
"save fp ipi" is an interrupt type counter, mark it so.
 1.252 17-Jan-2018  mrg fix previous:
CPUFLG_SUN4CACHEBUG was renamed to CACHE_TRAPPAGEBUG and moved
into the cacheinfo. don't revive the no longer used value, but
fix the non-sun4m code to match cpu.c 1.251.
 1.251 16-Jan-2018  mrg implement cpuctl identify for sparc and sparc64.

sparc:
- move enum vactype and struct cacheinfo into cpu.h
- move the cache flags from cpuinfo.flags into CACHEINFO.c_flags
(this allows the new cache_printf_backend() to see them.)
remove unused CPUFLG_CACHEIOMMUTABLES and CPUFLG_CACHEDVMA.
- align xmpsg to 64 bytes
- move cache_print() into cache_print.h so it can be shared with
cpuctl. it only depends upon a working printf().
- if found, store the CPU node's "name" into cpu_longname. this
changes the default output to show the local CPU not the
generic CPU family. eg:
cpu0 at mainbus0: mid 8: Ross,RT625 @ 90 MHz, on-chip FPU
vs the generic "RT620/625" previously shown.
- for each CPU export these things:
- name
- fpuname
- mid
- cloc
- freq
- psr impl and version
- mmu impl, version, and number of contexts
- cacheinfo structure (which changed for the first time ever
with this commit.)

sparc64:
- add a minimal "cacheinfo" structure to export the i/d/e-cache
size and linesize.
- store %ver, cpu node "name" and cacheinfo in cpu_info.
- set cpu_info ver, name and cacheinfo in cpu_attach(), and
export them via sysctl, as well as CPU ID and clock freq

cpuctl:
- add identifycpu_bind() that returns false on !x86 as their
identify routines do not need to run on a particular CPU to
obtain its information, and use it to avoid trying to set
affinity when not needed.
- add sparc and sparc64 cpu identify support using the newly
exported values.
 1.250 02-Dec-2017  macallan - return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.249 18-Jan-2017  macallan branches: 1.249.6;
be more specific when identifying SuperSPARC CPUs
 1.248 25-Jul-2014  nakayama branches: 1.248.2; 1.248.4; 1.248.8; 1.248.12;
Backout using humanize_number(9) in clockfreq().
humanize_number(9) cannot handle a fraction part and doesn't
match the intention of clockfreq().

Also backout the changes caused by the fallout of clockfreq().

Fixed outputs:

-cpu0 at mainbus0: MB86904 @ 170 MHz, MB86910 or WTL1164/5 FPU
+cpu0 at mainbus0: MB86904 @ 170 MHz, MB86910 or WTL1164/5 FPU

-sbus0 at iommu0: clock = 21250 MHz
+sbus0 at iommu0: clock = 21.250 MHz

-cpu0 at mainbus0: SUNW,UltraSPARC-II @ 449 MHz, CPU id 0
+cpu0 at mainbus0: SUNW,UltraSPARC-II @ 449.971 MHz, CPU id 0
 1.247 04-Jun-2014  martin Patch from Nobuyoshi SATO: scale secondary cpu frequency in attach message
just like the primary one.
 1.246 20-May-2014  rmind Put malloc.h back; we still need it.
 1.245 19-May-2014  rmind Implement MI IPI interface with cross-call support.
 1.244 15-Apr-2014  macallan cpu0 at mainbus0: mid 8: RT620/625 @ 125000 MHz, on-chip FPU
unfortunately that's too good to be true, so print frequency in MHz when we
say it's in MHz
 1.243 27-Mar-2014  christos branches: 1.243.2;
correct/add protection against snprintf overflow.
 1.242 26-Mar-2014  christos kill sprintf
 1.241 24-Mar-2014  christos use cpu_{g,s}etmodel
 1.240 16-Nov-2013  mrg - convert CPU_INFO_ITERATOR in the !MP case to be __unused, and convert
all the iterators to use it
- print the right variables in nmi_hard_msiiep() (thanks set-but-unused)
- move variable inside usage #ifdef
- use (void) instead of a "volatile int" junk variable
- remove unused variables
 1.239 27-Oct-2012  chs branches: 1.239.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.238 31-Jul-2012  martin branches: 1.238.2;
Ifdef MSIIEP differently, so krups actually boots again.
 1.237 31-Jul-2012  martin Make KRUPS kernel buildable again
 1.236 29-Jul-2012  matt Fix more -fno-common fallout.
 1.235 11-Mar-2012  mrg move IPI debugging all inside DEBUG, but disable it by default.
 1.234 15-Aug-2011  mrg branches: 1.234.2; 1.234.6; 1.234.8;
re-introduce the NULL savefpstate IPI checks and evcnts. something
is Wrong with GCC 4.5.3 and these trigger. i haven't seen anything
else particularly wrong so for now this will allow sparc to switch
to GCC 4.5, which otherwise seems to be working very well for me.

sigh. i'm going to file a PR to research what is really wrong here.
 1.233 17-Jul-2011  mrg convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.232 20-Feb-2011  mrg add some #if 0'ed code to turn the xcall() timeout into a hard panic.
probably put this under DIAGNOSTIC when it is later properly working.
 1.231 20-Feb-2011  mrg remove the evcnt for NULL struct fpstate * ipi, and switch over to an
explicit panic() if we get one.

i'm pretty sure that converting xmpsg_lock from IPL_VM to IPL_SCHED
fixed this problem properly. i have not seen the evcnt trigger since
that change, nor have several others queried.
 1.230 15-Feb-2011  mrg remove unused CPUFLG_READY and CPU_NOTREADY() macro.
 1.229 14-Feb-2011  mrg add a "mach xcall" command to dump info about each cpus xpmsg{} values.

while here, move the prototype for cpu_debug_dump() to cpuvar.h and
avoid the copy in db_interface.c.
 1.228 04-Feb-2011  mrg in xcall(), use a (static) errbuf if we timeout, so we can build the whole
message up for a single call to printf_nolog(). this should get rid of
these messages that report no cpus answered. eg:

xcall(cpu0,0xf000868c): couldn't ping cpus:
vs
xcall(cpu0,0xf000868c): couldn't ping cpus: cpu1
 1.227 27-Jan-2011  mrg consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters. beyond the extra info, it seems to help avoid some
of these counters getting corrupted due to unlocked multiple accesses.

adjust the xcallintr() from xcall() hack so that we don't count these
events as interrupts. align the existing evcnt name to count this.
 1.226 27-Jan-2011  mrg to quote a new comment:

* There's a deadlock potential between multiple CPUs trying
* to xcall() at the same time, and the thread that loses the
* race to get xpmsg_lock is at an IPL above the incoming IPI
* IPL level, so it sits around waiting to take the lock while
* the other CPU is waiting for this CPU to handle the IPI and
* mark it as completed.
*
* If we fail to get the mutex, and we're at high enough IPL,
* call xcallintr() if there is a valid msg.tag.

this seems to fix the xcall() failed to ping cpus problem.
idea from martin, tested by macallan and myself.
 1.225 22-Jan-2011  mrg convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load
when running with multiple active CPUs.
 1.224 13-Jan-2011  mrg branches: 1.224.2; 1.224.4;
introduce a hack to workaround the savefpstate IPI get's NULL
struct fpstate *.

add a new entry point ipi_savefpstate() that is used for this IPI
instead of the plain ipi_savefpstate(). check for %o0 being NULL,
and if so, just return.

add event counters for the savefpstate IPI, and another one for
when it detects the NULL problem.

make the cpu_info struct xmpsg be aligned to a single cache line.

with this change applied (and another minor change in testing) my
SS20 with dual SM75's has survived for 17 hours on build.sh -j5,
and has reported 7 NULL savefps. (the minor change seems to have
a significant effect at reducing this number, but more testing is
needed for it.)


XXX: this is horrible and we really need to find the real problem
XXX: but this should let people use sparc smp again, and fixes
XXX: for the real problem can be tested by seeing if any of the
XXX: savefp IPI null counter becomes non-zero.
 1.223 22-Jun-2010  rmind Implement high priority (XC_HIGHPRI) xcall(9) mechanism - a facility
to execute functions from software interrupt context, at SOFTINT_CLOCK.
Functions must be lightweight. Will be used for passive serialization.

OK ad@.
 1.222 31-May-2010  mrg add #if 0'ed implementation of xc_send_ipi(), to be used shortly.
 1.221 23-Jan-2010  mrg branches: 1.221.2; 1.221.4;
rename cpu_info{}::cpu_name member to cpu_longname, to avoid a potential conflict
with <sys/cpu.h>.
 1.220 20-Dec-2009  mrg minor KNF.
 1.219 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.218 11-Jun-2009  tsutsui Call cache_flush_all() in getcpuinfo().
Not sure if it's actually necessary, but it fixes panic
"makememarr: cannot find "memory" node" on RT626 HyperSPARC.
Ok'ed by martin@.
 1.217 31-May-2009  mrg - bump the size of cpus[] by one, so we have a NULL pointer at the end,
from tsutsui
- for MP kernels, copy the loop to find the bootcpu in mainbus_attach()
into getcacheinfo_obp() so we can get cache properties on the bootcpu
before calling main()
- in getcpuinfo(), move the call of getmid() before the call to
getcacheinfo() so that the above change to getcacheinfo_obp() can work
- move the struct cpu_info setup to the end of the initial kernel page
setup and don't access this space until after we have switched to the
kernel pagetables
- revive most of the old CPUINFO_VA alignment/congruency code from the
old alloc_cpuinfo_global_va() function, and ensure that all cpuinfo
structures are sanely aligned. this makes hypersparc work again
- introduce a new way to free the wasted pages back to UVM, as we can't
simply uvm_unmap() them this early in bootstrap


i believe that the first used cpuinfo_data page is still being wasted,
but i haven't checked.
 1.216 30-May-2009  mrg print the curpcb in "mach cpu" output as well.
 1.215 27-May-2009  mrg - use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now


with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a fwe commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.


tested in UP LOCKDEBUG/DEBUG/DIAGNOSTIC kernel as well.
MP kernel with only cpu0 configured panics starting /sbin/init.
have not yet tested on a real UP machine.
 1.214 18-May-2009  mrg - retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)

we still waste one page of space, but this gets SMP much closer to
actually working again.
 1.213 10-Mar-2009  martin Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:

Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.

The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.212 19-Dec-2008  cegger branches: 1.212.2;
use M_ZERO on malloc() and remove subsequent bzero().
 1.211 04-Jun-2008  ad branches: 1.211.6; 1.211.8; 1.211.14;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.210 16-Feb-2008  he branches: 1.210.6; 1.210.8; 1.210.10; 1.210.12;
Remove a now-superfluous & after the change to spc_lwplock in sched.h.
 1.209 14-Feb-2008  ad Make schedstate_percpu::spc_lwplock an exernally allocated item. Remove
the hacks in sparc/cpu.c to reinitialize it. This should be in its own
cache line but that's another change.
 1.208 05-Jan-2008  ad Fix includes
 1.207 17-Oct-2007  garbled branches: 1.207.2; 1.207.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.206 08-Oct-2007  ad Merge run time accounting changes from the vmlocking branch. These make
the LWP "start time" per-thread instead of per-CPU.
 1.205 01-Aug-2007  macallan branches: 1.205.2; 1.205.4; 1.205.6;
fix the fix - do not impose all those extra cache ops on all supersparcs,
only those without external cache
 1.204 31-Jul-2007  macallan SuperSPARCs without cache controller need some extra cache flushs
With this a MULTIPROCESSOR kernel works again with a pair of SM50
 1.203 28-May-2007  mrg branches: 1.203.2; 1.203.4;
cpu_attach(): in the MP case, fix up idle lwp info as well as lwp0.l_cpu.
for LOCKDEBUG, mutex_destroy() the cpu0 spc_lwplock with the global
cpuinfo VA, and re-mutex_init() it with the per-cpu address that is only
now available. for non-boot cpus, be sure to also initialise curlwp to
the idle lwp.

xcall(), pmap_quiet_check(), pmap_pmap_pool_ctor(), pmap_pmap_pool_dtor(),
and pmap_enu4m(): don't care about cpus that have not been attached yet.
 1.202 19-May-2007  mrg fix a compile error #ifdef MULTIPROCESSOR. does not boot yet...
 1.201 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.200 04-Mar-2007  mrg branches: 1.200.2; 1.200.4; 1.200.10;
fix fall out from caddr_t changes.
 1.199 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.198 07-Jun-2006  kardel branches: 1.198.12;
convert to timecounters (from branch simonb-timecounters)
 1.197 16-Nov-2005  uwe branches: 1.197.4; 1.197.6; 1.197.8; 1.197.14;
Use uint<N>_t. Drop trailing whitespace.
 1.196 14-Nov-2005  uwe ANSIify one function I missed in previous.
 1.195 14-Nov-2005  uwe branches: 1.195.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.194 01-Nov-2005  bjh21 Put the "cache chip bug" message back on a line of its own after the CPU type
is announced, which is where it was before 1997. This finally stops the
CPU attachment message overflowing a line on an ELC.
 1.193 25-Oct-2005  uwe Compute c_totalsize for split caches correctly: it's max, not sum (and
we even have that documented in cache.h). Initialize c_nlines for
split caches.

This should fix srmmu cache flush routines for split I/D caches that
has been broken since cache.c revision 1.79 started using c_nlines.
 1.192 19-Jun-2005  thorpej branches: 1.192.2; 1.192.4;
Move common Sun ID PROM definitions into <dev/sun/idprom.h>.
 1.191 16-Jun-2005  briggs Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.190 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.189 11-Apr-2005  perseant Ensure that "align" is a power of two before passing it as an argument
to uvm_map(). Approved by pk@.
 1.188 09-Apr-2005  yamt alloc_cpuinfo_global_va: don't bother to specify alignment to uvm_map.
we'll do a partial unmap dance later anyway. PR/29924.
 1.187 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.186 07-May-2004  pk branches: 1.186.4; 1.186.6; 1.186.10;
viking_module_error: check for unconfigured cpus.
 1.185 17-Apr-2004  pk Remove the cache_flush() trampoline; it's no longer directly cross-called.
Instead, implement the MP parts in terms of cross-callable vcache_flush_range()
function.
 1.184 17-Apr-2004  pk Add support for fast cross call handlers that execute in the trap window
on the destination CPU. The `fast handler' address takes the place of the
unused fourth argument to xcall().
 1.183 15-Apr-2004  pk xcall: increase spin-out; fix diag output.
 1.182 03-Apr-2004  chs don't complain about mid == 0 on SUN4D, it's normal there.
 1.181 17-Mar-2004  pk branches: 1.181.2;
Rename PROM_getprop*() => prom_getprop*().
 1.180 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.179 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.178 01-Aug-2003  pk Fix initialisation of the module_viking_sun4d structure.
 1.177 16-Jul-2003  pk viking_getmid(): don't try to read MXCC registers on non-MXCC machines.
cpu_attach(): if `bootmid' could not be determined early set it to the MID
of the first attaching CPU.
 1.176 15-Jul-2003  lukem __KERNEL_RCSID()
 1.175 02-Apr-2003  thorpej branches: 1.175.2;
Use PAGE_SIZE rather than NBPG.
 1.174 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.173 23-Jan-2003  pk Optimize xcall() et.al. further by maintaining a cpuset mask of all CPUs
marked ready. This saves repeated testing for NULL pointers and the
CPUFLG_READY flag.
Also use a separate flag variable to signal xcall completion. This saves a
load and a pipeline stall.
 1.172 23-Jan-2003  pk Shave some code off xcall().
 1.171 23-Jan-2003  pk LWPify cpu_debug_dump().
 1.170 21-Jan-2003  sjg Don't hide bootmid behind MULTIPROCESSOR.
 1.169 20-Jan-2003  pk Remove the restriction that the boot CPU must be the first CPU in the order
as it is presented by the PROM. This is actually amazingly less trivial
than it looks at first, since the finding the Module ID that's currently
executing your code is specific for each module type and/or manufacture.
 1.168 20-Jan-2003  pk xcall(): two more printf => printf_nolog
 1.167 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.166 16-Jan-2003  pk mp_{pause,resume,halt}_cpus(): check for cpus==NULL.
 1.165 16-Jan-2003  pk Remove some accidental garbage.
 1.164 16-Jan-2003  pk Rename the current mp_{pause,resume}_cpus() => mp_{pause,resume}_cpus_ddb().
Implement mp_pause_cpus/mp_resume_cpus on top of the PROM services.
 1.163 16-Jan-2003  pk What do you know.. the prom_cpu{stop,idle,resume} function appear to be
returning a success/fail flag. For now, use it to be informative.
 1.162 16-Jan-2003  pk * Implement mp_halt_cpus()
* xcall: use printf_nolog()
 1.161 14-Jan-2003  pk xcall: raise IPL to splsched() to prevent interrupts that take schedlock.
Otherwise we have a locking order problem with schedlock and xmsglock.
 1.160 13-Jan-2003  mrg remove cpu_hatched, cpu_hatch_sc and cpu_hatchstack. the first can use
the cpi->flags, the second is unused and the third is also cpi-idle_u.
 1.159 13-Jan-2003  pk Use print_nolog() from xcall(), to avoid confounding things even further
by re-entering the scheduling code to wakeup syslog waiters.
 1.158 12-Jan-2003  pk Use per-CPU virtual addresses for pmap_copy_page() & pmap_zero_page().
 1.157 10-Jan-2003  pk Replace `want_resched' and `want_ast' globals by per-CPU variables.
 1.156 09-Jan-2003  mrg - s/xpmsg11/xpmsg15/
- clean up
- no need to reset the msg.tag
 1.155 08-Jan-2003  pk Avoid external declaration for the dummy `ross_pend' variable.
 1.154 08-Jan-2003  pk Initialise the secondary CPUs' `spc_runtime'.
 1.153 07-Jan-2003  mrg - add a new message tag for level15 software NMI, and switch ddb to use this
rather than the level13 software intr xpmsg area. now DDB IPI's don't lock
the xpmsg_lock and we avoid recursion and more.
- don't actually use cpuinfo.msg.lock yet, xpmsg_lock suffices.
- reread the pending register on mbus hypersparc cpus to avoid bugs in the
h/w that cause IPI's to be missed.
 1.152 07-Jan-2003  pk #include <sys/kernel.h> for `cold'.
 1.151 07-Jan-2003  pk xcall: use splclock() to prevent interrupts that want the kernel lock.
 1.150 03-Jan-2003  mrg remove a now bogus comment from xcall()
 1.149 03-Jan-2003  pk xcall(): consult the `cpuset' argument for posting the cross calls.
 1.148 03-Jan-2003  pk reverse mailbox physical address check: now warn if it's not I/O space.
 1.147 02-Jan-2003  mrg don't try to setup MXCC registers on non-primary CPU's on systems without
SMP support.
 1.146 01-Jan-2003  pk prom mailbox map: look for the property `mailbox-virtual' first.
 1.145 31-Dec-2002  pk * map the PROM CPU mailbox if available.
* map MXCC error/status registers if available.
* add MXCC-specific module error interrupt handler.
* use high priority interrupt level in mp_pause_cpus()
 1.144 28-Dec-2002  mrg rename CPU_READY() to CPU_NOTREADY() seeing that's what it checks.
 1.143 22-Dec-2002  mrg change what 'hw.model' reports to be more inline with other netbsd ports, as
well as reporting the actual machine model & cpu, rather than first configured
CPU. changes for two machines are:

old:
hw.model = TMS390Z50 v0 or TMS390Z55 @ 75 MHz, on-chip FPU
hw.model = SUNW,UltraSPARC @ 143.002 MHz, version 0 FPU

new:
hw.model = SUNW,SPARCstation-20 (TMS390Z50 v0 or TMS390Z55 @ 75 MHz, on-chip FPU)
hw.model = SUNW,Ultra-1 (SUNW,UltraSPARC @ 143.002 MHz, version 0 FPU)

as per discussion on port-sparc & port-sparc64.
 1.142 21-Dec-2002  pk * getcacheinfo_obp(): also initialise the cacheinfo i/d associativity fields
in the case of a unified cache.
* xcall(): slightly optimise the `wait for other CPUs' loop.
 1.141 19-Dec-2002  pk Mark CPUs that did not spin up properly and don't enable them later on.
 1.140 19-Dec-2002  pk Brush-up the generic cross-call routine and use it to implement the SMP
cache flush ops.
Also a standard soft interrupt handler for standard cross-call notification
reserving the NMI level 15 softint for urgent cross calls.
 1.139 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.138 15-Dec-2002  pk Disable `unimplemented flush' traps during boot. Keep it disabled on
non-MULTIPROCESSOR kernels.
 1.137 29-Nov-2002  pk Always get the `mid' cpu property. Whine if it's not set on an actual
multi-processor machine.
 1.136 29-Nov-2002  pk Find the CPU architecture version early in the bootstrap phase, and switch
to the V8 specific .mul/.div/.rem routines while we still have a writable
.text section.
 1.135 28-Nov-2002  pk Not all sun4m platforms have version 8 sparc CPUs. So go out to the PROM
and get the CPU architecture version from the PROM cpu node `sparc-version'
property.
 1.134 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.133 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.132 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.131 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.130 23-Aug-2002  thorpej Add autoconfiguration glue for the Sun4d "cpu-unit". Each processor
board has 2 CPU units (one for each processor), one of which also has
a "bootbus", to which the serial ports, etc. are attached.

We can now probe/attach CPUs on a SPARCserver 1000.
 1.129 09-Aug-2002  tsutsui Fix cacheinfo.c_nlines for sun4 and sun4c machines.
(they are not used anyway..)
 1.128 17-Jul-2002  thorpej More cache/cpu stuff common to sun4m and sun4d. Note the sun4d
machines always use the Viking CPU, and cache info is not available
from the PROM, so we have to hard-code it in that case.

Rearrange some stuff to make it easier to share.
 1.127 02-Jun-2002  drochner move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling
 1.126 25-Jan-2002  pk branches: 1.126.8;
Implement the sun4c hardware-assisted page flush operation in a separate
function.
 1.125 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.124 03-Oct-2001  chs branches: 1.124.4;
use pmap_k{enter_pa,remove}() where appropriate.
 1.123 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.122 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.121 10-Jul-2001  mrg branches: 1.121.2;
use CPU_READY(). add cross_call() code.
 1.120 07-Jul-2001  mrg branches: 1.120.2;
- replace CPUFLG_STARTUP with new CPUFLG_READY scheme, used after startup has
occured. cpus now spin waiting for new `go_smp_cpus' variable to go non-zero.
- new xpmsg_lock that must held around all cross call activity. new macros:
LOCK_XPMSG() and UNLOCK_XPMSG().
- delete delay(1)/cache_flush gone from raise_ipi_wait_and_unlock(), it incurred
a stupid performance penalty.
 1.119 07-Jun-2001  mrg more SMP work:

make IPI's work. modify boot_secondary_processors() to clear the startup flag
in each cpu. new raise_ipi_wait_and_unlock() that calls raise_ipi(), waits
for the cpu to acknowledge it got the message, and then unlocks the msglock.
use the new framework in mp_{pause,resume}_cpus(). nmi_soft() takes a
`struct trapframe *', to be used by ddb.
 1.118 26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.117 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.116 16-Mar-2001  mrg #ifdef DDB, add new function cpu_debug_dump(). define CPU_INFO_ITERATOR and
CPU_INFO_FOREACH.
 1.115 06-Mar-2001  pk * A couple of `#if defined(SUN4M)' should be `#if defined(MULTIPROCESSOR)'
* Print notice if not all CPUs were attached
* Switch to SMP version of cache flush routines in just one place: in
cpu_attach() after all known CPUs have been configured.
 1.114 05-Mar-2001  pk branches: 1.114.2;
mp_{pause,resume}_cpu(): avoid crash when cpu(s) not yet configured.
 1.113 03-Mar-2001  pk alloc_cpuinfo: zero all the memory we allocate; not just the `cpuinfo' part.
cpu_attach: initialize `curpcb->pcb_wim' for each additional CPU.
 1.112 02-Mar-2001  pk Initialize the IPI message locks.
 1.111 28-Feb-2001  pk Make sure that e.g. myetheraddr() has a valid idprom pointer as soon as
possible on sun4, since it may be used before the clock attaches.
 1.110 21-Jan-2001  christos fix bit rot so that MP kernel compiles s/cpu_no/ci_cpuid/
 1.109 11-Nov-2000  pk Rename storage for the sun4 idprom structure to `sun4_idprom_store'.
 1.108 19-Sep-2000  pk MULTIPROCESSOR: if the cache flush functions are no-ops on a single
processor, they can be no-ops in the MP case as well.
 1.107 10-Sep-2000  pk Turn off page zeroing in the idle loop; an unidentified bug causes (very
sporadic) user process corruption.
 1.106 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.105 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.104 05-Jun-2000  pk branches: 1.104.2;
Re-arrange code to flush physically indexed caches:

* replace `flush by line' function with a `flush by page' funtion, which
also takes an argument to indicate that write-back caches need not
validate its backing memory.

* use this function when allocating page table memory to flush the cache
before mapping it into kernel virtual space.

* also use it in pmap_{zero,copy}_page(), so we can safely use non-cacheable
access in there.
 1.103 03-Jun-2000  pk Make sure to have the cache info before allocating the global cpu_info
virtual addresses.
 1.102 02-Jun-2000  pk Re-initialize `proc0.p_cpu' after allocating the global `cpu_info'
address for the boot cpu (XXX)
 1.101 31-May-2000  pk Initialize `ci_self' on all CPUs.
Check `cpuinfo' pointers in mp_pause_cpus() & mp_resume_cpus()
 1.100 31-May-2000  pk Fix a couple of typos.
 1.99 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Fix a bug where all cpu_info structures except for the boot CPUs
would exist at both a CPU-local VA (CPUINFO_VA) and a gloal VA;
The boot CPU's existed only a CPUINFO_VA.
- Add a self-reference pointer to the cpu_info that references the
global address in the MULTIPROCESSOR case. Just allow it to reference
the `local' VA in the single-processor case, as CPUINFO_VA is global
enough when there's only one processor to care about. Change curcpu()
to return the global address.
 1.98 30-Apr-2000  pk branches: 1.98.2;
Allow for CPU specific page clear and page copy functions.
 1.97 16-Dec-1999  thorpej Provide cpu_boot_secondary_cpus().
 1.96 27-Nov-1999  mrg add some missing #ifdef SUN4M to the MP-handling code.
 1.95 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.94 24-Jun-1999  pk branches: 1.94.2; 1.94.4; 1.94.8;
When overriding cache flush functions for specific cpu models, make
sure to update the correct function pointers in `cpuinfo'.
 1.93 20-May-1999  pk Operate Hypersparc cache in write-back mode again.
Remove `hypersparc under construction' message.
 1.92 31-Mar-1999  pk branches: 1.92.2; 1.92.4; 1.92.6;
* Pull in more uvm prototypes.
* Retrieve MID on all modules.
 1.91 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.90 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.89 17-Mar-1999  pk Shouldn't call getpropint() on old proms: only get a CPU's `mid' if needed.
 1.88 27-Feb-1999  pk Do not call printf() from a CPU that is spinning up; defer the probe
messages to cpu_attach() where the boot processor takes care of them.
This also necessitates a slight change in the way the FPU name is stored.
 1.87 14-Feb-1999  pk Use the PROMLIB interface.
 1.86 24-Oct-1998  pk branches: 1.86.2;
Define and use CPU pause/resume IPI messages (until such times that I know
what the prom supplied versions actually do).
 1.85 14-Oct-1998  pk Don't allocate two stacks per CPU.
Minor attach-time message change.
 1.84 13-Oct-1998  pk `ncpu != 0' doesn't make much sense when deciding what CP info to print.
 1.83 13-Oct-1998  pk We use MULTIPROCESSOR explicitly here, so pull in "opt_multiprocessor.h".
 1.82 13-Oct-1998  pk Add missing `return'.
 1.81 12-Oct-1998  pk Make `cpcb' (current u.area) a per-CPU variable.
Brace some MP-only code with `#ifdef MULTIPROCESSOR'.
 1.80 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.79 11-Oct-1998  pk Allocate a private PCB, kernel stack and interrupt stack for each processor.
As a result, the stack setup code in locore.s changes slightly in
the MULTIPROCESSOR case. Also, make the stack redzone barrier (for
debugging only) a per-CPU entity.
 1.78 09-Oct-1998  pk More `#if defined(MULTIPROCESSOR)'s.
 1.77 08-Oct-1998  pk Find out about the number of CPUs in the system before starting device
configuration, so we can build a cpus[] array without "holes".
 1.76 30-Sep-1998  pk Make the current FPU owner (`fpproc') a per-CPU entity. Unresolved issue
as yet: lazy FPU context switching may require co-operation from other
CPUs.
 1.75 26-Sep-1998  pk Implement mp_pause_cpus() and mp_resume_cpus(): pause and resume all
CPUs except the one running this code.
 1.74 26-Sep-1998  pk Use CPU start function in obp.c
 1.73 22-Sep-1998  pk Introduce a `flush entire cache' method.
 1.72 22-Sep-1998  pk Keep the per-processor interrupt status in the cpuinfo structure.
For now, map them to the fixed virtual addresses set up early in autoconf.c
 1.71 21-Sep-1998  pk We no longer need to access memerr() through a function pointer.
 1.70 20-Sep-1998  pk Split memory fault status function into `synchronous' and `asynchronous'
versions.
 1.69 16-Sep-1998  pk Make all cpu info structures accessible through an array `cpus[_MAXNCPUS]'.
 1.68 15-Sep-1998  pk sub-arch protection.
 1.67 14-Sep-1998  pk Collect redundant code into cpu_setup().
 1.66 12-Sep-1998  pk Machinery to configure multiple CPUs. All CPUs found are spun up from the
auto-configuration cpu_attach() function using the firmware.
Currently, all CPUs except the one used to boot end up in an idle loop
in locore.
 1.65 07-Sep-1998  pk De-couple the CPU info structure from auto-configuration structures.
 1.64 06-Sep-1998  pk Sanitize memerr*() a bit.
 1.63 26-Jul-1998  pk Add a cpu-specific function to flush a pure virtually-indexed/virtually-tagged
cache, which needs to be flushed at context switch.
 1.62 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.61 12-Jan-1998  thorpej Update for changes to config.
 1.60 22-Nov-1997  tv eliminate declarations of global data in <sparc/cpu.h> and declare in
source files, reducing global symblol replication in .o kernel files
 1.59 02-Oct-1997  christos Oops, missed a space in previous formatting change.
 1.58 22-Sep-1997  christos Fix printf formatting; remove extra spaces, add : at the end.
 1.57 18-Sep-1997  pk Check for the `VIKING_PCR_TC' being set, just in case. If it isn't set,
delay the use of the `CPUFLG_CACHEPAGETABLES' flag.
 1.56 15-Sep-1997  pk Hard-code a couple of sun4 cpu-clock speeds.
Fix a printf formatting glitch.
 1.55 10-Sep-1997  pk Turn off "branch folding" in microsparc II processors. This seems to
avoid strange panics happening. Patch suggested by Chris Torek.
 1.54 05-Aug-1997  pk Some cosmetic changes suggested by Brian Baird: cache config msgs & RT625 fpu.
 1.53 04-Aug-1997  pk Hypersparc detection.
 1.52 29-Jul-1997  fair branches: 1.52.2;
%x -> 0x%x
 1.51 08-Jul-1997  pk In the turbosparc's "match" function, test for the `master' CPU, in case
someone ever builds a multi-processor turbosparc module.
 1.50 08-Jul-1997  pk Add FPU version 5 (turbosparc on-chip).

Re-arrange cpuattach() a bit so that more initialization is done before
dealing with the FPU. Some more work is still required to de-couple
FPU detection from the autoconfiguration attach code in SMP systems.
 1.49 07-Jul-1997  pk Clear relevant `cpuinfo' fields upon detection of a cloaked TurboSparc.
 1.48 07-Jul-1997  pk Add `turbosparc_getfaultstatus()' to be used instead of the generic srmmu item.
 1.47 07-Jul-1997  hannken Fix bad parentheses in `getcpuinfo()'.
 1.46 06-Jul-1997  pk Turn off microsparc II compatibility bit in Fujitsu turbosparc processors.
 1.45 06-Jul-1997  pk Use the module info fields `cputype' and `vactype' to hold a processor
family's type and cache information. This can be optionally modified
by the associated `match' routine.
 1.44 02-Jul-1997  pk Defer setting the CACHEPAGETABLES flag until cache_enable().
 1.43 09-Jun-1997  veego Initialize machine from MACHINE and machine_arch from MACHINE_ARCH.
 1.42 06-Jun-1997  veego Add 'char machine_arch[] = "xxx";' for the new sysctl hw.machine_arch.
 1.41 06-May-1997  pk turbosparc: 256 contexts, page tables cannot be cached.
 1.40 18-Apr-1997  pk * Remove ineffective and incorrect cache flush in viking_mmuenable().
* A bunch of cosmetic changes.
 1.39 14-Apr-1997  pk Add CY7C601 to SUN4 cpu section (Sun 4/300, 4/400 series). Noticed by
Ralph Sauther.
 1.38 11-Apr-1997  pk Cypress 605 cache can be run in write-back mode (fingers crossed..).
 1.37 11-Apr-1997  pk Add Cypress 605 with MMU version 0xb (reported by Harald Barth).
 1.36 22-Mar-1997  pk Add a `[ide]c_ncachelines' field to cacheinfo structure; initialize
and use it where appropriate.
Add `swift' and `turbosparc' cache enable function.
 1.35 22-Mar-1997  pk For each major "module", define a separate set of MMU control register bits.
 1.34 21-Mar-1997  pk viking: flush cache before enabling MMU.
 1.33 21-Mar-1997  pk Set pcache_flush_line function pointer for correct cache configuration.
 1.32 21-Mar-1997  pk Store cache associativities in the `cacheinfo' structure, and use it
in computing the cache "alias distance" and in the viking cache line
flush function.
 1.31 20-Mar-1997  pk Add hook for flushing a single cache line.
 1.30 12-Mar-1997  pk Turn off "cache pagetables bit" on non-MXCC modules.
 1.29 12-Mar-1997  pk Correct output from cpumatch_unknown() and add missing viking variant
to cpu table (noticed by Andrew Gillham).
 1.28 11-Mar-1997  pk Re-write of CPU/MMU detection code.

Use a table driven classification based on CPU and MMU implementation/version
fields. Each CPU class or module defines a collection of routines that
implement CPU or MMU specific operations that can collect detailed setup
information.

All information is collected in a `cpu_softc' structure provided by the
auto-configuration code. However, in the interest of SMP support this
structure is located at a fixed virtual address identified by the
symbol `cpuinfo'. The `boot' CPU currently uses the the physical page(s) at
address 0x2000 for its cpuinfo. Consequently, the fixed virtual address
will be `KERNBASE+0x2000'.

The cache flush routines for several systems (sun4/4c vs. sun4m;
virtual vs. physical tags) have been factored out. Function pointers
to an appropriate set are located in `cpuinfo'. The former global
`cacheinfo' structure is now also a part of `cpuinfo'. Because of the
fixed virtual address of `cpuinfo' no extra performance penalties
are incurred by this move. In multi-architecture kernels, there's
no longer the need for run-time `cputyp' tests in this part of the system.
 1.27 10-Dec-1996  pk branches: 1.27.6;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.26 13-Oct-1996  christos backout previous kprintf change
 1.25 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.24 12-Jun-1996  pk Add signature for the Fujitsu MB86904 processor.
 1.23 12-Jun-1996  pk Use `ic_*' cacheinfo fields, and in the split-I&D case, derive `c_linesize[l2]'
from from the corresponding `ic_*' and `dc_*' values. This is not perfect,
but it makes SS4s and SS5s run until we have proper per-cpu cache handling.

Use the `cache-physical?' property to determine the value of `vactype'
on sun4m's. If absent, set vactype to VAC_WRITETHROUGH (XXX) else VAC_NONE.

Print simpler sun4m CPU identifier on attach.
 1.22 16-May-1996  abrown branches: 1.22.4;
Copyright police (s/Harvard University/Harvard College/).
 1.21 07-Apr-1996  thorpej Fix slight oversight in previous change.
 1.20 07-Apr-1996  thorpej Make this compile again on a SUN4-only kernel. (Avoid "unused foo"
warnings from gcc -Wall. While the optimizer is smart enough to
eliminate dead code, it looks like the rest of gcc doesn't Get It.)
 1.19 04-Apr-1996  abrown cpu.c: correctly identify Sun4m associative caches
kgdb_stub.c: make it compile again with Sun4m-only kernel
 1.18 31-Mar-1996  pk Accomodate sun4m CPUs and caches (Aaron). Cache handling needs to be
revised.
 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 16-Mar-1996  christos Fix typo in fsrtoname() use && as intended instead of &
 1.15 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.14 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.13 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.12 20-Nov-1994  deraadt copyright/Id cleanup
 1.11 13-Nov-1994  deraadt cache: write-throough/back, and 4/100 has no cache
 1.10 02-Oct-1994  deraadt sun4/300 support works
 1.9 18-Sep-1994  deraadt generalize bus support for match/attach
 1.8 20-Aug-1994  deraadt sun4 cpu types are determined by the idprom.
cache type is determined by the model number.
 1.7 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.6 07-May-1994  deraadt sysctl support
 1.5 26-Nov-1993  deraadt add info about the Pinnacle cpu
 1.4 05-Nov-1993  deraadt now that esp.c is fixed, go back to using the enhanced cache code.
 1.3 27-Oct-1993  deraadt back out of Torek's cache enable code since it makes 1/1+-style
esp chips blow chunks.
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.22.4.1 12-Jun-1996  pk Pull down from trunk:
>rev 1.24: Add signature for the Fujitsu MB86904 processor
>rev 1.23: [...] handle caches on SS4 & SS5 [...]
 1.27.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.52.2.5 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.2.4 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.2.2 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.86.2.1 09-Nov-1998  chs initial snapshot. lots left to do.
 1.92.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.92.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.92.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.92.2.2 25-Jun-1999  perry pullup 1.93->1.94 (pk)
 1.92.2.1 22-Jun-1999  perry pullup 1.92->1.93 (pk): support for hypersparc CPU modules
 1.94.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.94.4.1 15-Nov-1999  fvdl Sync with -current
 1.94.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.94.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.94.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.94.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.94.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.98.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.104.2.1 12-Sep-2000  pk Pullup rev. 1.106->1.107 (approved by thorpej):

> revision 1.107
> date: 2000/09/10 11:32:04; author: pk; state: Exp; lines: +17 -2
> Turn off page zeroing in the idle loop; an unidentified bug causes (very
> sporadic) user process corruption.

(actually applies to Microsparc 1 machines only).
 1.114.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.114.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.120.2.7 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.120.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.120.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.120.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.120.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.120.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.120.2.1 03-Aug-2001  lukem update to -current
 1.121.2.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.121.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.124.4.20 17-Jan-2003  thorpej Sync with HEAD.
 1.124.4.19 15-Jan-2003  thorpej Sync with HEAD.
 1.124.4.18 08-Jan-2003  thorpej Sync with HEAD.
 1.124.4.17 07-Jan-2003  thorpej Sync with HEAD.
 1.124.4.16 03-Jan-2003  pk proc0 -> lwp0
 1.124.4.15 03-Jan-2003  thorpej Sync with HEAD (again).
 1.124.4.14 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.124.4.13 29-Dec-2002  thorpej Sync with HEAD.
 1.124.4.12 19-Dec-2002  thorpej Sync with HEAD.
 1.124.4.11 11-Dec-2002  thorpej Sync with HEAD.
 1.124.4.10 26-Nov-2002  uwe Make this compile with DDB: s/fpproc/fplwp/
 1.124.4.9 18-Oct-2002  nathanw Catch up to -current.
 1.124.4.8 27-Aug-2002  nathanw Catch up to -current.
 1.124.4.7 13-Aug-2002  nathanw Catch up to -current.
 1.124.4.6 01-Aug-2002  nathanw Catch up to -current.
 1.124.4.5 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.124.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.124.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.124.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.124.4.1 03-Oct-2001  nathanw file cpu.c was added on branch nathanw_sa on 2002-01-08 00:27:43 +0000
 1.126.8.3 31-Aug-2002  gehenna catch up with -current.
 1.126.8.2 21-Jul-2002  gehenna catch up with -current.
 1.126.8.1 15-Jul-2002  gehenna catch up with -current.
 1.175.2.6 11-Dec-2005  christos Sync with head.
 1.175.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.175.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.175.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.175.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.175.2.1 03-Aug-2004  skrll Sync with HEAD
 1.181.2.3 30-Oct-2005  riz Pull up following revision(s) (requested by uwe in ticket #5950):
sys/arch/sparc/sparc/cpu.c: revision 1.193
Compute c_totalsize for split caches correctly: it's max, not sum (and
we even have that documented in cache.h). Initialize c_nlines for
split caches.
This should fix srmmu cache flush routines for split I/D caches that
has been broken since cache.c revision 1.79 started using c_nlines.
 1.181.2.2 10-May-2004  tron branches: 1.181.2.2.2; 1.181.2.2.4;
Pull up revision 1.186 (requested by pk in ticket #277):
viking_module_error: check for unconfigured cpus.
 1.181.2.1 24-Apr-2004  jdc Pull up revisions 1.183-1.185 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.181.2.2.4.1 30-Oct-2005  riz Pull up following revision(s) (requested by uwe in ticket #5950):
sys/arch/sparc/sparc/cpu.c: revision 1.193
Compute c_totalsize for split caches correctly: it's max, not sum (and
we even have that documented in cache.h). Initialize c_nlines for
split caches.
This should fix srmmu cache flush routines for split I/D caches that
has been broken since cache.c revision 1.79 started using c_nlines.
 1.181.2.2.2.1 30-Oct-2005  riz Pull up following revision(s) (requested by uwe in ticket #5950):
sys/arch/sparc/sparc/cpu.c: revision 1.193
Compute c_totalsize for split caches correctly: it's max, not sum (and
we even have that documented in cache.h). Initialize c_nlines for
split caches.
This should fix srmmu cache flush routines for split I/D caches that
has been broken since cache.c revision 1.79 started using c_nlines.
 1.186.10.1 30-Oct-2005  jmc Pullup rev 1.193 (requested by uwe in ticket #919)
Compute c_totalsize for split caches correctly: it's max, not sum (and
we even have that documented in cache.h). Initialize c_nlines for
split caches.

This should fix srmmu cache flush routines for split I/D caches that
has been broken since cache.c revision 1.79 started using c_nlines.
 1.186.6.1 12-Feb-2005  yamt - use new apis.
- don't leave page mapped at kva being freed.
 1.186.4.1 29-Apr-2005  kent sync with -current
 1.192.4.2 02-Nov-2005  yamt sync with head.
 1.192.4.1 26-Oct-2005  yamt sync with head
 1.192.2.5 27-Feb-2008  yamt sync with head.
 1.192.2.4 21-Jan-2008  yamt sync with head
 1.192.2.3 27-Oct-2007  yamt sync with head.
 1.192.2.2 03-Sep-2007  yamt sync with head.
 1.192.2.1 21-Jun-2006  yamt sync with head.
 1.195.2.2 22-Nov-2005  yamt sync with head.
 1.195.2.1 14-Nov-2005  yamt file cpu.c was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.197.14.1 19-Jun-2006  chap Sync with head.
 1.197.8.1 26-Jun-2006  yamt sync with head.
 1.197.6.1 27-May-2006  kardel convert to timecounters
 1.197.4.1 09-Sep-2006  rpaulo sync with head
 1.198.12.2 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.198.12.1 12-Mar-2007  rmind Sync with HEAD.
 1.200.10.4 16-Oct-2007  garbled Sync with HEAD
 1.200.10.3 03-Oct-2007  garbled Sync with HEAD
 1.200.10.2 26-Jun-2007  garbled Sync with HEAD.
 1.200.10.1 22-May-2007  matt Update to HEAD.
 1.200.4.1 11-Jul-2007  mjf Sync with head.
 1.200.2.4 09-Oct-2007  ad Sync with head.
 1.200.2.3 20-Aug-2007  ad Sync with HEAD.
 1.200.2.2 09-Jun-2007  ad Sync with head.
 1.200.2.1 27-May-2007  ad Sync with head.
 1.203.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.203.2.1 07-Aug-2007  matt Sync with HEAD.
 1.205.6.1 14-Oct-2007  yamt sync with head.
 1.205.4.3 23-Mar-2008  matt sync with HEAD
 1.205.4.2 09-Jan-2008  matt sync with HEAD
 1.205.4.1 06-Nov-2007  matt sync with HEAD
 1.205.2.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.207.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.207.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.210.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.210.10.4 11-Aug-2010  yamt sync with head.
 1.210.10.3 11-Mar-2010  yamt sync with head
 1.210.10.2 20-Jun-2009  yamt sync with head
 1.210.10.1 04-May-2009  yamt sync with head.
 1.210.8.1 17-Jun-2008  yamt sync with head.
 1.210.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.210.6.1 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.211.14.1 21-Apr-2010  matt sync to netbsd-5
 1.211.8.5 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.211.8.4 16-Feb-2011  bouyer Apply patch, requested my mrg in ticket 1553:
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/pmap.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
- print the curpcb in ddb "mach cpu" output as well.
- bump the size of cpus[] by one, so we have a NULL pointer at the end,
from tsutsui
- for MP kernels, copy the loop to find the bootcpu in mainbus_attach()
into getcacheinfo_obp() so we can get cache properties on the bootcpu
before calling main()
- in getcpuinfo(), move the call of getmid() before the call to
getcacheinfo() so that the above change to getcacheinfo_obp() can work
- move the struct cpu_info setup to the end of the initial kernel page
setup and don't access this space until after we have switched to the
kernel pagetables
- revive most of the old CPUINFO_VA alignment/congruency code from the
old alloc_cpuinfo_global_va() function, and ensure that all cpuinfo
structures are sanely aligned. this makes hypersparc work again
- introduce a new way to free the wasted pages back to UVM, as we can't
simply uvm_unmap() them this early in bootstrap
- make sure to initialise the cpuinfo sz in all cases. noted by martin.
- add per-cpu event counters for lev10 and lev14 interrupts.
- make CPU_INFO_FOREACH() set the iterator count to '0' in the !MP case.
- add some disabled MP code to poke other cpus on level 14 interrupts.
- add a diagnostic to ensure that cpus[0] == cpu0's cpu_info->ci_self
- if a cpu doesn't have any mappings allocated, don't copy them. this
occurs if a cpu isn't attached (such as a MP kernel with only "cpu0"
listed in the config file..)
- fix the previous to compile !MULTIPROCESSOR.
 1.211.8.3 28-Jan-2011  snj Pull up following revision(s) (requested by mrg in ticket #1532):
sys/arch/sparc/sparc/cpu.c: revision 1.215 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.78 via patch
sys/arch/sparc/sparc/genassym.cf: revision 1.57 via patch
sys/arch/sparc/sparc/intr.c: revision 1.103-1.105 via patch
sys/arch/sparc/sparc/locore.s: revision 1.247, 1.250 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.329 via patch

- print the cpu_number() when we get a strayintr().

- use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now

with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a few commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.

convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits. amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement. ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?

XXX the current implementation depends on a couple of things:
XXX - ev_count member of evcnt{} is first and has offset 0
XXX - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it

- remove unused ft_want_ast()
- give nmi_sun* ENTRY() points so they show up in symbols properly
- add some disabled code to use this cpu's idlelwp area when hatching
a cpu, but right now it makes this worse not better...
 1.211.8.2 16-Jan-2011  bouyer Pull up following revision(s) (requested by mrg in ticket #1527):
sys/arch/sparc/sparc/pmap.c: revision 1.327, 1.328
sys/arch/sparc/sparc/cpuvar.h: revision 1.77
sys/arch/sparc/sparc/locore.s: revision 1.245
sys/arch/sparc/sparc/cpu.c: revision 1.214
sys/arch/sparc/sparc/db_interface.c: revision 1.84
- retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)
we still waste one page of space, but this gets SMP much closer to
actually working again.
fix a LOCKDEBUG problem from the previous: need to call pmap_kremove()
on a pre-existing mapping, before installing a new one.
 1.211.8.1 30-May-2009  snj Pull up following revision(s) (requested by mrg in ticket #776):
sys/arch/sparc/sparc/autoconf.c: revision 1.233 via patch
sys/arch/sparc/sparc/cpu.c: revision 1.213 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.76 via patch
sys/arch/sparc/sparc/db_interface.c: revision 1.83 via patch
sys/arch/sparc/sparc/intr.c: revision 1.102 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.325 via patch
sys/arch/sparc/sparc/timer_sun4m.c: revision 1.17 via patch
Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:
Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.
The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.211.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.211.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.212.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.221.4.2 05-Mar-2011  rmind sync with head
 1.221.4.1 03-Jul-2010  rmind sync with head
 1.221.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.224.4.3 05-Mar-2011  bouyer Sync with HEAD
 1.224.4.2 17-Feb-2011  bouyer Sync with HEAD
 1.224.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.224.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.234.8.1 19-Mar-2012  riz Pull up following revision(s) (requested by mrg in ticket #127):
sys/arch/sparc/sparc/cpu.c: revision 1.235
move IPI debugging all inside DEBUG, but disable it by default.
 1.234.6.1 05-Apr-2012  mrg sync to latest -current.
 1.234.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.234.2.2 30-Oct-2012  yamt sync with head
 1.234.2.1 17-Apr-2012  yamt sync with head
 1.238.2.3 03-Dec-2017  jdolecek update from HEAD
 1.238.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.238.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.239.2.1 18-May-2014  rmind sync with head
 1.243.2.1 10-Aug-2014  tls Rebase.
 1.248.12.1 21-Apr-2017  bouyer Sync with HEAD
 1.248.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.248.4.1 05-Feb-2017  skrll Sync with HEAD
 1.248.2.1 21-Mar-2018  martin Pull up following revision(s) (requested by mrg in ticket #1585):
sys/arch/sparc/sparc/cpu.c: revision 1.250 (patch)
sys/arch/sparc/include/cpu.h: revision 1.99 (patch -> cpuvar.h)
sys/arch/sparc/sparc/intr.c: revision 1.119 (patch)

- return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed

With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.

Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.249.6.1 08-Dec-2017  msaitoh Pull up following revision(s) (requested by macallan in ticket #429):
sys/arch/sparc/sparc/cpu.c: revision 1.250
sys/arch/sparc/include/cpu.h: revision 1.99
sys/arch/sparc/sparc/intr.c: revision 1.119
- return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.253.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.253.4.1 10-Jun-2019  christos Sync with HEAD
 1.253.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.256.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.256.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.259.6.1 31-May-2021  cjep sync with head
 1.259.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1 20-Sep-2010  tsutsui branches: 1.1.2; 1.1.4; 1.1.10;
Prepare sparc optimized (by 32 bit add-with-carry insns) cpu_in_cksum()
which is reusing in_cksum_internal() in old sparc/in_cksum.c.

~4% improvements of ttcp(1) xfer rates on SS1+ with le(4).
 1.1.10.2 05-Mar-2011  rmind sync with head
 1.1.10.1 20-Sep-2010  rmind file cpu_in_cksum.c was added on branch rmind-uvmplock on 2011-03-05 20:52:02 +0000
 1.1.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.1.4.1 20-Sep-2010  uebayasi file cpu_in_cksum.c was added on branch uebayasi-xip on 2010-10-22 07:21:32 +0000
 1.1.2.2 09-Oct-2010  yamt sync with head
 1.1.2.1 20-Sep-2010  yamt file cpu_in_cksum.c was added on branch yamt-nfs-mp on 2010-10-09 03:31:53 +0000
 1.19 04-Oct-2025  thorpej Propagate child device handles.
 1.18 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.17 24-Apr-2021  thorpej branches: 1.17.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.16 22-Nov-2020  thorpej branches: 1.16.2;
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.15 17-Jul-2011  mrg branches: 1.15.66;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.14 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.13 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.12 11-Dec-2005  christos branches: 1.12.74; 1.12.76; 1.12.78;
merge ktrace-lwp.
 1.11 27-Jun-2004  pk Always use `full bus space'. In order to implement this more efficiently,
require that all bus tags have pointers to bus_space_read/write functions,
i.e. no run-time hunting for the first "upstream" implementation.
Since this changes the way bus tags should be constructed it makes sense
to do the same thing for the rest of the bus space methods.
So, now bus space tags are generally constructed by copying the parent's bus
tag and then overriding the methods that the bus driver needs to handle,
instead of starting with an empty bus tag and fiiling in only the fields needed.
 1.10 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.9 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.8 15-Jul-2003  lukem __KERNEL_RCSID()
 1.7 01-Jan-2003  thorpej branches: 1.7.2;
Use aprint_normal() for cfprint routines.
 1.6 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.5 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 25-Aug-2002  thorpej branches: 1.3.2; 1.3.4; 1.3.6;
Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.2 25-Aug-2002  thorpej Add a generic function to translate a device address using a
parent's "ranges" property, and use it.
 1.1 23-Aug-2002  thorpej Add autoconfiguration glue for the Sun4d "cpu-unit". Each processor
board has 2 CPU units (one for each processor), one of which also has
a "bootbus", to which the serial ports, etc. are attached.

We can now probe/attach CPUs on a SPARCserver 1000.
 1.3.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.3.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.6.1 25-Aug-2002  jdolecek file cpuunit.c was added on branch kqueue on 2002-09-06 08:41:07 +0000
 1.3.4.2 31-Aug-2002  gehenna catch up with -current.
 1.3.4.1 25-Aug-2002  gehenna file cpuunit.c was added on branch gehenna-devsw on 2002-08-31 14:52:21 +0000
 1.3.2.4 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.3.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.3.2.1 25-Aug-2002  nathanw file cpuunit.c was added on branch nathanw_sa on 2002-08-27 23:45:40 +0000
 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.12.78.1 16-May-2008  yamt sync with head.
 1.12.76.1 18-May-2008  yamt sync with head.
 1.12.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.66.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.16.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.17.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 23-Aug-2002  thorpej branches: 1.2.2; 1.2.4; 1.2.6; 1.2.114; 1.2.116; 1.2.118;
Oops, don't need a DMA tag.
 1.1 23-Aug-2002  thorpej Add autoconfiguration glue for the Sun4d "cpu-unit". Each processor
board has 2 CPU units (one for each processor), one of which also has
a "bootbus", to which the serial ports, etc. are attached.

We can now probe/attach CPUs on a SPARCserver 1000.
 1.2.118.1 16-May-2008  yamt sync with head.
 1.2.116.1 18-May-2008  yamt sync with head.
 1.2.114.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.1 23-Aug-2002  jdolecek file cpuunitvar.h was added on branch kqueue on 2002-09-06 08:41:08 +0000
 1.2.4.2 31-Aug-2002  gehenna catch up with -current.
 1.2.4.1 23-Aug-2002  gehenna file cpuunitvar.h was added on branch gehenna-devsw on 2002-08-31 14:52:21 +0000
 1.2.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.2.2.1 23-Aug-2002  nathanw file cpuunitvar.h was added on branch nathanw_sa on 2002-08-27 23:45:40 +0000
 1.97 17-Jan-2018  mrg fix previous:
CPUFLG_SUN4CACHEBUG was renamed to CACHE_TRAPPAGEBUG and moved
into the cacheinfo. don't revive the no longer used value, but
fix the non-sun4m code to match cpu.c 1.251.
 1.96 17-Jan-2018  christos fix compilation
 1.95 16-Jan-2018  mrg implement cpuctl identify for sparc and sparc64.

sparc:
- move enum vactype and struct cacheinfo into cpu.h
- move the cache flags from cpuinfo.flags into CACHEINFO.c_flags
(this allows the new cache_printf_backend() to see them.)
remove unused CPUFLG_CACHEIOMMUTABLES and CPUFLG_CACHEDVMA.
- align xmpsg to 64 bytes
- move cache_print() into cache_print.h so it can be shared with
cpuctl. it only depends upon a working printf().
- if found, store the CPU node's "name" into cpu_longname. this
changes the default output to show the local CPU not the
generic CPU family. eg:
cpu0 at mainbus0: mid 8: Ross,RT625 @ 90 MHz, on-chip FPU
vs the generic "RT620/625" previously shown.
- for each CPU export these things:
- name
- fpuname
- mid
- cloc
- freq
- psr impl and version
- mmu impl, version, and number of contexts
- cacheinfo structure (which changed for the first time ever
with this commit.)

sparc64:
- add a minimal "cacheinfo" structure to export the i/d/e-cache
size and linesize.
- store %ver, cpu node "name" and cacheinfo in cpu_info.
- set cpu_info ver, name and cacheinfo in cpu_attach(), and
export them via sysctl, as well as CPU ID and clock freq

cpuctl:
- add identifycpu_bind() that returns false on !x86 as their
identify routines do not need to run on a particular CPU to
obtain its information, and use it to avoid trying to set
affinity when not needed.
- add sparc and sparc64 cpu identify support using the newly
exported values.
 1.94 10-Dec-2016  mrg rearrange slightly to enable crash(8) to build.
 1.93 10-Dec-2016  mrg move struct cpu_info and xpmsg into <machine/cpu.h> from
<sparc/sparc/cpuvar.h>. this enables them for crash(8)
and this seems more natural to me anyway.
 1.92 16-Nov-2013  mrg branches: 1.92.4; 1.92.6; 1.92.10;
- convert CPU_INFO_ITERATOR in the !MP case to be __unused, and convert
all the iterators to use it
- print the right variables in nmi_hard_msiiep() (thanks set-but-unused)
- move variable inside usage #ifdef
- use (void) instead of a "volatile int" junk variable
- remove unused variables
 1.91 19-Oct-2013  mrg - remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.90 15-Aug-2011  mrg branches: 1.90.2; 1.90.12; 1.90.16;
re-introduce the NULL savefpstate IPI checks and evcnts. something
is Wrong with GCC 4.5.3 and these trigger. i haven't seen anything
else particularly wrong so for now this will allow sparc to switch
to GCC 4.5, which otherwise seems to be working very well for me.

sigh. i'm going to file a PR to research what is really wrong here.
 1.89 20-Feb-2011  mrg remove the evcnt for NULL struct fpstate * ipi, and switch over to an
explicit panic() if we get one.

i'm pretty sure that converting xmpsg_lock from IPL_VM to IPL_SCHED
fixed this problem properly. i have not seen the evcnt trigger since
that change, nor have several others queried.
 1.88 15-Feb-2011  mrg remove unused CPUFLG_READY and CPU_NOTREADY() macro.
 1.87 14-Feb-2011  mrg add a "mach xcall" command to dump info about each cpus xpmsg{} values.

while here, move the prototype for cpu_debug_dump() to cpuvar.h and
avoid the copy in db_interface.c.
 1.86 27-Jan-2011  mrg consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters. beyond the extra info, it seems to help avoid some
of these counters getting corrupted due to unlocked multiple accesses.

adjust the xcallintr() from xcall() hack so that we don't count these
events as interrupts. align the existing evcnt name to count this.
 1.85 27-Jan-2011  mrg to quote a new comment:

* There's a deadlock potential between multiple CPUs trying
* to xcall() at the same time, and the thread that loses the
* race to get xpmsg_lock is at an IPL above the incoming IPI
* IPL level, so it sits around waiting to take the lock while
* the other CPU is waiting for this CPU to handle the IPI and
* mark it as completed.
*
* If we fail to get the mutex, and we're at high enough IPL,
* call xcallintr() if there is a valid msg.tag.

this seems to fix the xcall() failed to ping cpus problem.
idea from martin, tested by macallan and myself.
 1.84 13-Jan-2011  mrg branches: 1.84.2; 1.84.4;
introduce a hack to workaround the savefpstate IPI get's NULL
struct fpstate *.

add a new entry point ipi_savefpstate() that is used for this IPI
instead of the plain ipi_savefpstate(). check for %o0 being NULL,
and if so, just return.

add event counters for the savefpstate IPI, and another one for
when it detects the NULL problem.

make the cpu_info struct xmpsg be aligned to a single cache line.

with this change applied (and another minor change in testing) my
SS20 with dual SM75's has survived for 17 hours on build.sh -j5,
and has reported 7 NULL savefps. (the minor change seems to have
a significant effect at reducing this number, but more testing is
needed for it.)


XXX: this is horrible and we really need to find the real problem
XXX: but this should let people use sparc smp again, and fixes
XXX: for the real problem can be tested by seeing if any of the
XXX: savefp IPI null counter becomes non-zero.
 1.83 23-Jan-2010  mrg branches: 1.83.4;
rename cpu_info{}::cpu_name member to cpu_longname, to avoid a potential conflict
with <sys/cpu.h>.
 1.82 13-Jan-2010  mrg replace local ci_cpuname[] and use new cpu_name().
 1.81 20-Dec-2009  mrg make CPU_INFO_FOREACH() set the iterator count to '0' in the !MP case.
 1.80 20-Dec-2009  mrg add per-cpu event counters for lev10 and lev14 interrupts.
 1.79 31-May-2009  mrg - bump the size of cpus[] by one, so we have a NULL pointer at the end,
from tsutsui
- for MP kernels, copy the loop to find the bootcpu in mainbus_attach()
into getcacheinfo_obp() so we can get cache properties on the bootcpu
before calling main()
- in getcpuinfo(), move the call of getmid() before the call to
getcacheinfo() so that the above change to getcacheinfo_obp() can work
- move the struct cpu_info setup to the end of the initial kernel page
setup and don't access this space until after we have switched to the
kernel pagetables
- revive most of the old CPUINFO_VA alignment/congruency code from the
old alloc_cpuinfo_global_va() function, and ensure that all cpuinfo
structures are sanely aligned. this makes hypersparc work again
- introduce a new way to free the wasted pages back to UVM, as we can't
simply uvm_unmap() them this early in bootstrap


i believe that the first used cpuinfo_data page is still being wasted,
but i haven't checked.
 1.78 27-May-2009  mrg - use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now


with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a fwe commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.


tested in UP LOCKDEBUG/DEBUG/DIAGNOSTIC kernel as well.
MP kernel with only cpu0 configured panics starting /sbin/init.
have not yet tested on a real UP machine.
 1.77 18-May-2009  mrg - retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)

we still waste one page of space, but this gets SMP much closer to
actually working again.
 1.76 10-Mar-2009  martin Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:

Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.

The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.75 28-Apr-2008  martin branches: 1.75.8; 1.75.10; 1.75.14; 1.75.18;
Remove clause 3 and 4 from TNF licenses
 1.74 08-Jan-2008  martin branches: 1.74.6; 1.74.8; 1.74.10;
cpu_intr_p() for sparc, from Andrew Doran.
 1.73 16-Nov-2007  martin branches: 1.73.6;
Define a simple variant of CPUINFO_FOREACH for non-MULTIPROCESSOR
kernels. The SMP variant does not work early in bootstrap, but I'll
leave that for Andrew to fix ;-)
 1.72 17-Oct-2007  garbled branches: 1.72.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.71 17-May-2007  yamt branches: 1.71.8; 1.71.10; 1.71.14;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.70 04-Mar-2007  christos branches: 1.70.2; 1.70.4; 1.70.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.69 09-Feb-2007  ad branches: 1.69.2;
Merge newlock2 to head.
 1.68 24-Dec-2005  perry branches: 1.68.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.67 11-Dec-2005  christos merge ktrace-lwp.
 1.66 24-Sep-2005  macallan add a function pointer to struct cpu_info:
void idlespin(struct cpu_info *)
which is called whenever the CPU is idle and uvm_pageidlezero() has nothing to
do
 1.65 16-Jun-2005  briggs branches: 1.65.2;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.64 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.63 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.62 17-Apr-2004  pk Remove the cache_flush() trampoline; it's no longer directly cross-called.
Instead, implement the MP parts in terms of cross-callable vcache_flush_range()
function.
 1.61 17-Apr-2004  pk raise_ipi: don't bother fetching the cpu type from memory in order to
avoid one instruction.
 1.60 17-Apr-2004  pk Add support for fast cross call handlers that execute in the trap window
on the destination CPU. The `fast handler' address takes the place of the
unused fourth argument to xcall().
 1.59 10-Apr-2004  pk Expose CPUSET_ALL to non-MULTIPROCESSOR source.
 1.58 23-Jan-2003  pk branches: 1.58.2; 1.58.4;
When stopping a CPU, clear its bit from cpu_ready_mask.
 1.57 23-Jan-2003  pk Optimize xcall() et.al. further by maintaining a cpuset mask of all CPUs
marked ready. This saves repeated testing for NULL pointers and the
CPUFLG_READY flag.
Also use a separate flag variable to signal xcall completion. This saves a
load and a pipeline stall.
 1.56 23-Jan-2003  pk GC the per-CPU message lock.
Move the level 15 msg area further down the cpuinfo structure, as it's
used infrequently.
 1.55 20-Jan-2003  pk Remove the restriction that the boot CPU must be the first CPU in the order
as it is presented by the PROM. This is actually amazingly less trivial
than it looks at first, since the finding the Module ID that's currently
executing your code is specific for each module type and/or manufacture.
 1.54 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.53 12-Jan-2003  pk Use per-CPU virtual addresses for pmap_copy_page() & pmap_zero_page().
 1.52 09-Jan-2003  mrg - s/xpmsg11/xpmsg15/
- clean up
- no need to reset the msg.tag
 1.51 08-Jan-2003  pk Avoid external declaration for the dummy `ross_pend' variable.
 1.50 08-Jan-2003  pk Prepare for per-CPU reschedule and AST requests.
 1.49 07-Jan-2003  mrg - add a new message tag for level15 software NMI, and switch ddb to use this
rather than the level13 software intr xpmsg area. now DDB IPI's don't lock
the xpmsg_lock and we avoid recursion and more.
- don't actually use cpuinfo.msg.lock yet, xpmsg_lock suffices.
- reread the pending register on mbus hypersparc cpus to avoid bugs in the
h/w that cause IPI's to be missed.
 1.48 04-Jan-2003  pk Re-arrange the fields in struct cpu_info such that the most heavily used ones
are together, to reduce cache stomping.
 1.47 03-Jan-2003  pk Define a few XCALL? shorthand macros to avoid clutter.
 1.46 31-Dec-2002  pk * Add level argument to raise_ipi()
* Add diagnostic field members to cpu_info.
 1.45 28-Dec-2002  mrg rename CPU_READY() to CPU_NOTREADY() seeing that's what it checks.
 1.44 19-Dec-2002  pk * mark selected fields of `struct xpmsg' as volatile, instead of the whole
structure.
* change volatile => __volatile
 1.43 19-Dec-2002  pk Mark CPUs that did not spin up properly and don't enable them later on.
 1.42 19-Dec-2002  pk Sprinkle volatiles to avoid register allocation, esp. in cross-call
synchronisation functions used in SMP kernels.
 1.41 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.40 17-Jul-2002  thorpej More cache/cpu stuff common to sun4m and sun4d. Note the sun4d
machines always use the Viking CPU, and cache info is not available
from the PROM, so we have to hard-code it in that case.

Rearrange some stuff to make it easier to share.
 1.39 04-Dec-2001  darrenr branches: 1.39.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.38 10-Jul-2001  mrg branches: 1.38.6;
de-__P()ifify. prototype cross_call().
 1.37 10-Jul-2001  mrg new CPU_READY() macro, determines if a CPU is accepting IPIs.
 1.36 07-Jul-2001  mrg branches: 1.36.2;
- replace CPUFLG_STARTUP with new CPUFLG_READY scheme, used after startup has
occured. cpus now spin waiting for new `go_smp_cpus' variable to go non-zero.
- new xpmsg_lock that must held around all cross call activity. new macros:
LOCK_XPMSG() and UNLOCK_XPMSG().
- delete delay(1)/cache_flush gone from raise_ipi_wait_and_unlock(), it incurred
a stupid performance penalty.
 1.35 08-Jun-2001  mrg need a per-cpu ddb_regs pointer.
 1.34 07-Jun-2001  mrg more SMP work:

make IPI's work. modify boot_secondary_processors() to clear the startup flag
in each cpu. new raise_ipi_wait_and_unlock() that calls raise_ipi(), waits
for the cpu to acknowledge it got the message, and then unlocks the msglock.
use the new framework in mp_{pause,resume}_cpus(). nmi_soft() takes a
`struct trapframe *', to be used by ddb.
 1.33 03-Jun-2001  mrg finish moving context management back to being global. add a new ctx_lock
for context administration.
 1.32 30-May-2001  mrg use _KERNEL_OPT
 1.31 16-Mar-2001  mrg #ifdef DDB, add new function cpu_debug_dump(). define CPU_INFO_ITERATOR and
CPU_INFO_FOREACH.
 1.30 21-Jan-2001  christos branches: 1.30.2;
fix bit rot so that MP kernel compiles s/cpu_no/ci_cpuid/
 1.29 27-Jun-2000  pk Move `DIAGNOSTIC || LOCKDEBUG'-only lock counters to the end of the cpu_info
structure, Just In Case.
 1.28 06-Jun-2000  pk Make the address argument of pcache_flush_page() a `paddr_t'.
 1.27 05-Jun-2000  pk Re-arrange code to flush physically indexed caches:

* replace `flush by line' function with a `flush by page' funtion, which
also takes an argument to indicate that write-back caches need not
validate its backing memory.

* use this function when allocating page table memory to flush the cache
before mapping it into kernel virtual space.

* also use it in pmap_{zero,copy}_page(), so we can safely use non-cacheable
access in there.
 1.26 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Fix a bug where all cpu_info structures except for the boot CPUs
would exist at both a CPU-local VA (CPUINFO_VA) and a gloal VA;
The boot CPU's existed only a CPUINFO_VA.
- Add a self-reference pointer to the cpu_info that references the
global address in the MULTIPROCESSOR case. Just allow it to reference
the `local' VA in the single-processor case, as CPUINFO_VA is global
enough when there's only one processor to care about. Change curcpu()
to return the global address.
 1.25 27-May-2000  mason branches: 1.25.2;
Make compile after scheduler state cleanup.
 1.24 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.23 30-Apr-2000  pk Allow for CPU specific page clear and page copy functions.
 1.22 04-Oct-1999  pk branches: 1.22.2;
Since a context table is now pointing at the correct per-CPU region table
at all times, we can dispense with the hackery that patches the magic entry
at context-switch time.
 1.21 27-Feb-1999  pk Do not call printf() from a CPU that is spinning up; defer the probe
messages to cpu_attach() where the boot processor takes care of them.
This also necessitates a slight change in the way the FPU name is stored.
 1.20 24-Oct-1998  pk Define and use CPU pause/resume IPI messages (until such times that I know
what the prom supplied versions actually do).
 1.19 19-Oct-1998  pk Maintain a current process (`curproc') a per CPU.
 1.18 16-Oct-1998  pk Drop cpuinfo's `L1_ptps'; instead keep a per CPU segment (level 2) page
table descriptor that is used to patch up a region (level 1) page table
associated with a user pmap at context switch time.
 1.17 12-Oct-1998  pk Make `cpcb' (current u.area) a per-CPU variable.
Brace some MP-only code with `#ifdef MULTIPROCESSOR'.
 1.16 11-Oct-1998  pk Allocate a private PCB, kernel stack and interrupt stack for each processor.
As a result, the stack setup code in locore.s changes slightly in
the MULTIPROCESSOR case. Also, make the stack redzone barrier (for
debugging only) a per-CPU entity.
 1.15 08-Oct-1998  pk Define a message structure of inter-processor communication.
 1.14 22-Sep-1998  pk Introduce a `flush entire cache' method.
 1.13 22-Sep-1998  pk Keep the per-processor interrupt status in the cpuinfo structure.
For now, map them to the fixed virtual addresses set up early in autoconf.c
 1.12 20-Sep-1998  pk Split memory fault status function into `synchronous' and `asynchronous'
versions.
 1.11 16-Sep-1998  pk Make all cpu info structures accessible through an array `cpus[_MAXNCPUS]'.
 1.10 12-Sep-1998  pk Add field holding the physical address of the MMU context table.
 1.9 07-Sep-1998  pk De-couple the CPU info structure from auto-configuration structures.
 1.8 06-Sep-1998  pk Sanitize memerr*() a bit.
 1.7 26-Jul-1998  pk Add a cpu-specific function to flush a pure virtually-indexed/virtually-tagged
cache, which needs to be flushed at context switch.
 1.6 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.5 27-Sep-1997  pk Move the per-processor counter register into cpuinfo.
 1.4 06-Jul-1997  pk branches: 1.4.2;
Add two more fields (`cputype' and `vactype') to the module info.
 1.3 20-Mar-1997  pk Add hook for flushing a single cache line.
 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 11-Mar-1997  pk branches: 1.1.2;
Per-CPU information which is collected in cpu_attach().
Many things in here were imported from an earlier version from Aaron
Brown and are not yet used. This version has all the attributes of a
snapshot; more to come as addtional CPU/MMU details get implemented.
 1.1.2.2 12-Mar-1997  is Merge in changes from The Trunk
 1.1.2.1 11-Mar-1997  is file cpuvar.h was added on branch is-newarp on 1997-03-12 13:55:28 +0000
 1.4.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.22.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.22.2.2 11-Feb-2001  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.25.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.30.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.30.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.36.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.36.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.36.2.1 03-Aug-2001  lukem update to -current
 1.38.6.12 15-Jan-2003  thorpej Sync with HEAD.
 1.38.6.11 07-Jan-2003  thorpej Sync with HEAD.
 1.38.6.10 04-Jan-2003  pk Sync with HEAD.
 1.38.6.9 03-Jan-2003  thorpej Sync with HEAD (again).
 1.38.6.8 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.38.6.7 29-Dec-2002  thorpej Sync with HEAD.
 1.38.6.6 19-Dec-2002  thorpej Sync with HEAD.
 1.38.6.5 01-Aug-2002  nathanw Catch up to -current.
 1.38.6.4 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.38.6.3 08-Jan-2002  nathanw Catch up to -current.
 1.38.6.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.38.6.1 10-Jul-2001  pk file cpuvar.h was added on branch nathanw_sa on 2001-11-20 16:31:54 +0000
 1.39.8.1 21-Jul-2002  gehenna catch up with -current.
 1.58.4.1 24-Apr-2004  jdc Pull up revisions 1.59-1.62 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.58.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.58.2.4 24-Sep-2004  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.65.2.5 21-Jan-2008  yamt sync with head
 1.65.2.4 07-Dec-2007  yamt sync with head
 1.65.2.3 03-Sep-2007  yamt sync with head.
 1.65.2.2 26-Feb-2007  yamt sync with head.
 1.65.2.1 21-Jun-2006  yamt sync with head.
 1.68.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.69.2.2 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.69.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.70.10.1 22-May-2007  matt Update to HEAD.
 1.70.4.1 11-Jul-2007  mjf Sync with head.
 1.70.2.2 03-Dec-2007  ad Sync with HEAD.
 1.70.2.1 27-May-2007  ad Sync with head.
 1.71.14.1 18-Nov-2007  bouyer Sync with HEAD
 1.71.10.3 23-Mar-2008  matt sync with HEAD
 1.71.10.2 09-Jan-2008  matt sync with HEAD
 1.71.10.1 06-Nov-2007  matt sync with HEAD
 1.71.8.1 21-Nov-2007  joerg Sync with HEAD.
 1.72.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.72.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.73.6.1 10-Jan-2008  bouyer Sync with HEAD
 1.74.10.4 11-Mar-2010  yamt sync with head
 1.74.10.3 20-Jun-2009  yamt sync with head
 1.74.10.2 04-May-2009  yamt sync with head.
 1.74.10.1 16-May-2008  yamt sync with head.
 1.74.8.1 18-May-2008  yamt sync with head.
 1.74.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.75.18.1 21-Apr-2010  matt sync to netbsd-5
 1.75.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.75.10.5 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.75.10.4 16-Feb-2011  bouyer Apply patch, requested my mrg in ticket 1553:
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/pmap.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
- print the curpcb in ddb "mach cpu" output as well.
- bump the size of cpus[] by one, so we have a NULL pointer at the end,
from tsutsui
- for MP kernels, copy the loop to find the bootcpu in mainbus_attach()
into getcacheinfo_obp() so we can get cache properties on the bootcpu
before calling main()
- in getcpuinfo(), move the call of getmid() before the call to
getcacheinfo() so that the above change to getcacheinfo_obp() can work
- move the struct cpu_info setup to the end of the initial kernel page
setup and don't access this space until after we have switched to the
kernel pagetables
- revive most of the old CPUINFO_VA alignment/congruency code from the
old alloc_cpuinfo_global_va() function, and ensure that all cpuinfo
structures are sanely aligned. this makes hypersparc work again
- introduce a new way to free the wasted pages back to UVM, as we can't
simply uvm_unmap() them this early in bootstrap
- make sure to initialise the cpuinfo sz in all cases. noted by martin.
- add per-cpu event counters for lev10 and lev14 interrupts.
- make CPU_INFO_FOREACH() set the iterator count to '0' in the !MP case.
- add some disabled MP code to poke other cpus on level 14 interrupts.
- add a diagnostic to ensure that cpus[0] == cpu0's cpu_info->ci_self
- if a cpu doesn't have any mappings allocated, don't copy them. this
occurs if a cpu isn't attached (such as a MP kernel with only "cpu0"
listed in the config file..)
- fix the previous to compile !MULTIPROCESSOR.
 1.75.10.3 28-Jan-2011  snj Pull up following revision(s) (requested by mrg in ticket #1532):
sys/arch/sparc/sparc/cpu.c: revision 1.215 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.78 via patch
sys/arch/sparc/sparc/genassym.cf: revision 1.57 via patch
sys/arch/sparc/sparc/intr.c: revision 1.103-1.105 via patch
sys/arch/sparc/sparc/locore.s: revision 1.247, 1.250 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.329 via patch

- print the cpu_number() when we get a strayintr().

- use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now

with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a few commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.

convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits. amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement. ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?

XXX the current implementation depends on a couple of things:
XXX - ev_count member of evcnt{} is first and has offset 0
XXX - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it

- remove unused ft_want_ast()
- give nmi_sun* ENTRY() points so they show up in symbols properly
- add some disabled code to use this cpu's idlelwp area when hatching
a cpu, but right now it makes this worse not better...
 1.75.10.2 16-Jan-2011  bouyer Pull up following revision(s) (requested by mrg in ticket #1527):
sys/arch/sparc/sparc/pmap.c: revision 1.327, 1.328
sys/arch/sparc/sparc/cpuvar.h: revision 1.77
sys/arch/sparc/sparc/locore.s: revision 1.245
sys/arch/sparc/sparc/cpu.c: revision 1.214
sys/arch/sparc/sparc/db_interface.c: revision 1.84
- retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)
we still waste one page of space, but this gets SMP much closer to
actually working again.
fix a LOCKDEBUG problem from the previous: need to call pmap_kremove()
on a pre-existing mapping, before installing a new one.
 1.75.10.1 30-May-2009  snj Pull up following revision(s) (requested by mrg in ticket #776):
sys/arch/sparc/sparc/autoconf.c: revision 1.233 via patch
sys/arch/sparc/sparc/cpu.c: revision 1.213 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.76 via patch
sys/arch/sparc/sparc/db_interface.c: revision 1.83 via patch
sys/arch/sparc/sparc/intr.c: revision 1.102 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.325 via patch
sys/arch/sparc/sparc/timer_sun4m.c: revision 1.17 via patch
Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:
Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.
The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.75.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.83.4.1 05-Mar-2011  rmind sync with head
 1.84.4.3 05-Mar-2011  bouyer Sync with HEAD
 1.84.4.2 17-Feb-2011  bouyer Sync with HEAD
 1.84.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.84.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.90.16.1 18-May-2014  rmind sync with head
 1.90.12.2 03-Dec-2017  jdolecek update from HEAD
 1.90.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.90.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.92.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.92.6.1 05-Feb-2017  skrll Sync with HEAD
 1.92.4.1 21-Mar-2018  martin Pull up following revision(s) (requested by mrg in ticket #1585):

sys/arch/sparc/include/cpu.h: revision 1.99 (patch -> cpuvar.h)


- return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed

With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.

Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...

[file accidently missed in previous commit]
 1.23 06-Apr-2021  simonb The location arg of db_disasm() is a db_addr_t, not a vaddr_t.
 1.22 11-Jan-2017  joerg branches: 1.22.30;
Don't cast the result of abs() to int, but the argument.
 1.21 04-Oct-2015  joerg branches: 1.21.2;
Avoid left-shifting negative values.
 1.20 14-Apr-2011  mrg branches: 1.20.14; 1.20.32;
port to userspace.
 1.19 21-Feb-2007  thorpej branches: 1.19.68; 1.19.74;
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.18 25-Feb-2006  wiz branches: 1.18.20;
Fix some typos.
 1.17 14-Nov-2005  uwe branches: 1.17.2; 1.17.4; 1.17.6;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.16 03-Jun-2005  martin branches: 1.16.2; 1.16.8;
Sprinkle some const
 1.15 15-Jul-2003  lukem __KERNEL_RCSID()
 1.14 13-Oct-2001  uwe branches: 1.14.4; 1.14.20;
Fix SIGNEX macro: sizeof is in bytes, not bits.
 1.13 16-Aug-2000  pk branches: 1.13.4;
Sync with sparc64.
 1.12 25-May-2000  jhawk Interface change: db_printsym() takes a third argument, pr, a function
pointer indicating how to print the symbol. This allows db_printsym()
to called in places where db_printf() is not an appropriate output
function.

While straightforward, apologies in advance if I've introduced any minor
syntax errors; I was unable to test compilation this on all the affected
platforms.
 1.11 22-Sep-1998  chs branches: 1.11.12;
sign-extend some operand types which need it.
 1.10 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.9 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.8 30-Mar-1996  christos Fix db_printf formats.
 1.7 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.6 19-Apr-1995  pk Use db_printsym() for calls and branches.
 1.5 22-Feb-1995  pk Really fix `call n'.
 1.4 17-Feb-1995  pk call argument off by two bits
 1.3 05-Jan-1995  pk Sparc disassembler from David Miller.
Heavily munged by me to:
- reduce table size significantly.
- follow various opcode tables in the Sparc Architecture Manual (V9)
more closely.
- recognise V8 priviliged instructions.
- fit the DDB interface.
- fix many typos.
Todo:
- get a number of FP ops right (unimportant until V9 is here).
- opcode aliases (`mov',`cmp',`set') for simple instructions.
- better template matching; current method is sloppy and is prone to spurious
matches.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 24-Mar-1994  pk DDB support.
 1.11.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.20.5 11-Dec-2005  christos Sync with head.
 1.14.20.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.20.1 03-Aug-2004  skrll Sync with HEAD
 1.14.4.2 13-Oct-2001  uwe Fix SIGNEX macro: sizeof is in bytes, not bits.
 1.14.4.1 13-Oct-2001  uwe file db_disasm.c was added on branch nathanw_sa on 2001-10-13 00:41:50 +0000
 1.16.8.1 22-Nov-2005  yamt sync with head.
 1.16.2.2 26-Feb-2007  yamt sync with head.
 1.16.2.1 21-Jun-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.17.2.1 01-Mar-2006  yamt sync with head.
 1.18.20.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.19.74.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.68.1 21-Apr-2011  rmind sync with head
 1.20.32.2 05-Feb-2017  skrll Sync with HEAD
 1.20.32.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.20.14.1 03-Dec-2017  jdolecek update from HEAD
 1.21.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.22.30.1 17-Apr-2021  thorpej Sync with HEAD.
 1.98 26-Oct-2023  andvar Build db_machdep.c when KGDB option is enabled.
Do not cast (regs)->db_tf.tf_pc to db_addr_t (thus ifdef block is redundant).
Adjust ifdef conditions in db_interface.c to make it build with KGDB option.
While here, add #endif comments for longer blocks.

These changes should make sparc build with KGDB option, once ddb/db_access.c
code will be fixed to build with it.
 1.97 26-Oct-2022  riastradh ddb/db_active.h: New home for extern db_active.

This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero. Reduces need for #include opt_ddb.h, #ifdef DDB.
 1.96 23-Feb-2021  mrg introduce DDB_END_CMD and replace more than 20 copies of the same
list of NULLs and 0. idea from rillig@.

all touched ports built, several booted.
 1.95 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.94 21-Jul-2017  nakayama branches: 1.94.16;
Move the ddb registers and empty command table used for crash(8) into
db_machdep.c like other archs.
 1.93 14-Dec-2016  mrg branches: 1.93.8;
remove local lwp_eprio() definition that broke the clang build.
 1.92 10-Dec-2016  mrg rearrange slightly to enable crash(8) to build.
 1.91 04-Oct-2015  joerg branches: 1.91.2;
Arrays are never NULL.
 1.90 28-Feb-2014  skrll branches: 1.90.6;
G/C sys/simplelock.h includes
 1.89 09-Jul-2011  mrg branches: 1.89.2; 1.89.12; 1.89.16;
avoid array bounds violation and use fr_fp and fr_pc.
 1.88 14-Feb-2011  mrg add a "mach xcall" command to dump info about each cpus xpmsg{} values.

while here, move the prototype for cpu_debug_dump() to cpuvar.h and
avoid the copy in db_interface.c.
 1.87 06-Nov-2010  uebayasi branches: 1.87.2; 1.87.4;
Machine dependent code is considered as part of UVM. Include
internal API header.
 1.86 10-Jan-2010  mrg branches: 1.86.2; 1.86.4;
document sparc ddb commands. PR#38312.
 1.85 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.84 18-May-2009  mrg - retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)

we still waste one page of space, but this gets SMP much closer to
actually working again.
 1.83 10-Mar-2009  martin Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:

Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.

The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.82 11-Jan-2009  nakayama branches: 1.82.2;
Redo previous for 32-bit kernel.
 1.81 11-Jan-2009  nakayama p_timer has been changed to struct itimerspec.
 1.80 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.79 08-Aug-2008  skrll branches: 1.79.2; 1.79.4; 1.79.10;
Make "show uvmhist" available to all arches (not just sparc*) in ddb.
 1.78 30-Jan-2008  ad branches: 1.78.6; 1.78.10; 1.78.12; 1.78.16;
Remove lock/simplelock cruft.
 1.77 05-Jan-2008  martin Add missing include.
 1.76 04-Jan-2008  martin lk_interlock is a kmutex_t now
 1.75 16-Dec-2007  mrg catch up with LOCKDEBUG changes.
 1.74 05-Nov-2007  ad branches: 1.74.2; 1.74.4; 1.74.8;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.73 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.72 22-Sep-2007  martin branches: 1.72.4;
Add a new option DDB_VERBOSE_HELP that adds online help to ddb.
From Adam Hamsik.
Minor modifications by me, all bugs are probably mine.
 1.71 22-Feb-2007  thorpej branches: 1.71.4; 1.71.12; 1.71.20; 1.71.22;
TRUE -> true, FALSE -> false
 1.70 22-Feb-2007  matt More boolean_t -> bool fixes
 1.69 21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.68 24-Dec-2005  perry branches: 1.68.26;
bare asm -> __asm
 1.67 16-Nov-2005  uwe Drop trailing whitespace.
 1.66 14-Nov-2005  uwe branches: 1.66.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.65 29-Oct-2005  jdc Don't drop to ddb in the default case if ddb.onpanic is 0.
OK'd by martin@.
 1.64 17-Jun-2005  hannken branches: 1.64.2; 1.64.4;
Avoid shadow warnings, const and __UNVOLATILE().
Kernel sparc/GENERIC.MP builds again.
 1.63 16-Jun-2005  briggs Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.62 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.61 13-May-2004  pk branches: 1.61.10;
No need to pull in <bsd_openprom.h> explicitly.
 1.60 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.59 11-Jan-2004  jdolecek use P_ZOMBIE() macro instead of checking p_state direct
 1.58 07-Sep-2003  uwe Define 'nil' as long and remove the cast in the *only* place it's used.
Makes gcc3 happy as well.
 1.57 15-Jul-2003  lukem __KERNEL_RCSID()
 1.56 23-Jun-2003  martin branches: 1.56.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.55 18-May-2003  martin Make kernels with options KGDB compile. (Didn't test kgdb though)
 1.54 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.53 16-Jan-2003  pk Rename the current mp_{pause,resume}_cpus() => mp_{pause,resume}_cpus_ddb().
Implement mp_pause_cpus/mp_resume_cpus on top of the PROM services.
 1.52 13-Jan-2003  pk Reset ddb_cpuinfo when leaving DDB.
 1.51 10-Jan-2003  mrg expand db_proc_cmd() a little more.
 1.50 09-Jan-2003  mrg clean up db_proc_cmd() output slightly.
 1.49 07-Jan-2003  pk Simplify ddb register storage setup: remove MULTIPROCESSOR special cases
and keep the ddb register copies on the current stack always.
 1.48 07-Jan-2003  pk * Maintain a pointer to the cpu_info structure of the CPU being examined.
* Force cpu_Debugger() to have a stack frame, so tracing can at least
start off matching arguments and function calls correctly.
 1.47 23-Dec-2002  pk Upon trap exit, update the trapframe with data for the running CPU rather
than the one which was the last target of the `machine cpu' command.
 1.46 19-Dec-2002  pk Sprinkle volatiles to avoid register allocation, esp. in cross-call
synchronisation functions used in SMP kernels.
 1.45 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.44 13-May-2002  matt Nuke local extern label_t *db_recover; it's now in <ddb/db_extern.h>
 1.43 30-Jun-2001  mrg branches: 1.43.2; 1.43.8;
db_cpu_cmd is DDB specific; move it into the DDB specific portions of this file. KGDB compiles again.
 1.42 08-Jun-2001  mrg if MULTIPROCESSOR, make the registers virtual, so that we can access other
processors registers. rework enter/exit ddb code to look more like the i386
code. make "mach cpu" and "mach cpu N" work.
 1.41 26-May-2001  chs fix typo.
 1.40 26-May-2001  chs replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.39 18-Mar-2001  mrg show the cpu a process is running on in proc
 1.38 18-Mar-2001  mrg redo previous slightly differently.
 1.37 18-Mar-2001  mrg "mach slock" for simple_locks
 1.36 17-Mar-2001  mrg "mach cpu" is MP only.
 1.35 16-Mar-2001  mrg steal a few mach commands from sparc64. add a #if 0'ed "mach cpu"
 1.34 22-Jan-2001  jdolecek branches: 1.34.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.
 1.33 18-Jan-2001  jdolecek make db_[e]regs[] const
 1.32 21-Nov-2000  chs add a missing newline in a printf().
 1.31 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.30 12-Oct-1999  jdolecek branches: 1.30.2;
rename the MD Debugger() to cpu_Debugger()
add MI Debugger() which switches to console if wscons is used prior
to calling cpu_Debugger()
 1.29 12-Apr-1999  pk branches: 1.29.2;
Quote "AS IS" as in the majority of Carnegy Mellon notices.
 1.28 06-Apr-1999  pk Fix a pasto in copyright text which has been procreating like rabbits..
 1.27 14-Feb-1999  pk branches: 1.27.2;
Use the PROMLIB interface.
 1.26 26-Sep-1998  pk Stop all other CPUs upon entering a debugger.
 1.25 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.24 04-Jul-1998  jonathan defopt DDB.
 1.23 03-Apr-1998  pk Make the single-step support routines available to KGDB-only kernels as well.
 1.22 22-Feb-1998  mycroft Always go to splhigh() inside DDB.
 1.21 08-Jan-1998  mrg some KNF.
 1.20 23-Dec-1997  tv Exclude /dev/fb code if no framebuffer is compiled into the system.
Adds a fb.h flag file with '#define NFB 1' if any such card is configured
in to the kernel.
 1.19 10-Dec-1997  pk Code for software-assisted DDB single-stepping from Chuck Silvers.
 1.18 01-Sep-1997  pk Bring db_{read,write}_bytes() prototypes in scope.
Move Debugger() within `#ifdef DDB'
 1.17 31-Aug-1997  pk Switch to MI kgdb code.
 1.16 04-Aug-1997  pk Move MMU dependent DDB goo into a pmap helper function.
 1.15 05-Feb-1997  pk branches: 1.15.8;
db_expr_t is now a long.
 1.14 13-Oct-1996  christos backout previous kprintf change
 1.13 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.12 18-May-1996  mrg put promdev definition into <machine/bsd_openprom.h>.
 1.11 01-Apr-1996  christos Fix another printf format argument.
 1.10 31-Mar-1996  pk Various sun4m-related changes straight from Aaron.
 1.9 30-Mar-1996  christos Fix db_printf formats.
 1.8 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.7 14-Feb-1996  pk Eliminate <setjmp.h>.
 1.6 09-Apr-1995  pk Unblank frame buffer when entering the debugger.
 1.5 09-Feb-1995  pk We have more registers.
 1.4 01-Feb-1995  pk Deal with writing to kernel text (largely stolen from the sun3 port).
 1.3 25-Nov-1994  deraadt repair some stuff
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 24-Mar-1994  pk DDB support.
 1.15.8.2 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.8.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.27.2.2 12-Apr-1999  pk branches: 1.27.2.2.2;
Pullup copyright text corrections.
 1.27.2.1 07-Apr-1999  pk Pull up from trunk: copyright text warts.
 1.27.2.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.29.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.30.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.30.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.30.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.30.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.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.34.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.43.8.9 17-Jan-2003  thorpej Sync with HEAD.
 1.43.8.8 15-Jan-2003  thorpej Sync with HEAD.
 1.43.8.7 07-Jan-2003  thorpej Sync with HEAD.
 1.43.8.6 29-Dec-2002  thorpej Sync with HEAD.
 1.43.8.5 19-Dec-2002  thorpej Sync with HEAD.
 1.43.8.4 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.43.8.3 20-Jun-2002  nathanw Catch up to -current.
 1.43.8.2 29-Nov-2001  pk Adapt db_proc_cmd() to SA structures.
 1.43.8.1 30-Jun-2001  pk file db_interface.c was added on branch nathanw_sa on 2001-11-29 13:25:22 +0000
 1.43.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.56.2.5 11-Dec-2005  christos Sync with head.
 1.56.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.61.10.1 30-Oct-2005  tron Pull up following revision(s) (requested by jdc in ticket #921):
sys/arch/sparc/sparc/db_interface.c: revision 1.65
sys/arch/sparc64/sparc64/db_interface.c: revision 1.81
Don't drop to ddb in the default case if ddb.onpanic is 0.
OK'd by martin@.
 1.64.4.1 02-Nov-2005  yamt sync with head.
 1.64.2.6 04-Feb-2008  yamt sync with head.
 1.64.2.5 21-Jan-2008  yamt sync with head
 1.64.2.4 15-Nov-2007  yamt sync with head.
 1.64.2.3 27-Oct-2007  yamt sync with head.
 1.64.2.2 26-Feb-2007  yamt sync with head.
 1.64.2.1 21-Jun-2006  yamt sync with head.
 1.66.2.2 22-Nov-2005  yamt sync with head.
 1.66.2.1 14-Nov-2005  yamt file db_interface.c was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.68.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.71.22.3 23-Mar-2008  matt sync with HEAD
 1.71.22.2 09-Jan-2008  matt sync with HEAD
 1.71.22.1 06-Nov-2007  matt sync with HEAD
 1.71.20.2 06-Nov-2007  joerg Sync with HEAD.
 1.71.20.1 02-Oct-2007  joerg Sync with HEAD.
 1.71.12.1 03-Oct-2007  garbled Sync with HEAD
 1.71.4.2 03-Dec-2007  ad Sync with HEAD.
 1.71.4.1 09-Oct-2007  ad Sync with head.
 1.72.4.1 13-Nov-2007  bouyer Sync with HEAD
 1.74.8.2 08-Jan-2008  bouyer Sync with HEAD
 1.74.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.74.4.1 26-Dec-2007  ad Sync with head.
 1.74.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.78.16.1 19-Oct-2008  haad Sync with HEAD.
 1.78.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.78.10.3 11-Mar-2010  yamt sync with head
 1.78.10.2 20-Jun-2009  yamt sync with head
 1.78.10.1 04-May-2009  yamt sync with head.
 1.78.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.78.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.79.10.1 21-Apr-2010  matt sync to netbsd-5
 1.79.4.3 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.79.4.2 16-Jan-2011  bouyer Pull up following revision(s) (requested by mrg in ticket #1527):
sys/arch/sparc/sparc/pmap.c: revision 1.327, 1.328
sys/arch/sparc/sparc/cpuvar.h: revision 1.77
sys/arch/sparc/sparc/locore.s: revision 1.245
sys/arch/sparc/sparc/cpu.c: revision 1.214
sys/arch/sparc/sparc/db_interface.c: revision 1.84
- retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)
we still waste one page of space, but this gets SMP much closer to
actually working again.
fix a LOCKDEBUG problem from the previous: need to call pmap_kremove()
on a pre-existing mapping, before installing a new one.
 1.79.4.1 30-May-2009  snj Pull up following revision(s) (requested by mrg in ticket #776):
sys/arch/sparc/sparc/autoconf.c: revision 1.233 via patch
sys/arch/sparc/sparc/cpu.c: revision 1.213 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.76 via patch
sys/arch/sparc/sparc/db_interface.c: revision 1.83 via patch
sys/arch/sparc/sparc/intr.c: revision 1.102 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.325 via patch
sys/arch/sparc/sparc/timer_sun4m.c: revision 1.17 via patch
Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:
Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.
The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.79.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.79.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.82.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.86.4.1 05-Mar-2011  rmind sync with head
 1.86.2.1 27-May-2010  uebayasi Fix build.
 1.87.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.87.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.89.16.1 18-May-2014  rmind sync with head
 1.89.12.2 03-Dec-2017  jdolecek update from HEAD
 1.89.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.89.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.90.6.3 28-Aug-2017  skrll Sync with HEAD
 1.90.6.2 05-Feb-2017  skrll Sync with HEAD
 1.90.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.91.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.93.8.1 25-Jul-2017  snj Pull up following revision(s) (requested by nakayama in ticket #152):
usr.sbin/crash/Makefile: revision 1.37
sys/arch/sparc/conf/files.sparc: revision 1.157
sys/arch/sparc/sparc/db_interface.c: revision 1.94
sys/arch/sparc/sparc/db_machdep.c: revision 1.1
Move the ddb registers and empty command table used for crash(8) into
db_machdep.c like other archs.
--
sparc has db_machdep.c now.
 1.94.16.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 23-Feb-2021  mrg introduce DDB_END_CMD and replace more than 20 copies of the same
list of NULLs and 0. idea from rillig@.

all touched ports built, several booted.
 1.1 21-Jul-2017  nakayama branches: 1.1.2; 1.1.4; 1.1.6; 1.1.22;
Move the ddb registers and empty command table used for crash(8) into
db_machdep.c like other archs.
 1.1.22.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1.6.2 03-Dec-2017  jdolecek update from HEAD
 1.1.6.1 21-Jul-2017  jdolecek file db_machdep.c was added on branch tls-maxphys on 2017-12-03 11:36:43 +0000
 1.1.4.2 28-Aug-2017  skrll Sync with HEAD
 1.1.4.1 21-Jul-2017  skrll file db_machdep.c was added on branch nick-nhusb on 2017-08-28 17:51:52 +0000
 1.1.2.2 25-Jul-2017  snj Pull up following revision(s) (requested by nakayama in ticket #152):
usr.sbin/crash/Makefile: revision 1.37
sys/arch/sparc/conf/files.sparc: revision 1.157
sys/arch/sparc/sparc/db_interface.c: revision 1.94
sys/arch/sparc/sparc/db_machdep.c: revision 1.1
Move the ddb registers and empty command table used for crash(8) into
db_machdep.c like other archs.
--
sparc has db_machdep.c now.
 1.1.2.1 21-Jul-2017  snj file db_machdep.c was added on branch netbsd-8 on 2017-07-25 02:11:14 +0000
 1.37 06-Apr-2019  thorpej Fix building crash(8) on sparc after ufetch / ustore changes.
 1.36 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.35 10-Dec-2016  mrg branches: 1.35.16;
rearrange slightly to enable crash(8) to build.
 1.34 14-Apr-2011  mrg branches: 1.34.14; 1.34.32; 1.34.36;
port to userspace.
 1.33 01-Jul-2010  rmind branches: 1.33.2;
Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.32 21-Nov-2009  rmind branches: 1.32.2; 1.32.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.31 21-Oct-2009  rmind 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.30 02-Jul-2008  rmind Remove proc_representative_lwp(), use a simple LIST_FIRST() instead.
OK by <ad>.
 1.29 22-Feb-2007  thorpej branches: 1.29.42; 1.29.46; 1.29.48; 1.29.50;
TRUE -> true, FALSE -> false
 1.28 22-Feb-2007  matt More boolean_t -> bool fixes
 1.27 21-Feb-2007  thorpej Pick up some additional files that were missed before due to conflicts
with newlock2 merge:

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.26 20-Feb-2007  ad - Add /a modifier to trace that allows a specific LWP to be selected.
- When doing trace/t, always note which pid/lid combination is being traced.
 1.25 17-Feb-2007  pavel Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

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

Reviewed by Andrew Doran.
 1.24 06-Sep-2006  ad branches: 1.24.8;
Use p_find(addr, PFIND_LOCKED) in case the proclist_lock is held.
 1.23 14-Nov-2005  uwe branches: 1.23.4; 1.23.8;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.22 30-May-2005  chs branches: 1.22.2; 1.22.8;
adapt to const changes.
 1.21 07-Sep-2003  uwe Drop bogus ## to make gcc3 happy.
 1.20 15-Jul-2003  lukem __KERNEL_RCSID()
 1.19 18-Jan-2003  thorpej branches: 1.19.2;
Merge the nathanw_sa branch.
 1.18 13-Jan-2003  pk Fix stack tracing once again.
Also check for trap frame boundaries when fetching the return address.
 1.17 23-Dec-2002  pk * Use correct PC value for displaying the called function.
* Merge code to display non-kernel frames.
 1.16 26-May-2000  jhawk branches: 1.16.12;
Rename the machine-specific stack trace printing functions
from db_stack_trace_cmd() to db_stack_trace_print(),
and add an additional argument, a function pointer for an
output routine (i.e. printf() or db_printf()).

Add db_stack_trace_cmd() in db_command.[ch], calling
db_stack_trace_print() with db_printf() as the printer.

Move count==-1 special handling from db_stack_trace_print() [nee
db_stack_trace_cmd()] to db_stack_trace_cmd() [nascent here].

Again, I'm unable to test compilation on all affected platforms,
so advance apologies for potential brokenness.
 1.15 25-May-2000  jhawk Interface change: db_printsym() takes a third argument, pr, a function
pointer indicating how to print the symbol. This allows db_printsym()
to called in places where db_printf() is not an appropriate output
function.

While straightforward, apologies in advance if I've introduced any minor
syntax errors; I was unable to test compilation this on all the affected
platforms.
 1.14 10-Apr-2000  chs add rudimentary support for tracing stacks back into user space.
 1.13 04-Jul-1999  chs branches: 1.13.2;
add "trace/t <pid>".
 1.12 12-Apr-1999  pk Quote "AS IS" as in the majority of Carnegy Mellon notices.
 1.11 06-Apr-1999  pk Fix a pasto in copyright text which has been procreating like rabbits..
 1.10 21-Aug-1998  pk branches: 1.10.6;
Convert to [pv]addr_t & [pv]size_t.
 1.9 29-Jul-1997  fair %x -> 0x%x
 1.8 04-Apr-1996  pk Check for frame pointers we can handle (i.e. in kernel space). This prevents
data faults when tracing proc0's context.
 1.7 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.6 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.5 02-Feb-1996  mycroft Fix #includes.
 1.4 05-Jul-1995  pk remove a db_printf() that has been there for too long.
 1.3 09-Feb-1995  pk We have more registers.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 24-Mar-1994  pk DDB support.
 1.10.6.2 12-Apr-1999  pk branches: 1.10.6.2.2;
Pullup copyright text corrections.
 1.10.6.1 07-Apr-1999  pk Pull up from trunk: copyright text warts.
 1.10.6.2.2.2 04-Jul-1999  chs from the trunk: add "trace/t <pid>".
 1.10.6.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.16.12.3 15-Jan-2003  thorpej Sync with HEAD.
 1.16.12.2 29-Dec-2002  thorpej Sync with HEAD.
 1.16.12.1 29-Nov-2001  pk Adapt the stack trace code to SA structures.
 1.19.2.5 11-Dec-2005  christos Sync with head.
 1.19.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.8.1 22-Nov-2005  yamt sync with head.
 1.22.2.3 26-Feb-2007  yamt sync with head.
 1.22.2.2 30-Dec-2006  yamt sync with head.
 1.22.2.1 21-Jun-2006  yamt sync with head.
 1.23.8.1 14-Sep-2006  yamt sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.24.8.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.29.50.1 03-Jul-2008  simonb Sync with head.
 1.29.48.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.29.46.3 11-Aug-2010  yamt sync with head.
 1.29.46.2 11-Mar-2010  yamt sync with head
 1.29.46.1 04-May-2009  yamt sync with head.
 1.29.42.1 28-Sep-2008  mjf Sync with HEAD.
 1.32.4.2 21-Apr-2011  rmind sync with head
 1.32.4.1 03-Jul-2010  rmind sync with head
 1.32.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.33.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.34.36.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.34.32.1 05-Feb-2017  skrll Sync with HEAD
 1.34.14.1 03-Dec-2017  jdolecek update from HEAD
 1.35.16.1 10-Jun-2019  christos Sync with HEAD
 1.37 15-Nov-2003  bouyer Commit changes proposed on tech-kern Thu, 6 Nov 2003
- factor out disksubr.c between sun3, sparc and sparc64. Keep the sun3
groveling code to find a NetBSD disklabel in the first sector (so that it
can find a label at the old sun3 LABELOFFSET) as a fallback is not
label at LABELOFFSET, or sun label is present.
- Fix the sun3 LABELOFFSET (was 64, but the kernel wrote the NetBSD label at
128)
- Make next68k disksubr.c always write a next-compatible disklabel.
- remove #ifdef __sparc__ hack from disklabel(8), and change it to issue
a DIOCWDINFO after writing the disklabel to the raw partition in the
-r/-I case (so that the kernel can convert the label if needed).
 1.36 15-Jul-2003  lukem __KERNEL_RCSID()
 1.35 10-May-2003  thorpej branches: 1.35.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.34 02-May-2003  dsl Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
 1.33 05-Mar-2002  simonb Don't cast argument to ffs() to long.
Per discussion on port-alpha, noticed by Robert Elz.
 1.32 19-Feb-2002  wiz strategy should have an 'r'. Inspired by similar change in OpenBSD.
 1.31 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.30 20-Nov-2000  chs branches: 1.30.2; 1.30.4; 1.30.8;
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.29 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.28 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.27 30-Mar-2000  tsutsui Remove register declarations.
 1.26 07-Mar-2000  tsutsui Use DISKPART/DISKMINOR/DISKUNIT instead of dkpart/dkminor/dkunit.
 1.25 18-Jan-2000  thorpej Use b_cylinder as defined in sys/buf.h
 1.24 11-Jan-2000  pk Remove old-style boot device recognition.
 1.23 14-Feb-1999  pk branches: 1.23.8; 1.23.14;
Fake a label only if it appears to be blank, and if so use RAW_PART
instead of 0.
 1.22 20-Jun-1998  mrg do what the comment says: move this [sun_dkioctl] to compat/sunos. use <dev/sun/disklabel.h>
 1.21 29-Mar-1998  mrg remove register from decl.
 1.20 25-Jan-1998  pk disk_establish(): add xd & xy cases (XXX - need more thought).
 1.19 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.18 03-Jul-1996  pk branches: 1.18.8; 1.18.10;
Fix label sector confusion, per der mouse (PR#2598).
 1.17 29-Jun-1996  pk Put native NetBSD disk label in a piece of wasteland within a SunOS label.
read_disk_label() uses the native label if present.
write_disk_label() constructs a SunOS label around the native one.
 1.16 28-Apr-1996  thorpej dk_establish() returns void.
 1.15 22-Apr-1996  christos remove include of <sys/cpu.h>
 1.14 10-Apr-1996  pk Move some of the SCSI target juggling to autoconf's fake_bootpath() routine.
Fix incorrect interpretation of bootpath's val[2] as a SCSI unit.
 1.13 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.12 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.11 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.10 29-Nov-1995  pk Merge changes from sun3 port; per Gordon.
 1.9 01-Sep-1995  pk Enable writing of disklabels (Many thanks to Jason Thorpe, Gordon Ross
and Matthew Green).
 1.8 29-Aug-1995  pk Garbage collect.
 1.7 29-Aug-1995  pk Avoid NULL dereference
 1.6 18-Aug-1995  pk Bootpath construction code and associated SCSI target mapping to aid
the search for the boot-device in `swap generic' kernels.
From Chuck, munched by me.
 1.5 26-Jun-1995  pk isbad(), for Chuck's new xd driver.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 02-Nov-1994  deraadt various
 1.2 02-Oct-1994  deraadt XXX a nasty
 1.1 17-Sep-1994  deraadt hacked into shape by Peter Galbavy.
 1.18.10.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.8.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.23.14.1 21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

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

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

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.23.8.3 22-Nov-2000  bouyer Sync with HEAD.
 1.23.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.23.8.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.30.8.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.30.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.30.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.30.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.30.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.35.2.1 03-Aug-2004  skrll Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file disksubr.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file disksubr.c.rej was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.9 17-Jul-2011  mrg branches: 1.9.66;
convert all the "empty softc" (just "struct device") drivers to using
device_t/cfdata_t and CFATTACH_DECL_NEW().

the mspcic driver was also converted since it does not ever touch the
sc_dev it used to have in there.
 1.8 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 14-Nov-2005  uwe branches: 1.6.74; 1.6.76; 1.6.78;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.5 15-Jul-2003  lukem branches: 1.5.16; 1.5.24;
__KERNEL_RCSID()
 1.4 02-Oct-2002  thorpej branches: 1.4.6;
Add trailing ; to CFATTACH_DECL.
 1.3 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 28-Mar-2002  pk branches: 1.1.2; 1.1.8;
Untangle clock.c:
* put various time-of-day clock, timer and eeprom drivers in separate files
* avoid unnecessary overhead in interrupt handlers
* make the MSIIEP timer attach through the regular autoconf mechanisms
 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 28-Mar-2002  jdolecek file eeprom.c was added on branch kqueue on 2002-06-23 17:41:49 +0000
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1 28-Mar-2002  nathanw file eeprom.c was added on branch nathanw_sa on 2002-04-01 07:42:50 +0000
 1.4.6.4 11-Dec-2005  christos Sync with head.
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.5.24.1 22-Nov-2005  yamt sync with head.
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.6.78.1 16-May-2008  yamt sync with head.
 1.6.76.1 18-May-2008  yamt sync with head.
 1.6.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.66.1 03-Apr-2021  thorpej Sync with HEAD.
 1.19 15-Aug-2016  maxv Return zero instead of error, otherwise it looks like it is supposed to
return an error; found by brainy.
 1.18 27-Nov-2015  joerg Remove shifts of the PSR constants before applying to the trap frame.
Oring 0 doesn't do anything useful.
 1.17 01-May-2012  martin branches: 1.17.2; 1.17.16;
On unaligned access, provide the data address to the signal handler, instead
of the faulting instructions address.
 1.16 28-Apr-2008  martin branches: 1.16.34; 1.16.38;
Remove clause 3 and 4 from TNF licenses
 1.15 04-Mar-2007  christos branches: 1.15.40; 1.15.42; 1.15.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 10-May-2006  skrll branches: 1.14.14;
Fix a bunch of cast lvalues.
 1.13 24-Dec-2005  perry branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.12 16-Nov-2005  uwe Drop trailing whitespace.
 1.11 14-Nov-2005  uwe branches: 1.11.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.10 03-Jun-2005  martin branches: 1.10.2;
Sprinkle some const
 1.9 13-Apr-2004  pk Turn FLUSH instructions that wind up here into no-ops.
 1.8 15-Jul-2003  lukem branches: 1.8.2;
__KERNEL_RCSID()
 1.7 18-Jan-2003  thorpej branches: 1.7.2;
Merge the nathanw_sa branch.
 1.6 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.5 01-Oct-1998  christos branches: 1.5.30;
make this compile with DIAGNOSTIC again.
 1.4 05-Sep-1998  christos Assign copyright to TNF.
 1.3 29-Jul-1997  fair %x -> 0x%x
 1.2 15-Mar-1997  christos - fix return value in case we failed to write to the destination register.
- pretty-print registers.
 1.1 14-Mar-1997  christos - move instruction emulation and alignment fixing to emul.c
- add sparc-v8 {s,u}{mul,div}{cc,} instruction emulation
 1.5.30.6 19-Dec-2002  thorpej Sync with HEAD.
 1.5.30.5 20-Nov-2002  martin Change cpuinfo.fpproc to cpuinfo.fplwp.
 1.5.30.4 05-Oct-2002  gmcgarry Pull in lwp.h
 1.5.30.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.5.30.2 29-Nov-2001  pk One more transformation: `struct proc *p' => `struct lwp *l'
 1.5.30.1 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.7.2.5 11-Dec-2005  christos Sync with head.
 1.7.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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 24-Apr-2004  jdc Pull up revision 1.9 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.10.2.2 03-Sep-2007  yamt sync with head.
 1.10.2.1 21-Jun-2006  yamt sync with head.
 1.11.2.2 22-Nov-2005  yamt sync with head.
 1.11.2.1 14-Nov-2005  yamt file emul.c was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.13.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.13.10.1 11-May-2006  elad sync with head
 1.13.8.1 24-May-2006  yamt sync with head.
 1.13.6.1 01-Jun-2006  kardel Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.14.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.44.1 16-May-2008  yamt sync with head.
 1.15.42.1 18-May-2008  yamt sync with head.
 1.15.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.38.1 02-Jun-2012  mrg sync to latest -current.
 1.16.34.1 23-May-2012  yamt sync with head.
 1.17.16.2 05-Oct-2016  skrll Sync with HEAD
 1.17.16.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.17.2.1 03-Dec-2017  jdolecek update from HEAD
 1.20 12-Mar-1997  mycroft No longer needed.
 1.19 10-Mar-1997  pk Define CPUINFO_FAULTSTATUS for use in locore.s
 1.18 26-May-1996  pk branches: 1.18.6;
Some more #defines.
 1.17 31-Mar-1996  pk branches: 1.17.4;
Update for 4m locore.s. Remove some items, since locore.s now #includes
param.h
 1.16 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.15 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.14 04-May-1995  pk define audio `evcnt' field.
 1.13 01-May-1995  pk New location & definitions for audio driver.
 1.12 07-Apr-1995  pk Add evcnt_attach().
 1.11 22-Feb-1995  pk Defines for floppy trap handler.
 1.10 07-Dec-1994  deraadt Use symbolic constants to access the prom vector.
Deal with v0 openrom (on sun4c machines only).
 1.9 20-Nov-1994  deraadt copyright/Id cleanup
 1.8 02-Oct-1994  deraadt don't pass UPAGES
 1.7 23-Aug-1994  deraadt fix 3 dumb bugs
 1.6 20-Aug-1994  deraadt sun4 merge changes
 1.5 21-May-1994  deraadt vmmeter
 1.4 01-Feb-1994  deraadt sparc runs in current today
 1.3 26-Nov-1993  deraadt include cpu.h instead of a number of other unreasonable files
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.17.4.1 12-Jun-1996  pk Pull down from trunk:
a few defines needed for changes in locore.s
 1.18.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.71 12-Sep-2020  isaki Improve am7930 family drivers to share more code.
audioamd(4) on sparc, vsaudio(4) on vax, and bba(4) are.
- Remove complex and useless callbacks: onopen, onclose, and
indirect_{read,write}. This makes audioamd and vsaudio almost the same.
- Remove (already disabled) assembly fast interrupt path from audioamd(4).
cf. http://mail-index.netbsd.org/source-changes/2009/12/19/msg004585.html
- Use trigger_* method rather than start_* method. It's more suitable.
vsaudio(4) was tested by naru@, bba(4) was tested by tsutsui@.
 1.70 20-Feb-2020  skrll G/C
 1.69 17-Feb-2020  skrll G/C LS{SLEEP,RUN,ONPROC}

LWP status manipulation was moved out of assembly long ago.
 1.68 02-Nov-2012  chs branches: 1.68.38; 1.68.44;
Add RAS support for sparc.
 1.67 15-Aug-2011  mrg branches: 1.67.2; 1.67.12;
re-introduce the NULL savefpstate IPI checks and evcnts. something
is Wrong with GCC 4.5.3 and these trigger. i haven't seen anything
else particularly wrong so for now this will allow sparc to switch
to GCC 4.5, which otherwise seems to be working very well for me.

sigh. i'm going to file a PR to research what is really wrong here.
 1.66 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.65 20-Feb-2011  mrg remove the evcnt for NULL struct fpstate * ipi, and switch over to an
explicit panic() if we get one.

i'm pretty sure that converting xmpsg_lock from IPL_VM to IPL_SCHED
fixed this problem properly. i have not seen the evcnt trigger since
that change, nor have several others queried.
 1.64 27-Jan-2011  mrg consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters. beyond the extra info, it seems to help avoid some
of these counters getting corrupted due to unlocked multiple accesses.

adjust the xcallintr() from xcall() hack so that we don't count these
events as interrupts. align the existing evcnt name to count this.
 1.63 14-Jan-2011  rmind branches: 1.63.2; 1.63.4;
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.62 13-Jan-2011  mrg introduce a hack to workaround the savefpstate IPI get's NULL
struct fpstate *.

add a new entry point ipi_savefpstate() that is used for this IPI
instead of the plain ipi_savefpstate(). check for %o0 being NULL,
and if so, just return.

add event counters for the savefpstate IPI, and another one for
when it detects the NULL problem.

make the cpu_info struct xmpsg be aligned to a single cache line.

with this change applied (and another minor change in testing) my
SS20 with dual SM75's has survived for 17 hours on build.sh -j5,
and has reported 7 NULL savefps. (the minor change seems to have
a significant effect at reducing this number, but more testing is
needed for it.)


XXX: this is horrible and we really need to find the real problem
XXX: but this should let people use sparc smp again, and fixes
XXX: for the real problem can be tested by seeing if any of the
XXX: savefp IPI null counter becomes non-zero.
 1.61 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.60 03-Jan-2010  mrg branches: 1.60.4;
use genassym generated names for struct intrhand elements and avoid magic.
 1.59 10-Dec-2009  rmind Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.58 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.57 05-Jun-2009  mrg convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits. amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement. ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?


XXX the current implementation depends on a couple of things:
XXX - ev_count member of evcnt{} is first and has offset 0
XXX - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it
 1.56 20-Sep-2008  tsutsui branches: 1.56.4;
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.55 04-Jun-2008  ad branches: 1.55.4;
Remove ref to uvm.page_idle_zero
 1.54 02-May-2008  martin branches: 1.54.2;
Move TNF licenses to 2 clause form
 1.53 08-Jan-2008  martin branches: 1.53.6; 1.53.8; 1.53.10;
cpu_intr_p() for sparc, from Andrew Doran.
 1.52 17-Oct-2007  garbled branches: 1.52.2; 1.52.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.51 17-May-2007  yamt branches: 1.51.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.50 18-Feb-2007  ad branches: 1.50.4; 1.50.6; 1.50.12;
Export __SIMPLELOCK_LOCKED, __SIMPLELOCK_UNLOCKED.
 1.49 09-Feb-2007  ad branches: 1.49.2;
Merge newlock2 to head.
 1.48 11-Dec-2005  christos branches: 1.48.20;
merge ktrace-lwp.
 1.47 24-Sep-2005  macallan add a function pointer to struct cpu_info:
void idlespin(struct cpu_info *)
which is called whenever the CPU is idle and uvm_pageidlezero() has nothing to
do
 1.46 10-Sep-2005  uwe Hanlde NMI on microSPARC-IIep.

We don't do much useful except reporting, but that's better than to
stupidly use sun4m handler and wedge the machine. May need to revisit
what's fatal.

Prodding by macallan@
 1.45 10-Jul-2005  christos - add syscall_{plain,fancy}
- make it use mi_userret
 1.44 04-May-2004  pk branches: 1.44.12;
`uvmexp.swtch++' is already done in exit1().
 1.43 17-Apr-2004  pk Add EV_COUNT.
 1.42 17-Apr-2004  pk Add CPUINFO_XMSG_* symbols for use in fast xcall handlers.
 1.41 18-Jan-2003  thorpej branches: 1.41.2; 1.41.4;
Merge the nathanw_sa branch.
 1.40 12-Jan-2003  uwe Account softintr_common as uvmexp.softs, not uvmexp.intrs.
 1.39 11-Jan-2003  mrg keep track of which cpu's have run a pmap and only broadcast tlb flushes to
cpu's who have done so. implement pmap_deactivate() for MULTIPROCESSOR and
call it from cpu_switch() when we are about to switch proces and when we
enter idle().

with this change, i see significantly reduced tlb IPI traffic and fork/exec
bound processes -- such as "configure" -- run significantly faster, upto
15%. i also obvserved a small (0-2%) benefit to CPU bound tasks as well.
 1.38 08-Jan-2003  pk Add CPUINFO_WANT_RESCHED and CPUINFO_WANT_AST
 1.37 31-Dec-2002  pk Add offset for `cpuinfo.ci_tt'.
 1.36 26-Sep-2002  thorpej Remove <sys/map.h>
 1.35 17-Jul-2002  thorpej Remove an unnecessary "if defined(SUN4M)"
 1.34 07-May-2002  uwe branches: 1.34.2;
Drop SUN4_PGSHIFT and SUN4CM_PGSHIFT. They are already known to .S
files from sys/param.h. The problem is that lint stubs are generated
with -C (keep comments) and gcc complains about macro redefinition,
since "assym.h" doesn't have the comments that "sys/param.h" has.
 1.33 11-Dec-2001  uwe branches: 1.33.4;
Add constants for microSPARC-IIep registers.
 1.32 08-Jun-2001  mrg branches: 1.32.2; 1.32.8;
add CPUINFO_FLAGS
 1.31 21-Jan-2001  christos branches: 1.31.2;
fix bit rot so that MP kernel compiles s/cpu_no/ci_cpuid/
 1.30 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.29 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Fix a bug where all cpu_info structures except for the boot CPUs
would exist at both a CPU-local VA (CPUINFO_VA) and a gloal VA;
The boot CPU's existed only a CPUINFO_VA.
- Add a self-reference pointer to the cpu_info that references the
global address in the MULTIPROCESSOR case. Just allow it to reference
the `local' VA in the single-processor case, as CPUINFO_VA is global
enough when there's only one processor to care about. Change curcpu()
to return the global address.
 1.28 26-May-2000  thorpej branches: 1.28.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.27 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.26 08-May-2000  mycroft Make the audioamd assembler code compile again.
 1.25 30-Apr-2000  pk Define offset for uvm.page_idle_zero.
 1.24 21-Jan-2000  pk Update FDC offsets used by fdintr.s
 1.23 17-Jan-2000  pk Add offset to bus handle in `struct fdio'.
 1.22 04-Oct-1999  pk branches: 1.22.2;
Since a context table is now pointing at the correct per-CPU region table
at all times, we can dispense with the hackery that patches the magic entry
at context-switch time.
 1.21 25-Mar-1999  pk branches: 1.21.2;
UVM no longer an option.
 1.20 14-Mar-1999  jonathan Use bus_space tags and handles, embedded in MD hooks AM7930_{READ_WRITE}_REG
to handle MD delay and bus padding. Tested on sparc2 by David Brownlee.

Should use regmaps, but that breaks sparc pDMA assembly code.
 1.19 14-Feb-1999  pk Use the PROMLIB interface.
 1.18 19-Oct-1998  pk Maintain a current process (`curproc') a per CPU.
 1.17 16-Oct-1998  pk Drop cpuinfo's `L1_ptps'; instead keep a per CPU segment (level 2) page
table descriptor that is used to patch up a region (level 1) page table
associated with a user pmap at context switch time.
 1.16 12-Oct-1998  pk Add offset of `cpuinfo.idle_u'.
 1.15 12-Oct-1998  pk Define `sizeof(struct cpu_info)'.
 1.14 11-Oct-1998  pk Allocate a private PCB, kernel stack and interrupt stack for each processor.
As a result, the stack setup code in locore.s changes slightly in
the MULTIPROCESSOR case. Also, make the stack redzone barrier (for
debugging only) a per-CPU entity.
 1.13 24-Sep-1998  pk Add `intreg' cpuinfo offset.
 1.12 21-Sep-1998  pk We no longer need to access memerr() through a function pointer.
 1.11 20-Sep-1998  pk Account for changes in struct cpuinfo & locore
 1.10 13-Sep-1998  pk Pull in <sys/syscall.h> directly into locore.s
 1.9 07-Sep-1998  pk Adapt to cpuvar.h changes.
 1.8 06-Sep-1998  pk Sanitize memerr*() a bit.
 1.7 05-Sep-1998  christos Assign copyright to TNF.
 1.6 26-Jul-1998  pk Add a cpu-specific function to flush a pure virtually-indexed/virtually-tagged
cache, which needs to be flushed at context switch.
 1.5 24-Jun-1998  jonathan Split sparc am7930 driver into sparc attach and "MI" sys/dev/ic/am7930
chipset driver. Needs bus'ifying and register-access.
 1.4 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.3 16-Oct-1997  mycroft Fix up includes.
 1.2 28-Jun-1997  pk Accommodate non-VM_PMAP_HACK code.
 1.1 12-Mar-1997  christos Added genassym.cf
 1.21.2.1 08-Feb-2000  he Apply patch (requested by pk):
Fix several problems:
o Floppy driver dislikes being accessed with no floppy inserted
(PR#5740)
o Floppy drive being detected even though there is none (PR#5760)
o Panic when fdformat is used (PR#9251)
 1.22.2.2 11-Feb-2001  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 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.31.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.32.8.10 15-Jan-2003  thorpej Sync with HEAD.
 1.32.8.9 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.32.8.8 18-Oct-2002  nathanw Catch up to -current.
 1.32.8.7 01-Aug-2002  nathanw Catch up to -current.
 1.32.8.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.32.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.32.8.4 08-Jan-2002  nathanw Catch up to -current.
 1.32.8.3 28-Nov-2001  pk Use `L_' prefix in stead `P_' where appropriate.
Add L_PRIORITY and L_STAT.
 1.32.8.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.32.8.1 08-Jun-2001  pk file genassym.cf was added on branch nathanw_sa on 2001-11-20 16:31:55 +0000
 1.32.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.32.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.32.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.32.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.33.4.2 22-Mar-2002  thorpej Handle MUTEX_DEBUG.
 1.33.4.1 18-Mar-2002  thorpej First cut at mutex and rwlock implementation for SPARC.
 1.34.2.1 21-Jul-2002  gehenna catch up with -current.
 1.41.4.1 24-Apr-2004  jdc Pull up revisions 1.42-1.43 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.41.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.41.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.41.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.41.2.1 03-Aug-2004  skrll Sync with HEAD
 1.44.12.4 21-Jan-2008  yamt sync with head
 1.44.12.3 03-Sep-2007  yamt sync with head.
 1.44.12.2 26-Feb-2007  yamt sync with head.
 1.44.12.1 21-Jun-2006  yamt sync with head.
 1.48.20.3 01-Feb-2007  ad Header file cleanup.
 1.48.20.2 28-Jan-2007  ad - Fix sequence error between saving/raising the SPL.
- Changes for JavaStation.
- Fix bugs with mips & sparc support routines.
 1.48.20.1 12-Jan-2007  ad sparc MD changes.
 1.49.2.2 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.49.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.50.12.1 22-May-2007  matt Update to HEAD.
 1.50.6.1 11-Jul-2007  mjf Sync with head.
 1.50.4.1 27-May-2007  ad Sync with head.
 1.51.10.2 23-Mar-2008  matt sync with HEAD
 1.51.10.1 06-Nov-2007  matt sync with HEAD
 1.52.8.1 10-Jan-2008  bouyer Sync with HEAD
 1.52.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.53.10.4 11-Mar-2010  yamt sync with head
 1.53.10.3 20-Jun-2009  yamt sync with head
 1.53.10.2 04-May-2009  yamt sync with head.
 1.53.10.1 16-May-2008  yamt sync with head.
 1.53.8.2 17-Jun-2008  yamt sync with head.
 1.53.8.1 18-May-2008  yamt sync with head.
 1.53.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.53.6.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.53.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.54.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.54.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.55.4.1 19-Oct-2008  haad Sync with HEAD.
 1.56.4.2 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.56.4.1 28-Jan-2011  snj Pull up following revision(s) (requested by mrg in ticket #1532):
sys/arch/sparc/sparc/cpu.c: revision 1.215 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.78 via patch
sys/arch/sparc/sparc/genassym.cf: revision 1.57 via patch
sys/arch/sparc/sparc/intr.c: revision 1.103-1.105 via patch
sys/arch/sparc/sparc/locore.s: revision 1.247, 1.250 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.329 via patch

- print the cpu_number() when we get a strayintr().

- use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now

with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a few commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.

convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits. amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement. ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?

XXX the current implementation depends on a couple of things:
XXX - ev_count member of evcnt{} is first and has offset 0
XXX - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it

- remove unused ft_want_ast()
- give nmi_sun* ENTRY() points so they show up in symbols properly
- add some disabled code to use this cpu's idlelwp area when hatching
a cpu, but right now it makes this worse not better...
 1.60.4.1 05-Mar-2011  rmind sync with head
 1.63.4.2 05-Mar-2011  bouyer Sync with HEAD
 1.63.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.63.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.67.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.67.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.68.44.1 29-Feb-2020  ad Sync with head.
 1.68.38.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.21 20-Sep-2010  tsutsui Prepare sparc optimized (by 32 bit add-with-carry insns) cpu_in_cksum()
which is reusing in_cksum_internal() in old sparc/in_cksum.c.

~4% improvements of ttcp(1) xfer rates on SS1+ with le(4).
 1.20 30-May-2008  mrg branches: 1.20.12; 1.20.18; 1.20.20;
convert the rest of my licenses to 2-clause, extracting myself out
from a group as necessary.

bozohttpd remains, but it will get fixed next time i update it.
 1.19 24-Dec-2005  perry branches: 1.19.74; 1.19.76; 1.19.78; 1.19.80;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.18 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.17 16-Nov-2005  uwe Drop trailing whitespace.
 1.16 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.15 13-Oct-2003  agc branches: 1.15.16; 1.15.24;
Move Matt Green's code from a 4-clause to a 3-clause licence by removing
the advertising clause. Diffs provided in PR 22396 by Joel Baker, the changes
were confirmed to the board by Matt Green.
 1.14 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.13 15-Jul-2003  lukem __KERNEL_RCSID()
 1.12 05-Apr-2002  simonb branches: 1.12.10;
Fix a tyop in a comment.
 1.11 03-Jun-2001  thorpej branches: 1.11.2; 1.11.8;
Skip the pseudo-header checksum if nxt == 0.
 1.10 21-Mar-2001  pk Merge in4_cksum().
 1.9 29-Nov-1998  mycroft branches: 1.9.10; 1.9.22;
Fix bogus asm statements; tmp1 and tmp2 need to be outputs rather than inputs.
 1.8 15-Aug-1998  mycroft branches: 1.8.2;
Make copyright notices with my name consistent.
 1.7 05-Oct-1996  mrg minor copyright update.
 1.6 29-Aug-1996  pk Faster checksumming, contributed by Zubin Dittia.
 1.5 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.4 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.3 26-Apr-1995  pk Fast checksummer from Matthew Green.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.2.1 25-Feb-1999  chs sync with HEAD - egcs fixes.
 1.9.22.2 21-Jun-2001  nathanw Catch up to -current.
 1.9.22.1 09-Apr-2001  nathanw Catch up with -current.
 1.9.10.1 27-Mar-2001  bouyer Sync with HEAD.
 1.11.8.2 17-Apr-2002  nathanw Catch up to -current.
 1.11.8.1 03-Jun-2001  nathanw file in_cksum.c was added on branch nathanw_sa on 2002-04-17 00:04:26 +0000
 1.11.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.12.10.4 11-Dec-2005  christos Sync with head.
 1.12.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.10.1 03-Aug-2004  skrll Sync with HEAD
 1.15.24.1 22-Nov-2005  yamt sync with head.
 1.15.16.1 21-Jun-2006  yamt sync with head.
 1.19.80.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.19.78.2 09-Oct-2010  yamt sync with head
 1.19.78.1 04-May-2009  yamt sync with head.
 1.19.76.1 04-Jun-2008  yamt sync with head
 1.19.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.20.1 05-Mar-2011  rmind sync with head
 1.20.18.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.20.12.1 24-Oct-2010  jym Sync with HEAD
 1.4 02-May-1997  pk Switch to copy of file in /sys/dev/ic.
 1.3 02-May-1996  pk Various simplifications and corrections from Chuck Cranor (makes `oclock'
calibration work.. thanks!).
 1.2 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.1 16-Dec-1994  deraadt oclock support for the 4/100 and 4/200
 1.127 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.126 22-Nov-2020  thorpej malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.125 22-Mar-2020  ad branches: 1.125.4;
cpu_intr_p(): use cpuinfo (always the same VA) for preemption safety.
 1.124 14-Mar-2020  ad sparc cpu_intr_p(): try to work around l_cpu not being set early on by
using curcpu().
 1.123 03-Dec-2019  riastradh Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)
 1.122 01-Dec-2019  ad Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.
 1.121 01-Mar-2019  macallan since SX can trigger NMIs dump the status and error registers along with
the rest if sx is present.
 1.120 04-Feb-2019  mrg print the cpu number for the mutex not held xcallintr debug message.
add a comment about why this case fires.
 1.119 02-Dec-2017  macallan branches: 1.119.4;
- return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.118 16-Nov-2013  mrg branches: 1.118.4; 1.118.22;
- convert CPU_INFO_ITERATOR in the !MP case to be __unused, and convert
all the iterators to use it
- print the right variables in nmi_hard_msiiep() (thanks set-but-unused)
- move variable inside usage #ifdef
- use (void) instead of a "volatile int" junk variable
- remove unused variables
 1.117 07-Apr-2013  jdc branches: 1.117.4;
When we receive a PCI PIO error, print the PCIC status register too.
 1.116 13-Apr-2012  mrg branches: 1.116.2;
don't bother whining about bogusintr on zs.
 1.115 23-May-2011  rmind branches: 1.115.4; 1.115.8; 1.115.10;
nmi_hard: convert nmi_hard_wait to use atomics.

OK mrg@
 1.114 15-Feb-2011  mrg - move nmi_sun4m intr counting into nmi_soft/nmi_hard.
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
 1.113 15-Feb-2011  mrg sprinkle some kpreempt_{dis,en}able() in various strategic points
we will need when we get to actually enabling kernel preemption.
 1.112 15-Feb-2011  mrg remove unused CPUFLG_READY and CPU_NOTREADY() macro.
 1.111 27-Jan-2011  mrg consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters. beyond the extra info, it seems to help avoid some
of these counters getting corrupted due to unlocked multiple accesses.

adjust the xcallintr() from xcall() hack so that we don't count these
events as interrupts. align the existing evcnt name to count this.
 1.110 27-Jan-2011  mrg to quote a new comment:

* There's a deadlock potential between multiple CPUs trying
* to xcall() at the same time, and the thread that loses the
* race to get xpmsg_lock is at an IPL above the incoming IPI
* IPL level, so it sits around waiting to take the lock while
* the other CPU is waiting for this CPU to handle the IPI and
* mark it as completed.
*
* If we fail to get the mutex, and we're at high enough IPL,
* call xcallintr() if there is a valid msg.tag.

this seems to fix the xcall() failed to ping cpus problem.
idea from martin, tested by macallan and myself.
 1.109 22-Jan-2011  mrg XXX:

in strayintr() don't print about stray zs inters in MP case.
 1.108 05-Jan-2010  macallan branches: 1.108.4; 1.108.6; 1.108.8;
fix a typo - we need to check classipl vs. IPL_VM, not the SBus interrupt
level
 1.107 03-Jan-2010  mrg add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.106 03-Jan-2010  mrg add two new members to struct intrhand: ih_realfun and ih_realarg, and
use them to take the kernel lock around non-IPL_VM interrupts, using
a intr_biglock_wrapper() function ike x86 does.
 1.105 05-Jun-2009  mrg convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits. amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement. ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?


XXX the current implementation depends on a couple of things:
XXX - ev_count member of evcnt{} is first and has offset 0
XXX - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it
 1.104 27-May-2009  mrg - use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now


with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a fwe commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.


tested in UP LOCKDEBUG/DEBUG/DIAGNOSTIC kernel as well.
MP kernel with only cpu0 configured panics starting /sbin/init.
have not yet tested on a real UP machine.
 1.103 18-May-2009  mrg also print the cpu_number() when we get a strayintr().
 1.102 10-Mar-2009  martin Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:

Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.

The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.101 16-Dec-2008  christos branches: 1.101.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.100 09-Jan-2008  ad branches: 1.100.6; 1.100.10; 1.100.18; 1.100.20; 1.100.26;
Fix headers.
 1.99 08-Jan-2008  martin cpu_intr_p() for sparc, from Andrew Doran.
 1.98 03-Dec-2007  ad branches: 1.98.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.97 09-Feb-2007  ad branches: 1.97.6; 1.97.22; 1.97.24; 1.97.30;
Merge newlock2 to head.
 1.96 14-Jan-2007  jdc Don't check for reserved softintr slots on SUN4, as 4/300's have hardware
that uses the same levels.
 1.95 07-Jun-2006  kardel branches: 1.95.6;
convert to timecounters (from branch simonb-timecounters)
 1.94 16-Nov-2005  uwe branches: 1.94.4; 1.94.6; 1.94.8; 1.94.14;
Use uint<N>_t. Drop trailing whitespace.
 1.93 14-Nov-2005  uwe branches: 1.93.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.92 25-Sep-2005  uwe Use mspcic_read_stream_N to access error addresses. They don't need
to be byteswapped.
 1.91 25-Sep-2005  uwe G/c unused variable.
 1.90 24-Sep-2005  macallan Run the MicroSPARC IIep PCI bus without endianness translation.
This allows us to run X without any additional code changes.
 1.89 23-Sep-2005  uwe Introduce mspcic_{read,write}_N instead of using struct syntax. This
is the first step to make PCIC run without byteswapping - which is
necessary for X server support. Current macros are still just a
kludgy shim over struct syntax, but accesses to PCIC in the .c files
are now marked up properly.
 1.88 10-Sep-2005  uwe Hanlde NMI on microSPARC-IIep.

We don't do much useful except reporting, but that's better than to
stupidly use sun4m handler and wedge the machine. May need to revisit
what's fatal.

Prodding by macallan@
 1.87 16-Jun-2005  briggs branches: 1.87.2;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.86 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.85 17-Apr-2004  pk Add xcall event counters.
 1.84 17-Apr-2004  pk xcallintr: arg3 is gone.
 1.83 07-Aug-2003  agc branches: 1.83.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.82 15-Jul-2003  lukem __KERNEL_RCSID()
 1.81 02-Apr-2003  thorpej branches: 1.81.2;
Use PAGE_SIZE rather than NBPG.
 1.80 02-Mar-2003  pk Use the new pmap_kprotect() function instead of pmap_changeprot().
The latter is now a pmap internal function; and it wasn't used correctly
in mkclock.c anyway.
 1.79 23-Jan-2003  pk When stopping a CPU, clear its bit from cpu_ready_mask.
 1.78 23-Jan-2003  pk Optimize xcall() et.al. further by maintaining a cpuset mask of all CPUs
marked ready. This saves repeated testing for NULL pointers and the
CPUFLG_READY flag.
Also use a separate flag variable to signal xcall completion. This saves a
load and a pipeline stall.
 1.77 23-Jan-2003  pk bogusintr: print cpu number.
 1.76 22-Jan-2003  pk Add functions to set & get the interrupt target CPU.
 1.75 16-Jan-2003  pk Read the CPU mailbox in the level 15 soft interrupt handler and respond
to idle and stop requests.
 1.74 09-Jan-2003  pk Check for existing soft interrupts too before trying to install a fast
interrupt handler.
 1.73 09-Jan-2003  mrg - s/xpmsg11/xpmsg15/
- clean up
- no need to reset the msg.tag
 1.72 07-Jan-2003  mrg - add a new message tag for level15 software NMI, and switch ddb to use this
rather than the level13 software intr xpmsg area. now DDB IPI's don't lock
the xpmsg_lock and we avoid recursion and more.
- don't actually use cpuinfo.msg.lock yet, xpmsg_lock suffices.
- reread the pending register on mbus hypersparc cpus to avoid bugs in the
h/w that cause IPI's to be missed.
 1.71 03-Jan-2003  mrg FPU save is handled in xcall() now.
 1.70 31-Dec-2002  pk * map the PROM CPU mailbox if available.
* map MXCC error/status registers if available.
* add MXCC-specific module error interrupt handler.
* use high priority interrupt level in mp_pause_cpus()
 1.69 23-Dec-2002  pk xcallintr() receive a `clockframe *' argument, not a `trapframe *'.
Setup a DDB context for paused CPUs by defining a soft trap (T_DBPAUSE)
which uses the generic trap handler code to get the trapframe constructed
and then calls on a debugger-defined `suspend' routine.
 1.68 21-Dec-2002  pk * xcallintr(): use cpuinfo directly again.
* nmi_soft(): remove most of the obsoleted requests.
 1.67 19-Dec-2002  pk Brush-up the generic cross-call routine and use it to implement the SMP
cache flush ops.
Also a standard soft interrupt handler for standard cross-call notification
reserving the NMI level 15 softint for urgent cross calls.
 1.66 18-Dec-2002  mrg we use nmi_hard and nmi_soft on SUN4D as well
 1.65 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.64 11-Dec-2002  pk softintr_establish(): append handler to the list for the actually choosen
processor interrupt level.
 1.63 10-Dec-2002  pk Allow a `fast trap' handler installation to be undone if an interrupt level
must be shared. This requires drivers that request the installation of
a `fast trap' handler to supply a regular interrupt handler as well to fall
back on.

The `fast trap' routine (if present) is now passed as an additional
argument to intr_establish().
 1.62 09-Dec-2002  pk Finish the switch to the softintr(9) framework.

To make this work, we now have to use separate handler lists for hardware
and software interrupts as the soft interrupt handlers do not return
an `interrupt handled' status.

Thanks to Matt Fredette for providing an initial set of patches on port-sparc.
 1.61 06-Dec-2002  pk Pass the `device class interrupt level' on to intr_establish() and use to
raise the ipl in the interrupt handlers to the appropriate level. This avoids
interrupt handler interference if one of the devices actually interrupts at
a lower hardware level than the maximum level assined to a device class.

Based on code from Art Grabowski in openbsd.
 1.60 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.59 04-Aug-2002  uwe In DIAGNOSTIC kernels detect situation that on sun4m neither hardware
nor software interrupt pending bit is set for the current ipl. Report
this as a "bogus" interrupt (better name anyone?). This is a symptom
of a bug in interrupt handling in one of device drivers interrupting
at this ipl. Reviewed by pk.
 1.58 04-Dec-2001  darrenr branches: 1.58.4; 1.58.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.57 21-Nov-2001  wiz "than" instead of "then".
 1.56 18-Oct-2001  uwe branches: 1.56.4;
Minor cleanup. Garbage-collect unused declaration of comsoft() now
that sparc has generic soft interrupts. In softnet() - return
immediately if netisr is zero.
 1.55 27-Sep-2001  mrg implement generic soft interrupts as described in softintr(9). convert
the network, clock & serial softint's to use them.
 1.54 10-Jul-2001  mrg branches: 1.54.2;
enable XPMSG_FUNC support.
 1.53 07-Jul-2001  mrg branches: 1.53.2;
- implement XPMSG_DEMAP_TLB_PAGE, XPMSG_DEMAP_TLB_SEGMENT,
XPMSG_DEMAP_TLB_REGION, XPMSG_DEMAP_TLB_CONTEXT and XPMSG_DEMAP_TLB_ALL
- new setpgt4m_va(), call it when you need to ensure all cpus see the same value
- new smp_tlb_flush_context(), smp_tlb_flush_region(), smp_tlb_flush_segment(),
smp_tlb_flush_page() and smp_tlb_flush_all() functions, if MULTIPROCESSOR
- define the tlb_flush*() routines to the smp_*() versions, if MULTIPROCESSOR
- sun4m safe PTE update updatepte4m() routine, vaguely derived from code posted
by torek@bsdi.com on port-sparc a couple of years ago.
- new nmihard_lock to synchronize other cpus during hard NMI. (XXX: should be
a bit smarter about which CPU's do/don't check in.)
 1.52 08-Jun-2001  mrg if DDB, when pausing, save a copy of this cpus registers while paused.
 1.51 07-Jun-2001  mrg more SMP work:

make IPI's work. modify boot_secondary_processors() to clear the startup flag
in each cpu. new raise_ipi_wait_and_unlock() that calls raise_ipi(), waits
for the cpu to acknowledge it got the message, and then unlocks the msglock.
use the new framework in mp_{pause,resume}_cpus(). nmi_soft() takes a
`struct trapframe *', to be used by ddb.
 1.50 22-Mar-2001  mrg remove overzealous locking changes.
 1.49 15-Mar-2001  mrg sprinkle KERNEL_LOCK() and KERNEL_PROC_LOCK() where they're missing. add
SYSCALL_DEBUG support to trap.c.
 1.48 15-Jan-2001  thorpej branches: 1.48.2;
Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
 1.47 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.46 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.45 09-May-2000  pk Include <sparc/sparc/asm.h>, per PR#10082
 1.44 19-Mar-2000  pk Nuke dead code.
 1.43 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.42 09-Feb-2000  shin fix include file.

<netinet6/ip6.h> -> <netinet/ip6.h>
 1.41 28-Jun-1999  itojun branches: 1.41.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.40 16-May-1999  pk Remove cruft from `nmi_hard()' interrupt handler.
 1.39 27-Feb-1999  pk branches: 1.39.4; 1.39.6;
Missing `break'.
 1.38 14-Feb-1999  pk Use the PROMLIB interface.
 1.37 19-Jan-1999  pk Deal with SIR_SERIAL (for `com' devices).
XXX - consider using __GENERIC_SOFT_INTERRUPTS instead
 1.36 24-Oct-1998  pk branches: 1.36.2;
Define and use CPU pause/resume IPI messages (until such times that I know
what the prom supplied versions actually do).
 1.35 13-Oct-1998  pk We use MULTIPROCESSOR explicitly here, so pull in "opt_multiprocessor.h".
 1.34 08-Oct-1998  pk Define SMP versions of some cache flush methods.
 1.33 23-Sep-1998  pk The nmi_* routines are sun4m-only.
 1.32 22-Sep-1998  pk Flush cache after diddling with trap vectors.
 1.31 20-Sep-1998  pk Add sun4m NMI handlers.
 1.30 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.29 05-Jul-1998  jonathan defopt NATM.
 1.28 05-Jul-1998  jonathan defopt NS, NSIP.
 1.27 05-Jul-1998  jonathan defopt ISO TPIP.
 1.26 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.25 29-Mar-1998  mrg use bitmask_snprintf.
 1.24 03-Dec-1997  mjacob handle case of no keyboard configured
 1.23 22-Nov-1997  tv eliminate declarations of global data in <sparc/cpu.h> and declare in
source files, reducing global symblol replication in .o kernel files
 1.22 19-Nov-1997  pk Use intr_establish() to install the timer interrupt handlers.
 1.21 13-Nov-1997  veego Add a missing #if NARP > 0 around arpintr(); and add a #include "arp.h"
for NARP. This is for the 'new' arp system.
 1.20 29-Jul-1997  fair branches: 1.20.6;
%x -> 0x%x
 1.19 03-Apr-1997  christos Add netatalk netisr
 1.18 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.17 20-Oct-1996  pk branches: 1.17.6;
Drop a duplicate `#include ppp.h'; noted by Chris Demetriou.
 1.16 13-Oct-1996  christos backout previous kprintf change
 1.15 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.14 04-Jul-1996  chuck add native mode atm soft interrupt
 1.13 31-Mar-1996  pk Changes to match 4m-aware locore.s. Note changed `trapbase' and
`sparc_interrupt_{44c.4m}' labels.
 1.12 26-Mar-1996  pk Back to normal printf()s, now that gcc understands `%b'.
 1.11 16-Mar-1996  christos Fix format strings in panic()
 1.10 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.9 04-Jul-1995  paulus Add code to soft01intr to call pppintr.
 1.8 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.7 16-Dec-1994  deraadt do not need clockreg.h
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.4 20-Apr-1994  deraadt arpintr called now
 1.3 01-Feb-1994  deraadt sparc runs in current today
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.17.6.1 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.20.6.2 20-Nov-1997  mellon Pull rev 1.22 up from trunk (pk)
 1.20.6.1 15-Nov-1997  mellon Pull rev 1.21 up from trunk (veego)
 1.36.2.1 09-Nov-1998  chs initial snapshot. lots left to do.
 1.39.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.39.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.39.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.39.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.41.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.41.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.41.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.48.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.48.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.53.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.53.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.53.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.53.2.1 03-Aug-2001  lukem update to -current
 1.54.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.56.4.13 17-Jan-2003  thorpej Sync with HEAD.
 1.56.4.12 15-Jan-2003  thorpej Sync with HEAD.
 1.56.4.11 07-Jan-2003  thorpej Sync with HEAD.
 1.56.4.10 03-Jan-2003  thorpej Sync with HEAD (again).
 1.56.4.9 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.56.4.8 29-Dec-2002  thorpej Sync with HEAD.
 1.56.4.7 19-Dec-2002  thorpej Sync with HEAD.
 1.56.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.56.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.56.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.56.4.3 13-Aug-2002  nathanw Catch up to -current.
 1.56.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.56.4.1 18-Oct-2001  nathanw file intr.c was added on branch nathanw_sa on 2002-01-08 00:27:44 +0000
 1.58.8.1 31-Aug-2002  gehenna catch up with -current.
 1.58.4.1 18-Mar-2002  thorpej Add splraiseipl() for use by kern_mutex.c
 1.81.2.5 11-Dec-2005  christos Sync with head.
 1.81.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.81.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.81.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.81.2.1 03-Aug-2004  skrll Sync with HEAD
 1.83.2.1 24-Apr-2004  jdc Pull up revisions 1.84-1.85 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.87.2.4 21-Jan-2008  yamt sync with head
 1.87.2.3 07-Dec-2007  yamt sync with head
 1.87.2.2 26-Feb-2007  yamt sync with head.
 1.87.2.1 21-Jun-2006  yamt sync with head.
 1.93.2.2 22-Nov-2005  yamt sync with head.
 1.93.2.1 14-Nov-2005  yamt file intr.c was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.94.14.1 19-Jun-2006  chap Sync with head.
 1.94.8.1 26-Jun-2006  yamt sync with head.
 1.94.6.1 27-May-2006  kardel convert to timecounters
 1.94.4.1 09-Sep-2006  rpaulo sync with head
 1.95.6.2 01-Feb-2007  ad Sync with head.
 1.95.6.1 28-Jan-2007  ad - Fix sequence error between saving/raising the SPL.
- Changes for JavaStation.
- Fix bugs with mips & sparc support routines.
 1.97.30.2 18-Feb-2008  mjf Sync with HEAD.
 1.97.30.1 08-Dec-2007  mjf Sync with HEAD.
 1.97.24.2 23-Mar-2008  matt sync with HEAD
 1.97.24.1 09-Jan-2008  matt sync with HEAD
 1.97.22.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.97.6.1 03-Dec-2007  ad Sync with HEAD.
 1.98.6.1 10-Jan-2008  bouyer Sync with HEAD
 1.100.26.1 21-Apr-2010  matt sync to netbsd-5
 1.100.20.3 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.100.20.2 28-Jan-2011  snj Pull up following revision(s) (requested by mrg in ticket #1532):
sys/arch/sparc/sparc/cpu.c: revision 1.215 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.78 via patch
sys/arch/sparc/sparc/genassym.cf: revision 1.57 via patch
sys/arch/sparc/sparc/intr.c: revision 1.103-1.105 via patch
sys/arch/sparc/sparc/locore.s: revision 1.247, 1.250 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.329 via patch

- print the cpu_number() when we get a strayintr().

- use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now

with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a few commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.

convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits. amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement. ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?

XXX the current implementation depends on a couple of things:
XXX - ev_count member of evcnt{} is first and has offset 0
XXX - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it

- remove unused ft_want_ast()
- give nmi_sun* ENTRY() points so they show up in symbols properly
- add some disabled code to use this cpu's idlelwp area when hatching
a cpu, but right now it makes this worse not better...
 1.100.20.1 30-May-2009  snj Pull up following revision(s) (requested by mrg in ticket #776):
sys/arch/sparc/sparc/autoconf.c: revision 1.233 via patch
sys/arch/sparc/sparc/cpu.c: revision 1.213 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.76 via patch
sys/arch/sparc/sparc/db_interface.c: revision 1.83 via patch
sys/arch/sparc/sparc/intr.c: revision 1.102 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.325 via patch
sys/arch/sparc/sparc/timer_sun4m.c: revision 1.17 via patch
Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:
Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.
The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.100.18.2 28-Apr-2009  skrll Sync with HEAD.
 1.100.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.100.10.3 11-Mar-2010  yamt sync with head
 1.100.10.2 20-Jun-2009  yamt sync with head
 1.100.10.1 04-May-2009  yamt sync with head.
 1.100.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.101.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.108.8.2 17-Feb-2011  bouyer Sync with HEAD
 1.108.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.108.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.108.4.2 31-May-2011  rmind sync with head
 1.108.4.1 05-Mar-2011  rmind sync with head
 1.115.10.1 07-May-2012  riz Pull up following revision(s) (requested by mrg in ticket #206):
sys/arch/sparc/sparc/intr.c: revision 1.116
don't bother whining about bogusintr on zs.
 1.115.8.1 29-Apr-2012  mrg sync to latest -current.
 1.115.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.115.4.1 17-Apr-2012  yamt sync with head
 1.116.2.3 03-Dec-2017  jdolecek update from HEAD
 1.116.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.116.2.1 23-Jun-2013  tls resync from head
 1.117.4.1 18-May-2014  rmind sync with head
 1.118.22.1 08-Dec-2017  msaitoh Pull up following revision(s) (requested by macallan in ticket #429):
sys/arch/sparc/sparc/cpu.c: revision 1.250
sys/arch/sparc/include/cpu.h: revision 1.99
sys/arch/sparc/sparc/intr.c: revision 1.119
- return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.118.4.1 21-Mar-2018  martin Pull up following revision(s) (requested by mrg in ticket #1585):
sys/arch/sparc/sparc/cpu.c: revision 1.250 (patch)
sys/arch/sparc/include/cpu.h: revision 1.99 (patch -> cpuvar.h)
sys/arch/sparc/sparc/intr.c: revision 1.119 (patch)

- return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed

With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.

Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.119.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.119.4.1 10-Jun-2019  christos Sync with HEAD
 1.125.4.2 03-Apr-2021  thorpej Sync with HEAD.
 1.125.4.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.13 16-Nov-2005  uwe Use uint<N>_t.
 1.12 14-Nov-2005  uwe branches: 1.12.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.11 07-Aug-2003  agc branches: 1.11.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.10 06-Dec-2002  pk branches: 1.10.6;
ienab_bi[cs] are never used in a context common to both sun4/4c and sun4m,
so there's no point in constructing common entry points for them in locore.s.
 1.9 26-Oct-1998  pk branches: 1.9.30;
No need for `#ifdef SUN4M' protection.
 1.8 22-Sep-1998  pk Express per-processor interrupt registers in a C structure as well.
 1.7 20-Sep-1998  pk Format string for SI register.
 1.6 22-Jul-1997  pk Add some missing entries. Make SINTR_VME()/SINTR_SBUS() more useful.
 1.5 31-Mar-1996  pk Add sun4m VA definitions (for clock and interrupt).
Make these generic for all architectures (i.e. avoid `#if defined(SUN4*)'s).
 1.4 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.3 25-Jun-1995  pk add a couple more sun4m bits.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.9.30.1 11-Dec-2002  thorpej Sync with HEAD.
 1.10.6.4 11-Dec-2005  christos Sync with head.
 1.10.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 03-Aug-2004  skrll Sync with HEAD
 1.11.16.1 21-Jun-2006  yamt sync with head.
 1.12.2.2 22-Nov-2005  yamt sync with head.
 1.12.2.1 14-Nov-2005  yamt file intreg.h was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.102 01-Dec-2023  thorpej Use vmem(9) rather than extent(9) to manage DVMA mappings.
 1.101 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.100 09-Aug-2021  andvar s/aligment/alignment/ + one more typo fix in comments.
 1.99 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.98 10-May-2021  thorpej branches: 1.98.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.97 24-Apr-2021  thorpej branches: 1.97.2; 1.97.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.96 14-Jun-2020  chs branches: 1.96.4;
replace EX_NOWAIT with EX_WAITOK in device attach methods.
remove checks for failures that can no longer occur.
 1.95 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.94 17-Jul-2011  mrg branches: 1.94.2; 1.94.6;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.93 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.92 07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.91 18-Mar-2009  cegger bzero -> memset
 1.90 04-Jun-2008  ad branches: 1.90.6; 1.90.12;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.89 17-Oct-2007  garbled branches: 1.89.16; 1.89.18; 1.89.20; 1.89.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.88 01-Aug-2007  macallan branches: 1.88.4;
fix the fix - do not impose all those extra cache ops on all supersparcs,
only those without external cache
 1.87 31-Jul-2007  macallan SuperSPARCs without cache controller need some extra cache flushs
With this a MULTIPROCESSOR kernel works again with a pair of SM50
 1.86 17-Mar-2007  msaitoh branches: 1.86.4; 1.86.6; 1.86.8;
s/intialized/initialized/
 1.85 04-Mar-2007  christos branches: 1.85.2; 1.85.4; 1.85.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.84 24-Nov-2006  christos branches: 1.84.4;
fix spelling of accommodate; from Zapher.
 1.83 16-Nov-2005  uwe branches: 1.83.20; 1.83.22;
Drop trailing whitespace.
 1.82 14-Nov-2005  uwe branches: 1.82.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.81 01-Apr-2005  yamt branches: 1.81.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.80 28-Apr-2004  pk branches: 1.80.4; 1.80.6;
Rename `sc_hasiocache' => `sc_cachecoherent'. Avoid the cache flush in
dma_load() if we have coherency.
 1.79 28-Mar-2004  pk iommu_dmamap_load: deal with pmap_extract() failing.
 1.78 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.77 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.76 15-Jul-2003  lukem __KERNEL_RCSID()
 1.75 02-Apr-2003  thorpej branches: 1.75.2;
Use PAGE_SIZE rather than NBPG.
 1.74 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.73 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.72 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.71 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.70 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.69 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.68 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.67 25-Aug-2002  thorpej Move the DMA tag and DVMA map into the iommu_softc, and pass the
iommu_softc in the DMA tag cookie. This gives us a chance of supporting
systems (such as the Sun4d) which have multiple iommus.
 1.66 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.65 17-Jul-2002  thorpej Remote CPU_ISSUN4OR4C and CPU_ISSUN4COR4M, and instead express them
as (CPU_ISSUN4 || CPU_ISSUN4C) and (CPU_ISSUN4C || CPU_ISSUN4M),
respectively. The compiler can still optimize as desired by expressing
them this way, and it simplifies adding new tests.

While here, just remove CPU_ISSUN4MOR4U; it's not used by anything.
 1.64 02-Jun-2002  drochner move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling
 1.63 11-Mar-2002  pk branches: 1.63.4; 1.63.6;
* `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.62 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.61 13-Nov-2001  uwe Move dvma_cachealign to cache.c where it belongs and declare it in
cache.h, so that kernel can be linked without iommu support (for the
sake of microSPARC-IIep that has a very different iotlb).
 1.60 27-Oct-2001  darrenr fix so it compiles on a system without 'options SUN4M'
 1.59 03-Oct-2001  chs branches: 1.59.2; 1.59.4;
use pmap_k{enter_pa,remove}() where appropriate.
 1.58 28-Sep-2001  chs don't depend on other headers to include sys/proc.h for us.
 1.57 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.56 26-Sep-2001  eeh *NEVER* cast a reference parameter to a different type.
 1.55 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.54 26-May-2001  chs branches: 1.54.2; 1.54.4;
replace vm_page_t with struct vm_page *.
 1.53 21-May-2001  uwe There is no iommu prom node on JavaStation 1 and sbus node is directly
under root. If /sbus is encountered on sun4m - attach implied iommu
first and attach /sbus under it. Adjust bootpath accordingly to match
the attachment.
 1.52 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.51 05-Mar-2001  pk branches: 1.51.2;
Fix `flags' argument to pmap_enter().
 1.50 22-Jul-2000  pk Minor comment update; remove unused code.
 1.49 04-Jul-2000  pk GC dead code.
 1.48 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.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 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.45 24-Jun-2000  pk Maintain the DVMA map extent subregion boundaries in the bus_dma map
structure.
 1.44 30-May-2000  cjs branches: 1.44.2;
Fix typo in DEBUG code.
 1.43 29-May-2000  pk Use uvm_pglistalloc() to allocate memory for the I/O PTEs; modelled after
a similar change by Art Grabowski in Openbsd.
 1.42 28-May-2000  pk Cleanup iommu_attach().
 1.41 23-May-2000  pk branches: 1.41.2;
Simplify the bus_dma(9) implementation:

- the `alignment' and `boundary' arguments in bus_dmamem_alloc() only
serve as hints on how to break up a DMA transaction into chunks
when necessary; it is not necessary on sparc DVMA hardware.

- exclusively use the VM page size (i.e. PAGE_SIZE et.al.) when computing
resource allocations.

- remember the size of DVMA resource allocations in the private `_ds_sgsize'
field in a dma segment descriptor.
 1.40 10-May-2000  pk * Fix thinko in offset computations.
* Add DIAGNOSTIC checks.
 1.39 09-May-2000  pk The bus_dma(9) implementation now allocates DVMA addresses in
bus_dmamap_load_*() routines only. Note that DMA memory buffers
allocated with bus_dmamem_alloc() _must_ be loaded by bus_dmamap_load_raw().
 1.38 11-Jan-2000  pk Remove old-style boot device recognition.
 1.37 07-Jan-2000  pk Deal with `24 bit' devices which can still be plugged into an Sbus slot.
 1.36 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.35 08-Jul-1999  thorpej branches: 1.35.2; 1.35.4; 1.35.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.34 25-May-1999  thorpej bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.
 1.33 20-Apr-1999  pk Protect extent(9) ops with splhigh().
 1.32 26-Mar-1999  mycroft branches: 1.32.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.31 25-Mar-1999  pk Put back <uvm/uvm.h>
 1.30 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.29 18-Oct-1998  christos PR/6311: By me... There was a bug unloading the dmamap:

addr = map->dm_segs[0].ds_addr & ~PGOFSET;
len = map->dm_segs[0].ds_len;
len = ((addr & PGOFSET) + len + PGOFSET) & ~PGOFSET;
addr &= ~PGOFSET;

Notice that the & ~PGOFSET in the first line should be gone. This fixes
the newfs large disk panic.
 1.28 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.27 19-Sep-1998  pk Pass the children register space in the attach arguments.
 1.26 10-Sep-1998  pk Use our brand new extent_alloc1() function to allocate cache-aligned
DVMA addresses.
 1.25 01-Sep-1998  pk Hang on to `old VM' a little while longer..
 1.24 31-Aug-1998  pk Implement cache alignment in bus_dmamem_load().
 1.23 28-Aug-1998  pk Pass on bus_dma*() aligment and boundary arguments.
 1.22 23-Aug-1998  pk Rename DVMA constants.
 1.21 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.20 20-Aug-1998  pk Pass on `NOWAIT' and `boundary' args to extent_alloc().
 1.19 31-Jul-1998  pk Move `dvma_cachealign' here from vm_machdep.c
 1.18 30-Jul-1998  pk The IOMMU now has its own dma bus tag and associated functions.
machdep.c retains the `mainbus' (i.e. sun4/sun4c) bus_dma* versions for now.
Create a DVMA map specifically for 24-bit devices (le,ie), which has a
more room than previous DVMA map which should be reserved for sun4 VME.
 1.17 30-Mar-1998  pk branches: 1.17.2;
Replace direct `sparc_bus_map()' calls with bus space map method.
 1.16 21-Mar-1998  pk The iommu "bus" now presents its own attach arguments to its children.
 1.15 12-Jan-1998  thorpej Update for changes to config.
 1.14 18-Sep-1997  pk Fix viking/MXCC botch similar to pmap.c.
 1.13 29-Jul-1997  fair branches: 1.13.2;
%x -> 0x%x
 1.12 02-Jul-1997  pk Remove a bogon.
 1.11 24-May-1997  pk Remove `bustype' argument from map[io]dev().
 1.10 22-Mar-1997  pk For each major "module", define a separate set of MMU control register bits.
 1.9 10-Mar-1997  pk Leave `has_iocache' unset if cache not enabled.
 1.8 10-Dec-1996  pk branches: 1.8.6;
Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.7 13-Oct-1996  christos backout previous kprintf change
 1.6 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.5 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.4 21-May-1996  pk Protect body of iommuattach() to be more resilient against configuration
file oddities.
 1.3 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.2 04-Apr-1996  abrown Add back support for cached DVMA on SuperSPARC (sun4m) machines that was lost
during merge
 1.1 31-Mar-1996  pk The sun4m IOMMU "device".
 1.8.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.13.2.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.32.2.2 15-Jan-2000  he Pull up revision 1.37 (requested by pk):
Allow old sbus cards with 24-bit devices (e.g. lance) to be
configured correctly on sun4m machines.
 1.32.2.1 23-Apr-1999  perry branches: 1.32.2.1.2;
pullup 1.32->1.33 (pk)
 1.32.2.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.32.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.35.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.35.4.1 15-Nov-1999  fvdl Sync with -current
 1.35.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.35.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.41.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.44.2.2 22-Jul-2000  pk Pull up revisions 1.45,1.49.

revision 1.45
Maintain the DVMA map extent subregion boundaries in the bus_dma map
structure.

revision 1.49
GC dead code.
 1.44.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.51.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.54.4.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.54.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.54.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.54.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.54.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.54.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.54.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.54.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.59.4.9 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.59.4.8 19-Dec-2002  thorpej Sync with HEAD.
 1.59.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.59.4.6 27-Aug-2002  nathanw Catch up to -current.
 1.59.4.5 01-Aug-2002  nathanw Catch up to -current.
 1.59.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.59.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.59.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.59.4.1 03-Oct-2001  nathanw file iommu.c was added on branch nathanw_sa on 2002-01-08 00:27:45 +0000
 1.59.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.63.6.1 22-Nov-2002  tron Pull up revision 1.66 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.63.4.3 31-Aug-2002  gehenna catch up with -current.
 1.63.4.2 21-Jul-2002  gehenna catch up with -current.
 1.63.4.1 15-Jul-2002  gehenna catch up with -current.
 1.75.2.5 11-Dec-2005  christos Sync with head.
 1.75.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.75.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.75.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.75.2.1 03-Aug-2004  skrll Sync with HEAD
 1.80.6.2 12-Feb-2005  yamt - use new apis.
- don't leave page mapped at kva being freed.
 1.80.6.1 12-Feb-2005  yamt use new apis.
 1.80.4.1 29-Apr-2005  kent sync with -current
 1.81.2.3 03-Sep-2007  yamt sync with head.
 1.81.2.2 30-Dec-2006  yamt sync with head.
 1.81.2.1 21-Jun-2006  yamt sync with head.
 1.82.2.2 22-Nov-2005  yamt sync with head.
 1.82.2.1 14-Nov-2005  yamt file iommu.c was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.83.22.1 10-Dec-2006  yamt sync with head.
 1.83.20.1 12-Jan-2007  ad Sync with head.
 1.84.4.2 24-Mar-2007  yamt sync with head.
 1.84.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.85.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.85.4.1 11-Jul-2007  mjf Sync with head.
 1.85.2.2 20-Aug-2007  ad Sync with HEAD.
 1.85.2.1 10-Apr-2007  ad Sync with head.
 1.86.8.1 15-Aug-2007  skrll Sync with HEAD.
 1.86.6.1 07-Aug-2007  matt Sync with HEAD.
 1.86.4.1 03-Oct-2007  garbled Sync with HEAD
 1.88.4.1 06-Nov-2007  matt sync with HEAD
 1.89.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.89.20.2 11-Mar-2010  yamt sync with head
 1.89.20.1 04-May-2009  yamt sync with head.
 1.89.18.1 17-Jun-2008  yamt sync with head.
 1.89.16.1 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.90.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.90.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.94.6.1 18-Feb-2012  mrg merge to -current.
 1.94.2.1 17-Apr-2012  yamt sync with head
 1.96.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.97.4.1 31-May-2021  cjep sync with head
 1.97.2.1 13-May-2021  thorpej Sync with HEAD.
 1.98.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.9 16-Nov-2005  uwe Use uint<N>_t.
 1.8 06-Jan-2003  wiz branches: 1.8.2; 1.8.18; 1.8.26;
writable, not writeable.
 1.7 28-May-2000  pk branches: 1.7.10;
Add a few comments.
 1.6 18-Nov-1998  pk branches: 1.6.10; 1.6.18;
Increase the delay after touching the IOMMU control register by another
three no-ops (empirically verified by Robert Elz).
 1.5 04-May-1998  pk Reading back the IOMMU registers apparently has the ability to wedge
microSPARC I cpus. Instead insert a couple of no-ops that seems to
avoid the microSPARC II lossage just as well.
 1.4 24-Jan-1998  pk After writing to the IOMMU flush registers, read something back from
IOMMU control space to a flush register to drain internal write buffers (?).
This avoids utter lossage on some machines (SS4s & SS5s) where our caller
would see some of its local (`%lx') registers trashed. This is probably
caused by a silicon bug allowing interference on internal data paths..
 1.3 14-Sep-1997  pk branches: 1.3.2;
Move sbus fields to sbusreg.h where they belong.
 1.2 16-May-1996  abrown branches: 1.2.12;
Copyright police (s/Harvard University/Harvard College/).
 1.1 31-Mar-1996  pk The sun4m IOMMU "device".
 1.2.12.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.2.3 22-Nov-1998  cgd pull up rev 1.6 from trunk (pk)
 1.3.2.2 05-May-1998  mycroft Pull up 1.5, per request of pk.
 1.3.2.1 07-Feb-1998  mellon Pull up 1.4
 1.6.18.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.6.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.10.1 06-Jan-2003  martin Catch up to -current.
 1.8.26.1 22-Nov-2005  yamt sync with head.
 1.8.18.1 21-Jun-2006  yamt sync with head.
 1.8.2.1 11-Dec-2005  christos Sync with head.
 1.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 11-Dec-2005  christos branches: 1.9.74; 1.9.76; 1.9.78;
merge ktrace-lwp.
 1.8 04-Jun-2005  tsutsui Add const.
 1.7 25-Aug-2002  thorpej branches: 1.7.6;
Move the DMA tag and DVMA map into the iommu_softc, and pass the
iommu_softc in the DMA tag cookie. This gives us a chance of supporting
systems (such as the Sun4d) which have multiple iommus.
 1.6 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.5 11-Jan-2000  pk branches: 1.5.8; 1.5.12; 1.5.20; 1.5.22;
Remove old-style boot device recognition.
 1.4 19-Sep-1998  pk branches: 1.4.12;
Pass the children register space in the attach arguments.
 1.3 21-Aug-1998  pk Move iommu_enter/iommu_remove here from <include/cpu.h>.
 1.2 21-Mar-1998  pk Add RCS-Id & copyright.
 1.1 21-Mar-1998  pk The iommu "bus" now presents its own attach arguments to its children.
 1.4.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.22.1 22-Nov-2002  tron Pull up revision 1.6 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.5.20.1 31-Aug-2002  gehenna catch up with -current.
 1.5.12.1 27-Aug-2002  nathanw Catch up to -current.
 1.5.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.7.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.78.1 16-May-2008  yamt sync with head.
 1.9.76.1 18-May-2008  yamt sync with head.
 1.9.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.20 11-Jan-2009  cegger adaption for making kgdb_dev a dev_t
 1.19 28-Apr-2008  martin branches: 1.19.8;
Remove clause 3 and 4 from TNF licenses
 1.18 04-Mar-2007  christos branches: 1.18.40; 1.18.42; 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;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.16 14-Nov-2005  uwe branches: 1.16.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.15 14-Nov-2005  uwe Catch up with changes to make this compile for MULTIPROCESSOR.
While here add some #endif comments.
 1.14 07-Aug-2003  agc branches: 1.14.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.13 15-Jul-2003  lukem __KERNEL_RCSID()
 1.12 02-Apr-2003  thorpej branches: 1.12.2;
Use PAGE_SIZE rather than NBPG.
 1.11 17-Jul-2002  thorpej More sun4m/sun4d common stuff.
 1.10 04-Dec-2001  darrenr branches: 1.10.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.9 30-Jun-2001  mrg branches: 1.9.2; 1.9.8;
pause other cpus from KGDB. XXX: need to implement other cpu trapframe access.
 1.8 26-May-2001  pk Pull in "opt_kgdb.h"; see PR#13036.
 1.7 29-Jun-2000  mrg branches: 1.7.2;
remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 08-Oct-1998  pk branches: 1.6.12;
Move [gs]etcontext() and [gs]etpte() to pte.h
 1.5 26-Sep-1998  pk Stop all other CPUs upon entering a debugger.
 1.4 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.3 08-Jan-1998  mrg do not use fb_unblank unless NFB > 0
 1.2 27-Sep-1997  pk GC setpte*() declarations.
 1.1 31-Aug-1997  pk branches: 1.1.2;
Switch to MI kgdb code.
 1.1.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.2 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 31-Aug-1997  thorpej file kgdb_machdep.c was added on branch marc-pcmcia on 1997-09-01 20:17:29 +0000
 1.6.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.9.8.3 01-Aug-2002  nathanw Catch up to -current.
 1.9.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.9.8.1 30-Jun-2001  nathanw file kgdb_machdep.c was added on branch nathanw_sa on 2002-01-08 00:27:45 +0000
 1.9.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.8.1 21-Jul-2002  gehenna catch up with -current.
 1.12.2.4 11-Dec-2005  christos 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.14.16.2 03-Sep-2007  yamt sync with head.
 1.14.16.1 21-Jun-2006  yamt sync with head.
 1.16.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.16.2.1 14-Nov-2005  uwe file kgdb_machdep.c was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 1.17.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.44.2 04-May-2009  yamt sync with head.
 1.18.44.1 16-May-2008  yamt sync with head.
 1.18.42.1 18-May-2008  yamt sync with head.
 1.18.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.18.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.5 26-Sep-1998  pk This file is no longer used
 1.4 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.3 31-Mar-1996  pk Various sun4m-related changes straight from Aaron.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.11 31-Aug-1997  pk Switch to MI kgdb code.
 1.10 13-Oct-1996  christos branches: 1.10.10;
backout previous kprintf change
 1.9 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.7 04-Apr-1996  abrown cpu.c: correctly identify Sun4m associative caches
kgdb_stub.c: make it compile again with Sun4m-only kernel
 1.6 01-Apr-1996  christos Fix warnings when SUN4M is not defined.
 1.5 01-Apr-1996  christos Added missing prototypes and include files, fixed parentheses so that it
compiles cleanly.
 1.4 31-Mar-1996  pk Various sun4m-related changes straight from Aaron.
 1.3 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.10.1 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6 28-Apr-2023  skrll Pass local symbols relocations in both passes and provide the kobj_reloc
implementation visibility of these relocations.

Currently all implementations resolve local symbol relocations in the first
pass and simply skip them in the second. The RISC-V implementation will
make use of this visiblity.
 1.5 05-Nov-2017  christos fix type of addr.
 1.4 03-Nov-2017  maxv Handle absolute relocations coming from the kernel: preserve SHN_ABS in
the kernel and module symbols, and when relocating a symbol that has
SHN_ABS, take its value as-is and don't return an error if it equals zero.

Sent on tech-kern@.
 1.3 12-Jun-2011  mrg branches: 1.3.12;
sparc relative reloctions are busted here; copy the sparc64 style
which seems to make things work fine, and also seems to follow what
ld.elf_so does.

this makes modules work in my limited testing.
 1.2 28-Apr-2008  martin branches: 1.2.32;
Remove clause 3 and 4 from TNF licenses
 1.1 04-Jan-2008  ad branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14; 1.1.16; 1.1.18;
More linker stuff
 1.1.18.1 16-May-2008  yamt sync with head.
 1.1.16.1 18-May-2008  yamt sync with head.
 1.1.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.8.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.8.1 04-Jan-2008  mjf file kobj_machdep.c was added on branch mjf-devfs on 2008-02-18 21:05:03 +0000
 1.1.6.2 21-Jan-2008  yamt sync with head
 1.1.6.1 04-Jan-2008  yamt file kobj_machdep.c was added on branch yamt-lazymbuf on 2008-01-21 09:39:25 +0000
 1.1.4.2 09-Jan-2008  matt sync with HEAD
 1.1.4.1 04-Jan-2008  matt file kobj_machdep.c was added on branch matt-armv6 on 2008-01-09 01:48:58 +0000
 1.1.2.2 08-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 04-Jan-2008  bouyer file kobj_machdep.c was added on branch bouyer-xeni386 on 2008-01-08 22:10:25 +0000
 1.2.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3.12.1 03-Dec-2017  jdolecek update from HEAD
 1.14 06-Apr-2022  riastradh Nix trailing whitespace in files of membars, atomics, and lock stubs.

Will be touching many of these files soon for functional changes.

No functional change intended.
 1.13 30-Dec-2019  ad PR port-sparc/54789: Sparc boot fails with "Trap 0x21 while interrupts disabled"

Remove assumption that cpu_info is smaller than 1kB.
 1.12 25-May-2008  chs branches: 1.12.86;
enable profiling of assembly functions.
 1.11 28-Apr-2008  martin branches: 1.11.2;
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 28-May-2007  mrg branches: 1.9.10;
disable mutex_spin_enter() & mutex_spin_exit() as they are currently
broken and cause MULTIPROCESSOR kernels to hang while entering
userland boot up.
 1.8 03-Mar-2007  macallan branches: 1.8.2; 1.8.4; 1.8.10;
shave a nop
 1.7 03-Mar-2007  macallan found the last piece of crack, so
- now my sparcbook goes multiuser without LOCKDEBUG
- shaved a couple instructions
 1.6 03-Mar-2007  macallan unsmoke some more crack ;)
mutex_enter() and mutex_exit() should now work properly
 1.5 18-Feb-2007  ad Eliminate 2 unnecessary loads.
 1.4 18-Feb-2007  macallan "unsmoke crack"
from mrg and ad
 1.3 15-Feb-2007  ad branches: 1.3.2;
- mutex_exit(): call mutex_wakeup() if there are waiters, since we have
already released the lock when we reach the waiters check.
- mutex_enter(): denote the start and end of the critical and export
labels. If an LWP is preempted after grabbing the interlock, the dummy
owner value (0xff000000) will persist, but the real owner value must be
set soon to prevent deadlock. On entry to interrupt we'll need to check
for this and set in the correct value if the LWP was interrupted in the
critical section.
 1.2 09-Feb-2007  ad Merge newlock2 to head.
 1.1 18-Mar-2002  thorpej branches: 1.1.2; 1.1.18; 1.1.36;
file lock_stubs.s was initially added on branch newlock.
 1.1.36.2 28-Jan-2007  ad - Fix sequence error between saving/raising the SPL.
- Changes for JavaStation.
- Fix bugs with mips & sparc support routines.
 1.1.36.1 12-Jan-2007  ad sparc MD changes.
 1.1.18.2 03-Sep-2007  yamt sync with head.
 1.1.18.1 26-Feb-2007  yamt sync with head.
 1.1.2.4 22-Mar-2002  thorpej Handle MUTEX_DEBUG.
 1.1.2.3 18-Mar-2002  thorpej Two more fixes to rwlocks which get the kernel multi-user:
* %o6 is the stack pointer, so don't futz with it.
* When clearing the interlock, use stb (the interlocks are only
1 byte wide).
 1.1.2.2 18-Mar-2002  thorpej Make sure the _rwlock_*() helpers end up in .text.
 1.1.2.1 18-Mar-2002  thorpej First cut at mutex and rwlock implementation for SPARC.
 1.3.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.3.2.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.10.1 26-Jun-2007  garbled Sync with HEAD.
 1.8.4.1 11-Jul-2007  mjf Sync with head.
 1.8.2.1 09-Jun-2007  ad Sync with head.
 1.9.10.1 06-Nov-2007  matt sync with HEAD
 1.10.20.2 04-May-2009  yamt sync with head.
 1.10.20.1 16-May-2008  yamt sync with head.
 1.10.18.2 04-Jun-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.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.86.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.287 06-Sep-2025  riastradh paravirt_membar_sync(9): New memory barrier.

For use in paravirtualized drivers which require store-before-load
ordering -- irrespective of whether the kernel is built for a single
processor, or whether the (virtual) machine is booted with a single
processor.

This is even required on architectures that don't even have a
store-before-load ordering barrier, like m68k; adding, e.g., a virtio
bus is _as if_ the architecture has been extended with relaxed memory
ordering when talking with that new bus. Such architectures need
some way to request the hypervisor enforce that ordering -- on m68k,
that's done by issuing a CASL instruction, which qemu maps to an
atomic r/m/w with sequential consistency ordering in the host.

PR kern/59618: occasional virtio block device lock ups/hangs
 1.286 29-Apr-2025  martin PR port-sparc/59307: kernel longjmp(9) only gets a single argument,
make setjmp(9) always return 1 via longjmp(9).
 1.285 10-Feb-2024  andvar branches: 1.285.2;
s/indicies/indices/ in comments.
 1.284 23-Feb-2023  riastradh sparc: Add missing barriers in cpu_switchto.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.283 15-May-2022  mrg branches: 1.283.4;
remove unused Lpanic_savefpstate.
 1.282 16-Apr-2022  andvar fix various typos in comments and log messages.
 1.281 09-Aug-2021  andvar s/aligment/alignment/ + one more typo fix in comments.
 1.280 25-Apr-2021  mrg fix a comment to match the code.
 1.279 24-Jan-2021  mrg branches: 1.279.4;
avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.278 30-Jun-2020  maxv branches: 1.278.2;
Make copystr() a MI C function, part of libkern and shared on all
architectures.

Notes:

- On alpha and ia64 the function is kept but gets renamed locally to avoid
symbol collision. This is because on these two arches, I am not sure
whether the ASM callers do not rely on fixed registers, so I prefer to
keep the ASM body for now.
- On Vax, only the symbol is removed, because the body is used from other
functions.
- On RISC-V, this change fixes a bug: copystr() was just a wrapper around
strlcpy(), but strlcpy() makes the operation less safe (strlen on the
source beyond its size).
- The kASan, kCSan and kMSan wrappers are removed, because now that
copystr() is in C, the compiler transformations are applied to it,
without the need for manual wrappers.

Could test on amd64 only, but should be fine.
 1.277 12-Jan-2020  ad Fix some more places in this file it's assumed cpu_info is smaller than 1kB.
 1.276 08-Jan-2020  skrll oldlwp is always non-NULL in cpu_switchto so remove the test for NULL.
 1.275 30-Dec-2019  ad branches: 1.275.2;
PR port-sparc/54789: Sparc boot fails with "Trap 0x21 while interrupts disabled"

Remove assumption that cpu_info is smaller than 1kB.
 1.274 07-Jun-2019  mrg branches: 1.274.2;
remove code to directly check for NULL savefpstate() calls.
it has not triggered for years now, and if it comes back,
you still get a normal kernel fault.
 1.273 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.272 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.271 31-May-2018  mrg branches: 1.271.2;
convert Lfp_null_fpstate (which is invoked if savefpstate() is called
with NULL) into a panic for DIAGNOSTIC kernels.
 1.270 16-Mar-2018  mrg remove obsolete ovbcopy(). it may be the very slightly bit
faster for larger copies, but slower for smaller ones.
i don't see any major benefit in keeping this code.

this is the final ovbcopy() reference in src. you're welcome :-)
 1.269 25-Nov-2017  maya branches: 1.269.2;
Avoid an instruction requiring a higher alignment than we are guaranteed

Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.
 1.268 04-Nov-2012  chs branches: 1.268.12; 1.268.16; 1.268.24; 1.268.30;
in cpu_switchto(), remove the MP-unsafe code to mark a pmap active on a CPU,
pmap_activate() already does this. add MP locking to pmap_activate()
and pmap_deactivate(). move flushing of user windows and virtual caches
from pamp_activate() to pmap_deactivate().
 1.267 02-Nov-2012  chs Add RAS support for sparc.
 1.266 19-Feb-2012  rmind branches: 1.266.2;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.265 15-Aug-2011  mrg branches: 1.265.2; 1.265.6; 1.265.8;
re-introduce the NULL savefpstate IPI checks and evcnts. something
is Wrong with GCC 4.5.3 and these trigger. i haven't seen anything
else particularly wrong so for now this will allow sparc to switch
to GCC 4.5, which otherwise seems to be working very well for me.

sigh. i'm going to file a PR to research what is really wrong here.
 1.264 20-Feb-2011  mrg remove an unused "1:" label left over from previous commit.
 1.263 20-Feb-2011  mrg remove the evcnt for NULL struct fpstate * ipi, and switch over to an
explicit panic() if we get one.

i'm pretty sure that converting xmpsg_lock from IPL_VM to IPL_SCHED
fixed this problem properly. i have not seen the evcnt trigger since
that change, nor have several others queried.
 1.262 15-Feb-2011  mrg give memfault_sun*() some entry points that both gdb and ddb will find.
 1.261 15-Feb-2011  mrg - move nmi_sun4m intr counting into nmi_soft/nmi_hard.
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
 1.260 27-Jan-2011  mrg consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters. beyond the extra info, it seems to help avoid some
of these counters getting corrupted due to unlocked multiple accesses.

adjust the xcallintr() from xcall() hack so that we don't count these
events as interrupts. align the existing evcnt name to count this.
 1.259 13-Jan-2011  mrg branches: 1.259.2; 1.259.4;
introduce a hack to workaround the savefpstate IPI get's NULL
struct fpstate *.

add a new entry point ipi_savefpstate() that is used for this IPI
instead of the plain ipi_savefpstate(). check for %o0 being NULL,
and if so, just return.

add event counters for the savefpstate IPI, and another one for
when it detects the NULL problem.

make the cpu_info struct xmpsg be aligned to a single cache line.

with this change applied (and another minor change in testing) my
SS20 with dual SM75's has survived for 17 hours on build.sh -j5,
and has reported 7 NULL savefps. (the minor change seems to have
a significant effect at reducing this number, but more testing is
needed for it.)


XXX: this is horrible and we really need to find the real problem
XXX: but this should let people use sparc smp again, and fixes
XXX: for the real problem can be tested by seeing if any of the
XXX: savefp IPI null counter becomes non-zero.
 1.258 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.257 08-Aug-2010  chs update a comment.
 1.256 07-Mar-2010  mrg branches: 1.256.2;
gas has supported SPARC ".empty" for a long while; get rid of an
ancient workaround.
 1.255 28-Jan-2010  mrg branches: 1.255.2;
in savefpstate(), make sure we fill in the _first_ read of %fsr into
the fpstate structure, not the last one. avoids fs->fs_fsr lacking the
traptype field later when fpu_cleanup() is processing it, which leads
to a panic() occuring.

idea, and code suggestions from uwe.
 1.254 04-Jan-2010  mrg use the idle lwp's uarea for stack, not the interrupt stack. this works
now, and it fixes up idle vs interrupt time measurement for cpu>0.
 1.253 03-Jan-2010  mrg reinsert part of the code accidentally deleted by the previous change.
 1.252 03-Jan-2010  mrg add two new members to struct intrhand: ih_realfun and ih_realarg, and
use them to take the kernel lock around non-IPL_VM interrupts, using
a intr_biglock_wrapper() function ike x86 does.
 1.251 03-Jan-2010  mrg use genassym generated names for struct intrhand elements and avoid magic.
 1.250 20-Dec-2009  mrg - remove unused ft_want_ast()
- give nmi_sun* ENTRY() points so they show up in symbols properly
- add some disabled code to use this cpu's idlelwp area when hatching
a cpu, but right now it makes this worse not better...
 1.249 10-Dec-2009  rmind Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.248 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.247 05-Jun-2009  mrg convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits. amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement. ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?


XXX the current implementation depends on a couple of things:
XXX - ev_count member of evcnt{} is first and has offset 0
XXX - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it
 1.246 29-May-2009  mrg fix up cpu_setfunc() as noted by uwe:

- don't call lwp_startup for cpu_setfunc() users
- introduce lwp_setfunc_trampoline instead
- no need to set the "new" lwp for setfunc
 1.245 18-May-2009  mrg - retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)

we still waste one page of space, but this gets SMP much closer to
actually working again.
 1.244 25-May-2008  chs branches: 1.244.8; 1.244.16;
enable profiling of assembly functions.
 1.243 08-Jan-2008  martin branches: 1.243.6; 1.243.8; 1.243.10; 1.243.12;
cpu_intr_p() for sparc, from Andrew Doran.
 1.242 08-Dec-2007  mrg branches: 1.242.4;
catch up with the adses: IPL_CLOCK -> IPL_VM in a couple of places
that are #ifdef MULTIPROCESSOR.

MP sparc kernel faults inside proc0_init() yet.
 1.241 03-Dec-2007  ad branches: 1.241.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.240 17-Oct-2007  garbled branches: 1.240.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.239 23-May-2007  he branches: 1.239.8; 1.239.10;
Remove MUNGE(NOP_ON_4M_15), that label no longer exists.
 1.238 22-May-2007  mrg cpu_switchto(): if oldlwp is NULL, don't bother saving it.
 1.237 21-May-2007  martin Fix cpu_idle() for machines that have a idlespin function - use a
sibling call to invoke it (cpu_idle pretends to be a leaf function).
Pointed out by uwe.
 1.236 20-May-2007  macallan fix typo in cpu_idle - the function we want to call is in %01 not %o3
 1.235 19-May-2007  uwe Make lwp_trampoline comment explain how things are set up in more details.
While here, fix gimplish in the inline comment too (hi, phone!)
 1.234 19-May-2007  mrg fix the two problems i introduced with yamt-idlelwp:

- in lwp_trampoline, oldlwp is already in %o0. don't save or the wrongly
saved copy from cpu_lwp_fork(). as repeatedly pointed out my uwe.

- in cpu_idle use retl not ret. as pointed out by martin.


thanks to uwe/martin/tnn for all the real debugging work.
 1.233 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.232 21-Apr-2007  rjs branches: 1.232.2;
Don't need to save lwp for use in lwp_exit2().
 1.231 04-Mar-2007  christos branches: 1.231.2; 1.231.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.230 04-Mar-2007  uwe G/c NOP_ON_4_4C_1 that used to be part of microtime.
Keep for reference but ifdef out the code to munge 4/4c nops
as there are none left.
 1.229 26-Feb-2007  mrg - don't call lwp_exit2(). ad@ says it isn't required anymore.
- load uvm.page_idle_zero with "ldub" instead of "ld", avoiding an
unaligned access panic introduced since the int->bool changes.

now a -current kernel (both UP and MP) boot on my SS20 as long as
i have "options LOCKDEBUG" as well.
 1.228 09-Feb-2007  ad branches: 1.228.2;
Merge newlock2 to head.
 1.227 28-Jun-2006  martin branches: 1.227.4;
Align the size and alignment of label_t (kernel jmp_buf equivalent)
with the use in setjmp/longjmp. Duh!
This makes DDB work again on sparc kernels compiled with gcc4.
 1.226 07-Jun-2006  kardel branches: 1.226.2;
convert to timecounters (from branch simonb-timecounters)
 1.225 12-May-2006  skrll branches: 1.225.2;
Fix some comments.
 1.224 16-Nov-2005  uwe branches: 1.224.4; 1.224.6; 1.224.8; 1.224.12;
Drop trailing whitespace.
 1.223 14-Nov-2005  uwe Protect all places that refer to _redzone with
#if defined(DEBUG) && !defined(MULTIPROCESSOR)
Makes MULTIPROCESSOR + KGDB compilable.
 1.222 26-Oct-2005  uwe branches: 1.222.2;
sigcode is needed only for COMPAT_16.
 1.221 16-Oct-2005  uwe branches: 1.221.2;
Shave off one instruction in _syscall.
 1.220 30-Sep-2005  macallan fix borked MicroSPARC IIep microtime() from previous version.
 1.219 24-Sep-2005  macallan add a function pointer to struct cpu_info:
void idlespin(struct cpu_info *)
which is called whenever the CPU is idle and uvm_pageidlezero() has nothing to
do
 1.218 24-Sep-2005  macallan Run the MicroSPARC IIep PCI bus without endianness translation.
This allows us to run X without any additional code changes.
 1.217 10-Sep-2005  uwe Hanlde NMI on microSPARC-IIep.

We don't do much useful except reporting, but that's better than to
stupidly use sun4m handler and wedge the machine. May need to revisit
what's fatal.

Prodding by macallan@
 1.216 10-Jul-2005  christos - add syscall_{plain,fancy}
- make it use mi_userret
 1.215 01-Feb-2005  pk branches: 1.215.6;
sun4/sun4c sw interrupt entry: check interrupt register to determine to
see whether there is a pending software interrupt at the given level.
If not, it must be a device interrupt sharing that level.
 1.214 04-Jul-2004  pk branches: 1.214.4; 1.214.6;
cpu_simple_lock: on spin out, check whether we've already panicked. If so,
just take the lock on the assumption that in panic mode, we run on a single
CPU anyway.
 1.213 04-Jul-2004  pk Fix typo in CHECK_SP_REDZONE() which has been there since the beginning of time.
 1.212 13-May-2004  pooka 10+ entries in the kernel sources can't be wrong ... no, wait, they can:
it really is "panicking" instead of "panicing", so revert rev 1.211

thanks to Klaus for holding the spelling bee
 1.211 13-May-2004  pooka typo in comment: panicking -> panicing
 1.210 04-May-2004  pk `uvmexp.swtch++' is already done in exit1().
 1.209 02-May-2004  pk The cpu_exit() detour is no longer necessary.
 1.208 28-Apr-2004  pk Fast trap handler for Illegal Instruction traps for (user space) FLUSH
instructions (these occur only on Cypress CPUs).
 1.207 20-Apr-2004  pk Always provide the __cpu_simple_lock() entry point (for LKMs).
 1.206 20-Apr-2004  pk Provide a fast trap path for AST IPIs.
 1.205 19-Apr-2004  pk CMP_PTE_USER_READ4M: drop instruction that's effectively a no-op.
 1.204 18-Apr-2004  pk Various ft_srmmu_vcache_*() functions: use `branch on greater (unsigned)'
instead of `branch on positive'.
 1.203 18-Apr-2004  pk Make inlining __cpu_simple_lock() optional. Add a version with a built-in
spin out counter that panics with a diagnostic.
 1.202 17-Apr-2004  pk Update fast xcall interrupt event counter.
ft_srmmu_vcache_flush_range: adjust length for address alignment
 1.201 17-Apr-2004  pk When acknowledging a sun4m soft interrupt, read back the pending interrupts
hw register to make sure it gets through on Ross CPUs.
 1.200 17-Apr-2004  pk The macro CMP_PTE_USER_READ4M now needs to consider more PTE access
rights combinations, since the access rights table in pmap has changed.
 1.199 17-Apr-2004  pk Implement fast trap handlers for TLB and cache flushes.
 1.198 21-Mar-2004  pk branches: 1.198.2;
Add openfirmware() entry point, since it's no longer defined as a macro
in openfirm.c.
 1.197 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.196 16-Nov-2003  pk Drop the old cpu_switch() code.
 1.195 08-Nov-2003  pk Construct arguments properly and update comment in previous bzero -> memset
changes.
 1.194 08-Nov-2003  martin Fix previous (bzero -> memset), it overlooked the delay slot.
Use set and clr pseudo instructions to simplify the code a bit.
 1.193 08-Nov-2003  jdolecek use "mov 0, %o1" instead of kinda strange "sethi 0, %o1" in previous
pointed out by Matthew Green
 1.192 08-Nov-2003  jdolecek use memset() instead of bzero()
 1.191 07-Nov-2003  pk cpu_switch: values in global registers are not preserved across function calls.
 1.190 15-Oct-2003  pk sun4m_access_fault: Treat text/data error traps as if they were text/data
exception traps, except that they're logged on the console.
 1.189 05-Oct-2003  pk sparc kernel support for SA_SIGINFO.
 1.188 08-Apr-2003  uwe branches: 1.188.2;
Make v8_*_len symbols local so that they don't get in the way in ddb.
 1.187 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.186 21-Feb-2003  pk Allow the kernel to be loaded at its link address (aka KERNBASE) by the
boot program.
 1.185 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.184 17-Jan-2003  pk cpu_switch:
* return `switched to same process' only if that process was actually
already on a run queue when we entered.
* skip the switch to the idle stack if we can switch immediately
* .. and because of this, don't release the scheduler lock until after
we've fully switched to the new process's stack.
 1.183 17-Jan-2003  pk Don't grab the kernel lock for system timer interrupts; this mostly prevents
stalls in system time processing.

XXX - deal with non-atomic global time variables updates later.
 1.182 13-Jan-2003  mrg remove cpu_hatched, cpu_hatch_sc and cpu_hatchstack. the first can use
the cpi->flags, the second is unused and the third is also cpi-idle_u.
 1.181 12-Jan-2003  uwe Account softintr_common as uvmexp.softs, not uvmexp.intrs.
 1.180 11-Jan-2003  mrg keep track of which cpu's have run a pmap and only broadcast tlb flushes to
cpu's who have done so. implement pmap_deactivate() for MULTIPROCESSOR and
call it from cpu_switch() when we are about to switch proces and when we
enter idle().

with this change, i see significantly reduced tlb IPI traffic and fork/exec
bound processes -- such as "configure" -- run significantly faster, upto
15%. i also obvserved a small (0-2%) benefit to CPU bound tasks as well.
 1.179 10-Jan-2003  pk Replace `want_resched' and `want_ast' globals by per-CPU variables.
 1.178 07-Jan-2003  pk Let all CPUs play..
 1.177 04-Jan-2003  pk Grab the kernel lock on interrupts at level IPL_CLOCK and lower.
 1.176 04-Jan-2003  pk new cpu_switch: SMP: even if we pick up the same process after idling, we
must reset its context as the process might have run on another cpu in
between and had its context changed, e.g. by exec(2).
 1.175 01-Jan-2003  pk SMP: lock kernel for soft interrupts < IPL_SCHED as well.
 1.174 31-Dec-2002  pk Slight optimisation in proc_trampoline().
 1.173 31-Dec-2002  pk New version of cpu_switch/switchexit, mostly to simplify SMP support. It's
currently conditional on ALT_SWITCH_CODE (defaults to `on' if MULTIPROCESSOR
is defined) until more testing rounds are completed.
 1.172 31-Dec-2002  pk nmi_sun4m: run handler at splhigh()
 1.171 23-Dec-2002  pk xcallintr() receive a `clockframe *' argument, not a `trapframe *'.
Setup a DDB context for paused CPUs by defining a soft trap (T_DBPAUSE)
which uses the generic trap handler code to get the trapframe constructed
and then calls on a debugger-defined `suspend' routine.
 1.170 21-Dec-2002  pk * cpu_hatch(): enable interrupts upon return from cpu_setup().
* interrupt trap: acquire the kernel lock only for interrupt levels <= PIL_SCHED
 1.169 09-Dec-2002  pk Soft interrupts use their own set of handlers lists.
 1.168 08-Dec-2002  pk cpu_switch(): avoid raising the interrupt level and enabling traps at the
same time as this may cause a spurious interrupt in some implementations.
Pointed out by uwe.
 1.167 06-Dec-2002  pk ienab_bi[cs] are never used in a context common to both sun4/4c and sun4m,
so there's no point in constructing common entry points for them in locore.s.
 1.166 06-Dec-2002  pk Pass the `device class interrupt level' on to intr_establish() and use to
raise the ipl in the interrupt handlers to the appropriate level. This avoids
interrupt handler interference if one of the devices actually interrupts at
a lower hardware level than the maximum level assined to a device class.

Based on code from Art Grabowski in openbsd.
 1.165 29-Nov-2002  pk Provide the V8 mul/div routines for SUN4D as well.
 1.164 28-Nov-2002  pk Move the installation of v8 specific .mul/.div functions into a separate
routine to be called when we're sure the CPU is actually sparc version 8.
 1.163 27-Nov-2002  pk Provide sparc v8 multiply/divide routines which are copied over the base
v7 versions on sun4m and sun4d machines. Based on Chris Torek's BSD/OS
code.
 1.162 17-Aug-2002  uwe Add missing slash to /* notyet *
 1.161 14-Aug-2002  uwe Fix botch in previous. #ifdef DIAGNOSTIC was one instructions too early
in sparc_interrupt4m, thus breaking soft interrupts for normal 4m's.

Should fix port-sparc/17891 (thanks, Martin).
 1.160 04-Aug-2002  uwe In DIAGNOSTIC kernels detect situation that on sun4m neither hardware
nor software interrupt pending bit is set for the current ipl. Report
this as a "bogus" interrupt (better name anyone?). This is a symptom
of a bug in interrupt handling in one of device drivers interrupting
at this ipl. Reviewed by pk.
 1.159 17-Jul-2002  thorpej Add sun4d cases for early bootstrap. This is good enough to
get as far as printing the copyright on an SPARCserver 1000.
 1.158 17-Jul-2002  thorpej Print out a meaningful message on the sun4d if the kernel does
not support the sun4d, like we do with sun4c and sun4m.
 1.157 11-Jun-2002  uwe Fix typo in nmi_sun{4,4c}, use correct register.
 1.156 10-Jun-2002  uwe Fill delay slot in previous to match normal microtime.
 1.155 09-Jun-2002  uwe Do not use "std" in ms-IIep micortime, the argument is not guaranteed
to be double-word aligned and it is not when we are called from bpf.
Remove "should be able to std here" comment in generic microtime.
While here, simplify some asm mnemonics and fix a typo in comment.
 1.154 31-May-2002  thorpej Use C-style comments in a few places where ' appears in the comment,
so that this works with GCC 2.95.3's ISO C preprocessor.
 1.153 04-Feb-2002  pk branches: 1.153.4; 1.153.8; 1.153.10;
Rename `esym' to `kernel_top' and always initialize it in locore from
the information provided by the loader if possible (defaulting to `end').
If the DDB symbols aren't needed, `kernel_top' is adjusted in
autoconf:bootstrap() before calling pmap_bootstrap(). It will also
preserve the bootinfo data (if passed by the loader) for non-DDB kernels.
 1.152 23-Jan-2002  pk Eliminate `cputyp' test from cpu_switch().
 1.151 08-Jan-2002  uwe In the idle loop add a comment to wrpsr in the annulled delay slot of
an ifdefed branch instruction to make it obvious where it belongs to.
The ifdef makes it very confusing visually.
 1.150 30-Dec-2001  pk Change interface between cpu_fork() and proc_trampoline() so that `tf_pc'
(instead of `tf_npc') contains the user-space return address. This ensures
entering the signal trampoline code correctly in case we take handled
signal during child_return().
 1.149 11-Dec-2001  uwe Implement microSPARC-IIep versions of sparc_interrupt4m, raise and microtime.
 1.148 13-Sep-2001  pk branches: 1.148.4;
Some sun4c machine (e.g. an IPC) can also have just 7 register windows,
so check for a possible context switch optimization #if SUN4C too.
 1.147 13-Sep-2001  pk The SAVE macro used in the context switch code wound up being defined
only if MULTIPROCESSOR in rev 1.142, causing spurious register window
corruption on some machines.
 1.146 13-Aug-2001  jdolecek branches: 1.146.2;
g/c _remque()/_insque(); use the C version in libkern
 1.145 07-Jul-2001  mrg branches: 1.145.2;
- replace CPUFLG_STARTUP with new CPUFLG_READY scheme, used after startup has
occured. cpus now spin waiting for new `go_smp_cpus' variable to go non-zero.
- new xpmsg_lock that must held around all cross call activity. new macros:
LOCK_XPMSG() and UNLOCK_XPMSG().
- delete delay(1)/cache_flush gone from raise_ipi_wait_and_unlock(), it incurred
a stupid performance penalty.
 1.144 12-Jun-2001  uwe Be prepared to get OpenFirmware client entry in either %o3 (PROM way)
or %o0 (our boot code passes romp in %o0 even for OF machines).
Discussed with pk.
 1.143 10-Jun-2001  mrg oops; non-primary cpus should still spin, not jump to idle.
 1.142 08-Jun-2001  mrg more SMP work: finish up ipi's, SMP DDB support, cpu startup issues, and
idle() u area issues:

in nmi_sun4m(), if this is a soft NMI and DDB is configured, setup a trapframe
and pass it to nmi_soft(). in cpu_hatch(), spin until our cpu's flags no longer
have CPUFLG_STARTUP set. then, setup registers and jump to
idle_enter_no_schedlock. in idle(), if MULTIPROCESSOR, always switch to this
cpus idle u. a minor optimisation to cpu_switch().
 1.141 08-Jun-2001  mrg split {sunos,svr4}_sigcode out for LKMs
 1.140 26-May-2001  pk Pull in "opt_kgdb.h"; see PR#13036.
 1.139 09-Apr-2001  pk proc_trampoline(): mave the new process run at base interrupt priority level.
This is especially important for in-kernel processes started from here,
which would otherwise keep running at splclock().
 1.138 18-Mar-2001  chs in mem_access_fault*(), when invoking the pcb_onfault mechanism, pass the
return value of uvm_fault() to the onfault routine via %o0. users of
pcb_onfault now return this value to their callers rather than always
returning EFAULT. this allows i/o errors in VOP_GETPAGES() to be returned
back to read(), etc.
 1.137 15-Mar-2001  mrg lock the kernel around calling interrupt stubs.
 1.136 02-Mar-2001  pk branches: 1.136.2;
* proc_trampoline: call `proc_trampoline_mp()' #if MULTIPROCESSOR;
currently necessary to acquire the `running in kernel mode' lock;
pointed out by Bill Sommerfeld/Simon Gerraty.

* remove reference to `cpu_set_kpc()' from comments, as we don't have it.
 1.135 02-Mar-2001  pk bootstrap area: remove dead code + some trivial reformatting
 1.134 31-Aug-2000  pk Scheduler lock update.
 1.133 24-Jul-2000  pk Fix delay slot error in the SUN4_MMU3L startup code.
 1.132 31-May-2000  pk branches: 1.132.2;
Fix a couple of typos.
 1.131 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Fix a bug where all cpu_info structures except for the boot CPUs
would exist at both a CPU-local VA (CPUINFO_VA) and a gloal VA;
The boot CPU's existed only a CPUINFO_VA.
- Add a self-reference pointer to the cpu_info that references the
global address in the MULTIPROCESSOR case. Just allow it to reference
the `local' VA in the single-processor case, as CPUINFO_VA is global
enough when there's only one processor to care about. Change curcpu()
to return the global address.
 1.130 26-May-2000  thorpej branches: 1.130.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.129 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.128 30-Apr-2000  pk Arrange to call uvm_pageidlezero() from idle loop.
 1.127 21-Mar-2000  pk Missing _C_LABEL().
 1.126 05-Nov-1999  chs branches: 1.126.2;
several fixes to copy{in,out,}str() from charles and myself:
don't panic if maxlen == 0, just return ENAMETOLONG.
treat maxlen as unsigned like the manpage indicates.
avoid crashing if the userspace address is >= KERNBASE.
make sure *done is 0 when no bytes are copied.
 1.125 04-Oct-1999  pk branches: 1.125.2; 1.125.4; 1.125.6;
Since a context table is now pointing at the correct per-CPU region table
at all times, we can dispense with the hackery that patches the magic entry
at context-switch time.
 1.124 17-Sep-1999  thorpej Centralize the declaration and clearing of `cold'.
 1.123 05-May-1999  pk Declare `bootinfo' also if !DDB.
 1.122 05-May-1999  christos Argh, removed last ELF induced problem. We used to have syscall: in locore.s
and _C_LABEL(syscall) in trap.c. In ELF they are the same. Change the label
in locore.s to be _C_LABEL(_syscall).
While I am there, move the register save and restoral code used in the
*sigcode trampolines into two macros and use them instead of copying 100
lines of assembly each time.
Now everything ELF works.
 1.121 04-May-1999  christos Fix panic and panicstr to use _C_LABEL.
Statuc: ELF kernel loads symbols properly, hangs in syscall while running init.
 1.120 03-May-1999  pk Gain one instruction..
 1.119 03-May-1999  christos s/\<0x4000\>/PROM_LOADADDR
remove unused cputypvallen, and _msgbufaddr
 1.118 02-May-1999  pk * Add missing label.
* Avoid harmful delay-slot instruction, if we did not get a `bootinfo' thing.
* Compute correct location of `esym' for all three methods of debug
symbol loading we support.
 1.117 30-Apr-1999  christos Add bootinfo support for loading symbol tables.
 1.116 29-Apr-1999  christos Revert previous bootinfo premature commit, and commit the sunos_sigcode
stuff instead.
 1.115 29-Apr-1999  christos Add sunos_sigcode and sunos_esigcode for COMPAT_SUNOS
 1.114 30-Mar-1999  pk branches: 1.114.2;
The MMU_3L option became SUN4_MMU3L long ago.
 1.113 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.112 05-Mar-1999  pk Apply C_LABEL() to `esym' too.
 1.111 05-Mar-1999  pk Use macros from <machine/asm.h> to construct C labels.
 1.110 14-Feb-1999  pk romcall() => prom_halt()
 1.109 14-Feb-1999  pk Check OBP magic: if no match then assume an Openfirmware PROM.
 1.108 26-Nov-1998  mycroft Minor changes; indentation for delay slots and NOTREACHED comments.
 1.107 26-Nov-1998  mycroft Clean up kcopy() some more:
* Return EFAULT, not -1.
* Rearrange some instructions for better parallelism.
 1.106 26-Nov-1998  pk kcopy() must restore pcb_onfault handler. Pointed out by Charles Hannum.
 1.105 24-Oct-1998  pk Duh.. condition codes are not preserved when writing directly into %psr.
Also, we need to deal with bus latency when turning off bits in the
interrupt status register.
 1.104 19-Oct-1998  pk Maintain a current process (`curproc') a per CPU.
 1.103 16-Oct-1998  pk Drop cpuinfo's `L1_ptps'; instead keep a per CPU segment (level 2) page
table descriptor that is used to patch up a region (level 1) page table
associated with a user pmap at context switch time.
 1.102 14-Oct-1998  pk Let all CPUs spin at spl0.
 1.101 13-Oct-1998  pk EINTSTACK => EINTSTACKP
 1.100 12-Oct-1998  pk Oops, USPACE does not in 13 bits.. repair and save one instruction
in a non-SMP kernel.
 1.99 12-Oct-1998  pk In switchexit(), switch to the current CPU's idle u.area.
 1.98 12-Oct-1998  pk Make `_cpcb' (pointer to current user area) a per-CPU variable.
This cpuinfo field is initialized here in locore before calling bootstrap(),
since it must be valid before entering the window overflow/underflow handlers.

Fix miscalculation in the MULTIPROCESSOR version of INTR_SETUP().
 1.97 11-Oct-1998  pk Allocate a private PCB, kernel stack and interrupt stack for each processor.
As a result, the stack setup code in locore.s changes slightly in
the MULTIPROCESSOR case. Also, make the stack redzone barrier (for
debugging only) a per-CPU entity.
 1.96 23-Sep-1998  pk Use per-CPU interrupt status register.
 1.95 21-Sep-1998  pk We no longer need to access memerr() through a function pointer.
GC `cpumod' and `mmumod'.
 1.94 20-Sep-1998  pk Dedicate a pair of entry points to handling sun4m level 15 (NMI) interrupts.
Hardware NMIs are generated on various fault conditions that take place
asynchronously to the instruction stream. Software NMIs are going to be used
for inter-processor communications.

Get synchronous fault information separately from asynchronous fault
information. Do the former right after taking a memory fault trap and
store the values in temporary locations within the cpuinfo structure (XXX),
so we can unconditionally clear the sync fault status register after
MMU probe operations. This all is to work around a Hypersparc feature
which could lead to loss of fault information because of the fault
status register getting locked.
 1.93 18-Sep-1998  pk sigh.. put back non-garbage collectible `que' functions.
 1.92 13-Sep-1998  pk Pull in <sys/syscall.h> directly into locore.s
 1.91 12-Sep-1998  pk A few slight optimizations.
 1.90 12-Sep-1998  pk Nuke `insqeu' and `remque'
 1.89 12-Sep-1998  pk Add hatching code for other CPUs.
 1.88 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.87 06-Sep-1998  pk memerr() is now an indirect call.
 1.86 26-Jul-1998  pk Add a cpu-specific function to flush a pure virtually-indexed/virtually-tagged
cache, which needs to be flushed at context switch.
 1.85 04-Jul-1998  jonathan defopt DDB.
 1.84 26-Jun-1998  thorpej defopt COMPAT_SVR4
 1.83 22-Feb-1998  mycroft Finish making this compile after libkern changes.
 1.82 22-Feb-1998  mycroft Clean up after ffs() change.
Do *not* set runtime here; the way it was done was highly bogus, and the value
just gets blasted right away by mi_switch().
 1.81 22-Feb-1998  mycroft ffs() is identical to the one from libc, so just use that.
Move random() to libkern.
 1.80 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.79 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.78 13-Jan-1998  pk Add fkbyte(), which is like fubyte() but for kernel addresses.
Only used at this moment to work around unexplained transient bus
errors when reading the VME interrupt vector in bus control space.
 1.77 22-Nov-1997  tv eliminate declarations of global data in <sparc/cpu.h> and declare in
source files, reducing global symblol replication in .o kernel files
 1.76 19-Nov-1997  pk 1. Implement a trick from Chris Torek: if an unhandled interrupt occurs
during auto-configuration (`cold'), raise interrupt level to splhigh
and return, instead of reporting a stray interrupt.

2. In cpu_switch(), start running a newly selected proces at splclock()
instead of the saved IPL, allowing high-priority interrupts in
ctx_alloc() which can take many cycles to install a new context
(especially on the two-level sun4c MMU).
 1.75 23-Sep-1997  pk branches: 1.75.2;
The symbol `_msgbufaddr' is no longer exported.
 1.74 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.73 13-Sep-1997  pk NetBSD 1.2 and earlier sparc bootblocks have KERNBASE compiled in. This
prevents booting DDB kernels that are built with a different value of KERNBASE.

Apply a correction based on the magic number passed in by the bootblocks.

New bootblocks without the hard-coded KERNBASE reference will be assigned
a new magic number.
 1.72 07-Jul-1997  pk branches: 1.72.2;
Add `turbosparc_getfaultstatus()' to be used instead of the generic srmmu item.
 1.71 28-Jun-1997  pk Accommodate non-VM_PMAP_HACK code.
 1.70 22-Apr-1997  mrg add NetBSD RCSid.
 1.69 21-Apr-1997  mycroft Put back missing label.
 1.68 21-Apr-1997  mycroft Make microtime() work correctly with a 4- or 4C-only kernel.
 1.67 02-Apr-1997  pk Take another register snapshot at the end of dumpsys() to refresh the PCB
which may have been altered while writing the dump. Also, save PC in
the PCB.
 1.66 31-Mar-1997  pk `*_get_fault_status' should not get profiled; use ALTENTRY for now.
 1.65 31-Mar-1997  mycroft Fix bogus preprocessor conditional that caused the trap page to
not be rounded up when it should be.
 1.64 22-Mar-1997  pk Garbage collect.
 1.63 20-Mar-1997  pk Add a `no-op' function that the compiler can not touch.
 1.62 11-Mar-1997  pk Replace `cputyp' run-time tests by inserting multiple branches and NOPing
some at startup depending on architecture.

Use `get_faultstatus' field in `cpuinfo' (initialized in cpu.c) to branch
to CPU/MMU specific fault status reading stubs on memory fault traps.

Remove code top map the Interrupt Enable register on sun4/sun4c. Its VA
has moved to a high location and is now mapped in autoconf.c after
pmap has initialized. Note: this renders NMIs during bootstrap() fatal
(maybe loading %tbr should be deferred).
 1.61 11-Oct-1996  christos branches: 1.61.6;
printf -> kprintf, sprintf -> ksprintf
 1.60 13-Jun-1996  pk Allow DIAGNOSTIC kernels a FLUSHWIN trap in order to record stack traces
(currently used by the nullfs filesystem code, noted by der mouse).
 1.59 27-May-1996  pk CMP_PTE_USER_READ4M: check against PPROT_RWX_RWX; this is the canonical
stack protection (saves many excursions into trap.c on window underflows
as was the sole intention of the macro..).
 1.58 26-May-1996  pk Implement CMP_PTE_USER_WRITE4M more accurately.
CMP_PTE_USER_READ4M needs some more work..
 1.57 19-May-1996  pk branches: 1.57.4;
Make sure DELAY(0) returns within an hour..
 1.56 17-May-1996  pk Add `_kernel_text' symbol for kvm_mkdb(8).
 1.55 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.54 02-May-1996  pk Simpler and more accurate delay() function from Chuck Cranor.
 1.53 29-Apr-1996  pk Move delay() to locore, so we control code generation and can avoid
touching memory locations whose caching disposition can perturb timings.
 1.52 31-Mar-1996  pk Add sun4m support. Many, many changes..
Note on multi-architecture kernels: most architecture dependent traps are
forked off directly by having a separate trap table for each (sun4,sun4c,sun4m)
This reduces the number of tests on `cputyp' significantly, and it's easier
on the mind. There are still some entry points that need to test `cputyp',
most notably microtime().. yuck.
 1.51 14-Mar-1996  pk Install machinery for cpu_set_kpc().
 1.50 06-Feb-1996  pk beq -> be; some assemblers don't know about this alias.
 1.49 03-Feb-1996  mycroft Make this compile with `traditional' cpp.
 1.48 02-Feb-1996  mycroft Don't define _LOCORE here.
 1.47 02-Feb-1996  mycroft assym.s -> assym.h
(Some ports did this already.)
 1.46 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.45 29-Nov-1995  pk In probe[gs]et() there's no need to check against KERNBASE, as pointed
out by David Jones and Chris Torek.
 1.44 07-Oct-1995  mycroft Remove __builtin_saveregs().
 1.43 07-Oct-1995  mycroft Remove bzero().
 1.42 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.41 01-Jul-1995  christos svr4_machdep.c: Fix {get,set}context and sendsig.
locore.s: add signal trampoline code for svr4. There is a lot of code
duplication there. Maybe we should share the code?
SVR4 status now:
/bin/sh: works
/bin/ls: works
/bin/sleep: works
/bin/csh: gives unknown software trap 0xa7
/bin/ldd: works
 1.40 25-Jun-1995  pk Reserve arguments 2-4 for SunOS loaders; pass DDB stuff in args 5 and 6.
 1.39 24-Jun-1995  pk For a mmu3/sun4 too, it will suffice to just map the first 16MB.
 1.38 23-Jun-1995  pk Assume kernel is < 16MB in size,
Massage the a few control bits before remapping (from David S. Miller).
 1.37 30-May-1995  pk Remove useless msgbufmapped definition.
Two cases of incorrect addressing while not mapped at KERNBASE.
Some more sun4m stuff.
 1.36 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.35 19-Apr-1995  pk probeset() was trashing its arguments; fix from Chuck Cranor.
 1.34 13-Apr-1995  pk Remap regions to KERNBASE on 3-level MMU machines.
 1.33 31-Mar-1995  christos Moved KGDB trap 0x88 to 0x8a, and made 0x88 to be svr4 syscall [this is what
solaris uses]. Stubs for the missing and currently unused signal functions
stolen from the i386 code.
 1.32 12-Mar-1995  pk Move a comment back to appropriate place.
 1.31 01-Mar-1995  pk Make setjmp/longjmp available on non-DDB kernels.
 1.30 17-Dec-1994  deraadt microtime botch
 1.29 16-Dec-1994  deraadt microtime -> lo_microtime (oclock is different)
on machines with 6 register windows, "nop" out a pair of save/restore's (big
performance win on slow 4/100 and 4/200 machines)
 1.28 07-Dec-1994  deraadt Use symbolic constants to access the prom vector.
Deal with v0 openrom (on sun4c machines only).
 1.27 06-Dec-1994  pk Move DDB argument processing up before our input registers get trashed.
 1.26 06-Dec-1994  deraadt place message buffer in low physical memory, so that it can survive a
warm boot. the sun4 boot program corrupts some memory there so adjust
upwards on the sun4. (from chuck)
 1.25 23-Nov-1994  deraadt CP exceptions in wrong slots in trap table (noticed by matt@rme.com)
 1.24 23-Nov-1994  deraadt stack trace on crash
 1.23 20-Nov-1994  deraadt copyright/Id cleanup
 1.22 14-Nov-1994  deraadt make ldcontrolb() use p->p_addr instead of cpcb for the onfault, also
save current onfault value and act at splhigh.
 1.21 02-Nov-1994  deraadt add ldcontrolb
 1.20 02-Oct-1994  deraadt sun4/300 support works
 1.19 25-Sep-1994  deraadt sun4 memory error register code
 1.18 20-Sep-1994  deraadt ask the ROM if we are sun4c/sun4m/sun4d.
 1.17 02-Sep-1994  pk Don't clobber our input arguments.
 1.16 24-Aug-1994  deraadt fix relocation error
 1.15 23-Aug-1994  pk typo
 1.14 23-Aug-1994  deraadt fix 3 dumb bugs
 1.13 20-Aug-1994  deraadt stop using NBPG; start using USPACE
initialize cputyp, nbpg, pgshift, and pgofset variables based on cpu type.
deal with varying pagesize in register window underflow/overflow and trap
enter functions (hellish)
add idprom reading function for the sun4.
 1.12 10-Jun-1994  pk Allocate pmap's segmap separately.
Keep some tags on segment boundaries to optimise ctx_alloc().
 1.11 27-May-1994  deraadt 4.4-lite init startup
 1.10 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.9 12-May-1994  deraadt rearrange code to make sun4m support easier to add.
 1.8 23-Mar-1994  pk DDB support
 1.7 16-Mar-1994  pk make gas happy.
 1.6 10-Mar-1994  pk Fix addupc().
 1.5 01-Feb-1994  deraadt sparc runs in current today
 1.4 24-Nov-1993  deraadt properly setup the kernel stack during startup
use CCFSZ not 96..
 1.3 10-Nov-1993  deraadt use p_emul flag to indicate OS emulation
handle syscalls at standard sun place, ie. trap#80 not #89
add SunOS OMAGIC support
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.57.4.2 03-Jul-1996  jtc >Allow DIAGNOSTIC kernels a FLUSHWIN trap ...
 1.57.4.1 12-Jun-1996  pk Pull down from trunk:
Fixes in CMP_PTE_USER_READ4M macro.
 1.61.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.72.2.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.72.2.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.72.2.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.75.2.1 20-Nov-1997  mellon Pull rev 1.76 up from trunk (pk)
 1.114.2.2 05-Nov-1999  cgd pull up rev 1.126 from trunk (requested by chs):
Fix several panics in copy{in,out,}str().
 1.114.2.1 30-Apr-1999  perry branches: 1.114.2.1.2;
pullup 1.114->1.116 (christos)
 1.114.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.125.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.125.4.1 15-Nov-1999  fvdl Sync with -current
 1.125.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.125.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.125.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.125.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.126.2.2 05-Nov-1999  chs several fixes to copy{in,out,}str() from charles and myself:
don't panic if maxlen == 0, just return ENAMETOLONG.
treat maxlen as unsigned like the manpage indicates.
avoid crashing if the userspace address is >= KERNBASE.
make sure *done is 0 when no bytes are copied.
 1.126.2.1 05-Nov-1999  chs file locore.s was added on branch comdex-fall-1999 on 1999-11-05 04:49:27 +0000
 1.130.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.132.2.2 22-Apr-2001  he Pull up revision 1.139 (via patch, requested by pk):
In proc_trampoline() make the new process run at base interrupt
priority level. Especially important for kernel threads, which
would otherwise keep running at splclock().

Eliminates system clock instability.
 1.132.2.1 26-Jul-2000  pk Pull up revision 1.132 from trunk.

Fix delay slot error in the SUN4_MMU3L startup code.
 1.136.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.136.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.145.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.145.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.145.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.145.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.145.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.146.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.148.4.26 17-Jan-2003  thorpej Sync with HEAD.
 1.148.4.25 17-Jan-2003  pk Sync with HEAD.
 1.148.4.24 15-Jan-2003  thorpej Sync with HEAD.
 1.148.4.23 07-Jan-2003  thorpej Sync with HEAD.
 1.148.4.22 06-Jan-2003  martin Catch up to -current.
 1.148.4.21 05-Jan-2003  thorpej Remove the upcall trampoline, and invoke the upcall directly. Also,
there is no need to fiddle with register windows here, nor to save the
arguments to the stack.

Reviewed by uwe.
 1.148.4.20 03-Jan-2003  thorpej Pass exit2 or lwp_exit2 to switchexit(), as is suggested in comments,
and eliminate switchlwpexit().
 1.148.4.19 03-Jan-2003  pk Apply SA changes to ALT_SWITCH_CODE.
 1.148.4.18 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.148.4.17 31-Dec-2002  thorpej Rename cpu_preempt() to cpu_switchto(), and make the caller remove the
new process from its run queue before calling cpu_switchto().

While here, make a few cpu_switch() and cpu_switchto() implementations
get the outgoing LWP from the args, rather than looking at the curlwp
variable.
 1.148.4.16 29-Dec-2002  thorpej Sync with HEAD.
 1.148.4.15 11-Dec-2002  thorpej Sync with HEAD.
 1.148.4.14 28-Nov-2002  uwe Make upcalls work. sa2 passes now.
sa3 seems to work but hangs after printing "About to exit."
 1.148.4.13 27-Aug-2002  nathanw Catch up to -current.
 1.148.4.12 13-Aug-2002  nathanw Catch up to -current.
 1.148.4.11 01-Aug-2002  nathanw Catch up to -current.
 1.148.4.10 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.148.4.9 20-Jun-2002  nathanw Catch up to -current.
 1.148.4.8 28-Feb-2002  nathanw Catch up to -current.
 1.148.4.7 11-Jan-2002  nathanw More catchup.
 1.148.4.6 08-Jan-2002  nathanw Catch up to -current.
 1.148.4.5 30-Nov-2001  pk Eliminate the loading and testing of `cputyp' in cpu_switch().
 1.148.4.4 29-Nov-2001  pk `l_stat' is an `int' now in stead of an `u_char'... Bloody confustication!
 1.148.4.3 28-Nov-2001  pk More work on lwpswitchexit(), cpu_preempt() and cpu_switch().
Fortunately, it seems we can share a fair deal of code among these.
 1.148.4.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.148.4.1 13-Sep-2001  pk file locore.s was added on branch nathanw_sa on 2001-11-20 16:31:55 +0000
 1.153.10.1 18-Jun-2002  lukem Pull up revisions 1.154-1.157 (requested by pk in ticket #298):
revision 1.157
Fix typo in nmi_sun{4,4c}, use correct register.
revision 1.156
Fill delay slot in previous to match normal microtime.
revision 1.155
Do not use "std" in ms-IIep micortime, the argument is not guaranteed
to be double-word aligned and it is not when we are called from bpf.
Remove "should be able to std here" comment in generic microtime.
While here, simplify some asm mnemonics and fix a typo in comment.
revision 1.154
Use C-style comments in a few places where ' appears in the comment,
so that this works with GCC 2.95.3's ISO C preprocessor.
 1.153.8.3 31-Aug-2002  gehenna catch up with -current.
 1.153.8.2 21-Jul-2002  gehenna catch up with -current.
 1.153.8.1 15-Jul-2002  gehenna catch up with -current.
 1.153.4.1 18-Mar-2002  thorpej Provide storage for proc0.
 1.188.2.6 11-Dec-2005  christos Sync with head.
 1.188.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.188.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.188.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.188.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.188.2.1 03-Aug-2004  skrll Sync with HEAD
 1.198.2.1 24-Apr-2004  jdc branches: 1.198.2.1.2;
Pull up revisions 1.199-1.207 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.198.2.1.2.1 06-May-2005  riz Pull up revision 1.215 (requested by pk in ticket #1154):
sun4/sun4c sw interrupt entry: check interrupt register to determine to
see whether there is a pending software interrupt at the given level.
If not, it must be a device interrupt sharing that level.
 1.214.6.1 12-Feb-2005  yamt sync with head.
 1.214.4.1 29-Apr-2005  kent sync with -current
 1.215.6.6 21-Jan-2008  yamt sync with head
 1.215.6.5 07-Dec-2007  yamt sync with head
 1.215.6.4 03-Sep-2007  yamt sync with head.
 1.215.6.3 26-Feb-2007  yamt sync with head.
 1.215.6.2 30-Dec-2006  yamt sync with head.
 1.215.6.1 21-Jun-2006  yamt sync with head.
 1.221.2.1 26-Oct-2005  yamt sync with head
 1.222.2.1 22-Nov-2005  yamt sync with head.
 1.224.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.224.8.3 11-Aug-2006  yamt sync with head
 1.224.8.2 26-Jun-2006  yamt sync with head.
 1.224.8.1 24-May-2006  yamt sync with head.
 1.224.6.2 01-Jun-2006  kardel Sync with head.
 1.224.6.1 27-May-2006  kardel convert to timecounters
 1.224.4.1 09-Sep-2006  rpaulo sync with head
 1.225.2.1 19-Jun-2006  chap Sync with head.
 1.226.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.227.4.2 30-Jan-2007  ad For now always call sched_unlock_idle/sched_lock_idle. They will be
removed by yamt's cpu_switchto() changes.
 1.227.4.1 11-Jan-2007  ad Checkpoint work in progress.
 1.228.2.4 07-May-2007  yamt sync with head.
 1.228.2.3 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.228.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.228.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.231.4.1 11-Jul-2007  mjf Sync with head.
 1.231.2.2 03-Dec-2007  ad Sync with HEAD.
 1.231.2.1 27-May-2007  ad Sync with head.
 1.232.2.2 26-Jun-2007  garbled Sync with HEAD.
 1.232.2.1 22-May-2007  matt Update to HEAD.
 1.239.10.3 23-Mar-2008  matt sync with HEAD
 1.239.10.2 09-Jan-2008  matt sync with HEAD
 1.239.10.1 06-Nov-2007  matt sync with HEAD
 1.239.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.240.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.240.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.240.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.241.2.1 26-Dec-2007  ad Sync with head.
 1.242.4.1 10-Jan-2008  bouyer Sync with HEAD
 1.243.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.243.10.4 11-Aug-2010  yamt sync with head.
 1.243.10.3 11-Mar-2010  yamt sync with head
 1.243.10.2 20-Jun-2009  yamt sync with head
 1.243.10.1 04-May-2009  yamt sync with head.
 1.243.8.1 04-Jun-2008  yamt sync with head
 1.243.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.244.16.1 21-Apr-2010  matt sync to netbsd-5
 1.244.8.4 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.244.8.3 28-Jan-2011  snj Pull up following revision(s) (requested by mrg in ticket #1532):
sys/arch/sparc/sparc/cpu.c: revision 1.215 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.78 via patch
sys/arch/sparc/sparc/genassym.cf: revision 1.57 via patch
sys/arch/sparc/sparc/intr.c: revision 1.103-1.105 via patch
sys/arch/sparc/sparc/locore.s: revision 1.247, 1.250 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.329 via patch

- print the cpu_number() when we get a strayintr().

- use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now

with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a few commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.

convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits. amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement. ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?

XXX the current implementation depends on a couple of things:
XXX - ev_count member of evcnt{} is first and has offset 0
XXX - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it

- remove unused ft_want_ast()
- give nmi_sun* ENTRY() points so they show up in symbols properly
- add some disabled code to use this cpu's idlelwp area when hatching
a cpu, but right now it makes this worse not better...
 1.244.8.2 16-Jan-2011  bouyer Pull up following revision(s) (requested by mrg in ticket #1527):
sys/arch/sparc/sparc/pmap.c: revision 1.327, 1.328
sys/arch/sparc/sparc/cpuvar.h: revision 1.77
sys/arch/sparc/sparc/locore.s: revision 1.245
sys/arch/sparc/sparc/cpu.c: revision 1.214
sys/arch/sparc/sparc/db_interface.c: revision 1.84
- retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)
we still waste one page of space, but this gets SMP much closer to
actually working again.
fix a LOCKDEBUG problem from the previous: need to call pmap_kremove()
on a pre-existing mapping, before installing a new one.
 1.244.8.1 09-Jan-2010  snj Pull up following revision(s) (requested by mrg in ticket #1223):
sys/arch/sparc/include/cpu.h: revision 1.86
sys/arch/sparc/sparc/locore.s: revision 1.246
sys/arch/sparc/sparc/vm_machdep.c: revision 1.100
fix up cpu_setfunc() as noted by uwe:
- don't call lwp_startup for cpu_setfunc() users
- introduce lwp_setfunc_trampoline instead
- no need to set the "new" lwp for setfunc
 1.255.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.255.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.256.2.1 05-Mar-2011  rmind sync with head
 1.259.4.3 05-Mar-2011  bouyer Sync with HEAD
 1.259.4.2 17-Feb-2011  bouyer Sync with HEAD
 1.259.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.259.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.265.8.1 03-Mar-2018  snj Pull up following revision(s) (requested by maya in ticket #1513):
sys/arch/sparc/sparc/locore.s: 1.269
Avoid an instruction requiring a higher alignment than we are guaranteed
Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.
 1.265.6.1 24-Feb-2012  mrg sync to -current.
 1.265.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.265.2.1 17-Apr-2012  yamt sync with head
 1.266.2.2 03-Dec-2017  jdolecek update from HEAD
 1.266.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.268.30.2 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1859):

sys/arch/ia64/ia64/vm_machdep.c: revision 1.18
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.67
sys/arch/aarch64/aarch64/locore.S: revision 1.91
sys/arch/mips/include/asm.h: revision 1.74
sys/arch/hppa/include/cpu.h: revision 1.13
sys/arch/arm/arm/armv6_start.S: revision 1.38
(applied also to sys/arch/arm/cortex/a9_mpsubr.S,
sys/arch/arm/cortex/a9_mpsubr.S,
sys/arch/arm/cortex/cortex_init.S)
sys/arch/evbmips/ingenic/cpu_startup.S: revision 1.2
sys/arch/mips/mips/locore.S: revision 1.229
sys/arch/alpha/include/asm.h: revision 1.45
(applied to sys/arch/alpha/alpha/multiproc.s)
sys/arch/sparc64/sparc64/locore.s: revision 1.432
sys/arch/vax/vax/subr.S: revision 1.42
sys/arch/mips/mips/locore_mips3.S: revision 1.116
sys/arch/ia64/ia64/machdep.c: revision 1.44
sys/arch/arm/arm32/cpuswitch.S: revision 1.106
sys/arch/sparc/sparc/locore.s: revision 1.284
(all via patch)

aarch64: Add missing barriers in cpu_switchto.
Details in comments.

Note: This is a conservative change that inserts a barrier where
there was a comment saying none is needed, which is probably correct.
The goal of this change is to systematically add barriers to be
confident in correctness; subsequent changes may remove some bariers,
as an optimization, with an explanation of why each barrier is not
needed.

PR kern/57240

alpha: Add missing barriers in cpu_switchto.
Details in comments.

arm32: Add missing barriers in cpu_switchto.
Details in comments.

hppa: Add missing barriers in cpu_switchto.
Not sure hppa has ever had working MULTIPROCESSOR, so maybe no
pullups needed?

ia64: Add missing barriers in cpu_switchto.
(ia64 has never really worked, so no pullups needed, right?)

mips: Add missing barriers in cpu_switchto.
Details in comments.

powerpc: Add missing barriers in cpu_switchto.
Details in comments.

sparc: Add missing barriers in cpu_switchto.

sparc64: Add missing barriers in cpu_switchto.
Details in comments.

vax: Note where cpu_switchto needs barriers.

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.
 1.268.30.1 27-Nov-2017  martin Pull up following revision(s) (requested by maya in ticket #392):
sys/arch/sparc/sparc/locore.s: revision 1.269
Avoid an instruction requiring a higher alignment than we are guaranteed
Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.
 1.268.24.1 03-Jan-2018  snj Pull up following revision(s) (requested by maya in ticket #1530):
sys/arch/sparc/sparc/locore.s: revision 1.269
Avoid an instruction requiring a higher alignment than we are guaranteed
Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.
 1.268.16.1 03-Jan-2018  snj Pull up following revision(s) (requested by maya in ticket #1530):
sys/arch/sparc/sparc/locore.s: revision 1.269
Avoid an instruction requiring a higher alignment than we are guaranteed
Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.
 1.268.12.1 03-Jan-2018  snj Pull up following revision(s) (requested by maya in ticket #1530):
sys/arch/sparc/sparc/locore.s: revision 1.269
Avoid an instruction requiring a higher alignment than we are guaranteed
Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.
 1.269.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.269.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.269.2.1 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.271.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.271.2.1 10-Jun-2019  christos Sync with HEAD
 1.274.2.1 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1676):

sys/arch/ia64/ia64/vm_machdep.c: revision 1.18
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.67
sys/arch/aarch64/aarch64/locore.S: revision 1.91
sys/arch/mips/include/asm.h: revision 1.74
sys/arch/hppa/include/cpu.h: revision 1.13
sys/arch/arm/arm/armv6_start.S: revision 1.38
sys/arch/evbmips/ingenic/cpu_startup.S: revision 1.2
sys/arch/mips/mips/locore.S: revision 1.229
sys/arch/aarch64/aarch64/cpuswitch.S: revision 1.40
sys/arch/alpha/include/asm.h: revision 1.45
sys/arch/sparc64/sparc64/locore.s: revision 1.432
sys/arch/vax/vax/subr.S: revision 1.42
sys/arch/mips/mips/locore_mips3.S: revision 1.116
sys/arch/ia64/ia64/machdep.c: revision 1.44
sys/arch/arm/arm32/cpuswitch.S: revision 1.106
sys/arch/sparc/sparc/locore.s: revision 1.284
(all via patch)

aarch64: Add missing barriers in cpu_switchto.
Details in comments.

Note: This is a conservative change that inserts a barrier where
there was a comment saying none is needed, which is probably correct.
The goal of this change is to systematically add barriers to be
confident in correctness; subsequent changes may remove some bariers,
as an optimization, with an explanation of why each barrier is not
needed.

PR kern/57240

alpha: Add missing barriers in cpu_switchto.
Details in comments.

arm32: Add missing barriers in cpu_switchto.
Details in comments.

hppa: Add missing barriers in cpu_switchto.
Not sure hppa has ever had working MULTIPROCESSOR, so maybe no
pullups needed?

ia64: Add missing barriers in cpu_switchto.
(ia64 has never really worked, so no pullups needed, right?)

mips: Add missing barriers in cpu_switchto.
Details in comments.

powerpc: Add missing barriers in cpu_switchto.
Details in comments.

sparc: Add missing barriers in cpu_switchto.

sparc64: Add missing barriers in cpu_switchto.
Details in comments.

vax: Note where cpu_switchto needs barriers.

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.
 1.275.2.1 17-Jan-2020  ad Sync with head.
 1.278.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.279.4.1 13-May-2021  thorpej Sync with HEAD.
 1.283.4.1 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #264):

sys/arch/ia64/ia64/vm_machdep.c: revision 1.18
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.67
sys/arch/aarch64/aarch64/locore.S: revision 1.91
sys/arch/mips/include/asm.h: revision 1.74
sys/arch/hppa/include/cpu.h: revision 1.13
sys/arch/arm/arm/armv6_start.S: revision 1.38
sys/arch/evbmips/ingenic/cpu_startup.S: revision 1.2
sys/arch/mips/mips/locore.S: revision 1.229
sys/arch/aarch64/aarch64/cpuswitch.S: revision 1.40
sys/arch/alpha/include/asm.h: revision 1.45
sys/arch/sparc64/sparc64/locore.s: revision 1.432
sys/arch/vax/vax/subr.S: revision 1.42
sys/arch/mips/mips/locore_mips3.S: revision 1.116
sys/arch/riscv/riscv/cpu_switch.S: revision 1.3
sys/arch/ia64/ia64/machdep.c: revision 1.44
sys/arch/arm/arm32/cpuswitch.S: revision 1.106
sys/arch/sparc/sparc/locore.s: revision 1.284

aarch64: Add missing barriers in cpu_switchto.
Details in comments.

Note: This is a conservative change that inserts a barrier where
there was a comment saying none is needed, which is probably correct.
The goal of this change is to systematically add barriers to be
confident in correctness; subsequent changes may remove some bariers,
as an optimization, with an explanation of why each barrier is not
needed.

PR kern/57240

alpha: Add missing barriers in cpu_switchto.
Details in comments.

arm32: Add missing barriers in cpu_switchto.
Details in comments.

hppa: Add missing barriers in cpu_switchto.
Not sure hppa has ever had working MULTIPROCESSOR, so maybe no
pullups needed?

ia64: Add missing barriers in cpu_switchto.
(ia64 has never really worked, so no pullups needed, right?)

mips: Add missing barriers in cpu_switchto.
Details in comments.

powerpc: Add missing barriers in cpu_switchto.
Details in comments.

riscv: Add missing barriers in cpu_switchto.
Details in comments.

sparc: Add missing barriers in cpu_switchto.

sparc64: Add missing barriers in cpu_switchto.
Details in comments.

vax: Note where cpu_switchto needs barriers.

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.
 1.285.2.1 02-Aug-2025  perseant Sync with HEAD
 1.10 07-Dec-2002  pk Use MI versions of {set,rem}runqueue().
 1.9 26-May-2000  thorpej branches: 1.9.12;
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.8 22-Nov-1997  tv branches: 1.8.14;
eliminate declarations of global data in <sparc/cpu.h> and declare in
source files, reducing global symblol replication in .o kernel files
 1.7 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.6 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.3 13-May-1994  deraadt setrunqueue
 1.2 05-May-1994  deraadt p forw/back name changes
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.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.9.12.3 11-Dec-2002  thorpej Sync with HEAD.
 1.9.12.2 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.9.12.1 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.343 24-Apr-2025  riastradh sparc: Use STACK_ALIGNBYTES macro when aligning stack pointer.

Prompted by:

PR kern/59327: user stack pointer is not aligned properly
 1.342 19-Apr-2025  riastradh sparc: Load the signal handler _before_ resetting it, not after.

Should fix SA_RESETHAND.

PR port-sparc/59323: t_sigaction:sigaction_resethand test is failing
 1.341 05-Mar-2024  thorpej branches: 1.341.2;
Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.
 1.340 01-Dec-2023  thorpej Use vmem(9) rather than extent(9) to manage DVMA mappings.
 1.339 26-Jul-2022  andvar s/functin/function/ in copy pasted comment.
 1.338 27-Oct-2021  thorpej Use the signal trampoline version constants from <sys/signal.h>.
 1.337 17-Aug-2021  andvar fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected.
 1.336 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.335 22-Nov-2020  thorpej malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.334 11-Jun-2020  ad branches: 1.334.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.333 31-Dec-2019  ad Rename uvm_free() -> uvm_availmem().
 1.332 21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.331 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.330 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.329 04-Feb-2019  mrg - rework mm_md_readwrite() to avoid fallthrough warnings entirely
 1.328 10-Dec-2016  mrg branches: 1.328.6; 1.328.16;
rearrange slightly to enable crash(8) to build.
 1.327 21-Sep-2014  christos branches: 1.327.2; 1.327.4;
fix leak.
 1.326 28-Feb-2014  skrll branches: 1.326.4;
G/C sys/simplelock.h includes
 1.325 02-Nov-2012  chs branches: 1.325.2;
Add RAS support for sparc.
 1.324 13-Sep-2012  martin Adapt for _UC_TLSBASE addition
 1.323 31-Jul-2012  martin branches: 1.323.2;
Move cn_tab initialization to bootstrap()
 1.322 30-Jul-2012  christos move cn_tab initializationt to cpu_startup
 1.321 28-Jul-2012  matt Remove declartions of physmem
 1.320 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.319 21-May-2012  martin Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.
 1.318 25-Apr-2012  dholland Fix totally uncompilable code. PR 46374 from Henning Petersen.
 1.317 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.316 12-Feb-2012  matt branches: 1.316.2;
Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.315 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.314 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.313 17-Jul-2011  dyoung branches: 1.313.2; 1.313.6;
Switch sparc and sparc64 to new-style <sys/bus.h>.
 1.312 02-Jul-2011  mrg don't try to print fr_arg[6] since it doesn't exist.
 1.311 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.310 03-Jun-2011  rmind Revert maxdmap/maxsmap constification, as it causes problems on some
sparc models. Reported by tsutsui@.
 1.309 16-May-2011  rmind branches: 1.309.2;
Hack-around sparc/sun4c case, which modifies const maxdmap/maxsmap.
From he@. OK mrg@.
 1.308 18-Apr-2011  rmind Replace malloc with kmem, and remove M_SUBPROC.
 1.307 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.306 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.305 14-Jan-2011  rmind branches: 1.305.2; 1.305.4;
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.304 13-Jan-2011  mrg introduce a hack to workaround the savefpstate IPI get's NULL
struct fpstate *.

add a new entry point ipi_savefpstate() that is used for this IPI
instead of the plain ipi_savefpstate(). check for %o0 being NULL,
and if so, just return.

add event counters for the savefpstate IPI, and another one for
when it detects the NULL problem.

make the cpu_info struct xmpsg be aligned to a single cache line.

with this change applied (and another minor change in testing) my
SS20 with dual SM75's has survived for 17 hours on build.sh -j5,
and has reported 7 NULL savefps. (the minor change seems to have
a significant effect at reducing this number, but more testing is
needed for it.)


XXX: this is horrible and we really need to find the real problem
XXX: but this should let people use sparc smp again, and fixes
XXX: for the real problem can be tested by seeing if any of the
XXX: savefp IPI null counter becomes non-zero.
 1.303 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.302 08-Feb-2010  joerg branches: 1.302.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.301 26-Jan-2010  mrg branches: 1.301.2;
convert fpulock into fpu_mtx.
 1.300 03-Jan-2010  mrg add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.299 10-Dec-2009  matt 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.298 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.297 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.296 07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.295 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.294 26-May-2009  macallan do as phone suggested - remove sparc_bus_map_large() again and use a flag
instead ( BUS_SPACE_MAP_LARGE )
 1.293 16-May-2009  cegger KNF, same object code generated.
 1.292 16-Apr-2009  macallan Add sparc_bus_map_large() to map large bus ranges like framebuffers and
apertures outside the IODEV range. ZX for example needs 8MB for the framebuffer
alone while the IODEV range provides only 16MB.
 1.291 18-Mar-2009  cegger bcopy -> memcpy
 1.290 18-Mar-2009  cegger bzero -> memset
 1.289 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.288 21-Jan-2009  he branches: 1.288.2;
Re-adapt to the changed return types for major() and minor().
 1.287 12-Jan-2009  cegger use PRIu64 format to printf major() and minor() values
 1.286 11-Jan-2009  mrg add an empty module_init_md(), allows a MODULAR kernel to link.
 1.285 25-Nov-2008  ad dumpsys: don't spew numbers into the log.
 1.284 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.283 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.282 16-Oct-2008  martin branches: 1.282.2; 1.282.4;
Add misissing include and fix a few typos.
 1.281 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.280 02-Jul-2008  ad branches: 1.280.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.
 1.279 04-Jun-2008  ad branches: 1.279.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.278 28-Apr-2008  martin branches: 1.278.2;
Remove clause 3 and 4 from TNF licenses
 1.277 24-Apr-2008  ad branches: 1.277.2;
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.276 05-Jan-2008  martin branches: 1.276.6; 1.276.8;
Add missing include.
 1.275 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.274 17-Oct-2007  garbled branches: 1.274.2; 1.274.4; 1.274.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.273 08-Jul-2007  pooka branches: 1.273.10;
Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."
 1.272 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.271 04-Mar-2007  mrg branches: 1.271.2; 1.271.4; 1.271.10;
fix fall out from caddr_t changes.
 1.270 04-Mar-2007  macallan make this compile again
 1.269 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.268 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.267 09-Feb-2007  ad branches: 1.267.2;
Merge newlock2 to head.
 1.266 14-Jan-2007  jdc Apply the same UBC, data and stack limits that are applied to SUN4C to
SUN4 as well.

The data and stack limits are definitely needed, otherwise MI code will try
and map shared libraries in the 4/4c MMU hole. The UBC limits may not be
necessary, but SUN4 machines are unlikely to have much larger amounts of
memory than this caters for (64Mb).

SUN4 machines will now boot userland with this change.

Thanks to martin@, mrg@ and uwe@ for hints while debugging this.
 1.265 25-Oct-2006  he branches: 1.265.2;
Propagate const, prompted by new gcc.
 1.264 03-Sep-2006  gdamore branches: 1.264.2; 1.264.4;
Convert both sparc and sparc64 to MI todr.
 1.263 11-Dec-2005  christos branches: 1.263.4; 1.263.8;
merge ktrace-lwp.
 1.262 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.261 16-Nov-2005  uwe Use uint<N>_t. Drop trailing whitespace.
 1.260 14-Nov-2005  uwe branches: 1.260.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.259 26-Oct-2005  uwe Move md_flags back to mdproc. MDP_FIXALIGN, the only flag we have, is
per-process, not per-lwp. We don't have per-lwp flags currently.
 1.258 14-Sep-2005  he branches: 1.258.2;
We need <compat/sys/signal.h> and <compat/sys/signalvar.h> here
for native_sigset13_to_sigset, sigset13_t, and sigvec.
The includes in sparc's machdep.c is conditional on COMPAT_13, as is
the use of native_sigset13_to_sigset.
 1.257 16-Jun-2005  briggs branches: 1.257.2;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.256 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.255 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.254 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.253 09-Mar-2005  matt branches: 1.253.2; 1.253.4;
Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.
 1.252 30-Jan-2005  chs define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).
 1.251 30-Jun-2004  pk branches: 1.251.4; 1.251.6;
Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.
 1.250 28-Jun-2004  pk Rename bus_translate_address_generic => bus_space_translate_address_generic()
and move prototype to <machine/bus.h>.
 1.249 27-Jun-2004  pk Always use `full bus space'. In order to implement this more efficiently,
require that all bus tags have pointers to bus_space_read/write functions,
i.e. no run-time hunting for the first "upstream" implementation.
Since this changes the way bus tags should be constructed it makes sense
to do the same thing for the rest of the bus space methods.
So, now bus space tags are generally constructed by copying the parent's bus
tag and then overriding the methods that the bus driver needs to handle,
instead of starting with an empty bus tag and fiiling in only the fields needed.
 1.248 27-Apr-2004  pk Limit buffer cache VM to prevent too many locked `PMEGs' on small sun4c
systems.
 1.247 04-Apr-2004  pk Remove private declarations of maxdmap and maxsmap.
 1.246 03-Apr-2004  pk On sun4c, clip max data & stack size to avoid the MMU hole.
 1.245 24-Mar-2004  atatat branches: 1.245.2;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.244 01-Jan-2004  pk Enable reset of a process's alternative signal stack flag.
 1.243 30-Dec-2003  pk When powering down, first ask the PROM to do it for us.
 1.242 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.241 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.240 28-Oct-2003  chs uninitialized variables.
 1.239 21-Oct-2003  kleink Don't use NULL in integer-type assignments/comparisons.
 1.238 12-Oct-2003  pk sendsig: we must copy out the `ksi_info' field.
 1.237 12-Oct-2003  pk sendsig: don't copy out the ucontext_t padding bytes onto the user stack.
 1.236 12-Oct-2003  pk Simplify struct sigframe.
 1.235 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.234 05-Oct-2003  pk sparc kernel support for SA_SIGINFO.
 1.233 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.232 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.231 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.230 02-Aug-2003  pk On small sun4c machines trim the buffer cache to reduce the demand for
kernel virtual memory. This leaves more of the precious PMEG resources
available for user space VM which speeds up things considerably, since
a reasonable PMEG working set can be maintained.
 1.229 15-Jul-2003  lukem __KERNEL_RCSID()
 1.228 29-Jun-2003  fvdl branches: 1.228.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.227 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.226 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.225 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.224 03-May-2003  wiz DMA, not dma nor Dma.
 1.223 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.222 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.221 16-Jan-2003  pk Some PROMs get really uneasy if the prom_reboot() function is called
after the other CPUs have already return into the PROM through prom_cpustop().
So don't do it; try to halt the other CPUs only when an actual `halt'
is requested.

My guess in this case is that the PROM does not expect its original boot
CPU to call prom_cpustop(0), or possibly treats it as the equivalent of
a prom_halt() which is then called again by some other CPU. In any case,
the result is garbage.
 1.220 16-Jan-2003  pk Fix reboot options handling; now one-letter kernel names can also be booted.
 1.219 13-Jan-2003  pk Remove UNLOCK_XPMSG() before cpu_halt(); it's not compatible with LOCKDEBUG
and it wan't chique in any case.
 1.218 13-Jan-2003  mrg remove cpu_hatched, cpu_hatch_sc and cpu_hatchstack. the first can use
the cpi->flags, the second is unused and the third is also cpi-idle_u.
 1.217 13-Jan-2003  pk Halt any other CPUs in cpu_reboot().
 1.216 12-Jan-2003  pk fpulock: encapsulate required IPL raise in the FPU LOCK/UNLOCK macros.
 1.215 09-Jan-2003  mrg call splclock() around the FPU_LOCK().

XXX: pk suggests we can make the this a sleeping lock.
 1.214 06-Jan-2003  pk Protect FPU context switching with its own lock.
 1.213 03-Jan-2003  pk Define a few XCALL? shorthand macros to avoid clutter.
 1.212 03-Jan-2003  pk Finish FPU context switching on SMP systems.
 1.211 03-Jan-2003  mrg part one of bus_space(9) fixes to enable bus spaces to override the
bus_space_{read,write}_[1248]() functions, which will allow 16-bit
PCMCIA support to work without additional hacks in MI drivers.
this option is not enabled yet.
 1.210 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.209 12-Dec-2002  pk dumpsys(): Use pmap_kremove() to unmap pages mapped pmap_kenter().
 1.208 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.207 10-Dec-2002  pk bus_intr_establish() now takes an optional `fast trap' handler argument.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.206 06-Dec-2002  pk Pass the `device class interrupt level' on to intr_establish() and use to
raise the ipl in the interrupt handlers to the appropriate level. This avoids
interrupt handler interference if one of the devices actually interrupts at
a lower hardware level than the maximum level assined to a device class.

Based on code from Art Grabowski in openbsd.
 1.205 28-Nov-2002  pk Not all sun4m platforms have version 8 sparc CPUs. So go out to the PROM
and get the CPU architecture version from the PROM cpu node `sparc-version'
property.
 1.204 26-Nov-2002  pk Add `machdep.cpu_arch' sysctl to determine the CPU architecture version.
Currrently, cpu types `sun4' and `sun4c' produce version 7, all others
version 8.
 1.203 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.202 19-Sep-2002  ragge Do not include <sys/clist.h>, it's not used in NetBSD at all.
 1.201 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.200 30-Aug-2002  thorpej Fix missing error check in sparc_bus_map(). Pointed out by uwe.
 1.199 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.198 25-Aug-2002  thorpej Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.197 17-Jul-2002  thorpej More sun4m/sun4d common stuff.
 1.196 17-Jul-2002  thorpej Remote CPU_ISSUN4OR4C and CPU_ISSUN4COR4M, and instead express them
as (CPU_ISSUN4 || CPU_ISSUN4C) and (CPU_ISSUN4C || CPU_ISSUN4M),
respectively. The compiler can still optimize as desired by expressing
them this way, and it simplifies adding new tests.

While here, just remove CPU_ISSUN4MOR4U; it's not used by anything.
 1.195 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.194 02-Jun-2002  drochner move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling
 1.193 28-Mar-2002  pk branches: 1.193.2; 1.193.4;
sysctl(CPU_BOOTED_KERNEL): look for kernel path bootinfo[].
 1.192 18-Mar-2002  christos goodbye PS_STRINGS
 1.191 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.190 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.189 03-Feb-2002  darrenr * add machdep.booted_device and machdep.boot_args (both fetched from
appropriate PROM variables).
* return "netbsd" for machdep.booted_kernel if the PROM doesn't return us a
kernel name.
 1.188 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.187 03-Oct-2001  chs branches: 1.187.4;
use pmap_k{enter_pa,remove}() where appropriate.
 1.186 03-Oct-2001  chs deal with bus_addr_t now being a 64-bit quantity. fixes PR 14107.
 1.185 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.184 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.183 03-Sep-2001  uwe branches: 1.183.2;
_bus_dmamap_load_mbuf: panic with correct function name.
 1.182 29-Jul-2001  chs use pmap_k* for buffer cache pages.
 1.181 02-Jun-2001  chs branches: 1.181.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.180 26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.179 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.178 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.177 05-Mar-2001  pk branches: 1.177.2;
Implement MSGBUFSIZE option.
 1.176 01-Mar-2001  pk * Correct the `flags' argument in several calls to pmap_enter().
* message buffer initialisation:
- change the buffer size to 8192 on all platforms
- don't assume the buffer is always located at physical address 0
- drop the SUN4 hack that left first half of the page unused;
I believe this is no longer necessary, since the msgbuf
data structure is duely sanity-checked before use in initmsgbuf().
 1.175 31-Jan-2001  pk _bus_dma_valloc_skewed(): return a vaddr_t, not error codes; make missing
boundary check return an error, so the caller can decide how to respond.
 1.174 28-Jan-2001  pk sun4_dmamap_load(): Check if boundary condition can be satisfied instead
of panicing blindly.
 1.173 20-Jan-2001  pk In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.
 1.172 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.171 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.170 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.169 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.168 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.167 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.166 24-Jun-2000  pk Maintain the DVMA map extent subregion boundaries in the bus_dma map
structure.
 1.165 23-May-2000  pk branches: 1.165.4;
Simplify the bus_dma(9) implementation:

- the `alignment' and `boundary' arguments in bus_dmamem_alloc() only
serve as hints on how to break up a DMA transaction into chunks
when necessary; it is not necessary on sparc DVMA hardware.

- exclusively use the VM page size (i.e. PAGE_SIZE et.al.) when computing
resource allocations.

- remember the size of DVMA resource allocations in the private `_ds_sgsize'
field in a dma segment descriptor.
 1.164 18-May-2000  pk bus_dmamem_alloc: ensure alignment is always at least the page size.
 1.163 10-May-2000  pk bus_dmamem_alloc: round-up `alignment' to a be a multiple of the page size.
 1.162 10-May-2000  pk * Fix thinko in offset computations.
* Add DIAGNOSTIC checks.
 1.161 09-May-2000  pk The bus_dma(9) implementation now allocates DVMA addresses in
bus_dmamap_load_*() routines only. Note that DMA memory buffers
allocated with bus_dmamem_alloc() _must_ be loaded by bus_dmamap_load_raw().
 1.160 19-Jan-2000  thorpej Move callout initialization to a single location; no need to duplicate
that code all over the place.
 1.159 15-Dec-1999  garbled add entrypoint for tctrl device, and add <machine/tctrl.h> to includes for
machdep.c
 1.158 04-Dec-1999  ragge CL* discarding.
 1.157 15-Nov-1999  thorpej Fix a couple of pmap_enter() calls I missed.
 1.156 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.155 04-Oct-1999  pk branches: 1.155.2; 1.155.4; 1.155.8;
Implement sysctl `machdep.booted_kernel'.
 1.154 17-Sep-1999  thorpej Centralize the declaration and clearing of `cold'.
 1.153 09-Aug-1999  matt Tadpoles don't use the standard sun4m power down hardware. So add
support for doing it the Tadpole way.
 1.152 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.151 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.150 25-May-1999  thorpej bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.
 1.149 21-May-1999  thorpej Provide an mdallocsys() that clips bufpages if necessary (on the Sun4c).
This will be (and needs to be) done before nbuf is computed.
 1.148 20-May-1999  thorpej Make this compile again.
 1.147 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.146 03-May-1999  christos remove unused msgbufaddr
 1.145 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.144 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.143 01-Apr-1999  thorpej branches: 1.143.2;
Don't call configure() from cpu_startup().
 1.142 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.141 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.140 27-Feb-1999  scottr defopt BUFCACHE and BUFPAGES.
 1.139 14-Feb-1999  pk Use the PROMLIB interface.
 1.138 16-Jan-1999  chuck MNN is no longer optional, remove dead code
 1.137 13-Jan-1999  pk Add `bus_space_subregion()' which was curiously missing.
 1.136 09-Jan-1999  thorpej Garbage-collect `mbutl'.
 1.135 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.134 12-Oct-1998  pk `cpcb' (pointer to current u.area) is now a per-CPU variable.
 1.133 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.132 06-Oct-1998  thorpej Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.
 1.131 30-Sep-1998  pk Make the current FPU owner (`fpproc') a per-CPU entity. Unresolved issue
as yet: lazy FPU context switching may require co-operation from other
CPUs.
 1.130 17-Sep-1998  thorpej Slight brain'o in last.
 1.129 17-Sep-1998  thorpej Minor cosmetic change to sendsig().
 1.128 13-Sep-1998  pk Move compat_13 sigreturn() into its own file.
 1.127 13-Sep-1998  pk Remove left-over SUNOS_COMPAT line.
 1.126 13-Sep-1998  pk Replace previous by something more complete.
 1.125 13-Sep-1998  mycroft Update these for signal handling changes.
XXX Not tested yet.
 1.124 07-Sep-1998  pk Clear up some type confusion.
 1.123 01-Sep-1998  pk Hang on to `old VM' a little while longer..
 1.122 25-Aug-1998  pk yanko
 1.121 23-Aug-1998  pk Nuke phys_map & old dvmamap.
 1.120 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.119 20-Aug-1998  pk Pay attention to BUS_DMA_NOWAIT & boundary args where appropriate.
 1.118 30-Jul-1998  pk The IOMMU now has its own dma bus tag and associated functions.
machdep.c retains the `mainbus' (i.e. sun4/sun4c) bus_dma* versions for now.
Create a DVMA map specifically for 24-bit devices (le,ie), which has a
more room than previous DVMA map which should be reserved for sun4 VME.
 1.117 28-Jul-1998  pk branches: 1.117.2;
In _bus_dmamem_map(), use uvm_km_valloc() to get kernel addresses.
uvm_map() -- which used to be here (why was that?) -- was called with
an uninitialized value in its `start' argument.
 1.116 25-Jun-1998  thorpej defopt COMPAT_SUNOS
 1.115 06-Jun-1998  thorpej Restructure cpu_reboot() a bit, and add support for powering down
on the Sun4m if RB_POWERDOWN is specified.
 1.114 03-Jun-1998  thorpej Panic if we can't fulfill a bus_dmamap_load() with a boundary constraint.
 1.113 07-May-1998  kleink Fix some arithmetics lossage on typeless pointers.
 1.112 07-Apr-1998  pk bus_space_*() functions now have the bus tag as first argument.
Remove old mapdev() function that is no longer used.
 1.111 01-Apr-1998  pk Move initialization of `proc0.p_addr' from cpu_startup() to bootstrap().
 1.110 29-Mar-1998  pk Declare `sparc_bus_unmap()' static.
 1.109 29-Mar-1998  mrg remove register from decl.
 1.108 28-Mar-1998  pk Implement generic bus probe function.
 1.107 24-Mar-1998  pk Include not-cacheable bit in base bus space mmap function.
 1.106 21-Mar-1998  pk Implement bus mapping and interrupt-establish functions.
 1.105 11-Feb-1998  thorpej Use kernel_map in bus_dmamem_{map,free}().
 1.104 11-Feb-1998  thorpej Use M_DMAMAP where appropriate.
 1.103 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.102 08-Feb-1998  thorpej Allow callers of uvm_km_suballoc() to specify where the base of the
submap _must_ begin, by adding a "fixed" boolean argument.
 1.101 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.100 04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.99 04-Feb-1998  thorpej Change the last argument of bus_dmamap_sync() from bus_dmasync_op_t to int,
and allow more than one synchronization operation to be specified in
a single call. Dissallow mixing of PRE and POST operations.
 1.98 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.97 24-Jan-1998  mycroft When dumping, print out the device number as major,minor.
 1.96 08-Jan-1998  mrg add new version of non contiguous memory code, written by chuck cranor,
called "MACHINE_NEW_NONCONGIG". this is required for UVM, the new VM
system (also written by chuck) that is coming soon. adds new functions:
vm_page_physload() -- tell the VM system about an area of memory.
vm_physseg_find() -- returns index in vm_physmem array that this
address is in.
and several new versions of old functions/macros defined in vm_page.h.


this is the sparc portion.
 1.95 23-Dec-1997  tv Exclude /dev/fb code if no framebuffer is compiled into the system.
Adds a fb.h flag file with '#define NFB 1' if any such card is configured
in to the kernel.
 1.94 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.93 26-Nov-1997  mjacob If not defining SUN4M, you still have to do something with has_iocache.
 1.92 23-Nov-1997  pk Re-do the `busdma' interface.
 1.91 04-Nov-1997  pk Include copyright statement for the bus_dma implementation added in
the previous revision.
 1.90 02-Nov-1997  pk Add bus_dma*() functions. Some functionality implemented in terms of
existing machinery (for now).
 1.89 16-Oct-1997  mycroft Fix up includes.
 1.88 23-Sep-1997  pk Fix some lossage resulting from changed message buffer initialization:
don't buck the trend and move the call to initmsgbuf() to cpu_startup()
in machdep.c (like most other ports do) where we can setup things right
in one go. (This means that the CSRG copyright will no longer be in
the kernel logs).
 1.87 20-Sep-1997  pk pmap_dumpsize() returns a number of disk blocks.
 1.86 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.85 12-Sep-1997  pk Update syscall() and setregs() in the wake of the recent execve() changes.
 1.84 11-Sep-1997  mycroft Fix execve(2) and *setregs() interfaces so emulations can set registers in a
more correct way. (See tech-kern.)
 1.83 29-Jul-1997  fair branches: 1.83.2; 1.83.4;
missed %lx -> 0x%lx
 1.82 29-Jul-1997  fair %x -> 0x%x
 1.81 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainilne.
 1.80 24-May-1997  pk mapdev() looses the `bustype' argument. It's superseded by `rr_iospace'
on all archs.
 1.79 06-Apr-1997  pk branches: 1.79.2;
sun4c `nbuf' workaround: make threshold dependend on value of MAXBSIZ.
 1.78 04-Apr-1997  pk Undo previous change; it can't have any effect (thinko..)
 1.77 02-Apr-1997  pk Take another register snapshot at the end of dumpsys() to refresh the PCB
which may have been altered while writing the dump. Also, save PC in
the PCB.
 1.76 27-Mar-1997  thorpej Don't allocate mclrefcnt[]; it's dead and gone.
 1.75 26-Mar-1997  gwr Renames: /dumpconf/cpu_dumpconf/, /boot/cpu_reboot/
 1.74 03-Mar-1997  pk Fix calculation of max virtual memory to be gobbled up by the buffer cache.
Apply "stop-gap" nbuf clamp only on sun4/4c and if nbuf not explicitly
configured in.
 1.73 27-Jan-1997  pk branches: 1.73.2; 1.73.4;
In cpu_startup(), after configure() returns, re-zero proc0's user area.
This largely nullifies the effect of proc0's stack running into the
user area during auto-configuration.
 1.72 21-Dec-1996  thorpej XXX Stop-gap for larger MAXBSIZE: limit nbuf to 128, so we don't chew
XXX up all of the available pmegs lower-model SPARC CPUs.
 1.71 09-Nov-1996  pk New-style crash dump format requires a slighty different interpretation of
the variable `dumpsize' (used by savecore(8)) and that the CPU specific data
gets dumped first.
Also, squash a typo that prevented the crash dump to be shifted towards the
end of the swap partition. In fact, the entire dumpconf() routine has been
redone, mostly by pasting large chunks from the alpha port.
 1.70 13-Oct-1996  christos backout previous kprintf change
 1.69 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.68 26-Sep-1996  christos Initialize md_flags.
 1.67 10-Aug-1996  mycroft Put back `waittime' variable.
 1.66 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.65 12-Jun-1996  pk Bound the buffer cache to 1/2 of kernel virtual memory, so machines with
lots of core don't run out of core (takes care of PR#2506).
 1.64 19-May-1996  mrg disable prom sync in romboot() and romhalt(), rather than before calling them.
 1.63 18-May-1996  mrg disable the prom `sync' command before calling romboot() or
romhalt() (idea from OpenBSD).
 1.62 22-Apr-1996  christos remove include of <sys/cpu.h>
 1.61 31-Mar-1996  pk Initialize DMA addresses properlier in cpu_startup().
dumpsys(): do not try to dump first physical page, this fucks up pmap_extract().
 1.60 16-Mar-1996  christos fix format strings. move rom routine decls in bsd_openprom.h
 1.59 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.58 14-Mar-1996  pk Actually enter executables where promised...
 1.57 13-Feb-1996  pk If `cold' simply halt the machine in boot(). Note, this still leaves a window
where vfs_shutdown() and sync() can be called prematurely.
 1.56 13-Jan-1996  chuck change mapdev to panic if size == 0 to be safe.
 1.55 12-Jan-1996  chuck change mapdev() so that it includes the offset from the start of the
page in the virtual address it returns.
 1.54 10-Jan-1996  pk Add shutdownhooks().
 1.53 04-Jan-1996  jtc Changed name of sigaltstack's ss_base field to ss_sp to match XPG4.2 and
traditional usage.
 1.52 11-Dec-1995  pk mapdev() now takes a `struct rom_reg' argument to get access to `iospace'.
 1.51 06-Dec-1995  pk Have v[un]mapbuf() allocate from plain kernel map instead of dvma space.
Remove dvma_malloc/dvma_free; drivers should allocate kernel memory and
use dvma_mapin/dvma_mapout to double map it in DVMA space.

Make the resource map `dvmamap' responsible for all DVMA allocation.
The VM map `physmap' only serves the role of placeholder in the VM system.
 1.50 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.49 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.48 01-Sep-1995  mycroft SA_ONSTACK --> SS_ONSTACK
 1.47 05-Jul-1995  pk Re-arrange dumpconf() and dumpsys().
 1.46 26-Jun-1995  pk Allocate/initialise DVMA maps and base address.
The fact that `phys_map' is split in half for different kinds of DVMA
allocations is not ideal..
 1.45 16-May-1995  mycroft Put the address of the ps_strings structure in %g1.
 1.44 16-May-1995  pk Remove redundant copy of sunos_sigreturn().
 1.43 25-Apr-1995  christos Make this 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  pk Use vfs_shutdown().
 1.40 13-Apr-1995  pk crash dumps need revision
 1.39 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.38 11-Jan-1995  pk Use `MACHINE_NONCONTIG' to deal with sparse memory in stead of private
mapping tables. We gain some pages, but there's still some wastage.
For the moment, `MACHINE_NONCONTIG' is still optional.
 1.37 06-Dec-1994  deraadt place message buffer in low physical memory, so that it can survive a
warm boot. the sun4 boot program corrupts some memory there so adjust
upwards on the sun4. (from chuck)
 1.36 25-Nov-1994  deraadt wcopy/wzero belong here
 1.35 23-Nov-1994  deraadt stack trace on crash
 1.34 20-Nov-1994  deraadt copyright/Id cleanup
 1.33 14-Nov-1994  deraadt make ldcontrolb() use p->p_addr instead of cpcb for the onfault, also
save current onfault value and act at splhigh.
 1.32 05-Nov-1994  deraadt proc0.p_addr must be initialized before we can take a probe trap, so
that the pcb_onfault will be work
 1.31 02-Nov-1994  deraadt sendsig u_long code
 1.30 26-Oct-1994  deraadt sunos compat changes
 1.29 20-Oct-1994  cgd update for new syscall args description mechanism
 1.28 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.27 25-Sep-1994  deraadt sun4 monitor "w" command support
 1.26 20-Aug-1994  deraadt IODEV_BASE cannot used as a static initialiser due to NBPG
 1.25 10-Jun-1994  pk Allocate pmap's segmap separately.
Keep some tags on segment boundaries to optimise ctx_alloc().
 1.24 24-May-1994  deraadt buffer map
 1.23 21-May-1994  deraadt vmmeter
 1.22 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.21 07-May-1994  deraadt sysctl & altstack
 1.20 05-May-1994  deraadt sendsig/sigreturn changes
 1.19 16-Apr-1994  deraadt use cnt.
 1.18 05-Mar-1994  deraadt cut and paste hell
 1.17 26-Feb-1994  deraadt support SYSVSEM and SYSVMSG
 1.16 01-Feb-1994  deraadt sparc runs in current today
 1.15 27-Jan-1994  pk ptrace_[fp][sg]etreg()
 1.14 28-Nov-1993  deraadt use new sun_exec_aout_makecmds
 1.13 26-Nov-1993  deraadt calculate sigtramp address based on PS_STRINGS, not USRSTACK
 1.12 10-Nov-1993  deraadt we do not have sysctl
 1.11 10-Nov-1993  deraadt use p_emul flag to indicate OS emulation
handle syscalls at standard sun place, ie. trap#80 not #89
add SunOS OMAGIC support
 1.10 05-Nov-1993  deraadt now that esp.c is fixed, go back to using the enhanced cache code.
 1.9 27-Oct-1993  deraadt back out of Torek's cache enable code since it makes 1/1+-style
esp chips blow chunks.
 1.8 15-Oct-1993  deraadt we now handle SunOS NMAGIC executables
 1.7 15-Oct-1993  deraadt No need to allocate clists.
 1.6 13-Oct-1993  deraadt de-POSIX'ify sendsig() and sigreturn().
Eventually when we get POSIX signals, we will want to back out of this
change.
 1.5 13-Oct-1993  deraadt move sysarch() to sys_machdep.c
 1.4 11-Oct-1993  deraadt machdep.c: setregs() adjusts the stack correct and warns about problems
cpu_exec_aout_makecmds() that understands sunos ZMAGIC.
trap.c: just Theo's debugging stuff, delete later.
 1.3 11-Oct-1993  deraadt setregs():
%sp needs to be offset +sizeof(struct rwindow)
warn if %sp isn't double-word aligned, it MUST be.
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.73.4.1 12-Mar-1997  is Merge in changes from The Trunk
 1.73.2.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.79.2.2 01-Jun-1997  mrg update to trunk.
 1.79.2.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.83.4.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.83.2.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.83.2.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.83.2.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.117.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.143.2.1 16-Apr-1999  chs branches: 1.143.2.1.2;
pull up 1.143 -> 1.144:
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.143.2.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.143.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.155.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.155.4.1 15-Nov-1999  fvdl Sync with -current
 1.155.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.155.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.155.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.155.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.155.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.165.4.4 04-Feb-2001  he Pull up revisions 1.174-1.175 (requested by pk):
Bus_dma fixes to support certain sbus extension devices on sun4c
machines.
 1.165.4.3 22-Jul-2000  pk Pull up revision 1.166.

Maintain the DVMA map extent subregion boundaries in the bus_dma map
structure.
 1.165.4.2 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.165.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.177.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.177.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.181.2.8 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.181.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.181.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.181.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.181.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.181.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.181.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.181.2.1 03-Aug-2001  lukem update to -current
 1.183.2.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.183.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.187.4.27 17-Jan-2003  thorpej Sync with HEAD.
 1.187.4.26 15-Jan-2003  thorpej Sync with HEAD.
 1.187.4.25 06-Jan-2003  martin Catch up to -current.
 1.187.4.24 05-Jan-2003  thorpej Correction from uwe: Reserve a C call frame on the stack, not a
register window.
 1.187.4.23 05-Jan-2003  thorpej Remove the upcall trampoline, and invoke the upcall directly. Also,
there is no need to fiddle with register windows here, nor to save the
arguments to the stack.

Reviewed by uwe.
 1.187.4.22 03-Jan-2003  thorpej Sync with HEAD (again).
 1.187.4.21 20-Dec-2002  uwe Adjust for mcontext changes.
 1.187.4.20 19-Dec-2002  thorpej Sync with HEAD.
 1.187.4.19 11-Dec-2002  thorpej Sync with HEAD.
 1.187.4.18 28-Nov-2002  uwe Make upcalls work. sa2 passes now.
sa3 seems to work but hangs after printing "About to exit."
 1.187.4.17 18-Oct-2002  nathanw Catch up to -current.
 1.187.4.16 17-Sep-2002  nathanw Catch up to -current.
 1.187.4.15 27-Aug-2002  nathanw Catch up to -current.
 1.187.4.14 02-Aug-2002  nathanw LWPify sigexit() call.
 1.187.4.13 01-Aug-2002  nathanw Catch up to -current.
 1.187.4.12 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.187.4.11 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.187.4.10 21-Jun-2002  gmcgarry Pull in appropriate headers; LWPify some more
 1.187.4.9 20-Jun-2002  nathanw Catch up to -current.
 1.187.4.8 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.187.4.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.187.4.6 28-Feb-2002  nathanw Catch up to -current.
 1.187.4.5 08-Jan-2002  nathanw Catch up to -current.
 1.187.4.4 28-Dec-2001  nathanw Garbage collect cpu_stashcontext().
 1.187.4.3 17-Dec-2001  nathanw Convert to new, smaller cpu_upcall().
 1.187.4.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.187.4.1 03-Oct-2001  pk file machdep.c was added on branch nathanw_sa on 2001-11-20 16:31:56 +0000
 1.193.4.1 22-Oct-2003  jmc Pullup via patch (requested by pk in ticket #1535)
On small sun4c machines trim the buffer cache to reduce the demand for
kernel virtual memory. This leaves more of the precious PMEG resources
available for user space VM which speeds up things considerably, since
a reasonable PMEG working set can be maintained.
 1.193.2.6 31-Aug-2002  gehenna catch up with -current.
 1.193.2.5 31-Aug-2002  gehenna catch up with -current.
 1.193.2.4 21-Jul-2002  gehenna catch up with -current.
 1.193.2.3 17-Jul-2002  gehenna catch up with -current.
 1.193.2.2 15-Jul-2002  gehenna catch up with -current.
 1.193.2.1 17-May-2002  gehenna Replace the access to devsw table and the hard-coded major with devsw API.
 1.228.2.8 11-Dec-2005  christos Sync with head.
 1.228.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.228.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.228.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.228.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.228.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.228.2.2 03-Aug-2004  skrll Sync with HEAD
 1.228.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.245.2.2 20-Mar-2005  tron Pull up revision 1.252 (requested by chs in ticket #1160):
define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).
 1.245.2.1 29-Apr-2004  jmc branches: 1.245.2.1.2;
Pullup rev 1.248 (requested by pk in ticket #211)

Changes to fix and help diagnose MMU resource shortage on small sun4c systems
 1.245.2.1.2.1 20-Mar-2005  tron Pull up revision 1.252 (requested by chs in ticket #1160):
define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).
 1.251.6.3 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.251.6.2 12-Feb-2005  yamt sync with head.
 1.251.6.1 12-Feb-2005  yamt - use new apis.
- don't leave page mapped at kva being freed.
 1.251.4.1 29-Apr-2005  kent sync with -current
 1.253.4.1 12-Jul-2006  tron Apply patch (requested by fair in ticket #1401):
Avoid panic in memory management on some SPARC systems with QFE cards.
This fixes PR port-sparc/33340 and PR port-sparc/33894.
 1.253.2.1 12-Jul-2006  tron Apply patch (requested by fair in ticket #1401):
Avoid panic in memory management on some SPARC systems with QFE cards.
This fixes PR port-sparc/33340 and PR port-sparc/33894.
 1.257.2.5 21-Jan-2008  yamt sync with head
 1.257.2.4 03-Sep-2007  yamt sync with head.
 1.257.2.3 26-Feb-2007  yamt sync with head.
 1.257.2.2 30-Dec-2006  yamt sync with head.
 1.257.2.1 21-Jun-2006  yamt sync with head.
 1.258.2.1 02-Nov-2005  yamt sync with head.
 1.260.2.3 29-Nov-2005  yamt sync with head.
 1.260.2.2 22-Nov-2005  yamt sync with head.
 1.260.2.1 14-Nov-2005  yamt file machdep.c was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.263.8.1 14-Sep-2006  yamt sync with head.
 1.263.4.1 09-Sep-2006  rpaulo sync with head
 1.264.4.1 10-Dec-2006  yamt sync with head.
 1.264.2.4 01-Feb-2007  ad Sync with head.
 1.264.2.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.264.2.2 12-Jan-2007  ad sparc MD changes.
 1.264.2.1 18-Nov-2006  ad Sync with head.
 1.265.2.1 19-Jan-2007  bouyer Pull up following revision(s) (requested by jdc in ticket #372):
sys/arch/sparc/sparc/machdep.c: revision 1.266
Allow SUN4 class machines to boot again by making process virtual
addresses avoid the MMU "hole", as is done on SUN4C class machines.
 1.267.2.3 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.267.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.267.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.271.10.2 03-Oct-2007  garbled Sync with HEAD
 1.271.10.1 22-May-2007  matt Update to HEAD.
 1.271.4.1 11-Jul-2007  mjf Sync with head.
 1.271.2.2 15-Jul-2007  ad Sync with head.
 1.271.2.1 27-May-2007  ad Sync with head.
 1.273.10.2 09-Jan-2008  matt sync with HEAD
 1.273.10.1 06-Nov-2007  matt sync with HEAD
 1.274.8.2 08-Jan-2008  bouyer Sync with HEAD
 1.274.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.274.4.1 26-Dec-2007  ad Sync with head.
 1.274.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.276.8.2 17-Jun-2008  yamt sync with head.
 1.276.8.1 18-May-2008  yamt sync with head.
 1.276.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.276.6.3 02-Jul-2008  mjf Sync with HEAD.
 1.276.6.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.276.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.277.2.5 11-Mar-2010  yamt sync with head
 1.277.2.4 19-Aug-2009  yamt sync with head.
 1.277.2.3 20-Jun-2009  yamt sync with head
 1.277.2.2 04-May-2009  yamt sync with head.
 1.277.2.1 16-May-2008  yamt sync with head.
 1.278.2.6 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.278.2.5 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.278.2.4 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.278.2.3 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.278.2.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.278.2.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.279.2.1 03-Jul-2008  simonb Sync with head.
 1.280.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.280.2.1 19-Oct-2008  haad Sync with HEAD.
 1.282.4.4 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.282.4.3 18-Oct-2009  bouyer Back out ticket 969
 1.282.4.2 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #969):
sys/arch/sparc/include/bus.h: revision 1.56
sys/arch/sparc/sparc/machdep.c: revision 1.294
do as phone suggested - remove sparc_bus_map_large() again and use a =20=
flag
instead ( BUS_SPACE_MAP_LARGE )
 1.282.4.1 02-Feb-2009  snj branches: 1.282.4.1.4;
Pull up following revision(s) (requested by ad in ticket #346):
sys/arch/alpha/alpha/machdep.c: revision 1.311
sys/arch/amiga/amiga/machdep.c: revision 1.211
sys/arch/atari/atari/machdep.c: revision 1.153
sys/arch/hp700/hp700/machdep.c: revision 1.53
sys/arch/i386/i386/dumpsys.c: revision 1.5
sys/arch/mips/mips/mips_machdep.c: revision 1.206
sys/arch/mvme68k/mvme68k/machdep.c: revision 1.132
sys/arch/news68k/news68k/machdep.c: revision 1.75
sys/arch/next68k/next68k/machdep.c: revision 1.88
sys/arch/sparc/sparc/machdep.c: revision 1.285
sys/arch/sparc64/sparc64/machdep.c: revision 1.230
sys/arch/sun2/sun2/machdep.c: revision 1.56
sys/arch/sun3/sun3/machdep.c: revision 1.188
sys/arch/sun3/sun3x/machdep.c: revision 1.114
sys/arch/x68k/x68k/machdep.c: revision 1.153
dumpsys: don't spew numbers into the log.
 1.282.4.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.282.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.282.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.282.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.288.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.301.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.302.2.7 12-Jun-2011  rmind sync with head
 1.302.2.6 31-May-2011  rmind sync with head
 1.302.2.5 21-Apr-2011  rmind sync with head
 1.302.2.4 05-Mar-2011  rmind sync with head
 1.302.2.3 25-Apr-2010  rmind A round of compile and other fixes to previous.
 1.302.2.2 25-Apr-2010  rmind - Invent mm_md_getva() and mm_md_relva() routines, provided by MD and
indicated with __HAVE_MM_MD_PREFER_VA. It will be used to deal with
cache aliasing issues and thus fix little MIPS, ARM and friends.

- Convert dev_mem_readwrite() to use unmanaged mappings. Fix a missed
offset addition in a case of direct map. Sprinkle various comments in
the memory device driver.

- Add missing direct map handling on hp700 and vax. Make checks across
m68k ports more consistent, reduce the diffs. Fix kernacc check miss
on news68k. Minor off-by-one fix for alpha. Add MEMC_PHYS_BASE for
mmap() case check on acorn26. Misc clean-up.
 1.302.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.305.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.305.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.309.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.313.6.4 02-Jun-2012  mrg sync to latest -current.
 1.313.6.3 29-Apr-2012  mrg sync to latest -current.
 1.313.6.2 24-Feb-2012  mrg sync to -current.
 1.313.6.1 18-Feb-2012  mrg merge to -current.
 1.313.2.5 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.313.2.4 16-Jan-2013  yamt sync with (a bit old) head
 1.313.2.3 30-Oct-2012  yamt sync with head
 1.313.2.2 23-May-2012  yamt sync with head.
 1.313.2.1 17-Apr-2012  yamt sync with head
 1.316.2.1 21-May-2012  riz Pull up following revision(s) (requested by martin in ticket #274):
sys/arch/amd64/amd64/process_machdep.c: revision 1.20
sys/kern/sys_lwp.c: revision 1.54
sys/arch/sparc64/sparc64/machdep.c: revision 1.267
sys/arch/mips/mips/cpu_subr.c: revision 1.16
sys/arch/vax/vax/machdep.c: revision 1.188
sys/sys/lwp.h: revision 1.161
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.98
sys/arch/alpha/alpha/machdep.c: revision 1.339
sys/compat/sys/ucontext.h: revision 1.6
sys/arch/hppa/hppa/hppa_machdep.c: revision 1.28
distrib/sets/lists/tests/mi: revision 1.469
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.42
tests/lib/libc/sys/t_lwp_create.c: revision 1.1
tests/lib/libc/sys/Makefile: revision 1.23
sys/arch/arm/arm/sig_machdep.c: revision 1.42
sys/arch/amd64/include/mcontext.h: revision 1.15
sys/arch/amd64/amd64/machdep.c: revision 1.183
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.99
sys/arch/i386/i386/machdep.c: revision 1.727
sys/compat/netbsd32/netbsd32_lwp.c: revision 1.13
sys/arch/sparc/sparc/machdep.c: revision 1.319
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.76
sys/arch/m68k/m68k/sig_machdep.c: revision 1.49
sys/sys/ucontext.h: revision 1.16
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.9
lib/libc/sys/_lwp_create.2: revision 1.5
Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.
To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.
Add an exhaustive atf test case, based partly on code from Joel Sing.
Should finally fix the remaining open part of PR kern/43903.
 1.323.2.3 03-Dec-2017  jdolecek update from HEAD
 1.323.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.323.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.325.2.1 18-May-2014  rmind sync with head
 1.326.4.1 10-Nov-2014  snj Pull up following revision(s) (requested by maxv in ticket #195):
sys/arch/arm/iomd/iomd_irqhandler.c: revision 1.21
sys/arch/arm/ofw/ofw_irqhandler.c: revision 1.21
sys/arch/atari/atari/intr.c: revision 1.24-1.25
sys/arch/ews4800mips/sbd/fb_sbdio.c: revision 1.14
sys/arch/hpcmips/tx/tx39icu.c: revision 1.34
sys/arch/shark/isa/isa_irqhandler.c: revision 1.27
sys/arch/sparc/sparc/machdep.c: revision 1.327
sys/arch/sparc64/dev/psycho.c: revision 1.119
sys/arch/sparc64/dev/schizo.c: revision 1.32
sys/arch/sparc64/sparc64/machdep.c: revision 1.279
sys/arch/sun68k/sun68k/bus.c: revision 1.22
sys/arch/x86/x86/ipmi.c: revision 1.58
sys/arch/xen/xen/privcmd.c: revision 1.46-1.49
Fix several memory leaks.
 1.327.4.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.327.4.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.327.2.1 05-Feb-2017  skrll Sync with HEAD
 1.328.16.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.328.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.328.16.1 10-Jun-2019  christos Sync with HEAD
 1.328.6.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.334.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.334.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.341.2.1 02-Aug-2025  perseant Sync with HEAD
 1.43 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.42 08-Feb-2011  rmind branches: 1.42.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.41 19-Dec-2008  cegger branches: 1.41.6; 1.41.8; 1.41.10;
use M_ZERO on malloc() and remove subsequent bzero().
 1.40 04-Mar-2007  macallan branches: 1.40.40; 1.40.44; 1.40.52;
fix more caddr_t removal fallout
 1.39 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.38 14-Nov-2005  uwe branches: 1.38.26;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.37 07-Aug-2003  agc branches: 1.37.16; 1.37.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.36 28-Jul-2003  pk As pointed out by Jason, the protection bits in pmap_enter()'s `flags' field
are valid (though the sparc implementation currently ignores them), so restore
revision 1.34.
 1.35 25-Jul-2003  pk Remove protection bits from flags arg in pmap_enter() call.
 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 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.28 10-Sep-2001  chris branches: 1.28.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.27 24-Apr-2001  thorpej branches: 1.27.2; 1.27.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.26 13-Nov-2000  pk branches: 1.26.2;
Detect "EOF" conditions on the memory-special files.
 1.25 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.24 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.23 04-Dec-1999  ragge branches: 1.23.4;
CL* discarding.
 1.22 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.21 27-Mar-1999  abs branches: 1.21.8; 1.21.10; 1.21.14;
Make this compile again after mycroft's pmap fixes.
 1.20 27-Mar-1999  mycroft Oops; vm_offset_t -> vaddr_t.
 1.19 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.18 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.17 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.16 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.15 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.14 19-Apr-1997  pk mmmmap() should return -1, not ENOTSUP.
Optimize the case of writing to /dev/zero etc, like the alpha,i386 and m68k.
 1.13 30-Mar-1996  christos iUse <machine/conf.h> instead of sparc_conf.h
 1.12 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.11 29-May-1995  pk eeprom device for Sun4 from Jason Thorpe.
 1.10 13-Apr-1995  pk declare externals
 1.9 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.8 10-Apr-1995  mycroft Add mmopen(), mmclose(), and mmmmap() where appropriate. Lock vmmap when
needed. Make types consistent.
 1.7 10-Mar-1995  pk Use pmap_pa_exists().
Allow read-only access to the prom via /dev/kmem.
 1.6 09-Jan-1995  mycroft Validate /dev/mem addresses again.
 1.5 09-Jan-1995  mycroft Reimplement /dev/mem like other ports. Change physlock to be a plain integer.
Keep the zero page after using it.
 1.4 06-Dec-1994  deraadt place message buffer in low physical memory, so that it can survive a
warm boot. the sun4 boot program corrupts some memory there so adjust
upwards on the sun4. (from chuck)
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.21.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.21.10.1 15-Nov-1999  fvdl Sync with -current
 1.21.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.21.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.23.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.26.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.27.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.27.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.27.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.27.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.27.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.28.4.5 11-Nov-2002  nathanw Catch up to -current
 1.28.4.4 17-Sep-2002  nathanw Catch up to -current.
 1.28.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.28.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.28.4.1 10-Sep-2001  nathanw file mem.c was added on branch nathanw_sa on 2002-01-08 00:27:47 +0000
 1.30.8.1 17-May-2002  gehenna Add the character device switch.
 1.33.2.4 11-Dec-2005  christos 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.37.24.1 22-Nov-2005  yamt sync with head.
 1.37.16.2 03-Sep-2007  yamt sync with head.
 1.37.16.1 21-Jun-2006  yamt sync with head.
 1.38.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.40.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.40.44.1 04-May-2009  yamt sync with head.
 1.40.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.40.40.1 29-Mar-2008  mjf - etc/devfsd.conf: Add some rules to give nodes like /dev/tty and
/dev/null better default modes, i.e. 0666.

- sbin/init: Run devfsd -s before going to multiuser.

- sys/arch: Provide arm32, i386, sparc with a mem_init() function to request
device nodes for /dev/null, /dev/zero, etc.

- sys/dev: Convert rnd, wd, agp, raid, cd, sd, wsdisplay, wskbd, wsmouse,
wsmux, tty, bpf, swap to devfs New World Order.

- sys/fs/devfs: Make the visibility attribute of device nodes configurable.
Also provide a function to mount a devfs on boot.

- sys/kern: Add a new boot flag, -n. This disables devfs support. Unless
the -n flag is specified the kernel will mount a devfs file
system on boot.
 1.41.10.1 17-Feb-2011  bouyer Sync with HEAD
 1.41.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.41.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.42.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.18 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.17 10-Jan-2018  mrg branches: 1.17.16;
s/level 25/level 15/ -- there's nothing higher than 15 on sparc, and
this is talking about NMI.
 1.16 19-Oct-2013  mrg - remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.15 10-Oct-2012  tsutsui branches: 1.15.2;
Fix device_t/softc split botches that could be fatal. From
Chuck Silvers' patch posted current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html

Should be pulled up to netbsd-6.
 1.14 29-Jul-2012  matt branches: 1.14.2;
Fix more -fno-common fallout.
 1.13 17-Jul-2011  mrg branches: 1.13.2; 1.13.8;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.12 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.11 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.10 28-Apr-2008  martin branches: 1.10.8;
Remove clause 3 and 4 from TNF licenses
 1.9 14-Nov-2005  uwe branches: 1.9.2; 1.9.76; 1.9.78; 1.9.80;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.8 22-Mar-2004  pk branches: 1.8.16;
Leverage the PROM's ability to identify the on-board location of a
physical memory address.
 1.7 15-Jul-2003  lukem __KERNEL_RCSID()
 1.6 02-Oct-2002  thorpej branches: 1.6.6;
Add trailing ; to CFATTACH_DECL.
 1.5 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.2 19-Sep-1998  pk branches: 1.2.26; 1.2.30;
Use the expected name for the config attach structure.
 1.1 18-Sep-1998  pk Handle ECC memory control found on a number of machines.
Also defines an entry point for memory errors reported by module interrupts.
 1.2.30.2 18-Oct-2002  nathanw Catch up to -current.
 1.2.30.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.26.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.6.6.4 11-Dec-2005  christos 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.16.1 21-Jun-2006  yamt sync with head.
 1.9.80.2 04-May-2009  yamt sync with head.
 1.9.80.1 16-May-2008  yamt sync with head.
 1.9.78.1 18-May-2008  yamt sync with head.
 1.9.76.2 17-Jan-2009  mjf Sync with HEAD.
 1.9.76.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.9.2.1 14-Nov-2005  uwe file memecc.c was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 1.10.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.8.1 17-Oct-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #602):
sys/arch/sparc/dev/fd.c: revision 1.151
sys/arch/sparc/sparc/memecc.c: revision 1.15
Fix device_t/softc split botches that could be fatal. From
Chuck Silvers' patch posted current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html
Should be pulled up to netbsd-6.
 1.13.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.2.1 30-Oct-2012  yamt sync with head
 1.14.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.15.2.1 18-May-2014  rmind sync with head
 1.17.16.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 07-Apr-2024  rillig sparc: fix typos and omissions in PSTATE_BITS and ECC_AFR_BITS

Fixes PR 57869.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 18-Sep-1998  pk branches: 1.1.148; 1.1.150; 1.1.152;
Handle ECC memory control found on a number of machines.
Also defines an entry point for memory errors reported by module interrupts.
 1.1.152.1 16-May-2008  yamt sync with head.
 1.1.150.1 18-May-2008  yamt sync with head.
 1.1.148.1 02-Jun-2008  mjf Sync with HEAD.
 1.45 29-Jul-2012  matt Fix more -fno-common fallout.
 1.44 17-Jul-2011  mrg branches: 1.44.2;
convert all the "empty softc" (just "struct device") drivers to using
device_t/cfdata_t and CFATTACH_DECL_NEW().

the mspcic driver was also converted since it does not ever touch the
sc_dev it used to have in there.
 1.43 17-Dec-2008  cegger make this compile
 1.42 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.41 21-May-2008  ad branches: 1.41.6;
Remove unneeded playing about with kernel_lock.
 1.40 09-Feb-2007  ad branches: 1.40.44; 1.40.46; 1.40.48; 1.40.50;
Merge newlock2 to head.
 1.39 14-Nov-2005  uwe branches: 1.39.2; 1.39.22;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.38 22-Mar-2004  pk branches: 1.38.16;
Leverage the PROM's ability to identify the on-board location of a
physical memory address.
 1.37 15-Jul-2003  lukem __KERNEL_RCSID()
 1.36 18-Jan-2003  thorpej branches: 1.36.2;
Merge the nathanw_sa branch.
 1.35 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.34 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.33 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.32 11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.31 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.30 15-Mar-2001  mrg branches: 1.30.2; 1.30.8;
sprinkle KERNEL_LOCK() and KERNEL_PROC_LOCK() where they're missing. add
SYSCALL_DEBUG support to trap.c.
 1.29 03-Mar-2001  pk branches: 1.29.2;
Sprinkle KERNEL_PROC_LOCK()s at the kernel entry points.
 1.28 21-Sep-1998  pk branches: 1.28.12;
Merge sun4 and sun4c version of memerr() again.
 1.27 20-Sep-1998  pk Re-arrange the sun4m cases a bit.
Entry points no longer have async arguments.
 1.26 06-Sep-1998  pk Sanitize memerr*() a bit.
 1.25 30-Mar-1998  pk Replace direct `sparc_bus_map()' calls with bus space map method.
 1.24 29-Mar-1998  pk Initialize `par_err_reg' in the mainbus attach function.
 1.23 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.22 12-Jan-1998  thorpej Update for changes to config.
 1.21 29-Jul-1997  fair %x -> 0x%x
 1.20 24-May-1997  pk Remove `bustype' argument from map[io]dev().
 1.19 22-Mar-1997  pk For each major "module", define a separate set of MMU control register bits.
 1.18 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.17 16-Nov-1996  pk Remove `unused variable' warning.
 1.16 13-Nov-1996  thorpej Use bitmask_snprintf().
 1.15 13-Oct-1996  christos backout previous kprintf change
 1.14 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 31-Mar-1996  pk Aaron's sun4m-related trap handling (memory faults).

Note that fork() no longer return in syscall() in the child.

Add a couple of `#ifdef DEBUG's.
 1.12 26-Mar-1996  pk Bitfields are unsigned.
 1.11 26-Mar-1996  pk Back to normal printf()s, now that gcc understands `%b'.
 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 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.8 11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.7 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.6 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.3 02-Oct-1994  deraadt sun4/300 support works
 1.2 18-Sep-1994  deraadt generalize bus support for match/attach
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.28.12.2 27-Mar-2001  bouyer Sync with HEAD.
 1.28.12.1 12-Mar-2001  bouyer Sync with HEAD.
 1.29.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.30.8.5 18-Oct-2002  nathanw Catch up to -current.
 1.30.8.4 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.30.8.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.30.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.30.8.1 15-Mar-2001  nathanw file memreg.c was added on branch nathanw_sa on 2002-01-08 00:27:48 +0000
 1.30.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.30.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.30.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.36.2.4 11-Dec-2005  christos Sync with head.
 1.36.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.36.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.36.2.1 03-Aug-2004  skrll Sync with HEAD
 1.38.16.2 26-Feb-2007  yamt sync with head.
 1.38.16.1 21-Jun-2006  yamt sync with head.
 1.39.22.1 12-Jan-2007  ad sparc MD changes.
 1.39.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.39.2.1 14-Nov-2005  uwe file memreg.c was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 1.40.50.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.40.48.1 04-May-2009  yamt sync with head.
 1.40.46.1 04-Jun-2008  yamt sync with head
 1.40.44.2 17-Jan-2009  mjf Sync with HEAD.
 1.40.44.1 02-Jun-2008  mjf Sync with HEAD.
 1.41.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.44.2.1 30-Oct-2012  yamt sync with head
 1.10 29-Jul-2012  matt Fix more -fno-common fallout.
 1.9 14-Nov-2005  uwe branches: 1.9.2; 1.9.114;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.8 07-Aug-2003  agc branches: 1.8.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 21-Sep-1998  pk branches: 1.7.46;
Merge sun4 and sun4c version of memerr() again.
 1.6 20-Sep-1998  pk Re-arrange the sun4m cases a bit.
Entry points no longer have async arguments.
 1.5 06-Sep-1998  pk Sanitize memerr*() a bit.
 1.4 31-Mar-1996  pk Aaron's sun4m-related trap handling (memory faults).

Note that fork() no longer return in syscall() in the child.

Add a couple of `#ifdef DEBUG's.
 1.3 26-Mar-1996  pk Bitfields are unsigned.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.7.46.4 11-Dec-2005  christos Sync with head.
 1.7.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.46.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.9.114.1 30-Oct-2012  yamt sync with head
 1.9.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.9.2.1 14-Nov-2005  uwe file memreg.h was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 1.21 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

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

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.20 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.19 01-Jul-2011  dyoung branches: 1.19.66;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.18 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.17 29-Mar-2008  tsutsui branches: 1.17.2; 1.17.4;
Don't forget to initialize sc_dev.
 1.16 28-Mar-2008  tsutsui Split device_t and softc for MI mk48txx(4) and intersil7170(4) clocks,
and other related misc cosmetics.
 1.15 10-Jan-2008  tsutsui branches: 1.15.6;
- move todr_attach(9) calls from each MD attachment to MI mk48txx_attach()
- don't clear todr_setwen in mk48txx_attach() since it might be set by
MD attachments
 1.14 03-Sep-2006  gdamore branches: 1.14.32; 1.14.38; 1.14.46;
Convert both sparc and sparc64 to MI todr.
 1.13 14-Nov-2005  uwe branches: 1.13.4; 1.13.8;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.12 03-Apr-2004  chs branches: 1.12.12; 1.12.18;
add a bootbus (SUN4D) attachment. from Stephen Sukovich in PR 24199.
 1.11 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.10 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.9 02-Nov-2003  tsutsui Fix leftover of MI mk48txx(4) changes inside #if defined(SUN4).
Pointed out by Juergen Hannken-Illjes.
 1.8 01-Nov-2003  tsutsui Adapt to MI mk48txx(4) changes.
Tested on SS1+ (mainbus), but not tested on sun4/sun4m (obio).

XXX maybe this file should be split into mainbus and obio attachments
XXX and moved into sys/arch/sparc/dev or sys/dev/sun.
 1.7 15-Jul-2003  lukem __KERNEL_RCSID()
 1.6 02-Mar-2003  pk branches: 1.6.2;
Use the new pmap_kprotect() function instead of pmap_changeprot().
The latter is now a pmap internal function; and it wasn't used correctly
in mkclock.c anyway.
 1.5 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.4 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.3 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 28-Mar-2002  pk branches: 1.1.2; 1.1.8;
Untangle clock.c:
* put various time-of-day clock, timer and eeprom drivers in separate files
* avoid unnecessary overhead in interrupt handlers
* make the MSIIEP timer attach through the regular autoconf mechanisms
 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 28-Mar-2002  jdolecek file mkclock.c was added on branch kqueue on 2002-06-23 17:41:52 +0000
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1 28-Mar-2002  nathanw file mkclock.c was added on branch nathanw_sa on 2002-04-01 07:42:53 +0000
 1.6.2.4 11-Dec-2005  christos Sync with head.
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.18.1 22-Nov-2005  yamt sync with head.
 1.12.12.3 21-Jan-2008  yamt sync with head
 1.12.12.2 30-Dec-2006  yamt sync with head.
 1.12.12.1 21-Jun-2006  yamt sync with head.
 1.13.8.1 14-Sep-2006  yamt sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.14.46.1 10-Jan-2008  bouyer Sync with HEAD
 1.14.38.1 18-Feb-2008  mjf Sync with HEAD.
 1.14.32.1 23-Mar-2008  matt sync with HEAD
 1.15.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.15.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.4.1 16-May-2008  yamt sync with head.
 1.17.2.1 18-May-2008  yamt sync with head.
 1.19.66.1 03-Apr-2021  thorpej Sync with HEAD.
 1.54 04-Oct-2025  thorpej Make sure the msiiep PROM node gets propagated down to the PCI
bus instance.
 1.53 21-Jan-2022  thorpej Don't bother with prom_node_to_devhandle() if we're just forwarding along
our own node; use device_handle(self) instead.
 1.52 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.51 10-May-2021  thorpej branches: 1.51.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.50 24-Apr-2021  thorpej branches: 1.50.2; 1.50.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.49 22-Nov-2020  thorpej branches: 1.49.2;
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)
 1.48 30-Dec-2019  ad branches: 1.48.8;
PR port-sparc/54789: Sparc boot fails with "Trap 0x21 while interrupts disabled"

Remove assumption that cpu_info is smaller than 1kB.
 1.47 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.46 04-Oct-2015  joerg branches: 1.46.18;
Don't check unsigned values for negativity.
 1.45 16-Nov-2013  mrg branches: 1.45.6;
- convert CPU_INFO_ITERATOR in the !MP case to be __unused, and convert
all the iterators to use it
- print the right variables in nmi_hard_msiiep() (thanks set-but-unused)
- move variable inside usage #ifdef
- use (void) instead of a "volatile int" junk variable
- remove unused variables
 1.44 16-Apr-2013  jdc branches: 1.44.4;
Add PCI fixup for MicroSPARC-IIep.
Unconfigured PCI-PCI bridges and devices behind them are configured.
 1.43 17-Jul-2011  mrg branches: 1.43.2; 1.43.12;
actually use CFATTACH_DECL_NEW() and device_private() for mspcic.
 1.42 17-Jul-2011  mrg convert all the "empty softc" (just "struct device") drivers to using
device_t/cfdata_t and CFATTACH_DECL_NEW().

the mspcic driver was also converted since it does not ever touch the
sc_dev it used to have in there.
 1.41 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.40 17-May-2011  dyoung PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.39 03-Jan-2010  mrg branches: 1.39.4; 1.39.6;
add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.38 11-Nov-2009  he Pass a 0 as flag value to pmap_kenter_pa().
 1.37 16-May-2009  martin Implement dmamap_unload - I might be missing something, or is it realy
this easy?
 1.36 04-Jun-2008  ad vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.35 04-Mar-2007  christos branches: 1.35.40; 1.35.42; 1.35.44; 1.35.46;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 24-Dec-2005  perry branches: 1.34.26;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.33 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.32 16-Nov-2005  uwe Drop trailing whitespace.
 1.31 25-Sep-2005  uwe branches: 1.31.6;
Move new bus space methods to be with the rest of the bus space
related functions.
 1.30 25-Sep-2005  uwe G/c msiiep_swap_endian, it's no longer used now that we run without
byteswapping in the PCIC.
 1.29 25-Sep-2005  macallan Put the CPU to sleep when idle
 1.28 24-Sep-2005  macallan Run the MicroSPARC IIep PCI bus without endianness translation.
This allows us to run X without any additional code changes.
 1.27 24-Sep-2005  uwe G/c unused fields in mspcic_softc.
 1.26 23-Sep-2005  uwe Introduce mspcic_{read,write}_N instead of using struct syntax. This
is the first step to make PCIC run without byteswapping - which is
necessary for X server support. Current macros are still just a
kludgy shim over struct syntax, but accesses to PCIC in the .c files
are now marked up properly.
 1.25 10-Sep-2005  uwe ANSIfy.
 1.24 01-Apr-2005  yamt branches: 1.24.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.23 30-Aug-2004  drochner branches: 1.23.4; 1.23.6;
Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.22 10-Jul-2004  martin Adapt to new sparc bus_space_tag_t world order.
 1.21 24-Apr-2004  kleink Update for new pci_devinfo(9) signature.
 1.20 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.19 15-Jun-2003  fvdl branches: 1.19.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.
 1.18 08-Apr-2003  uwe In msiiep_attach print \n to terminate its attachment line.
 1.17 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.16 03-Jan-2003  mrg part one of bus_space(9) fixes to enable bus spaces to override the
bus_space_{read,write}_[1248]() functions, which will allow 16-bit
PCMCIA support to work without additional hacks in MI drivers.
this option is not enabled yet.
 1.15 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.14 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.13 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.12 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.11 25-Aug-2002  thorpej Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.10 05-Jun-2002  uwe Fix phys->pci memory pass-through mapping.
While here, correct wording in a comment.
 1.9 16-May-2002  thorpej branches: 1.9.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.8 08-May-2002  uwe Oops, mspcic_bus_mmap was, effectively, adding offset twice.
While here, add __KERNEL_RCSID.
 1.7 04-Apr-2002  uwe Instead of relying on numerology set up by PROM, actually implement
bus_space_map/mmap methods that do proper PCI to phys address translation.
 1.6 28-Mar-2002  uwe Move ms-IIep PCIC driver into mspcic0 at msiiep0. msiiep0 now serves
as a stub bus that knows how to attach drivers for various functions
of PCIC.

This change is a follow up to timer0 at msiiep0 change, since all
children must share same attach arguments and so we no longer can
attach pci0 directly under msiiep0.
 1.5 28-Mar-2002  pk `intterupt' => `interrupt'
 1.4 28-Mar-2002  pk Untangle clock.c:
* put various time-of-day clock, timer and eeprom drivers in separate files
* avoid unnecessary overhead in interrupt handlers
* make the MSIIEP timer attach through the regular autoconf mechanisms
 1.3 13-Mar-2002  uwe Fix cast.
 1.2 11-Dec-2001  uwe branches: 1.2.2; 1.2.4;
tabify
 1.1 11-Dec-2001  uwe microSPARC-IIep support.
 1.2.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.2.4.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.2.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 11-Dec-2001  thorpej file msiiep.c was added on branch kqueue on 2002-01-10 19:49:02 +0000
 1.2.2.9 03-Jan-2003  thorpej Sync with HEAD (again).
 1.2.2.8 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.6 27-Aug-2002  nathanw Catch up to -current.
 1.2.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.2.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.1 11-Dec-2001  nathanw file msiiep.c was added on branch nathanw_sa on 2002-01-08 00:27:48 +0000
 1.9.2.3 31-Aug-2002  gehenna catch up with -current.
 1.9.2.2 15-Jul-2002  gehenna catch up with -current.
 1.9.2.1 16-May-2002  gehenna file msiiep.c was added on branch gehenna-devsw on 2002-07-15 01:21:27 +0000
 1.19.2.7 11-Dec-2005  christos Sync with head.
 1.19.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.19.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.2 03-Sep-2004  skrll Sync with HEAD
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.6.1 12-Feb-2005  yamt - use new apis.
- don't leave page mapped at kva being freed.
 1.23.4.1 29-Apr-2005  kent sync with -current
 1.24.2.2 03-Sep-2007  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.31.6.2 29-Nov-2005  yamt sync with head.
 1.31.6.1 22-Nov-2005  yamt sync with head.
 1.34.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.35.46.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.35.44.3 11-Mar-2010  yamt sync with head
 1.35.44.2 20-Jun-2009  yamt sync with head
 1.35.44.1 04-May-2009  yamt sync with head.
 1.35.42.1 17-Jun-2008  yamt sync with head.
 1.35.40.1 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.39.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.39.4.1 31-May-2011  rmind sync with head
 1.43.12.3 03-Dec-2017  jdolecek update from HEAD
 1.43.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.12.1 23-Jun-2013  tls resync from head
 1.43.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.44.4.1 18-May-2014  rmind sync with head
 1.45.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.46.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.46.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.48.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.49.2.2 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.49.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.50.4.1 31-May-2021  cjep sync with head
 1.50.2.1 13-May-2021  thorpej Sync with HEAD.
 1.51.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.9 04-Mar-2007  uwe Define MSIIEP_COUNTER_LIMIT
 1.8 11-Dec-2005  christos branches: 1.8.26;
merge ktrace-lwp.
 1.7 25-Sep-2005  uwe Stream versions of mspcic_read/write_N.
 1.6 24-Sep-2005  macallan Run the MicroSPARC IIep PCI bus without endianness translation.
This allows us to run X without any additional code changes.
 1.5 24-Sep-2005  uwe Whitespace nits.
 1.4 23-Sep-2005  uwe Introduce mspcic_{read,write}_N instead of using struct syntax. This
is the first step to make PCIC run without byteswapping - which is
necessary for X server support. Current macros are still just a
kludgy shim over struct syntax, but accesses to PCIC in the .c files
are now marked up properly.
 1.3 10-Sep-2005  uwe Add bitmask string for system interrupt pending register.
 1.2 10-Sep-2005  uwe u_intN_t -> uintN_t
 1.1 11-Dec-2001  uwe branches: 1.1.2; 1.1.4; 1.1.20; 1.1.36;
microSPARC-IIep support.
 1.1.36.2 03-Sep-2007  yamt sync with head.
 1.1.36.1 21-Jun-2006  yamt sync with head.
 1.1.20.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 11-Dec-2001  thorpej file msiiepreg.h was added on branch kqueue on 2002-01-10 19:49:02 +0000
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 11-Dec-2001  nathanw file msiiepreg.h was added on branch nathanw_sa on 2002-01-08 00:27:48 +0000
 1.8.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.10 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.9 16-Apr-2013  jdc branches: 1.9.48;
Add PCI fixup for MicroSPARC-IIep.
Unconfigured PCI-PCI bridges and devices behind them are configured.
 1.8 17-Jul-2011  mrg branches: 1.8.2; 1.8.12;
convert all the "empty softc" (just "struct device") drivers to using
device_t/cfdata_t and CFATTACH_DECL_NEW().

the mspcic driver was also converted since it does not ever touch the
sc_dev it used to have in there.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 24-Sep-2005  uwe No argument names in function declarations.
 1.5 24-Sep-2005  uwe G/c unused fields in mspcic_softc.
 1.4 03-Jun-2005  martin branches: 1.4.2;
Sprinkle some const
 1.3 28-Mar-2002  uwe branches: 1.3.10;
Move ms-IIep PCIC driver into mspcic0 at msiiep0. msiiep0 now serves
as a stub bus that knows how to attach drivers for various functions
of PCIC.

This change is a follow up to timer0 at msiiep0 change, since all
children must share same attach arguments and so we no longer can
attach pci0 directly under msiiep0.
 1.2 28-Mar-2002  pk `intterupt' => `interrupt'
 1.1 11-Dec-2001  uwe branches: 1.1.2; 1.1.4;
microSPARC-IIep support.
 1.1.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 11-Dec-2001  thorpej file msiiepvar.h was added on branch kqueue on 2002-01-10 19:49:02 +0000
 1.1.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 11-Dec-2001  nathanw file msiiepvar.h was added on branch nathanw_sa on 2002-01-08 00:27:49 +0000
 1.3.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.1 21-Jun-2006  yamt sync with head.
 1.8.12.1 23-Jun-2013  tls resync from head
 1.8.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.48.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 14-Feb-1999  pk This file is superseded by promlib.c
 1.2 26-Sep-1998  pk Add wrappers for PROM's CPU start/stop functions.
 1.1 26-Sep-1998  pk Move PROM interface routines into their own file.
 1.21 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.20 01-Jul-2011  dyoung branches: 1.20.66;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.19 03-Jan-2010  mrg add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.18 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.17 29-Mar-2008  tsutsui branches: 1.17.2; 1.17.4;
Don't forget to initialize sc_dev.
 1.16 28-Mar-2008  tsutsui Split device_t and softc for MI mk48txx(4) and intersil7170(4) clocks,
and other related misc cosmetics.
 1.15 10-Jan-2008  tsutsui branches: 1.15.6;
Move todr_attach(9) calls from each MD attachment to MI intersil7170_attach().
 1.14 04-Oct-2006  tsutsui branches: 1.14.28; 1.14.34; 1.14.42;
Reorganize MI intersil7170(4) TOD clock driver:
- make intersil7170_softc more generic and allocate it during autoconf(9)
rather than MALLOC(9) in attachment
- put todr_chip_handle_t, year0 value, and the century adjustment flag
into the intersil7170_softc
- change the attachment function to just take the softc like mk48txx(4)
- split sys/dev/ic/intersil7170.h into intersil7170reg.h and intersil7170var.h
- cleanup some macro

Untested on real sun4 machines, but no objection on port-sparc
(and port-sun3) in three days.
 1.13 03-Sep-2006  gdamore branches: 1.13.2; 1.13.4;
Convert both sparc and sparc64 to MI todr.
 1.12 16-Nov-2005  uwe branches: 1.12.4; 1.12.8;
Drop trailing whitespace.
 1.11 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.10 01-Jul-2004  pk branches: 1.10.12; 1.10.18;
Avoid unnecessary stores of discarded values.
 1.9 01-Jul-2004  pk Revision 1.27 of clock.c applies to the Intersil interrupt, not sun4m timers.
 1.8 15-Jul-2003  lukem branches: 1.8.2;
__KERNEL_RCSID()
 1.7 26-Feb-2003  pk branches: 1.7.2;
Move all `ID prom' stuff into the prom library.
 1.6 10-Dec-2002  pk intr_establish() signature change: pass NULL for the `fast trap' argument.
 1.5 06-Dec-2002  pk Pass the `device class interrupt level' on to intr_establish() and use to
raise the ipl in the interrupt handlers to the appropriate level. This avoids
interrupt handler interference if one of the devices actually interrupts at
a lower hardware level than the maximum level assined to a device class.

Based on code from Art Grabowski in openbsd.
 1.4 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.3 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 28-Mar-2002  pk branches: 1.1.2; 1.1.8;
Untangle clock.c:
* put various time-of-day clock, timer and eeprom drivers in separate files
* avoid unnecessary overhead in interrupt handlers
* make the MSIIEP timer attach through the regular autoconf mechanisms
 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 28-Mar-2002  jdolecek file oclock.c was added on branch kqueue on 2002-06-23 17:41:53 +0000
 1.1.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1 28-Mar-2002  nathanw file oclock.c was added on branch nathanw_sa on 2002-04-01 07:42:53 +0000
 1.7.2.4 11-Dec-2005  christos 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 10-Jul-2004  tron Pull up revision 1.9 (requested by pk in ticket #637):
Revision 1.27 of clock.c applies to the Intersil interrupt, not sun4m timers.
 1.10.18.1 22-Nov-2005  yamt sync with head.
 1.10.12.3 21-Jan-2008  yamt sync with head
 1.10.12.2 30-Dec-2006  yamt sync with head.
 1.10.12.1 21-Jun-2006  yamt sync with head.
 1.12.8.1 14-Sep-2006  yamt sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.4.1 06-Oct-2006  tsutsui Also update a file which depends on MI intersil7170(4) changes.
 1.13.2.1 18-Nov-2006  ad Sync with head.
 1.14.42.1 10-Jan-2008  bouyer Sync with HEAD
 1.14.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.14.28.1 23-Mar-2008  matt sync with HEAD
 1.15.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.15.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.4.2 11-Mar-2010  yamt sync with head
 1.17.4.1 16-May-2008  yamt sync with head.
 1.17.2.1 18-May-2008  yamt sync with head.
 1.20.66.1 03-Apr-2021  thorpej Sync with HEAD.
 1.24 27-Feb-2021  palle sun4v: add 32/64 bit workaround for the OF_read() call, similar to the one introduced in revision 1.21
 1.23 26-Mar-2017  martin branches: 1.23.26;
Add KASSERTs to catch access to NULL OF nodes early
 1.22 07-Apr-2016  palle branches: 1.22.2; 1.22.4;
Rework locking mechanism introduced in rev. 1.21: use __cpu_simple_lock... instead of mutex_... since this causes issues when LOCKDEBUG is defined
 1.21 01-Apr-2016  palle sun4v: Workaround for OpenBoot feature where a 64-bit address is truncated to a 32-bit address. This happends when a write to the console (/virtual-devices@100/console@1) is done. Avoid this by using a static buffer that is mapped below 4GB. Thanks to Tarl Neustaedter for explaining how OpenBoot works. ok martin@
 1.20 27-Mar-2015  nakayama Sync sparc64 kernel's OF_seek with ofwboot's one, but sparc version
is not changed.
 1.19 23-Nov-2014  christos branches: 1.19.2;
avoid shadowed variable
 1.18 18-Jul-2011  martin branches: 1.18.12; 1.18.28;
if _KERNEL is not defined, include <sys/stdarg.h> for va_list. For the
kernel (or modules) this is already done by systm.h.
 1.17 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.16 19-Aug-2008  martin Add missing va_end() calls, reported by Stepan "doomwarrior" on
port-sparc64.
 1.15 22-Feb-2007  thorpej branches: 1.15.42; 1.15.46; 1.15.48; 1.15.52;
TRUE -> true, FALSE -> false
 1.14 10-May-2006  skrll branches: 1.14.14;
Fix a bunch of cast lvalues.
 1.13 24-Dec-2005  perry branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.12 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.11 24-Sep-2005  macallan branches: 1.11.6;
Run the MicroSPARC IIep PCI bus without endianness translation.
This allows us to run X without any additional code changes.
 1.10 31-May-2005  christos branches: 1.10.2;
- sprinkle const
- convert to ansi prototypes.
 1.9 21-Mar-2004  pk * Add OF_claim() for sparc64.
* Change OF_interpret() to the unabridged version.
* Sync OF_sym2val() and OF_val2sym() with the psarc64 versions.
 1.8 30-Jul-2003  mrg sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.7 15-Jul-2003  lukem __KERNEL_RCSID()
 1.6 11-Dec-2001  uwe branches: 1.6.16;
On ms-IIep kernel runs with PCI endian swapping turned on but we need
to turn it off before we pass control to PROM's repl as it expects
PCIC to be in little endian mode and would hang otherwise.
 1.5 24-Sep-2001  wiz branches: 1.5.4;
va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
 1.4 30-May-2001  mrg branches: 1.4.2; 1.4.4;
use _KERNEL_OPT
 1.3 22-Mar-2001  mrg sync with sparc64 (just some debug messages.)
 1.2 15-Nov-2000  pk branches: 1.2.2;
Adjust OF_setprop() prototype.
 1.1 14-Feb-1999  pk branches: 1.1.8;
Provide a uniform interface to most of the PROM functions.
Include an Openfirmware back-end (mostly copied from sparc64).
 1.1.8.2 27-Mar-2001  bouyer Sync with HEAD.
 1.1.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.2.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.4.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.5.4.1 24-Sep-2001  nathanw file openfirm.c was added on branch nathanw_sa on 2002-01-08 00:27:49 +0000
 1.6.16.5 11-Dec-2005  christos Sync with head.
 1.6.16.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.16.1 03-Aug-2004  skrll Sync with HEAD
 1.10.2.2 26-Feb-2007  yamt sync with head.
 1.10.2.1 21-Jun-2006  yamt sync with head.
 1.11.6.1 22-Nov-2005  yamt sync with head.
 1.13.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.13.10.1 11-May-2006  elad sync with head
 1.13.8.1 24-May-2006  yamt sync with head.
 1.13.6.1 01-Jun-2006  kardel Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.14.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.15.52.1 19-Oct-2008  haad Sync with HEAD.
 1.15.48.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.15.46.1 04-May-2009  yamt sync with head.
 1.15.42.1 28-Sep-2008  mjf Sync with HEAD.
 1.18.28.1 29-Mar-2015  martin Pull up following revision(s) (requested by nakayama in ticket #649):
sys/arch/sparc/sparc/openfirm.c: revision 1.20
sys/arch/sparc/include/openfirm.h: revision 1.8
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
Sync sparc64 kernel's OF_seek with ofwboot's one, but sparc version
is not changed.
 1.18.12.1 03-Dec-2017  jdolecek update from HEAD
 1.19.2.3 28-Aug-2017  skrll Sync with HEAD
 1.19.2.2 22-Apr-2016  skrll Sync with HEAD
 1.19.2.1 06-Apr-2015  skrll Sync with HEAD
 1.22.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.22.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.23.26.1 03-Apr-2021  thorpej Sync with HEAD.
 1.28 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.27 16-Mar-2014  dholland branches: 1.27.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.26 04-Mar-2007  christos branches: 1.26.78; 1.26.88; 1.26.94;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.25 15-Oct-2006  martin branches: 1.25.4;
Missing initializers
 1.24 11-Dec-2005  christos branches: 1.24.20; 1.24.22;
merge ktrace-lwp.
 1.23 14-Nov-2005  uwe branches: 1.23.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.22 18-Mar-2004  pk branches: 1.22.16;
Implement OPIOCFINDDEVICE.
 1.21 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.20 16-Mar-2004  pk Encapsulate retrieval of properties from the global `options' prom node.
 1.19 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.18 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.17 15-Jul-2003  lukem __KERNEL_RCSID()
 1.16 29-Jun-2003  fvdl branches: 1.16.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.15 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.14 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.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 04-Dec-2001  darrenr branches: 1.12.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.11 26-Sep-2001  eeh branches: 1.11.4;
getprop* -> PROM_getprop*
 1.10 14-Feb-1999  pk branches: 1.10.20; 1.10.22;
Use the PROMLIB interface.
 1.9 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.8 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.7 30-Mar-1996  christos Use machine/conf.h, instead of sparc_conf.h
 1.6 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.5 10-Jan-1995  pk Avoid kernel memory corruption if user buffer too small; return ENOMEM in stead.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 02-Nov-1994  deraadt ioctl u_long cmd
 1.2 02-Oct-1994  deraadt cannot open on a sun4 machine
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.22.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.20.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.10.20.1 01-Oct-2001  fvdl Catch up with -current.
 1.11.4.4 11-Nov-2002  nathanw Catch up to -current
 1.11.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.11.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.11.4.1 26-Sep-2001  nathanw file openprom.c was added on branch nathanw_sa on 2002-01-08 00:27:49 +0000
 1.12.8.1 17-May-2002  gehenna Add device switch.
 1.16.2.5 11-Dec-2005  christos Sync with head.
 1.16.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.16.3 03-Sep-2007  yamt sync with head.
 1.22.16.2 30-Dec-2006  yamt sync with head.
 1.22.16.1 21-Jun-2006  yamt sync with head.
 1.23.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.23.2.1 14-Nov-2005  uwe file openprom.c was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 1.24.22.1 22-Oct-2006  yamt sync with head
 1.24.20.1 18-Nov-2006  ad Sync with head.
 1.25.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.26.94.1 18-May-2014  rmind sync with head
 1.26.88.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.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.27.2.1 10-Aug-2014  tls Rebase.
 1.7 13-Oct-2025  thorpej Implememt ether-get-mac-address as a system default device call, and get
completely out of the business of examining bus types and setting properties
in dictionaries when dealing with Ethernet MAC addresses.
 1.6 03-Oct-2025  thorpej Use device_setprop_data() to set the "mac-address" property.
 1.5 01-Nov-2021  andvar fix typos, mainly in words minimum and maximum, but also few others.
 1.4 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.3 02-Mar-2019  christos branches: 1.3.12;
Catch up with MI pci changes.
 1.2 01-Mar-2019  msaitoh - Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.
 1.1 16-Apr-2013  jdc branches: 1.1.4; 1.1.12; 1.1.40;
Add PCI fixup for MicroSPARC-IIep.
Unconfigured PCI-PCI bridges and devices behind them are configured.
 1.1.40.1 10-Jun-2019  christos Sync with HEAD
 1.1.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.1.12.1 16-Apr-2013  yamt file pci_fixup.c was added on branch yamt-pagecache on 2014-05-22 11:40:09 +0000
 1.1.4.2 23-Jun-2013  tls resync from head
 1.1.4.1 16-Apr-2013  tls file pci_fixup.c was added on branch tls-maxphys on 2013-06-23 06:20:12 +0000
 1.3.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 13-Oct-2025  thorpej Implememt ether-get-mac-address as a system default device call, and get
completely out of the business of examining bus types and setting properties
in dictionaries when dealing with Ethernet MAC addresses.
 1.1 16-Apr-2013  jdc branches: 1.1.4; 1.1.12;
Add PCI fixup for MicroSPARC-IIep.
Unconfigured PCI-PCI bridges and devices behind them are configured.
 1.1.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.1.12.1 16-Apr-2013  yamt file pci_fixup.h was added on branch yamt-pagecache on 2014-05-22 11:40:09 +0000
 1.1.4.2 23-Jun-2013  tls resync from head
 1.1.4.1 16-Apr-2013  tls file pci_fixup.h was added on branch tls-maxphys on 2013-06-23 06:20:12 +0000
 1.23 04-Oct-2025  thorpej Provide a PCI-device-to-devhandle mapping routines for msiiep machines,
using the PROM node encoded into the pcitag_t.
 1.22 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.21 02-Oct-2015  msaitoh PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.20 29-Mar-2014  christos branches: 1.20.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.19 26-Mar-2014  christos kill sprintf
 1.18 16-Apr-2013  jdc branches: 1.18.4;
Add PCI fixup for MicroSPARC-IIep.
Unconfigured PCI-PCI bridges and devices behind them are configured.
 1.17 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.16 01-Jul-2011  dyoung branches: 1.16.2; 1.16.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.15 04-Apr-2011  dyoung Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

For the most part, these changes add a 'const' where there was no
'const' before, however, some drivers and MD code used to modify
pci_attach_args. Now those drivers either copy their pci_attach_args
and modify the copy, or refrain from modifying pci_attach_args:

Xen: according to Manuel Bouyer, writing to pci_attach_args in
pci_intr_map() was a leftover from Xen 2. Probably a bug. I
stopped writing it. I have not tested this change.

siside(4): sis_hostbr_match() needlessly wrote to pci_attach_args.
Probably a bug. I use a temporary variable. I have not tested this
change.

slide(4): sl82c105_chip_map() overwrote the caller's pci_attach_args.
Probably a bug. Use a local pci_attach_args. I have not tested
this change.

viaide(4): via_sata_chip_map() and via_sata_chip_map_new() overwrote the
caller's pci_attach_args. Probably a bug. Make a local copy of the
caller's pci_attach_args and modify the copy. I have not tested
this change.

While I'm here, make pci_mapreg_submap() static.

With these changes in place, I have tested the compilation of these
kernels:

alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-eb NSLU2
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE GUMSTIX
HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321 IXDP425 IXM1200
KUROBOX_PRO LUBBOCK MARVELL_NAS NAPPI SHEEVAPLUG SMDK2800 TEAMASA_NPWR
TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sgimips GENERIC32_IP2x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC

As of Sun Apr 3 15:26:26 CDT 2011, I could not compile these kernels
with or without my patches in place:

### evbmips-el GDIUM

nbmake: nbmake: don't know how to make /home/dyoung/pristine-nbsd/src/sys/arch/mips/mips/softintr.c. Stop

### evbarm-el MPCSA_GENERIC
src/sys/arch/evbarm/conf/MPCSA_GENERIC:318: ds1672rtc*: unknown device `ds1672rtc'

### ia64 GENERIC

/tmp/genassym.28085/assym.c: In function 'f111':
/tmp/genassym.28085/assym.c:67: error: invalid application of 'sizeof' to incomplete type 'struct pcb'
/tmp/genassym.28085/assym.c:76: error: dereferencing pointer to incomplete type

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
 1.14 30-May-2008  ad branches: 1.14.20; 1.14.26;
pci_intr_setattr(), allows PCI interrupts to be marked MPSAFE on x86, and
other platforms if the code is added.

pci_intr_map(...)
pci_intr_setattr(pc, ih, PCI_INTR_MPSAFE, 1);
pci_intr_establish(...)
 1.13 02-Jul-2006  jdc branches: 1.13.58; 1.13.60; 1.13.62; 1.13.64;
PCI device list and interrupt mapping for JavaStation Espresso.
Interrupt line values from Linux sparc sources.
 1.12 16-Nov-2005  uwe branches: 1.12.4; 1.12.8; 1.12.16;
Drop trailing whitespace.
 1.11 24-Sep-2005  macallan branches: 1.11.6;
Run the MicroSPARC IIep PCI bus without endianness translation.
This allows us to run X without any additional code changes.
 1.10 24-Sep-2005  uwe ANSI. KNF.
 1.9 17-Mar-2004  pk branches: 1.9.16;
Rename PROM_getprop*() => prom_getprop*().
 1.8 15-Jul-2003  lukem __KERNEL_RCSID()
 1.7 26-Feb-2003  pk branches: 1.7.2;
Move all `ID prom' stuff into the prom library.
 1.6 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.5 16-May-2002  uwe branches: 1.5.2;
Fix stupid typo in pci_decompose_tag().
 1.4 28-Mar-2002  uwe Move ms-IIep PCIC driver into mspcic0 at msiiep0. msiiep0 now serves
as a stub bus that knows how to attach drivers for various functions
of PCIC.

This change is a follow up to timer0 at msiiep0 change, since all
children must share same attach arguments and so we no longer can
attach pci0 directly under msiiep0.
 1.3 28-Mar-2002  pk `intterupt' => `interrupt'
 1.2 20-Dec-2001  uwe branches: 1.2.2; 1.2.4;
Define SPARC_PCI_DEBUG only if DEBUG is defined.
 1.1 11-Dec-2001  uwe microSPARC-IIep support.
 1.2.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 20-Dec-2001  thorpej file pci_machdep.c was added on branch kqueue on 2002-01-10 19:49:03 +0000
 1.2.2.5 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.1 20-Dec-2001  nathanw file pci_machdep.c was added on branch nathanw_sa on 2002-01-08 00:27:49 +0000
 1.5.2.2 16-May-2002  uwe Fix stupid typo in pci_decompose_tag().
 1.5.2.1 16-May-2002  uwe file pci_machdep.c was added on branch gehenna-devsw on 2002-05-16 01:33:54 +0000
 1.7.2.5 11-Dec-2005  christos Sync with head.
 1.7.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.16.2 30-Dec-2006  yamt sync with head.
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.11.6.1 22-Nov-2005  yamt sync with head.
 1.12.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.12.8.1 11-Aug-2006  yamt sync with head
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.64.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.13.62.1 04-May-2009  yamt sync with head.
 1.13.60.1 04-Jun-2008  yamt sync with head
 1.13.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.26.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.20.1 21-Apr-2011  rmind sync with head
 1.16.12.4 03-Dec-2017  jdolecek update from HEAD
 1.16.12.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.12.2 23-Jun-2013  tls resync from head
 1.16.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.16.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.2.1 30-Oct-2012  yamt sync with head
 1.18.4.1 18-May-2014  rmind sync with head
 1.20.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.378 10-Feb-2024  andvar s/alloted/allotted/ in comments.
 1.377 09-Apr-2022  riastradh sys: Use membar_release/acquire around reference drop.

This just goes through my recent reference count membar audit and
changes membar_exit to membar_release and membar_enter to
membar_acquire -- this should make everything cheaper on most CPUs
without hurting correctness, because membar_acquire is generally
cheaper than membar_enter.
 1.376 12-Mar-2022  riastradh sys: Membar audit around reference count releases.

If two threads are using an object that is freed when the reference
count goes to zero, we need to ensure that all memory operations
related to the object happen before freeing the object.

Using an atomic_dec_uint_nv(&refcnt) == 0 ensures that only one
thread takes responsibility for freeing, but it's not enough to
ensure that the other thread's memory operations happen before the
freeing.

Consider:

Thread A Thread B
obj->foo = 42; obj->baz = 73;
mumble(&obj->bar); grumble(&obj->quux);
/* membar_exit(); */ /* membar_exit(); */
atomic_dec -- not last atomic_dec -- last
/* membar_enter(); */
KASSERT(invariant(obj->foo,
obj->bar));
free_stuff(obj);

The memory barriers ensure that

obj->foo = 42;
mumble(&obj->bar);

in thread A happens before

KASSERT(invariant(obj->foo, obj->bar));
free_stuff(obj);

in thread B. Without them, this ordering is not guaranteed.

So in general it is necessary to do

membar_exit();
if (atomic_dec_uint_nv(&obj->refcnt) != 0)
return;
membar_enter();

to release a reference, for the `last one out hit the lights' style
of reference counting. (This is in contrast to the style where one
thread blocks new references and then waits under a lock for existing
ones to drain with a condvar -- no membar needed thanks to mutex(9).)

I searched for atomic_dec to find all these. Obviously we ought to
have a better abstraction for this because there's so much copypasta.
This is a stop-gap measure to fix actual bugs until we have that. It
would be nice if an abstraction could gracefully handle the different
styles of reference counting in use -- some years ago I drafted an
API for this, but making it cover everything got a little out of hand
(particularly with struct vnode::v_usecount) and I ended up setting
it aside to work on psref/localcount instead for better scalability.

I got bored of adding #ifdef __HAVE_ATOMIC_AS_MEMBAR everywhere, so I
only put it on things that look performance-critical on 5sec review.
We should really adopt membar_enter_preatomic/membar_exit_postatomic
or something (except they are applicable only to atomic r/m/w, not to
atomic_load/store_*, making the naming annoying) and get rid of all
the ifdefs.
 1.375 09-Aug-2021  andvar s/aligment/alignment/ + one more typo fix in comments.
 1.374 07-Aug-2021  uwe sp_tlb_flush - consistent whitespace in inline asm.
 1.373 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.372 17-Jan-2021  mrg convert most uses of pmapdebug to use the new DPRINTF() macro.

add PMAP_INITLOUD debug option, that shows how pmap_bootstrap()
eats up the space provided by /boot as spare space.
 1.371 13-Jan-2021  chs in pmap_writetext(), restore the context also when we return early.
 1.370 11-Jan-2021  chs in pgt_page_alloc(), wait and retry the page allocation if PR_WAITOK.
fixes PR 55895.
 1.369 09-Dec-2020  uwe Add "memory" constraint on wrpsr, lost in previous.
 1.368 09-Dec-2020  uwe sp_tlb_flush() - fix inline asm miscompiled by newer gcc versions.

As one national park director once said: "my problems start when the
dumber of my visitors meet the smarter of my bears".

Old inline asm used specific hardcoded registers "assuming that gcc
doesn't do anything funny with these". Unfortunately now it does,
especially when this function is inlined. We ended up restoring a
wrong context. The result was mysterious infinite memory faults.

Rewrite in safer inline asm, so that gcc is not confused.

Many thanks to chs@ for his patience.
 1.367 14-Mar-2020  ad branches: 1.367.4;
pmap_remove_all(): Return a boolean value to indicate the behaviour. If
true, all mappings have been removed, the pmap is totally cleared out, and
UVM can then avoid doing the work to call pmap_remove() for each map entry.
If false, either nothing has been done, or some helpful arch-specific voodoo
has taken place.
 1.366 13-Jan-2019  mrg switch sparc pmap lock to the scheme sparc64 uses:

- local IPL_NONE mutex for general pmap locking operations, not
kernel lock.
- for pmap_activate()/pmap_deactivate(), switch to using the
existing ctx_lock, and push handling of it into ctx_alloc() the
ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus. without
this patch i usually hang during boot. with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.
 1.365 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.364 08-Feb-2018  dholland branches: 1.364.2; 1.364.4;
Typos.
 1.363 06-Feb-2018  mrg workaround a problem -Warray-bounds triggers but isn't a problem
in practise, as described from this old commment:

/*
* Set up pm_regmap for kernel to point NUREG *below* the beginning
* of kernel regmap storage. Since the kernel only uses regions
* above NUREG, we save storage space and can index kernel and
* user regions in the same way.
*/
 1.362 16-Jan-2018  mrg implement cpuctl identify for sparc and sparc64.

sparc:
- move enum vactype and struct cacheinfo into cpu.h
- move the cache flags from cpuinfo.flags into CACHEINFO.c_flags
(this allows the new cache_printf_backend() to see them.)
remove unused CPUFLG_CACHEIOMMUTABLES and CPUFLG_CACHEDVMA.
- align xmpsg to 64 bytes
- move cache_print() into cache_print.h so it can be shared with
cpuctl. it only depends upon a working printf().
- if found, store the CPU node's "name" into cpu_longname. this
changes the default output to show the local CPU not the
generic CPU family. eg:
cpu0 at mainbus0: mid 8: Ross,RT625 @ 90 MHz, on-chip FPU
vs the generic "RT620/625" previously shown.
- for each CPU export these things:
- name
- fpuname
- mid
- cloc
- freq
- psr impl and version
- mmu impl, version, and number of contexts
- cacheinfo structure (which changed for the first time ever
with this commit.)

sparc64:
- add a minimal "cacheinfo" structure to export the i/d/e-cache
size and linesize.
- store %ver, cpu node "name" and cacheinfo in cpu_info.
- set cpu_info ver, name and cacheinfo in cpu_attach(), and
export them via sysctl, as well as CPU ID and clock freq

cpuctl:
- add identifycpu_bind() that returns false on !x86 as their
identify routines do not need to run on a particular CPU to
obtain its information, and use it to avoid trying to set
affinity when not needed.
- add sparc and sparc64 cpu identify support using the newly
exported values.
 1.361 22-Dec-2016  cherry branches: 1.361.8;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.
 1.360 11-Dec-2015  macallan branches: 1.360.2;
|| -> &&
From PR50534
 1.359 04-Oct-2015  joerg Use pointer computation for references outside an object.
 1.358 03-May-2014  nakayama branches: 1.358.2; 1.358.4; 1.358.6; 1.358.10;
Fix build w/o options SUN4_MMU3L.
 1.357 16-Dec-2013  mrg branches: 1.357.2;
apply __diagused where appropriate and remove useless variables
 1.356 13-Dec-2013  christos use CPU_INFO_ITERATOR instead of int.
 1.355 10-Dec-2013  macallan shut up an unused variable warning that shows up in UP kernels
 1.354 08-Dec-2013  jdc Use a double linked list with a static head to track MMU entries.
Code from martin@.
Tested on SUN4 (4/330), SUN4C (SS2), and SUN4M (Krups, 4/630).
 1.353 25-Nov-2013  christos replace circleq with tailq.
XXX: this adds a pointer per mmu entry; we can do better, but it would
require custom lists. Is it worth it?
 1.352 16-Nov-2013  mrg - convert CPU_INFO_ITERATOR in the !MP case to be __unused, and convert
all the iterators to use it
- print the right variables in nmi_hard_msiiep() (thanks set-but-unused)
- move variable inside usage #ifdef
- use (void) instead of a "volatile int" junk variable
- remove unused variables
 1.351 01-Nov-2013  mrg sprinkle some __diagused where appropriate.
 1.350 07-Jan-2013  chs branches: 1.350.2;
switch to __USE_TOPDOWN_VM.
 1.349 04-Nov-2012  chs in cpu_switchto(), remove the MP-unsafe code to mark a pmap active on a CPU,
pmap_activate() already does this. add MP locking to pmap_activate()
and pmap_deactivate(). move flushing of user windows and virtual caches
from pamp_activate() to pmap_deactivate().
 1.348 29-Jan-2012  para branches: 1.348.6;
fix sparc after kmem_map is gone
 1.347 22-Oct-2011  mrg branches: 1.347.2; 1.347.6;
add a comment to sp_tlb_flush() about fixing the asm() better.
 1.346 01-Sep-2011  martin In pmap_unwire() fix an obvious editor mishap - enable kernel preemption
before returning, not the other way around.
Might fix PR kern/45137.
 1.345 28-Aug-2011  mrg fix sparc UP kernels with GCC 4.5, with special thanks to help from
mlelstv@ tracking down the real issue.

sp_tlb_flush() makes various assumptions about the ABI and what GCC
will do with the rest of this function. the inputs were not referenced
by name but only as "%o0" etc inside the asm. the result was that GCC
was not filling in the function parameters before calling it because
they were not used in the function. so, sp_tlb_flush() was getting
random data for it's inputs. oops.

for now, convert 2 asm() calls to pure C, and mark the inputs for
the sta calls. this makes GCC generate the right code, but it still
isn't entirely optimal.

ideally a pure C version would exist, but that adds non-trivial
overhead (15 instructions vs 23 or so.)

one more enhancement to make here would be to assign the %o3, %o4 and
%o5 usage into explicit temp variables, instead of assuming that they
are going to be free to use.
 1.344 24-Aug-2011  mrg normalise #if defined(MULTIPROCESSOR) usage.
 1.343 18-Jun-2011  mrg remove some debugging output no longer necessary.
 1.342 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.341 15-Feb-2011  mrg branches: 1.341.2;
sprinkle some kpreempt_{dis,en}able() in various strategic points
we will need when we get to actually enabling kernel preemption.
 1.340 26-Apr-2010  martin branches: 1.340.2; 1.340.4;
Avoid using demap_lock early in pmap_bootstrap before it is initialized.
 1.339 20-Dec-2009  mrg branches: 1.339.2; 1.339.4;
fix the previous to compile !MULTIPROCESSOR.
 1.338 20-Dec-2009  mrg - add a diagnostic to ensure that cpus[0] == cpu0's cpu_info->ci_self
- if a cpu doesn't have any mappings allocated, don't copy them. this
occurs if a cpu isn't attached (such as a MP kernel with only "cpu0"
listed in the config file..)
 1.337 07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.336 30-Oct-2009  he Avoid unused variable warnings on Sun4c-only kernels.
Fix applied from PR#42249 -- thanks!
 1.335 21-Oct-2009  rmind 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.334 10-Sep-2009  tsutsui Make sure to initialize cpus[0] which will also be used as cpuinfo
for sun4 and sun4c, not only for sun4m. Okay'ed by mrg@.
 1.333 16-Aug-2009  skrll s/int/u_int/ for flags in pmap_enter and deal with this in rump.

Hi cegger.
 1.332 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.331 31-May-2009  mrg make sure to initialise the cpuinfo sz in all cases. noted by martin.
 1.330 31-May-2009  mrg - bump the size of cpus[] by one, so we have a NULL pointer at the end,
from tsutsui
- for MP kernels, copy the loop to find the bootcpu in mainbus_attach()
into getcacheinfo_obp() so we can get cache properties on the bootcpu
before calling main()
- in getcpuinfo(), move the call of getmid() before the call to
getcacheinfo() so that the above change to getcacheinfo_obp() can work
- move the struct cpu_info setup to the end of the initial kernel page
setup and don't access this space until after we have switched to the
kernel pagetables
- revive most of the old CPUINFO_VA alignment/congruency code from the
old alloc_cpuinfo_global_va() function, and ensure that all cpuinfo
structures are sanely aligned. this makes hypersparc work again
- introduce a new way to free the wasted pages back to UVM, as we can't
simply uvm_unmap() them this early in bootstrap


i believe that the first used cpuinfo_data page is still being wasted,
but i haven't checked.
 1.329 27-May-2009  mrg - use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now


with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a fwe commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.


tested in UP LOCKDEBUG/DEBUG/DIAGNOSTIC kernel as well.
MP kernel with only cpu0 configured panics starting /sbin/init.
have not yet tested on a real UP machine.
 1.328 18-May-2009  mrg fix a LOCKDEBUG problem from the previous: need to call pmap_kremove()
on a pre-existing mapping, before installing a new one.
 1.327 18-May-2009  mrg - retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)

we still waste one page of space, but this gets SMP much closer to
actually working again.
 1.326 18-Mar-2009  cegger bzero -> memset
 1.325 10-Mar-2009  martin Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:

Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.

The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.324 10-Dec-2008  pooka branches: 1.324.2;
Make kernel_pmap_ptr a const. Requested by steve_martin.
 1.323 09-Dec-2008  pooka Make pmap_kernel() a MI macro for struct pmap *kernel_pmap_ptr,
which is now the "API" provided by the pmap module. pmap_kernel()
remains as the syntactic sugar.

Bonus cosmetics round: move all the pmap_t pointer typedefs into
uvm_pmap.h.

Thanks to Greg Oster for providing cpu muscle for doing test builds.
 1.322 02-Jan-2008  ad branches: 1.322.6; 1.322.10; 1.322.16; 1.322.18; 1.322.20; 1.322.26;
Merge vmlocking2 to head.
 1.321 16-Nov-2007  martin branches: 1.321.2; 1.321.6;
Initialize curlwp early
 1.320 07-Nov-2007  ad Merge from vmlocking:

- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
 1.319 17-Oct-2007  garbled branches: 1.319.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.318 10-Oct-2007  ad branches: 1.318.2;
Comment out references to spinlockmgr().
 1.317 16-Jul-2007  macallan branches: 1.317.8; 1.317.10; 1.317.12;
turn pmap_phys_address() into a macro since all the function ever did was
to cast its parameter to paddr_t and return it
approved by mrg
 1.316 28-May-2007  mrg cpu_attach(): in the MP case, fix up idle lwp info as well as lwp0.l_cpu.
for LOCKDEBUG, mutex_destroy() the cpu0 spc_lwplock with the global
cpuinfo VA, and re-mutex_init() it with the per-cpu address that is only
now available. for non-boot cpus, be sure to also initialise curlwp to
the idle lwp.

xcall(), pmap_quiet_check(), pmap_pmap_pool_ctor(), pmap_pmap_pool_dtor(),
and pmap_enu4m(): don't care about cpus that have not been attached yet.
 1.315 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.314 12-Mar-2007  ad branches: 1.314.2; 1.314.8;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.313 04-Mar-2007  mrg branches: 1.313.2;
fix fall out from caddr_t changes.
 1.312 04-Mar-2007  macallan make compile again
 1.311 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.310 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.309 22-Feb-2007  matt More boolean_t -> bool fixes
 1.308 21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.307 24-Dec-2005  perry branches: 1.307.26;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.306 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.305 16-Nov-2005  uwe Use uint<N>_t. Drop trailing whitespace.
 1.304 14-Nov-2005  uwe Halfhearted attempt to make EXTREME_DEBUG code compile again.
It should probably be just g/c'ed.
 1.303 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.302 16-Jun-2005  briggs branches: 1.302.2; 1.302.8;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.301 04-Jun-2005  tsutsui Fix a shadowing variable.
 1.300 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.299 29-May-2005  chs in pmap_enter(), preset the mod/ref bits based on the flags argument.
fixes 25640.
 1.298 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.297 19-Jan-2005  chs branches: 1.297.2; 1.297.6;
make this build again without sun4/4c.
 1.296 16-Jan-2005  chs implement pmap_wired_count(). use more macros for determining MMU type.
 1.295 01-May-2004  pk branches: 1.295.4;
pmap_kremove4m,pmap_protect4m,pmap_extract4m: the `demap' lock needs interrupt
protection.
 1.294 27-Apr-2004  pk Add instrumentation for `PMEG' management on sun4/4c.
 1.293 22-Apr-2004  pk ctx_free: reset the context's page table pointers in each context table.
 1.292 22-Apr-2004  pk Fix logic botch in previous commit.
 1.291 22-Apr-2004  pk Mostly undo rev. 1.287: for modified pages a table walk must be forced on
the next write access to get the modified bit set in the PTE and that
won't happen if it hits the cache.
 1.290 19-Apr-2004  pk pmap_extract4m: We can read a spurious invalid pte if the system is in
the middle of the PTE update protocol. So, if at first we get an invalid
PTE, retry with the demap lock held.
 1.289 17-Apr-2004  pk Use a fast cross call for TLB flushes.
 1.288 12-Apr-2004  pk Drop the special sun4d `tlb flush' lock. The pte update function already
serialises access to the PTEs to reliably get ref/mod bits.

Rename pte4m_lock => demap_lock.
 1.287 12-Apr-2004  pk pv_syncflags4m: no need to flush the cache. If the page is still mapped,
its ref/mod status may change at any moment anyway. If a definitive status
is required the UVM code will unmap the page first.
 1.286 12-Apr-2004  pk Drop sparc_protection_init4m() in favour of a (ro) data initialiser.
 1.285 10-Apr-2004  pk pmap_copy_page4m(): we only need to flush the local cache since we use
private virtual addresses.
 1.284 10-Apr-2004  pk Remove a number of redundant TLB page flushed, which are now done in
setpgt4m_va() and updatepte4m() as necessary.
 1.283 10-Apr-2004  pk Remove a remnant instance of __P().
 1.282 10-Apr-2004  pk Group updatepte4m() and the MP & SP versions of setpgt4m_va() together,
which is just a bit more pleasing to the eyes.
 1.281 10-Apr-2004  pk Do not maintain the number of valid pages per segment (`sg_npte') anymore
for the kernel map on SRMMU machines. This allows pmap_kenter() and
pmap_kremove() to update mappings without needing to lock the pmap
or raising the interrupt level.
 1.280 10-Apr-2004  pk pmap_protect4m: skip PTE update for invalid pages in the specified range.
 1.279 10-Apr-2004  pk setpte4m: remove ineffective debug assertions.
 1.278 04-Apr-2004  pk * Allow pv_link4_4c() to fail with ENOMEM on pool allocation failures
(catching up with pv_link4m()).
* Fix return code checking for pv_link4m() calls.
* Add low water setting to pv pool.
 1.277 03-Apr-2004  pk Maintain pmap resident count as pages are mapped and unmapped instead
of traversing the page tables each time it's needed.
 1.276 13-Feb-2004  wiz branches: 1.276.2;
Uppercase CPU, plural is CPUs.
 1.275 13-Dec-2003  martin Don't touch the PROM VA on JavaStations. From Valeriy.
 1.274 28-Oct-2003  chs uninitialized variables.
 1.273 02-Oct-2003  hannken Make it compile (again) with DEBUG enabled. With SUN4 defined, segfixmask
was an u_long while whithout SUN4 it was an int.

Approved by: Paul Kranenburg <pk@netbsd.org>
 1.272 29-Aug-2003  pk Fix DEBUG code in me_alloc().
 1.271 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.270 24-Aug-2003  chs make sp_tlb_flush() work for profiling kernels:
when we're profiling, the compiler creates a stack frame for us,
so doing a "retl" isn't so good in that case.
 1.269 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.268 21-Aug-2003  pk sun4/sun4c DIAGNOSTIC: fix tally of locked down pmegs.
pmap_page_protect: DIAGNOSTIC: show `pg' argument in panic.
pmap_unwire: for now, only used for sun4/sun4c MMUs.
 1.267 16-Aug-2003  pk sun4/sun4c MMU: keep `wired' status per page, implemented by defining a bit
in the PTE word that is not used by the hardware. Use it to unlock a `pmeg'
if the wired count in a segment drops to zero.
 1.266 14-Aug-2003  hannken Fix a typo: sm->sg_npte -> sp->sg_npte
 1.265 12-Aug-2003  pk Extensive rewrite of the sun4/sun4c pmap code to allow non-wired kernel
mappings to use the pre-emptable pool of `PMEG' MMU resources.
 1.264 12-Aug-2003  pk Use pmap_remove_all() to flush the cache by context and set a flag to
avoid subsequent user space cache flushes by page or segment in pmap_remove().
 1.263 15-Jul-2003  lukem __KERNEL_RCSID()
 1.262 28-Jun-2003  pk branches: 1.262.2;
me_alloc()/region_alloc(): return the MMU cookie directly.
 1.261 28-Jun-2003  pk Simplify pmap_extract4_4c(), as suggested by Chuck Silvers in private
communication.
 1.260 28-Jun-2003  pk me_free(): it makes no sense to try and update the ref/mod PTE bits here.
 1.259 27-Jun-2003  pk Make sure to flush any user register windows when stealing PMEGs in
me_alloc() (and SMEGs in region_alloc()).

Should fix PR#14180.
 1.258 23-Jun-2003  pk sun4/sun4c: move/add write_user_windows() at the top of pmap_[k]remove() and
pmap_[k]enter().
 1.257 23-Jun-2003  pk According to my calculations, the cross-over point for the amount of work
needed to flush an entire segment from the sun4/sun4c caches is at 16 pages.
 1.256 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.255 18-Jun-2003  pk pmap_bootstrap4_4c():
* enable caching of message buffer & cpuinfo
* it ought to be no longer necessary to not write-protect the kernel
text in order to support KGDB
 1.254 18-Jun-2003  pk Remove out-dated MP comment.
 1.253 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.252 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.251 01-May-2003  pk Restore TLB flushes when removing level 2 & 3 page tables (these went missing
in revision 1.242).
 1.250 25-Mar-2003  pk pmap_kprotect: use supervisor permissions; don't bother checking for `no
change' case, it's not worth the effort.
 1.249 03-Mar-2003  pk Note a kernel pmap locking problem in pmap_kenter_pa4m().
 1.248 02-Mar-2003  pk pmap_changeprot() is not a UVM <-> PMAP interface function; make it internal.
Provide pmap_kprotect() for MD code to change protection on a range of
kernel addresses (cuurent users: intr.c and mkclock.c).
 1.247 27-Feb-2003  pk Free page table pages to the same VM map they were allocated from.
 1.246 26-Feb-2003  pk Store the physical memory descriptors on top of the kernel instead of
allocating a fixed sized array.
 1.245 24-Feb-2003  pk pv_unlink4m(): don't forget to link in a new PV entry after alias checking.
 1.244 21-Feb-2003  pk Remove the assumption in the sun4/sun4c bootstrap code that the kernel
is always mapped using PMEGs and SMEGs starting at #0.
 1.243 20-Feb-2003  pk Change locking prerequisites for the pv_changepte4m() helper function
to avoid locking recursion.
 1.242 19-Feb-2003  pk Finish PV table locking. Terminology and locking strategy stolen from
the alpha port.
 1.241 18-Feb-2003  pk pgt_page_alloc: use uvm_km_kmemalloc() so we can honor the PR_NOWAIT flag
pmap_kenter_pa4m: lock the pmap we're working on.
 1.240 18-Feb-2003  pk Move makememarr() into promlib.c.
 1.239 15-Feb-2003  pk Fix pasto in previous.
 1.238 15-Feb-2003  pk Redo part of rev. 1.237; the pages at KERNBASE might not be mapped when the
kernel has just been loaded.
 1.237 14-Feb-2003  pk It's not necessary to complicate the computation of `va2pa_offset': we already
assume that the few leading pages in front of the kernel image are
always present.

Adjust `va2pa_offset' on sun4 and sun4c as well, so that some day we can
have the bootstrap program load the kernel some place else.
 1.236 13-Feb-2003  pk Move the PV list header into the VM page vm_page_md structure.
Also, start using a spin lock to protect PV list operations.
 1.235 23-Jan-2003  pk pmap_kenter_pa4m: like pmap_enk4m(), we can use setpte4m().
ctx_free: fix cache flush context for sun4/sun4c.
 1.234 20-Jan-2003  pk pmap_enter4m: when installing a new PTE we don't need to invoke the elaborate
TLB de-map protocol. In the relatively infrequent case where this function
must update an existing mapping, do the de-map explicitly before installing
the new PTE value.
 1.233 20-Jan-2003  pk Replace some more VA2PA(<static_addr>) calls with PMAP_BOOTSTRAP_VA2PA()
 1.232 20-Jan-2003  pk De-couple some MULTIPROCESSOR and SUN4M/SUN4D dependencies.
 1.231 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.230 17-Jan-2003  pk pmap_deactivate(): only update the pmap's cpuset if need to.
 1.229 14-Jan-2003  pk (Re)initialise the pmap structure fields that are not preserved on the
pmap pool cache all in one place.
 1.228 12-Jan-2003  pk Use per-CPU virtual addresses for pmap_copy_page() & pmap_zero_page().
 1.227 12-Jan-2003  pk pmap_deactivate(): arguments for sp_tlb_flush() were reversed.
 1.226 11-Jan-2003  mrg keep track of which cpu's have run a pmap and only broadcast tlb flushes to
cpu's who have done so. implement pmap_deactivate() for MULTIPROCESSOR and
call it from cpu_switch() when we are about to switch proces and when we
enter idle().

with this change, i see significantly reduced tlb IPI traffic and fork/exec
bound processes -- such as "configure" -- run significantly faster, upto
15%. i also obvserved a small (0-2%) benefit to CPU bound tasks as well.
 1.225 08-Jan-2003  pk Remove write_user_windows() from a number of `4m' functions, since we don't
switch contexts with traps enabled anymore.
 1.224 08-Jan-2003  pk Make pv_uncache() and pv_cacheflush() static functions.
Split pv_cacheflush() in sun4/sun4c and sun4m/sun4d versions.
 1.223 06-Jan-2003  pk Fix SP tlb_flush_{ctx,all} macros.
 1.222 05-Jan-2003  pk Combine the various sun4m/sun4d TLB flush routines into a hand-coded
assembler version.
 1.221 05-Jan-2003  pk Print the cpu number in many pmapdebug-controlled debug traces.
 1.220 03-Jan-2003  mrg - remove some dead debug code
- don't cross call the smp_tlb_flush*() routines on SUN4D, just ensure
that there is only one concurrent flush happening.
 1.219 03-Jan-2003  pk Define a few XCALL? shorthand macros to avoid clutter.
 1.218 01-Jan-2003  pk pmap_alloc_cpu: use flags from boot cpu for now, as the passed cpu_info
structure has not been fully setup yet.
 1.217 31-Dec-2002  pk Pass the CPU context to all TLB flush routines. Because of this (and the
fact that cache flushes are also passed the context number), most
"long-term" context switches can be eliminated from the SRMMU versions
of the pmap functions.
 1.216 21-Dec-2002  pk tlb_flush_segment() and tlb_flush_region() now take a virtual address
argument instead of segment and region numbers.
 1.215 21-Dec-2002  pk Use xcall() to broadcast MMU TLB flushes.
 1.214 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.213 26-Nov-2002  pk * pmap_destroy(): reset the region gap
* pmap_quiet_check(): add check for pmeg leaks on sun4/4c (this is DEBUG only).
 1.212 08-Sep-2002  tsutsui Rename some auto variables which might cause misleadings.
 1.211 07-Sep-2002  tsutsui Call setcontext{4,4m}() directly when we already know the CPU type.
(inspired by OpenBSD)
 1.210 17-Jul-2002  thorpej Add SUN4D ifdef cases. Use CPU_HAS_SRMMU where appropriate.
 1.209 17-Jul-2002  thorpej Remote CPU_ISSUN4OR4C and CPU_ISSUN4COR4M, and instead express them
as (CPU_ISSUN4 || CPU_ISSUN4C) and (CPU_ISSUN4C || CPU_ISSUN4M),
respectively. The compiler can still optimize as desired by expressing
them this way, and it simplifies adding new tests.

While here, just remove CPU_ISSUN4MOR4U; it's not used by anything.
 1.208 02-Jun-2002  drochner move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling
 1.207 11-Apr-2002  pk branches: 1.207.2; 1.207.4;
pmap_kremove4_4c(): correctly compute the maximum number of pages to be
unmapped within a segment.
 1.206 08-Mar-2002  thorpej 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.205 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.204 04-Feb-2002  pk Rename `esym' to `kernel_top' and always initialize it in locore from
the information provided by the loader if possible (defaulting to `end').
If the DDB symbols aren't needed, `kernel_top' is adjusted in
autoconf:bootstrap() before calling pmap_bootstrap(). It will also
preserve the bootinfo data (if passed by the loader) for non-DDB kernels.
 1.203 25-Jan-2002  pk Remove out-dated comment on pager pages + some other comment nit-pickings.
 1.202 24-Jan-2002  pk pmap_kenter_pa4_4c(): set supervisor bit in PTE.
 1.201 15-Dec-2001  chs when counting PTEs, look at all the segments in a region, not just the first.
 1.200 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.199 24-Sep-2001  chs branches: 1.199.4;
use pmap_kenter_pa() instead of pmap_enter() in a few places.
 1.198 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.197 10-Jul-2001  mrg branches: 1.197.2;
use CPU_READY(). disable smp_tlb_flush_*() for now; they hang.
 1.196 08-Jul-2001  mrg branches: 1.196.2;
modify setpgt4m_va() to clean up (remove) several #ifdef MULTIPROCESSOR points.
catchup pmap_kenter_pa4m() and pmap_kremove4m() with SMP safe PTE updates.
 1.195 07-Jul-2001  mrg - implement XPMSG_DEMAP_TLB_PAGE, XPMSG_DEMAP_TLB_SEGMENT,
XPMSG_DEMAP_TLB_REGION, XPMSG_DEMAP_TLB_CONTEXT and XPMSG_DEMAP_TLB_ALL
- new setpgt4m_va(), call it when you need to ensure all cpus see the same value
- new smp_tlb_flush_context(), smp_tlb_flush_region(), smp_tlb_flush_segment(),
smp_tlb_flush_page() and smp_tlb_flush_all() functions, if MULTIPROCESSOR
- define the tlb_flush*() routines to the smp_*() versions, if MULTIPROCESSOR
- sun4m safe PTE update updatepte4m() routine, vaguely derived from code posted
by torek@bsdi.com on port-sparc a couple of years ago.
- new nmihard_lock to synchronize other cpus during hard NMI. (XXX: should be
a bit smarter about which CPU's do/don't check in.)
 1.194 05-Jul-2001  chs implement pmap_k{enter_pa,remove}() correctly.
other cleanup in preparation for upcoming UVM changes.
 1.193 03-Jun-2001  mrg finish moving context management back to being global. add a new ctx_lock
for context administration.
 1.192 26-May-2001  pk Pull in "opt_kgdb.h"; see PR#13036.
 1.191 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.190 23-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.189 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.188 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.187 17-Apr-2001  pk pmap_enter():
* turn ad-hoc `pmap resources allocated during sleep' into a panic condition
(this should all be prevented by higher level VM locking).
* arrange for ENOMEM to be returned if PMAP_CANFAIL is on, and malloc()
and/or pool_get() fail.
 1.186 26-Mar-2001  pk Use a pool cache for pmap allocation. The cached pmap structures include
a ready-to-use level 1 page table (on sun4m) and MMU context.
A simple `fork()' test shows an improvement in spent system time of
around 4 percent (which is just a bit disappointing, IMO, but it's
an improvement nonetheless).
 1.185 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.184 05-Mar-2001  pk branches: 1.184.2;
In debug printf: missing quote on format string.
 1.183 04-Mar-2001  pk Fix syntax error in previous.
 1.182 04-Mar-2001  pk Simplify `bad alias' handling in pv_link()/pv_unlink():

- there's no need to have different PV_NC flags for sun4[c] & sun4m

- deal with kvm_uncache() being called on a managed page in a
separate helper function that deals with the caching state
within the pv list for that page, avoiding interference with
the `bad alias' removals in pv_unlink().

Note that currently never called for managed pages, but for now I'm
keeping the support in.
 1.181 01-Mar-2001  pk Change `pv list' management to use the hooks provided in the `vm_physmem'
structure. While this comes with the cost of having to search the
`vm_physmem' array every time need to find a PV entry corresponing to
some physical address, we gain the flexibility needed to support
arbitrary non-contiguous ranges of physical memory addresses.

Also, eliminate the need to sort the memory address ranges as presented
by the machine's PROM, and the requirement that physical memory starts
at address 0 (when possible).
 1.180 16-Feb-2001  pk Remove check for encoded iospace/nocache bits within physical addresses
in places where they can't possibly occur as the PA is for a VM managed
page.
 1.179 13-Feb-2001  pk Hold off supplying the text/data gap to the VM manager; our pv table
handling isn't adequate yet.
 1.178 13-Feb-2001  pk pmap_page_upload(): check if `etext_gap' is there, just in case.
 1.177 12-Feb-2001  pk Recover the ~64KB gap in between the text/rodata & data segments that's being
generated by the linker in sparc/ELF images. The physical pages in this gap
are unmapped from the kernel and given to the VM manager.
 1.176 21-Jan-2001  christos fix bit rot so that MP kernel compiles s/cpu_no/ci_cpuid/
 1.175 14-Jan-2001  thorpej splpmap() -> splvm()
 1.174 09-Sep-2000  pk Revise pv_table_map(): to simplify calculations, pv_table[] now covers
all of physical memory, i.e. it conceptually is pv_table[0..avail_end].
The previous version could lead to an off-by-one error in the page allocation
for pv_table[] in some memory configurations.
 1.173 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.172 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.171 25-Jun-2000  mrg remove some redundant <vm/vm_xxx.h> includes
 1.170 20-Jun-2000  pk region_free: use correct index to invalidate a MMU region cookie in a pmap.
Remove work-around in pmap_enter(); the sun4/3-level MMU now works.
 1.169 19-Jun-2000  pk branches: 1.169.2;
Use `pv_pool' in non-wait mode; for now, panic if memory is exhausted.
 1.168 06-Jun-2000  pk Oops, type confusion..
 1.167 05-Jun-2000  pk Re-arrange code to flush physically indexed caches:

* replace `flush by line' function with a `flush by page' funtion, which
also takes an argument to indicate that write-back caches need not
validate its backing memory.

* use this function when allocating page table memory to flush the cache
before mapping it into kernel virtual space.

* also use it in pmap_{zero,copy}_page(), so we can safely use non-cacheable
access in there.
 1.166 02-Jun-2000  pk In pmap_cpu_alloc(), allocate memory for the PTE tables in one sweep.
 1.165 31-May-2000  pk Fix a couple of typos.
 1.164 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Fix a bug where all cpu_info structures except for the boot CPUs
would exist at both a CPU-local VA (CPUINFO_VA) and a gloal VA;
The boot CPU's existed only a CPUINFO_VA.
- Add a self-reference pointer to the cpu_info that references the
global address in the MULTIPROCESSOR case. Just allow it to reference
the `local' VA in the single-processor case, as CPUINFO_VA is global
enough when there's only one processor to care about. Change curcpu()
to return the global address.
 1.163 29-May-2000  pk Remove IOMMU page table allocation from pmap_bootstrap() and all the
hacks surrounding it.
 1.162 02-May-2000  pk branches: 1.162.2;
Simplify pmap_page_protect(); modelled after a similar change by
Art Grabowski in Openbsd.
 1.161 02-May-2000  pk Remove unused code: getptesw4m(),setptesw4m()
 1.160 01-May-2000  pk - De-inline VA2PA(); it isn't in any time-critical path. Saves a bunch of space.
- Disable special-cased viking cache flushing in setpgt4m(). This work-around
should no longer be necessary.
- Remove some misc. dead code.
 1.159 01-May-2000  pk Implement HyperSPARC specific pmap_{zero,copy}_page functions.
 1.158 30-Apr-2000  pk Implement MXCC versions for pmap_{zero,copy}_page().
 1.157 20-Apr-2000  pk ctx_alloc: set context before flushing a stolen context's cache
 1.156 17-Apr-2000  pk Make sure to reset the CPU context in ctx_free().
 1.155 28-Jan-2000  pk pv_unlink4m: correctly clear the PV_ANC flag. Noted by Artur Grabowski.
 1.154 17-Nov-1999  chs update a prototype for the new pmap_enter().
 1.153 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.152 04-Oct-1999  pk branches: 1.152.2; 1.152.4; 1.152.8;
Each process (i.e. each `pmap') needs a region table for each CPU.
Implement this by making the fields `pm_reg_ptp' and `pm_reg_ptp_pa'
pointers to an array of `ncpu' region table pointers and corresponding
physical addresses.

This is a somewhat unfortunate side effect of having the per-CPU data
addressable by the same virtual address on each CPU.
 1.151 12-Sep-1999  chs 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.150 10-Sep-1999  pk Fix printf format (see PR#8358).
 1.149 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.148 28-Jun-1999  pk mmu_pagein: refuse kernel space addresses here.
 1.147 17-Jun-1999  thorpej pmap_change_wiring() -> pmap_unwire().
 1.146 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.145 20-May-1999  pk If TLB entries need to be flushed, make sure to do this after any necessary
cache flushes, since on VIPT machines the cache flush may induce a TLB load.
 1.144 16-May-1999  pk Temporary work-around in pmap_enter on 4/400 machines: pre-allocate
MMU region cookies. This keeps the machine from crashing when running
in user mode.
TODO: fix the bugs then kill or alter this work-around.
 1.143 16-May-1999  pk Well, what do you know.. the TLB context flush has been coded with the
wrong `type' field all these years. Fix this and add a TLB region flush
as well. Also take care of a few inconsequential nits.
 1.142 25-Apr-1999  pk In pmap_{zero,copy}_page4m() use setpgt4m() to setup temporary address
mappings.
 1.141 26-Mar-1999  mycroft branches: 1.141.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.140 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.139 16-Mar-1999  chs in pmap_bootstrap4_4c(), remove any bogus mappings the PROM
left around in the mmu.
 1.138 12-Mar-1999  perry exterminate ovbcopy. patches provided by Erik Bertelsen, pr-7145
 1.137 14-Feb-1999  pk Use PROMLIB's prom_setcontext().
 1.136 14-Feb-1999  pk Use the PROMLIB interface.
 1.135 16-Jan-1999  chuck MNN is no longer optional, remove dead code
 1.134 11-Jan-1999  thorpej Use a pool for pmap structures.
 1.133 16-Oct-1998  pk branches: 1.133.2;
Drop cpuinfo's `L1_ptps'; instead keep a per CPU segment (level 2) page
table descriptor that is used to patch up a region (level 1) page table
associated with a user pmap at context switch time.
 1.132 08-Oct-1998  pk Move [gs]etcontext() and [gs]etpte() to pte.h
 1.131 06-Oct-1998  pk more DIAGNOSTIC sanity checks
 1.130 14-Sep-1998  pk Use `swap' to install page-table entries which is recommended practice
for MP configurarions.
 1.129 14-Sep-1998  pk Fix cache bit confusion in pmap_alloc_cpu().
 1.128 12-Sep-1998  pk Add missing bits to per-CPU MMU table allocator routine.
 1.127 07-Sep-1998  pk Adapt to cpuvar.h changes.
 1.126 01-Sep-1998  pk Hang on to `old VM' a little while longer..
 1.125 23-Aug-1998  pk Remove DVMA address special cases in pv_changebit().
 1.124 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.123 26-Jul-1998  pk Add a cpu-specific function to flush a pure virtually-indexed/virtually-tagged
cache, which needs to be flushed at context switch.
 1.122 25-Jul-1998  pk Allocate physical memory for the pv_table array in bootstrap(), so we
don't have to call VM functions from pmap_init().

Use a memory pool for additional pvlist entries (used for double mappings).

Take care of the cacheable bit on pagetables while we're initializing them,
instead of calling kvm_uncache() afterwards.
 1.121 23-Jul-1998  pk Drop private page table list maintenance; use memory pools instead.
 1.120 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.119 04-Jul-1998  jonathan defopt DDB.
 1.118 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.117 19-May-1998  pk Don't bzero() the IO page table; it is fully initialized in iommu_attach().
 1.116 19-May-1998  pk In kvm_uncache(), turn off the PTE cache bit even after calling
pv_changepte(). Reason: the managed() macro does not take into
account the gap in the managed pages range that may have been introduced
by the page table allocation in bootstrap().
 1.115 06-May-1998  pk Maintain far more complete state in the PV lists on the cacheability of pages,
using separate flag bits for mappings that were requested to be not
cacheable and uncacheable pages due to incongruent aliases.

This avoids inadvertently turning on the cache-enable bits when removing
one of multiple virtual address mappings to the same page. Reading
from /dev/mem could do this to arbitrary pages.
 1.114 21-Mar-1998  pk Remove incorrect address validity check in two `#if DEBUG' sections.
 1.113 14-Feb-1998  pk Think-o in pmap_extract4m(), detected by UVM.
 1.112 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.111 07-Feb-1998  chs fix typo in locking.
 1.110 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.109 17-Jan-1998  pk A small optimization.
 1.108 14-Jan-1998  pk Fix a border case when committing physical pages to the VM system;
rename some variables in the process for clarity.
 1.107 13-Jan-1998  pk Turn NEW_NONCONTIG page upload code into a routine shared by sun4/4c
and sun4m pmap_bootstrap()s, simplify it, and make it not loose the
couple of slack pages we painstakingly remembered in pmap_bootstrap.
 1.106 08-Jan-1998  thorpej Update a comment relative to the vm_bootstrap_steal_memory() change, and
don't include pmap_free_pages() or pmap_next_page() in the new non-contig
case.
 1.105 08-Jan-1998  mrg add new version of non contiguous memory code, written by chuck cranor,
called "MACHINE_NEW_NONCONGIG". this is required for UVM, the new VM
system (also written by chuck) that is coming soon. adds new functions:
vm_page_physload() -- tell the VM system about an area of memory.
vm_physseg_find() -- returns index in vm_physmem array that this
address is in.
and several new versions of old functions/macros defined in vm_page.h.


this is the sparc portion.
 1.104 02-Jan-1998  thorpej Implement pmap_activate().
 1.103 19-Nov-1997  pk The pgtalloc() stuff is still not doing the right thing on non-MXCC
vikings... i don't know why. Install a work-around in setpgt4m(),
that is still lying about here.
 1.102 01-Oct-1997  pk branches: 1.102.2;
Missing `#ifdef SUN4M' in pmap_release(); rearrange slightly to look
more natural.
 1.101 27-Sep-1997  pk * Optimize pmap_{zero,copy}_page4m() a bit by pre-computing the PTE addresses
of the reserved KVAs (vpage[]) used by these routines. This avoids the
context switching in there.

* In pmap_redzone(), remove the first kernel address (at KERNBASE) from
the kernel maps instead of just turning off the PTE `valid' bits.
The latter doesn't create a "red zone" at all, but causes the VM to
allocate a new page if the red zone is touched.
 1.100 26-Sep-1997  pk * Implement a private page table storage allocator for SRMMUs. It provides
uncached (if needed) chunks of memory of the two sizes (256 and 1024
bytes) that the SRMMU ever needs.

* Change pmap_changeprot4m() so that is does not rely setpte4m() because
setpte4m() cannot be used for anything other than VAs that are in the
pmap associated with the current context.
In the same vain, make sure that kvm_uncache() switches to context 0.
 1.99 25-Sep-1997  fair Make the #ifdef expression prior to the declaration and use of
"nptesg" match each other, per PR#4024.
 1.98 20-Sep-1997  pk Change crash dump layout a bit so the size of the `cpu_kcore' structure
does not depend on the value of KERNBASE.

Change pmap_dumpsize() to return disk block units, in stead of pages.
 1.97 18-Sep-1997  pk Fix a botch in reservemon4m() causing the `Alternate cacheability' not being
set on viking MXCC machines while using transparent memory access mode. This
becomes apparent when booting on multi-processor viking machines.

While I'm here, arrange to tempt fate a little less by using `AC' mode
for the shortest possible periods of time.

Special thanks to Matt Ragan for running my test kernels.
 1.96 14-Sep-1997  pk Refer to KERNBASE instead of its current numerical value in comments
and some early debugging code.
 1.95 31-Aug-1997  pk pmap_writetext(): use context 0.
 1.94 05-Aug-1997  pk Comment out body of pmap_copy() which got committed accidentally (btw. it
works, but its performance benefits are not immediately obvious).
 1.93 04-Aug-1997  pk Don't flush the cache in setpte4m(). Most callers have flushed the page
already and some MMUs might require a valid mapping to exist for the
virtual address to be flushed.
 1.92 04-Aug-1997  pk Move MMU dependent DDB goo into a pmap helper function.
 1.91 29-Jul-1997  fair branches: 1.91.2;
%x -> 0x%x
 1.90 16-Jul-1997  pk pmap_extract(): move printf()'s inside debugging brackets. The caller
decides what to do upon finding an absent mapping.
 1.89 09-Jul-1997  pk Use setpgt4m(), not bzero(), to initialize a pmap's first-level page table.

Fix a slightly misleading comment.
 1.88 08-Jul-1997  pk Fix a pasto in kvm_uncache() (sun4m)
Add TLB flushes when removing segments/regions.
Flush cache appropriately when cache-tag protection bits need invalidation.
 1.87 06-Jul-1997  pk Adjust for generic lock changes.
 1.86 06-Jul-1997  pk Slight optimization when pv_unlink'ing last entry (suggested by Eric Fair).
Use MR4() macro where appropriate.
 1.85 06-Jul-1997  pk Use setpgt4m() in setptesw4m().
 1.84 12-Jun-1997  pk Change `pv_va' entry to a `vm_offset_t' as suggested in PR#3703.
Also, re-arrange pmap_page_protect4_4c() like the 4m variant; add
a more detailed panic message.
 1.83 12-Jun-1997  pk Erase kernel PTEs in pmap_page_protect4m(). This bug would leave spurious
entries in the kernel address space, eventually leading to panics in
pv_unlink(). This takes care of PRs 3575 & 3703.
 1.82 24-May-1997  pk Use page type encoding macros from pmap.h
 1.81 15-May-1997  pk Change some malloc -> MALLOC and free -> FREE
More accuracy in diag/panic messages (part of PR3602; Eric Fair).
 1.80 11-Apr-1997  pk Avoid compiler warning.
 1.79 09-Apr-1997  pk Since all kernel regions are pre-allocated, we can safely copy kernel
mappings to a user pmap when it's created rather than at context
allocation time. Also, do not copy the kernel's region administration
to every user pmap, especially since no memory appears to be allocated
to copy it into.

As a result of this, we must now switch to context 0 in both pmap_copy_page()
and pmap_zero_page() (XXX).
 1.78 31-Mar-1997  pk Garbage-collect a few items.
 1.77 31-Mar-1997  pk Deal differently with physical memory gaps resulting from alignment
restrictions.
 1.76 25-Mar-1997  pk In pmap_remove(), check for an empty segment before calling one of the
helper functions. This cuts down the number of needless function calls
by approx. 80%, which has a healthy effect on the responsiveness of
a machine under heavy process creation/teardown loads.
The VM system seems to be fond of asking to delete page mappings
which aren't there..
 1.75 22-Mar-1997  pk For each major "module", define a separate set of MMU control register bits.
 1.74 21-Mar-1997  pk Thinko.
 1.73 21-Mar-1997  pk Use `setpgt4m()' in some more places.
 1.72 20-Mar-1997  pk Replace many setpte4m() calls with a simpler helper function because
the address of the desired PTE location is readily available in the
callers context (setpte4m() retraces the entire 3-level structure
to arrive at the PTE location).

Also, in many cases we can do away with the distinction between pmaps
that have or have not allocated a context. This is really only useful
in cases where we're interested in the REF or MOD bits which can differ
in the TLB version of a PTE. By doing this, we avoid getpte()'s which
in many cases instruct the MMU to start a table walk only to find out
that there's nothing there after going 2/3 of the way, or waste a TLB
entry because of TLB flushing soon after getpte() completes.

In addition, there's a hook to flush the cache line corresponding to
the (kernel virtual) location of a PTE entry when it gets altered.
 1.71 15-Mar-1997  pk Simplify `4m' versions of pmapbootstrap() and mmu_reservemon():
allocate and initialize all kernel page tables before looking at the
PROM maps, which allows mmu_reservemon4m() to simply walk the PROM tables
without having to allocate bits and pieces of our own kernel tables.

Slightly optimize getcontext() macros in mutli-arch kernels.

Remove un-needed `4m' version of mmu_pagein().
 1.70 14-Mar-1997  pk Add some instrumentation to keep track of PMEG allocation.
Enabled #if DIAGNOSTIC.
 1.69 10-Mar-1997  pk Use many things from the newly defined `cpuinfo' structure:
- vcache_flush_*() routines.
- cpu_type/cpu_flags
- per cpu context table and context administration glue.
- different macros to enable sun4/3-level mmu support.

Simplify sun4m version of pmap_bootstrap() a bit; more to do still.

Move installation of page tables in MMU into a separate routine, in
anticipation for SMP.
 1.68 22-Feb-1997  abrown Fix bug in pmap_page_copy and pmap_page_zero that caused data corruption
when paging on Sun4m machines with SuperSPARC processors. Essentially,
the copy/zero operations were done via uncached memory accesses, which
bypassed the snooping logic of the write-back caches, causing stale data
to be copied or generated.
Pointed out by Chris Torek <torek@bsdi.com>
 1.67 09-Nov-1996  pk branches: 1.67.6;
Adapt pmap_dumpsize() and pmap_dumpmmu() to new-style kernel crash
dumps according to the layout in <sys/kcore.h> and <machine/kcore.h>.
 1.66 13-Oct-1996  christos backout previous kprintf change
 1.65 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.64 11-Jun-1996  pk pmap_changeprot: truncate VA argument to page-boundary. Needed in case we
call cache_page_flush().
 1.63 30-May-1996  pk Some slight optimizations.
 1.62 29-May-1996  pk Fix two cases of handling stale page table information:
1. when reading the referenced/modified bits the TLB entry must be flushed
before reading the in-core version.
2. when wrapping up an entire segment in pmap_page_protect(), flush the PTPs
from the TLB to prevent a table-walking operation to pick up stale - or
possibly bogus - PTEs.

(hopefully I'll get a few of my hairs back now..)
 1.61 27-May-1996  pk mmu_pagein() is only useful on sun4/sun4c. For now, keep a `mmu_pagein4m()'
within `#ifdef DEBUG' for monitoring.

Push user windows to stack in pmap_extract() if we need to switch contexts.
 1.60 19-May-1996  pk branches: 1.60.4;
Remove obsolete HWTOSW/SWTOHW macros.
VA2PA: flush TLB before proceeding with L2 probe (per the manual) [4m].
More KNF.
 1.59 18-May-1996  mrg put promdev definition into <machine/bsd_openprom.h>.
 1.58 16-May-1996  pk Replace a couple of (*foo_p)()'s with direct calls. All instances occurred
within in functions that were already mmu-arch specific.

Some formatting nits.
 1.57 16-May-1996  abrown Implement a hack to give pmap a better chance of working on SS10's with
no external L2 cache.
XXX this is ugly and will go away when cpu_softc gets done for the 1.3 release

Also, copyright police (s/Harvard University/Harvard College/).
 1.56 01-Apr-1996  pk Late-breaking patch from Aaron.
 1.55 31-Mar-1996  pk Aaron's SRMMU/sun4m pmap implementation.

Note: multi-architecture kernels use function pointers for several PMAP
entry points.

Cut down the `#if defined(SUN4*)' mess severely by using CPU_ISSUN4*
macros (see machine/param.h) wherever possible.
 1.54 16-Mar-1996  christos fix printf format strings
 1.53 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.52 29-Feb-1996  pk Fix typo, and bring back VA hole handling.
 1.51 28-Feb-1996  gwr update PMAP_PREFER
 1.50 12-Feb-1996  christos make pmap_page_index return int instead of u_long
 1.49 11-Dec-1995  pk Prevent possible race condition in ctx_alloc().
Remove some bogus casts.
 1.48 05-Dec-1995  pk Make pmap_prefer() also return a preferred virtual address when there's no
associated physical page.
 1.47 05-Jul-1995  pk Commit to MACHINE_NONCONTIG.
 1.46 05-Jul-1995  pk Move dumpmmu() over here.
 1.45 08-May-1995  pk Refuse to map addresses in a MMU hole; the process will get a SEGV.
Changed mmu_pagein() interface.
Small nit in mmu_entry.
 1.44 19-Apr-1995  pk Avoid dereffing a fuzzy NULL-pointer.
 1.43 13-Apr-1995  pk 3-level MMU changes:
- maintain software MMU state in 3-tuples <region,segment,pagemap>
for all types of MMU.
- maintain hardware region maps (in `region' alternate address space)
for machines that have them (identified by variable `mmu_3l').
Use <sys/queue.h> for most lists.
 1.42 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.41 10-Apr-1995  mycroft vmempage --> vmmap, and remove incorrect comment.
 1.40 12-Mar-1995  pk Add a pmap_pa_exists() in the non MACHINE_NONCONTIG case too.
 1.39 10-Mar-1995  pk Missing #ifdef MACHINE_NONCONTIG.
Add function pmap_pa_exists() to assist /dev/mem.
 1.38 23-Feb-1995  pk Clean NONCONTIG stuff, allocate and map pv_table[] in pmap_init() entirely.
 1.37 22-Feb-1995  pk More on MACHINE_NONCONTIG: gain back wasted pages (and make it work).
Still more GC required.
 1.36 17-Feb-1995  pk More work on MACHINE_NONCONTIG stuff.
 1.35 17-Feb-1995  pk More PG_TYPE checks/optimizations suggested by Theo.
 1.34 10-Feb-1995  pk More fixes from Chuck for IO pages related bugs that surfaced with the 4/110.
Also, pay attention to PMAP_TNC bits that can enter from the VM. These
come from the `device' pager, ie. pages associated with mmap()ed devices.
 1.33 09-Feb-1995  pk Fix two typos.
 1.32 09-Feb-1995  pk Two more VAC_NONE checks.
 1.31 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.30 12-Jan-1995  pk Remove a debug messsage & add a missing constant.
 1.29 11-Jan-1995  pk Use `MACHINE_NONCONTIG' to deal with sparse memory in stead of private
mapping tables. We gain some pages, but there's still some wastage.
For the moment, `MACHINE_NONCONTIG' is still optional.
 1.28 10-Jan-1995  pk Count pages correctly in pmap_bootstrap().
 1.27 09-Jan-1995  mycroft Validate /dev/mem addresses again.
 1.26 09-Jan-1995  mycroft Reimplement /dev/mem like other ports. Change physlock to be a plain integer.
Keep the zero page after using it.
 1.25 14-Dec-1994  deraadt make BADALIAS() and CACHE_ALIAS_DIST sun4-safe
 1.24 10-Dec-1994  pk Introduce pmap_prefer() which is used to obtain a cache-friendly virtual
address.
 1.23 06-Dec-1994  deraadt place message buffer in low physical memory, so that it can survive a
warm boot. the sun4 boot program corrupts some memory there so adjust
upwards on the sun4. (from chuck)
 1.22 20-Nov-1994  deraadt copyright/Id cleanup
 1.21 14-Nov-1994  deraadt fixed rss code by charles
 1.20 02-Nov-1994  deraadt kill perftest code
 1.19 02-Oct-1994  deraadt sun4/300 support works
 1.18 20-Aug-1994  deraadt sun4/sun4c getsegmap/setsegmap are different
use << PGSHIFT instead of * NBPG, because NBPG isn't a constant in some cases
for sun4+sun4c case, calculate nptesg early
 1.17 09-Aug-1994  deraadt tiny error
 1.16 08-Aug-1994  pk Only use `doflush' when `perftest' is #defined, as was probably intended.
 1.15 06-Aug-1994  deraadt maintain resident_count and wired_count
 1.14 13-Jul-1994  pk Remove debugging code.
 1.13 10-Jun-1994  pk branches: 1.13.2;
Allocate pmap's segmap separately.
Keep some tags on segment boundaries to optimise ctx_alloc().
 1.12 31-May-1994  pk Move misplaced `#ifdef DEBUG'.
 1.11 30-May-1994  pk Restore context before leaving in pmap_protect() & pmap_changeprot().
 1.10 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.9 05-May-1994  deraadt use SUN4C, not sun4c, throughout
 1.8 20-Mar-1994  pk add comment that was lost on last commit
 1.7 20-Mar-1994  pk DDB support
 1.6 03-Mar-1994  pk undo last change; bug was already fixed
 1.5 03-Mar-1994  deraadt bug fix torek sent me ages ago
 1.4 04-Feb-1994  pk Bogus argument to `lda' instr. Apparently only tickled when ptracing.
 1.3 03-Feb-1994  deraadt PG_NC workaround from torek
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.13.2.2 24-Oct-1994  deraadt make the release run more than 10 minutes
 1.13.2.1 11-Aug-1994  mycroft update from trunk
 1.60.4.1 12-Jun-1996  pk Pull down from trunk:
>rev 1.64: pmap_changeprot: truncate VA argument to page-boundary ...
>rev 1.63: Some slight optimizations
>rev 1.62: Fix two cases of handling stale page table information ... [sun4m]
>rev 1.61: mmu_pagein() is only useful on sun4/sun4c ...
 1.67.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.91.2.6 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.91.2.5 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.91.2.4 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.91.2.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.91.2.2 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.91.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.102.2.1 20-Nov-1997  mellon Pull rev 1.103 up from trunk (pk)
 1.133.2.2 25-Feb-1999  chs fill in print_all_pmegs().
 1.133.2.1 09-Nov-1998  chs initial snapshot. lots left to do.
 1.141.2.4 04-Dec-1999  he Pull up revision 1.150 (requested by jdc):
Make this file compile under -DDEBUG, fixing PR#8358.
 1.141.2.3 02-Jul-1999  perry pullup 1.147->1.148 (pk)
 1.141.2.2 22-Jun-1999  perry pullup 1.142->1.145 (pk): support for hypersparc CPU modules
 1.141.2.1 26-Apr-1999  perry branches: 1.141.2.1.2; 1.141.2.1.4;
pullup 1.141->1.142 (pk): fix address mapping setup (PR7442)
 1.141.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.141.2.1.2.4 02-Aug-1999  thorpej Update from trunk.
 1.141.2.1.2.3 31-Jul-1999  chs remove some debugging code.
 1.141.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.141.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.152.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.152.4.1 15-Nov-1999  fvdl Sync with -current
 1.152.2.7 23-Apr-2001  bouyer Sync with HEAD.
 1.152.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.152.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.152.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.152.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.152.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.152.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.162.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.169.2.3 27-Dec-2001  he Pull up revision 1.201 (requested by chs):
When counting PTEs, look at all the segments in a region, not
just the first.
 1.169.2.2 12-Sep-2000  pk Pullup rev. 1.173->1.174 (approved by thorpej):

> revision 1.174
> date: 2000/09/09 10:24:34; author: pk; state: Exp; lines: +48 -34
> Revise pv_table_map(): to simplify calculations, pv_table[] now covers
> all of physical memory, i.e. it conceptually is pv_table[0..avail_end].
> The previous version could lead to an off-by-one error in the page allocation
> for pv_table[] in some memory configurations.
 1.169.2.1 24-Jun-2000  thorpej Pull up rev. 1.170 (pk):
region_free: use correct index to invalidate a MMU region cookie in a pmap.
Remove work-around in pmap_enter(); the sun4/3-level MMU now works.
 1.184.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.184.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.196.2.8 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.196.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.196.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.196.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.196.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.196.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.196.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.196.2.1 03-Aug-2001  lukem update to -current
 1.197.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.199.4.21 17-Jan-2003  pk Sync with HEAD.
 1.199.4.20 17-Jan-2003  pk pmap_deactivate() takes a thread pointer.
 1.199.4.19 15-Jan-2003  thorpej Sync with HEAD.
 1.199.4.18 08-Jan-2003  thorpej Sync with HEAD.
 1.199.4.17 06-Jan-2003  martin Catch up to -current.
 1.199.4.16 03-Jan-2003  thorpej Fix some merge errors.
 1.199.4.15 03-Jan-2003  thorpej Sync with HEAD (again).
 1.199.4.14 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.199.4.13 29-Dec-2002  thorpej Sync with HEAD.
 1.199.4.12 19-Dec-2002  thorpej Sync with HEAD.
 1.199.4.11 11-Dec-2002  thorpej Sync with HEAD.
 1.199.4.10 17-Sep-2002  nathanw Catch up to -current.
 1.199.4.9 01-Aug-2002  nathanw Catch up to -current.
 1.199.4.8 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.199.4.7 20-Jun-2002  nathanw Catch up to -current.
 1.199.4.6 17-Apr-2002  nathanw Catch up to -current.
 1.199.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.199.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.199.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.199.4.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.199.4.1 24-Sep-2001  pk file pmap.c was added on branch nathanw_sa on 2001-11-20 16:31:56 +0000
 1.207.4.1 16-Aug-2003  tron Pull up revision 1.259 via patch (requested by pk in ticket #1362):
Make sure to flush any user register windows when stealing PMEGs in
me_alloc() (and SMEGs in region_alloc()).
Should fix PR#14180.
 1.207.2.2 21-Jul-2002  gehenna catch up with -current.
 1.207.2.1 15-Jul-2002  gehenna catch up with -current.
 1.262.2.8 11-Dec-2005  christos Sync with head.
 1.262.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.262.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.262.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.262.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.262.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.262.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.262.2.1 03-Aug-2004  skrll Sync with HEAD
 1.276.2.4 08-Jun-2005  tron Pull up revision 1.299 (requested by chs in ticket #1980):
in pmap_enter(), preset the mod/ref bits based on the flags argument.
fixes 25640.
 1.276.2.3 29-Apr-2004  jmc branches: 1.276.2.3.2;
Pullup rev 1.294 (requested by pk in ticket #211)

Changes to fix and help diagnose MMU resource shortage on small sun4c systems
 1.276.2.2 24-Apr-2004  jdc Pull up revisions 1.279-1.293 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.276.2.1 08-Apr-2004  jdc Pull up revisions 1.277-1.278 (requested by pk in ticket #96)

Maintain pmap resident count as pages are mapped and unmapped instead
of traversing the page tables each time it's needed.

* Allow pv_link4_4c() to fail with ENOMEM on pool allocation failures
(catching up with pv_link4m()).
* Fix return code checking for pv_link4m() calls.
* Add low water setting to pv pool.
 1.276.2.3.2.1 08-Jun-2005  tron Pull up revision 1.299 (requested by chs in ticket #1980):
in pmap_enter(), preset the mod/ref bits based on the flags argument.
fixes 25640.
 1.295.4.1 29-Apr-2005  kent sync with -current
 1.297.6.1 06-Jun-2005  tron Pull up revision 1.299 (requested by chs in ticket #424):
in pmap_enter(), preset the mod/ref bits based on the flags argument.
fixes 25640.
 1.297.2.1 12-Feb-2005  yamt use new apis.
 1.302.8.1 22-Nov-2005  yamt sync with head.
 1.302.2.7 21-Jan-2008  yamt sync with head
 1.302.2.6 07-Dec-2007  yamt sync with head
 1.302.2.5 15-Nov-2007  yamt sync with head.
 1.302.2.4 27-Oct-2007  yamt sync with head.
 1.302.2.3 03-Sep-2007  yamt sync with head.
 1.302.2.2 26-Feb-2007  yamt sync with head.
 1.302.2.1 21-Jun-2006  yamt sync with head.
 1.307.26.4 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.307.26.3 24-Mar-2007  yamt sync with head.
 1.307.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.307.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.313.2.6 03-Dec-2007  ad Sync with HEAD.
 1.313.2.5 19-Oct-2007  ad Sync with head.
 1.313.2.4 20-Aug-2007  ad Sync with HEAD.
 1.313.2.3 09-Jun-2007  ad Sync with head.
 1.313.2.2 27-May-2007  ad Sync with head.
 1.313.2.1 13-Mar-2007  ad Sync with head.
 1.314.8.4 16-Oct-2007  garbled Sync with HEAD
 1.314.8.3 03-Oct-2007  garbled Sync with HEAD
 1.314.8.2 26-Jun-2007  garbled Sync with HEAD.
 1.314.8.1 22-May-2007  matt Update to HEAD.
 1.314.2.1 11-Jul-2007  mjf Sync with head.
 1.317.12.1 14-Oct-2007  yamt sync with head.
 1.317.10.3 09-Jan-2008  matt sync with HEAD
 1.317.10.2 08-Nov-2007  matt sync with -HEAD
 1.317.10.1 06-Nov-2007  matt sync with HEAD
 1.317.8.3 21-Nov-2007  joerg Sync with HEAD.
 1.317.8.2 11-Nov-2007  joerg Sync with HEAD.
 1.317.8.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.318.2.2 18-Nov-2007  bouyer Sync with HEAD
 1.318.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.319.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.319.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.321.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.321.2.1 01-Jan-2008  ad Locking changes for sparc.
 1.322.26.1 21-Apr-2010  matt sync to netbsd-5
 1.322.20.5 16-Feb-2011  bouyer Apply patch, requested my mrg in ticket 1553:
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/pmap.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
- print the curpcb in ddb "mach cpu" output as well.
- bump the size of cpus[] by one, so we have a NULL pointer at the end,
from tsutsui
- for MP kernels, copy the loop to find the bootcpu in mainbus_attach()
into getcacheinfo_obp() so we can get cache properties on the bootcpu
before calling main()
- in getcpuinfo(), move the call of getmid() before the call to
getcacheinfo() so that the above change to getcacheinfo_obp() can work
- move the struct cpu_info setup to the end of the initial kernel page
setup and don't access this space until after we have switched to the
kernel pagetables
- revive most of the old CPUINFO_VA alignment/congruency code from the
old alloc_cpuinfo_global_va() function, and ensure that all cpuinfo
structures are sanely aligned. this makes hypersparc work again
- introduce a new way to free the wasted pages back to UVM, as we can't
simply uvm_unmap() them this early in bootstrap
- make sure to initialise the cpuinfo sz in all cases. noted by martin.
- add per-cpu event counters for lev10 and lev14 interrupts.
- make CPU_INFO_FOREACH() set the iterator count to '0' in the !MP case.
- add some disabled MP code to poke other cpus on level 14 interrupts.
- add a diagnostic to ensure that cpus[0] == cpu0's cpu_info->ci_self
- if a cpu doesn't have any mappings allocated, don't copy them. this
occurs if a cpu isn't attached (such as a MP kernel with only "cpu0"
listed in the config file..)
- fix the previous to compile !MULTIPROCESSOR.
 1.322.20.4 28-Jan-2011  snj Pull up following revision(s) (requested by mrg in ticket #1532):
sys/arch/sparc/sparc/cpu.c: revision 1.215 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.78 via patch
sys/arch/sparc/sparc/genassym.cf: revision 1.57 via patch
sys/arch/sparc/sparc/intr.c: revision 1.103-1.105 via patch
sys/arch/sparc/sparc/locore.s: revision 1.247, 1.250 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.329 via patch

- print the cpu_number() when we get a strayintr().

- use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's "retval" parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now

with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again. i can run a few commands
but some of them cause hangs. "ps auxw" works, but "top -b" does not.

convert sparc "intrcnt" counters to evcnt(9) style. XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure && make, to see
if the additional load/store & arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits. amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement. ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?

XXX the current implementation depends on a couple of things:
XXX - ev_count member of evcnt{} is first and has offset 0
XXX - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it

- remove unused ft_want_ast()
- give nmi_sun* ENTRY() points so they show up in symbols properly
- add some disabled code to use this cpu's idlelwp area when hatching
a cpu, but right now it makes this worse not better...
 1.322.20.3 16-Jan-2011  bouyer Pull up following revision(s) (requested by mrg in ticket #1527):
sys/arch/sparc/sparc/pmap.c: revision 1.327, 1.328
sys/arch/sparc/sparc/cpuvar.h: revision 1.77
sys/arch/sparc/sparc/locore.s: revision 1.245
sys/arch/sparc/sparc/cpu.c: revision 1.214
sys/arch/sparc/sparc/db_interface.c: revision 1.84
- retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (? as implemented on
x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
we only need a %sp until we get to run an MI thread (own idlelwp or
real code)
we still waste one page of space, but this gets SMP much closer to
actually working again.
fix a LOCKDEBUG problem from the previous: need to call pmap_kremove()
on a pre-existing mapping, before installing a new one.
 1.322.20.2 15-Nov-2009  snj Pull up following revision(s) (requested by jdc in ticket #1138):
sys/arch/sparc/sparc/pmap.c: revision 1.336
Avoid unused variable warnings on Sun4c-only kernels.
Fix applied from PR#42249 -- thanks!
 1.322.20.1 30-May-2009  snj Pull up following revision(s) (requested by mrg in ticket #776):
sys/arch/sparc/sparc/autoconf.c: revision 1.233 via patch
sys/arch/sparc/sparc/cpu.c: revision 1.213 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.76 via patch
sys/arch/sparc/sparc/db_interface.c: revision 1.83 via patch
sys/arch/sparc/sparc/intr.c: revision 1.102 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.325 via patch
sys/arch/sparc/sparc/timer_sun4m.c: revision 1.17 via patch
Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:
Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.
The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.322.18.2 28-Apr-2009  skrll Sync with HEAD.
 1.322.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.322.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.322.10.6 11-Aug-2010  yamt sync with head.
 1.322.10.5 11-Mar-2010  yamt sync with head
 1.322.10.4 16-Sep-2009  yamt sync with head
 1.322.10.3 19-Aug-2009  yamt sync with head.
 1.322.10.2 20-Jun-2009  yamt sync with head
 1.322.10.1 04-May-2009  yamt sync with head.
 1.322.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.324.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.339.4.3 05-Mar-2011  rmind sync with head
 1.339.4.2 30-May-2010  rmind sync with head
 1.339.4.1 25-Apr-2010  rmind - Drop vmmap and its reserved page on hp700, sparc and x86.
- mm_init: use UVM_KMF_WAITVA when allocating a VA.
 1.339.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.340.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.340.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.341.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.347.6.1 18-Feb-2012  mrg merge to -current.
 1.347.2.4 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.347.2.3 23-Jan-2013  yamt sync with head
 1.347.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.347.2.1 17-Apr-2012  yamt sync with head
 1.348.6.4 03-Dec-2017  jdolecek update from HEAD
 1.348.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.348.6.2 25-Feb-2013  tls resync with head
 1.348.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.350.2.1 18-May-2014  rmind sync with head
 1.357.2.1 10-Aug-2014  tls Rebase.
 1.358.10.1 15-Jan-2019  martin Pull up following revision(s) (requested by mrg in ticket #1672):

sys/arch/sparc/sparc/pmap.c: revision 1.366

switch sparc pmap lock to the scheme sparc64 uses:
- - local IPL_NONE mutex for general pmap locking operations, not
kernel lock.
- - for pmap_activate()/pmap_deactivate(), switch to using the
existing ctx_lock, and push handling of it into ctx_alloc() the
ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus. without
this patch i usually hang during boot. with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.
 1.358.6.1 15-Jan-2019  martin Pull up following revision(s) (requested by mrg in ticket #1672):

sys/arch/sparc/sparc/pmap.c: revision 1.366

switch sparc pmap lock to the scheme sparc64 uses:
- - local IPL_NONE mutex for general pmap locking operations, not
kernel lock.
- - for pmap_activate()/pmap_deactivate(), switch to using the
existing ctx_lock, and push handling of it into ctx_alloc() the
ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus. without
this patch i usually hang during boot. with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.
 1.358.4.2 05-Feb-2017  skrll Sync with HEAD
 1.358.4.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.358.2.1 15-Jan-2019  martin Pull up following revision(s) (requested by mrg in ticket #1672):

sys/arch/sparc/sparc/pmap.c: revision 1.366

switch sparc pmap lock to the scheme sparc64 uses:
- - local IPL_NONE mutex for general pmap locking operations, not
kernel lock.
- - for pmap_activate()/pmap_deactivate(), switch to using the
existing ctx_lock, and push handling of it into ctx_alloc() the
ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus. without
this patch i usually hang during boot. with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.
 1.360.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.361.8.1 15-Jan-2019  martin Pull up following revision(s) (requested by mrg in ticket #1163):

sys/arch/sparc/sparc/pmap.c: revision 1.366

switch sparc pmap lock to the scheme sparc64 uses:
- - local IPL_NONE mutex for general pmap locking operations, not
kernel lock.
- - for pmap_activate()/pmap_deactivate(), switch to using the
existing ctx_lock, and push handling of it into ctx_alloc() the
ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus. without
this patch i usually hang during boot. with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.
 1.364.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.364.4.1 10-Jun-2019  christos Sync with HEAD
 1.364.2.2 18-Jan-2019  pgoyette Synch with HEAD
 1.364.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.367.4.2 03-Apr-2021  thorpej Sync with HEAD.
 1.367.4.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.21 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.20 11-May-2020  kamil branches: 1.20.2;
Reject setting unaligned Program Counter

Patch taken from OpenBSD.

Tested in qemu.

Fixes PR port-sparc/54734 by Andreas Gustafsson
 1.19 30-Dec-2016  christos branches: 1.19.20;
- allocate state if we did not have any in fpregs
- make fpstate explicitly start with fpregs for better type checking
- use c11 initializers
 1.18 04-Jan-2014  dsl branches: 1.18.6; 1.18.10;
Remove __HAVE_PROCESS_XFPREGS and add the extra parameter for the size
of the fp save area to all the process_read_fpregs() and
process_write_fpregs() functions.
None of the functions have been modified to use the new parameters.
The size is set for all the writes, but some of the arch-specific reads
just pass NULL.
The amd64 (and i386) need variable sized fp register save areas in order
to support AVX and other enhanced register areas.
These functions are rarely called - so the extra argument won't matter.
 1.17 21-Nov-2009  rmind branches: 1.17.12; 1.17.22; 1.17.26;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.16 16-May-2009  cegger KNF, same object code generated.
 1.15 18-Mar-2009  cegger bcopy -> memcpy
 1.14 04-Mar-2007  christos branches: 1.14.44; 1.14.52; 1.14.58;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 14-Nov-2005  uwe branches: 1.13.26;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.12 03-Jun-2005  martin branches: 1.12.2; 1.12.8;
Sprinkle some const
 1.11 01-Jun-2005  scw Declare the second arg of process_write_{fp,}regs() to be const.
This permits sh5 to continue to re-use those functions in cpu_setmcontext()
with the recent change to Makefile.kern.inc (revision 1.62).
 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 15-Jul-2003  lukem __KERNEL_RCSID()
 1.8 18-Jan-2003  thorpej branches: 1.8.2;
Merge the nathanw_sa branch.
 1.7 29-Dec-1999  pk branches: 1.7.12;
Make sure to reset the FP queue when loading new values into FP registers.
 1.6 14-Mar-1996  christos branches: 1.6.24; 1.6.30;
Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 15-Aug-1994  cgd changes for the new sys_process.c, and some cleanup
 1.3 29-Mar-1994  pk branches: 1.3.2;
protect psr bits
 1.2 11-Feb-1994  pk [GS]ETREG ptrace functions.
 1.1 01-Feb-1994  deraadt empty file for pk to add things to :-)
 1.3.2.1 15-Aug-1994  mycroft update from trunk
 1.6.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.6.24.1 08-Jan-2000  he Pull up revision 1.7 (requested by pk):
Prevent garbage from entering the data structure holding the FP
state of a process.
 1.7.12.2 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.7.12.1 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.8.2.5 11-Dec-2005  christos Sync with head.
 1.8.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.8.1 22-Nov-2005  yamt sync with head.
 1.12.2.2 03-Sep-2007  yamt sync with head.
 1.12.2.1 21-Jun-2006  yamt sync with head.
 1.13.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.14.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.14.44.3 11-Mar-2010  yamt sync with head
 1.14.44.2 20-Jun-2009  yamt sync with head
 1.14.44.1 04-May-2009  yamt sync with head.
 1.17.26.1 18-May-2014  rmind sync with head
 1.17.22.2 03-Dec-2017  jdolecek update from HEAD
 1.17.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.18.6.1 05-Feb-2017  skrll Sync with HEAD
 1.19.20.1 25-May-2020  martin Pull up following revision(s) (requested by kamil in ticket #926):

sys/arch/sparc/sparc/process_machdep.c: revision 1.20

Reject setting unaligned Program Counter

Patch taken from OpenBSD.

Tested in qemu.
Fixes PR port-sparc/54734 by Andreas Gustafsson
 1.20.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.5 05-Apr-2014  christos adjust to new signature; return consistent stuff. 0 is ok -1 is error
 1.4 11-Dec-2005  christos branches: 1.4.112; 1.4.122; 1.4.128;
merge ktrace-lwp.
 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:23:02 +0000
 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.4.128.1 18-May-2014  rmind sync with head
 1.4.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.112.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.53 04-Oct-2025  thorpej Add a platform device tree passthrough for device properties. First,
the device's properties dictionary is consulted, and if it doesn't have
what we're looking for, we go ask the platform device tree. The upshot
is that we can g/c (or not have to add) code that duplicates values from
the device tree into the properties dictionary (either in something like
device_register() or in a driver attachment front-end -- there are multiple
example of both in the system, currently), and everyone gets to use a
consistent interface (which will, over time, allow more code to de-duplicated).

Implement back-ends for ACPI, Sun OpenBoot, and OpenFirmware (including FDT).
 1.52 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.51 21-Jan-2022  thorpej Replace devhandle_invalidate(), which invalidates a devhandle, with
devhandle_invalid(), which returns an invalid devhandle.
 1.50 17-Sep-2021  thorpej Don't include <sys/device_calls.h> in the _STANDALONE case.
 1.49 15-Sep-2021  thorpej Adjust the device_call() calling convention so as to provide type checking
of the arguments passed to the call, using auto-generated argument
structures and binding macros.
 1.48 10-May-2021  thorpej sparc{,64} promlib -> devhandle_t glue
 1.47 24-Jan-2021  mrg branches: 1.47.4; 1.47.6;
avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.46 11-Sep-2017  palle branches: 1.46.16;
sun4v: Update code to retrieve CPU clock frequency so it can handle (future?) CPU clock frequencies above the 32-bit limit. ok mrg@
 1.45 01-Apr-2016  palle sun4v: Workaround for OpenBoot feature where a 64-bit address is truncated to a 32-bit address. This happends when a write to the console (/virtual-devices@100/console@1) is done. Avoid this by using a static buffer that is mapped below 4GB. Thanks to Tarl Neustaedter for explaining how OpenBoot works. ok martin@
 1.44 26-Mar-2014  christos branches: 1.44.6;
kill sprintf
 1.43 17-Jul-2011  joerg branches: 1.43.2; 1.43.12; 1.43.16;
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.42 21-Jan-2010  martin Split the part out of prom_getether() that deals with the local
firmware device node into a new function.
 1.41 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.40 20-May-2006  mrg branches: 1.40.60; 1.40.62; 1.40.64;
when casting to assign to a u_char pointer, use (u_char *) not (char *).
 1.39 24-Dec-2005  perry branches: 1.39.4; 1.39.6; 1.39.8; 1.39.12; 1.39.14;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.38 16-Nov-2005  uwe Use uint<N>_t.
 1.37 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.36 19-Jun-2005  thorpej branches: 1.36.2; 1.36.8;
Move common Sun ID PROM definitions into <dev/sun/idprom.h>.
 1.35 31-May-2005  christos - sprinkle const
- change to ansi prototypes
 1.34 23-Mar-2004  pk prom_pa_location: re-arrange code a bit; use u_long cast to make this compile on 64 bit systems; to do: openfirmware version of this.
 1.33 23-Mar-2004  martin The function prom_pa_location casts magic spells that probably won't
work on 64 bit kernels (and at least do not compile). Since this function
is not used there, #ifndef _LP64 it for now.
 1.32 22-Mar-2004  pk Leverage the PROM's ability to identify the on-board location of a
physical memory address.
 1.31 21-Mar-2004  pk opf_getboot{path,file,args}: return static storage so these can be used
in the early boot phase.

Define prom_interpret() to be a simple form of the Openfirmware OF_interpret().

Re-arrange OLDMON code in prom_getidprom() to make it compile on sparc64.
 1.30 18-Mar-2004  pk obp_v2_finddevice: bounds check on local char buffer.
prom_findnode: implement node name matching for device named containing
commas, cf. IEEE 1275, section 4.3.6.
 1.29 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.28 17-Mar-2004  pk De-__P();
 1.27 17-Mar-2004  pk prom_getprop(): Make the `element size' argument a size_t (like sparc64).
 1.26 16-Mar-2004  pk Encapsulate retrieval of properties from the global `options' prom node.
 1.25 15-Mar-2004  pk prom_getether: support the "local-mac-address" property on network nodes.
 1.24 15-Oct-2003  pk obp_v2_getbootfile: we might as well be complete by also considering the
PROM environment variables `diag-switch?' and `diag-file'.
 1.23 13-Oct-2003  pk obp_v2_getbootfile: use the value of the `boot-file' prom environment
variable if we determine that the boot arguments presented to us by the
PROM do not contain a boot file name.

Idea from Greg Woods on port-sparc@netbsd.org.
 1.22 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.21 10-Aug-2003  martin Remove unecessary intermediate (void*) casts.
 1.20 30-Jul-2003  mrg sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.19 15-Jul-2003  lukem __KERNEL_RCSID()
 1.18 28-Jun-2003  uwe branches: 1.18.2;
Trust srt0.S if it has set cputyp to CPU_SUN4M.
It can infer OFW -> sun4m, as only JavaStations have OFW, and it can
detect OFW by the different calling convention.
 1.17 01-Mar-2003  pk Add support for large kernels by searching for a physical memory segment
to fit it in. As a bonus, the kernel is now also mapped to the virtual
address (i.e. KERNBASE) it is linked at.
 1.16 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.15 26-Feb-2003  pk Re-define `struct memarr' to have the same layout as the V2 ROM memory
property to avoid gratuitous copying in prom_makememarr().

Have prom_makememarr() accept a NULL pointer, in which case it will return
the size of the array needed to store the memory descriptors.
 1.14 18-Feb-2003  pk Move makememarr() into promlib.c.
 1.13 07-Dec-2001  hannken Protect `opt_sparc_arch.h'. Used from /sys/arch/sparc/stand/boot.
 1.12 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.11 26-Sep-2001  eeh branches: 1.11.4;
getprop* -> PROM_getprop*
 1.10 02-Aug-2001  matt branches: 1.10.2;
Fix non-properly ifdef'ed SUN4 only code.
 1.9 26-Jun-2001  uwe branches: 1.9.2;
KNF: put parens around returned values.
 1.8 26-Jun-2001  uwe Some OpenFirmware client services return -1 on error, while the rest
of the code expects zero. Add some wrappers so that opf promops are
consistent with obp promops. Now microSPARC-IIep correctly panics ;)
While here, propagate 'static' to opf_* definitions.
 1.7 20-May-2001  uwe Implement notimplemented() for OpenFirmware.
Implement opf_nextprop().
Reuse obp_v2_putstr for OF promops.
 1.6 03-May-1999  pk branches: 1.6.12; 1.6.14;
Missing initialization of getbootfile() method for `old' monitors.
 1.5 16-Apr-1999  pk `oldmon' proms need `putstr()' too.
 1.4 14-Apr-1999  pk PROM likes to see CR-NL.
 1.3 02-Mar-1999  pk branches: 1.3.2;
Print version prettier.
 1.2 18-Feb-1999  christos make the #if 0'ed code compile...
 1.1 14-Feb-1999  pk Provide a uniform interface to most of the PROM functions.
Include an Openfirmware back-end (mostly copied from sparc64).
 1.3.2.3 03-May-1999  perry branches: 1.3.2.3.2;
pullup 1.5->1.6 (pk): critical problem that caused boot block failure
 1.3.2.2 17-Apr-1999  pk Pull up rev 1.5 from trunk
 1.3.2.1 14-Apr-1999  pk Pull up re 1.4 from trunk
 1.3.2.3.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.14.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.12.1 20-Mar-2002  he Pull up revision 1.10 (requested by jonb):
Wrap SUN4-only code by the proper ifdef.
 1.9.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 03-Aug-2001  lukem update to -current
 1.10.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.11.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.11.4.1 26-Sep-2001  nathanw file promlib.c was added on branch nathanw_sa on 2002-01-08 00:27:51 +0000
 1.18.2.5 11-Dec-2005  christos Sync with head.
 1.18.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.36.8.1 22-Nov-2005  yamt sync with head.
 1.36.2.1 21-Jun-2006  yamt sync with head.
 1.39.14.1 19-Jun-2006  chap Sync with head.
 1.39.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.39.8.1 24-May-2006  yamt sync with head.
 1.39.6.1 01-Jun-2006  kardel Sync with head.
 1.39.4.1 09-Sep-2006  rpaulo sync with head
 1.40.64.2 11-Mar-2010  yamt sync with head
 1.40.64.1 16-May-2008  yamt sync with head.
 1.40.62.1 18-May-2008  yamt sync with head.
 1.40.60.1 02-Jun-2008  mjf Sync with HEAD.
 1.43.16.1 18-May-2014  rmind sync with head
 1.43.12.2 03-Dec-2017  jdolecek update from HEAD
 1.43.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.44.6.1 22-Apr-2016  skrll Sync with HEAD
 1.46.16.1 03-Apr-2021  thorpej Sync with HEAD.
 1.47.6.1 31-May-2021  cjep sync with head
 1.47.4.1 13-May-2021  thorpej Sync with HEAD.
 1.2 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.1 08-Jun-2001  mrg branches: 1.1.2; 1.1.10; 1.1.38; 1.1.216;
split {sunos,svr4}_sigcode out for LKMs
 1.1.216.1 10-Jun-2019  christos Sync with HEAD
 1.1.38.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.10.2 08-Jun-2001  mrg split {sunos,svr4}_sigcode out for LKMs
 1.1.10.1 08-Jun-2001  mrg file sigcode_state.s was added on branch nathanw_sa on 2001-06-08 04:49:47 +0000
 1.1.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.2 30-Mar-1996  christos Don't need this anymore; it's data are moved to <machine/conf.h> and conf.c
 1.1 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.25 24-Apr-2025  riastradh sparc: Use STACK_ALIGNBYTES macro when aligning stack pointer.

Prompted by:

PR kern/59327: user stack pointer is not aligned properly
 1.24 06-Apr-2019  thorpej branches: 1.24.36;
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.23 21-Nov-2009  rmind branches: 1.23.64;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.22 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.21 24-Apr-2008  ad branches: 1.21.2; 1.21.4;
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.20 20-Dec-2007  dsl branches: 1.20.6; 1.20.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.19 04-Mar-2007  mrg branches: 1.19.20; 1.19.28; 1.19.32;
fix fall out from caddr_t changes.
 1.18 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 09-Feb-2007  ad branches: 1.17.2;
Merge newlock2 to head.
 1.16 14-Nov-2005  uwe branches: 1.16.20;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.15 14-Sep-2005  he branches: 1.15.6;
We need <compat/sys/signal.h> and <compat/sys/signalvar.h> here
for native_sigset13_to_sigset, sigset13_t, and sigvec.
The includes in sparc's machdep.c is conditional on COMPAT_13, as is
the use of native_sigset13_to_sigset.
 1.14 05-Oct-2003  pk branches: 1.14.16;
sparc kernel support for SA_SIGINFO.
 1.13 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.12 15-Jul-2003  lukem __KERNEL_RCSID()
 1.11 18-Jan-2003  thorpej branches: 1.11.2;
Merge the nathanw_sa branch.
 1.10 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.9 07-Jun-2001  mrg branches: 1.9.2; 1.9.8; 1.9.16;
make lkm friendly.
 1.8 22-Dec-2000  jdolecek branches: 1.8.2;
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.7 17-Sep-1998  thorpej branches: 1.7.12;
Sync w/ sendsig().
 1.6 13-Sep-1998  pk Signal handling changes: sunos compat gets its own sendsig(); sunos
sigreturn() == compat_13_sigreturn().
 1.5 10-Oct-1997  mrg remove advertising clause from all my licenses.
 1.4 05-Oct-1996  mrg branches: 1.4.10;
minor copyright update.
 1.3 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.2 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.1 08-May-1995  christos Added sunos_machdep.c [from Matthew Green]
 1.4.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.12.1 05-Jan-2001  bouyer Sync with HEAD
 1.8.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.9.16.1 17-Jul-2002  gehenna catch up with -current.
 1.9.8.6 01-Aug-2002  nathanw Catch up to -current.
 1.9.8.5 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.9.8.4 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.9.8.3 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.9.8.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.9.8.1 07-Jun-2001  pk file sunos_machdep.c was added on branch nathanw_sa on 2001-11-20 16:31:58 +0000
 1.9.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.2.5 11-Dec-2005  christos Sync with head.
 1.11.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.16.4 21-Jan-2008  yamt sync with head
 1.14.16.3 03-Sep-2007  yamt sync with head.
 1.14.16.2 26-Feb-2007  yamt sync with head.
 1.14.16.1 21-Jun-2006  yamt sync with head.
 1.15.6.1 22-Nov-2005  yamt sync with head.
 1.16.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.16.20.1 12-Jan-2007  ad sparc MD changes.
 1.17.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.28.1 26-Dec-2007  ad Sync with head.
 1.19.20.1 09-Jan-2008  matt sync with HEAD
 1.20.8.2 04-Jun-2008  yamt sync with head
 1.20.8.1 18-May-2008  yamt sync with head.
 1.20.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.4.4 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.21.4.3 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.21.4.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.21.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.21.2.2 11-Mar-2010  yamt sync with head
 1.21.2.1 04-May-2009  yamt sync with head.
 1.23.64.1 10-Jun-2019  christos Sync with HEAD
 1.24.36.1 02-Aug-2025  perseant Sync with HEAD
 1.1 08-Jun-2001  mrg branches: 1.1.2; 1.1.10;
split {sunos,svr4}_sigcode out for LKMs
 1.1.10.2 08-Jun-2001  mrg split {sunos,svr4}_sigcode out for LKMs
 1.1.10.1 08-Jun-2001  mrg file sunos_sigcode.s was added on branch nathanw_sa on 2001-06-08 04:49:47 +0000
 1.1.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.72 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.71 10-Dec-2009  matt branches: 1.71.62; 1.71.64;
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.70 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.69 16-May-2009  cegger KNF, same object code generated.
 1.68 18-Mar-2009  cegger bcopy -> memcpy
 1.67 19-Nov-2008  ad branches: 1.67.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.66 28-Apr-2008  martin branches: 1.66.2; 1.66.6; 1.66.8;
Remove clause 3 and 4 from TNF licenses
 1.65 24-Apr-2008  ad branches: 1.65.2;
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.64 22-Dec-2007  yamt branches: 1.64.6; 1.64.8;
use binuptime for l_stime/l_rtime.
 1.63 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.62 17-Oct-2007  garbled branches: 1.62.4; 1.62.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.61 08-Oct-2007  ad Merge run time accounting changes from the vmlocking branch. These make
the LWP "start time" per-thread instead of per-CPU.
 1.60 04-Mar-2007  macallan branches: 1.60.2; 1.60.10; 1.60.18; 1.60.20; 1.60.22;
make this compile again
 1.59 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.58 09-Feb-2007  ad branches: 1.58.2;
Merge newlock2 to head.
 1.57 07-Jun-2006  kardel branches: 1.57.6;
convert to timecounters (from branch simonb-timecounters)
 1.56 14-Nov-2005  uwe branches: 1.56.2; 1.56.6; 1.56.8; 1.56.10; 1.56.16;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.55 12-Mar-2005  dsl branches: 1.55.4;
Fix convertion of seconds to nanoseconds.
Add the usec to the secs before subtracting the usec offset - otherwise
I suspect the value can do horribly wrong!
Change all T_SVR4_GETHRESTIME to return sec + nanoseconds (I've not sure
this is correct, but I doubt the 32bit emulation in a 64bit kernel should
act differently to a 32bit kernel!)
Untested - I don't even have a sparc compile setup at the moment.
 1.54 22-Mar-2004  nakayama branches: 1.54.8; 1.54.10;
Truncate values to 32-bit, not 40-bit.
 1.53 05-Oct-2003  pk sparc kernel support for SA_SIGINFO.
 1.52 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.51 10-Aug-2003  martin Replace strict-alias bug prone pointer magic with (IMHO clearer)
shift/mask arithmetic.
 1.50 10-Aug-2003  martin Remove unecessary intermediate (void*) casts.
 1.49 30-Jul-2003  mrg sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.48 15-Jul-2003  lukem __KERNEL_RCSID()
 1.47 18-Jan-2003  thorpej branches: 1.47.2;
Merge the nathanw_sa branch.
 1.46 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.45 31-May-2002  thorpej Remove redundant (and incorrect) extern decl.
 1.44 31-Mar-2002  christos branches: 1.44.2;
compat signal array renaming.
 1.43 30-May-2001  mrg branches: 1.43.2; 1.43.8;
use _KERNEL_OPT
 1.42 27-May-2001  pk !_LKM inclusion protection for opt_kgdb.h
 1.41 26-May-2001  pk Pull in "opt_kgdb.h"; see PR#13036.
 1.40 22-Dec-2000  jdolecek branches: 1.40.2;
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.39 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.38 12-Apr-2000  christos make this compile with -DDEBUG_SVR4 [wrong variable name]
 1.37 09-Apr-2000  christos Disable previous; it makes things worse.
 1.36 09-Apr-2000  christos Try to emulate the svr4 setpsr trap. Needed by lwp.
 1.35 12-Nov-1999  kleink Bring high-resolution time interfaces closer to SVR4:
* Change gethrtime() to use mono_time.
* gethrvtime() is defined to return the lwp/process's virtual time;
use p_rtime augmented with the current runtime.

Reviewed by: christos
 1.34 08-Sep-1999  sommerfeld branches: 1.34.2; 1.34.4; 1.34.8;
add svr4_lwp.h to let this build again.
 1.33 21-Jan-1999  christos move the machine independent portion out of the context functions.
 1.32 17-Dec-1998  kleink T_SVR4_GETHRESTIME returns a nanosecond quantity in %o1.
 1.31 15-Dec-1998  christos 1000000000 nsec != 2^31 nsec (from kleink)
 1.30 13-Sep-1998  pk Sync function prototypes; remove unsed variables.
 1.29 11-Sep-1998  mycroft Update for signal handling changes.
 1.28 05-Sep-1998  christos Assign copyright to TNF.
 1.27 07-May-1998  kleink Fix some arithmetics lossage on typeless pointers.
 1.26 24-Jan-1998  mycroft Add a svr4_setregs() (that just calls setregs() right now).
 1.25 16-Oct-1997  mycroft branches: 1.25.2;
Fix up includes.
 1.24 29-Jul-1997  fair branches: 1.24.4;
missed %lx -> 0x%lx
 1.23 29-Jul-1997  fair %x -> 0x%x
 1.22 06-Jul-1997  christos Fix printf formats.
 1.21 30-Mar-1997  christos Comment out DIAGNOSTIC panic in trap code translation. The DIAGNOSTIC is
correct, but unfortunately in trap.c trapsignal(p, SIGSEGV, code) passes
the address of the fault in code, instead of the trap code. So we punt for
now doing checking for trap code validity until this gets fixed.
 1.20 13-Oct-1996  christos backout previous kprintf change
 1.19 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.18 05-Jun-1996  christos Handle T_RESET, otherwise DIAGNOSTIC kernels panic.
 1.17 31-Mar-1996  pk branches: 1.17.4;
Various cleanup; mostly trailing spaces/tabs.
 1.16 26-Mar-1996  christos - add the GETHRTIME and GETHRVTIME traps. Do the best we can for them.
- getcontext() fills the stack_t portion of the context with an 8k size
stack, 0 flags, and below our current stack pointer. I am not sure where
to set the pointer. Thanks pk [2-2] for noticing that.

Now netscape and java work...
 1.15 16-Mar-1996  christos fix printf format strings
 1.14 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.13 07-Jan-1996  christos Fix setcontext call and sendsig
 1.12 04-Jan-1996  jtc Changed name of sigaltstack's ss_base field to ss_sp to match XPG4.2 and
traditional usage.
 1.11 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.10 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.9 01-Sep-1995  mycroft SA_ONSTACK --> SS_ONSTACK
 1.8 14-Aug-1995  mycroft Rename two functions.
 1.7 14-Aug-1995  mycroft Export bsd_to_svr4_sig[], and use it.
 1.6 14-Aug-1995  mycroft svr4_stack_t --> svr4_sigaltstack
 1.5 05-Jul-1995  pk make this compile better....
 1.4 04-Jul-1995  christos trap.c: Add svr4 software traps. Fix bug in errno mapping.
svr4_machdep.c: Add siginfo translation (from mrg), add some software traps.
 1.3 04-Jul-1995  pk make this compile better.
 1.2 01-Jul-1995  christos svr4_machdep.c: Fix {get,set}context and sendsig.
locore.s: add signal trampoline code for svr4. There is a lot of code
duplication there. Maybe we should share the code?
SVR4 status now:
/bin/sh: works
/bin/ls: works
/bin/sleep: works
/bin/csh: gives unknown software trap 0xa7
/bin/ldd: works
 1.1 31-Mar-1995  christos Moved KGDB trap 0x88 to 0x8a, and made 0x88 to be svr4 syscall [this is what
solaris uses]. Stubs for the missing and currently unused signal functions
stolen from the i386 code.
 1.17.4.1 11-Jun-1996  jtc Pulled up from trunk by request from christos
 1.24.4.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.25.2.1 29-Jan-1998  mellon Pull up 1.26 (mycroft)
 1.34.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.34.4.1 15-Nov-1999  fvdl Sync with -current
 1.34.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.34.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.40.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.43.8.9 01-Aug-2002  nathanw Catch up to -current.
 1.43.8.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.43.8.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.43.8.6 21-Jun-2002  gmcgarry Pull in appropriate headers; LWPify some more
 1.43.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.43.8.4 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.43.8.3 17-Apr-2002  nathanw Catch up to -current.
 1.43.8.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.43.8.1 30-May-2001  pk file svr4_machdep.c was added on branch nathanw_sa on 2001-11-20 16:31:58 +0000
 1.43.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.43.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.44.2.2 17-Jul-2002  gehenna catch up with -current.
 1.44.2.1 15-Jul-2002  gehenna catch up with -current.
 1.47.2.5 11-Dec-2005  christos Sync with head.
 1.47.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.54.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.54.8.1 29-Apr-2005  kent sync with -current
 1.55.4.5 21-Jan-2008  yamt sync with head
 1.55.4.4 27-Oct-2007  yamt sync with head.
 1.55.4.3 03-Sep-2007  yamt sync with head.
 1.55.4.2 26-Feb-2007  yamt sync with head.
 1.55.4.1 21-Jun-2006  yamt sync with head.
 1.56.16.1 19-Jun-2006  chap Sync with head.
 1.56.10.1 26-Jun-2006  yamt sync with head.
 1.56.8.1 27-May-2006  kardel convert to timecounters
 1.56.6.1 09-Sep-2006  rpaulo sync with head
 1.56.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.56.2.1 14-Nov-2005  uwe file svr4_machdep.c was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 1.57.6.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.57.6.1 12-Jan-2007  ad sparc MD changes.
 1.58.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.60.22.1 14-Oct-2007  yamt sync with head.
 1.60.20.2 09-Jan-2008  matt sync with HEAD
 1.60.20.1 06-Nov-2007  matt sync with HEAD
 1.60.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.60.10.1 16-Oct-2007  garbled Sync with HEAD
 1.60.2.1 09-Oct-2007  ad Sync with head.
 1.62.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.62.4.1 26-Dec-2007  ad Sync with head.
 1.64.8.1 18-May-2008  yamt sync with head.
 1.64.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.64.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.65.2.4 11-Mar-2010  yamt sync with head
 1.65.2.3 20-Jun-2009  yamt sync with head
 1.65.2.2 04-May-2009  yamt sync with head.
 1.65.2.1 16-May-2008  yamt sync with head.
 1.66.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.66.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.66.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.66.2.3 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.66.2.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.66.2.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.67.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.71.64.1 10-Jun-2019  christos Sync with HEAD
 1.71.62.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.2 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.1 08-Jun-2001  mrg branches: 1.1.2; 1.1.10; 1.1.38; 1.1.216;
split {sunos,svr4}_sigcode out for LKMs
 1.1.216.1 10-Jun-2019  christos Sync with HEAD
 1.1.38.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.10.2 08-Jun-2001  mrg split {sunos,svr4}_sigcode out for LKMs
 1.1.10.1 08-Jun-2001  mrg file svr4_sigcode.s was added on branch nathanw_sa on 2001-06-08 04:49:47 +0000
 1.1.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.9 31-Jan-1997  thorpej This file is obsolete; this information is now generated by config(8).
 1.8 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.7 16-Feb-1995  pk Working "config generic" support; from Theo.
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 26-Jul-1994  deraadt i was sure i did this before
 1.4 01-Feb-1994  deraadt branches: 1.4.2;
sparc runs in current today
 1.3 16-Oct-1993  deraadt mountroot is defined in vfs_conf.c
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.2.1 26-Jul-1994  cgd from trunk.
 1.16 20-Dec-2007  dsl branches: 1.16.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.15 09-Feb-2007  ad branches: 1.15.24; 1.15.32; 1.15.36;
Merge newlock2 to head.
 1.14 14-Nov-2005  uwe branches: 1.14.20;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.13 07-Aug-2003  agc branches: 1.13.16; 1.13.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.12 15-Jul-2003  lukem __KERNEL_RCSID()
 1.11 18-Jan-2003  thorpej branches: 1.11.2;
Merge the nathanw_sa branch.
 1.10 13-Dec-2000  jdolecek branches: 1.10.8;
g/c obsolete vtrace(2) stuff
 1.9 19-Jan-1999  thorpej branches: 1.9.8;
No need for <sys/mtio.h>
 1.8 25-Feb-1998  perry note second parm of sysarch() is now void *, + trivial KNF, etc.
 1.7 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.6 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.5 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 20-Oct-1994  cgd update for new syscall args description mechanism
 1.2 13-Oct-1993  deraadt move sysarch() to sys_machdep.c
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.9.8.1 05-Jan-2001  bouyer Sync with HEAD
 1.10.8.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.10.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.10.8.1 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.11.2.4 11-Dec-2005  christos 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.13.24.1 22-Nov-2005  yamt sync with head.
 1.13.16.3 21-Jan-2008  yamt sync with head
 1.13.16.2 26-Feb-2007  yamt sync with head.
 1.13.16.1 21-Jun-2006  yamt sync with head.
 1.14.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.36.1 02-Jan-2008  bouyer Sync with HEAD
 1.15.32.1 26-Dec-2007  ad Sync with head.
 1.15.24.1 09-Jan-2008  matt sync with HEAD
 1.16.12.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.16.12.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.33 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.32 20-Mar-2023  hannken Adjust pc/npc before syscall allowing EJUSTRETURN to return
to the next instruction. Only ERESTART should return to
the same instruction. Differences to sparc64 reduced.

Test t_ptrace_wait:syscallemu1 now passes on sparc.

Fixes PR kern/52166 "syscallemu does not work on sparc (32-bit)"

Ok: Martin Husemann
 1.31 06-Apr-2019  kamil branches: 1.31.30;
Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.
 1.30 03-Apr-2019  kamil Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.
 1.29 04-Oct-2015  joerg branches: 1.29.18;
Unsigned values can not be negative.
 1.28 26-Jun-2013  matt branches: 1.28.10;
Use sy_invoke.
Collapse syscall_fancy and syscall_plain into syscall.
Use p_trace_enabled.
 1.27 19-Feb-2012  rmind branches: 1.27.2;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.26 11-Feb-2012  martin Add a posix_spawn syscall, as discussed on tech-kern.
Based on the summer of code project by Charles Zhang, heavily reworked
later by me - all bugs are likely mine.
Ok: core, releng.
 1.25 27-Mar-2011  martin branches: 1.25.4; 1.25.8;
On second thought do not use bit 13 as a flag for syscall numbers, userland
typically sets those from a 13bit signed integer immediate field in the
instruction, so would need to jump through hoops (ok, small hoops) to
avoid sign extension.
Use a combination of the existing syscall flags instead.
 1.24 23-Mar-2011  martin Add a syscall variant passing the return address in %g5 (we need %g7 for
pthread_self and %g2 is an application register, so we can not use those
anymore).
 1.23 20-Dec-2010  matt branches: 1.23.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.22 25-Feb-2010  skrll branches: 1.22.2;
s/cpu_fork/cpu_lwp_fork/ in comment
 1.21 21-Oct-2008  ad branches: 1.21.14;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.
 1.20 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.19 16-Jun-2008  ad branches: 1.19.2;
PPWAIT is now in proc::p_lflag.
 1.18 24-Apr-2008  ad branches: 1.18.2; 1.18.4; 1.18.6;
- Retire SYCALL_MPSAFE. With the exceptions of darwin and irix emulations,
all system calls are now MPSAFE.
- Remove unneeded acquire/release of kernel_lock.
 1.17 06-Feb-2008  dsl branches: 1.17.6; 1.17.8;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53
 1.16 05-Jan-2008  dsl Don't pass 'curlwp' into trace_enter() and trace_exit().
 1.15 17-Oct-2007  garbled branches: 1.15.2; 1.15.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.14 15-Aug-2007  ad branches: 1.14.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.13 09-Feb-2007  ad branches: 1.13.6; 1.13.14; 1.13.18; 1.13.22;
Merge newlock2 to head.
 1.12 19-Jul-2006  ad branches: 1.12.4;
- 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.11 29-Jun-2006  martin Style nits from Christos.
 1.10 29-Jun-2006  martin The arguments to syscalls (struct args) need 64 bit alignment for some
syscalls (like mmap), and the same is true for return values (lseek).
Make both structs a union to force alignment. Thanks to uwe for helping
analyze this!
While there move the non syscall-related functions out of this file
(back to trap.c).

This makes kernels compiled with gcc4 and -Os work.
 1.9 07-Mar-2006  thorpej branches: 1.9.2; 1.9.8; 1.9.10;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
 1.8 07-Mar-2006  thorpej Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.7 05-Mar-2006  christos Add a proc_is_traced_p() macro and use it, instead of copying the same code
in many places. Idea from thorpej.
 1.6 05-Mar-2006  christos branches: 1.6.2;
implement PT_SYSCALL
 1.5 24-Dec-2005  perry branches: 1.5.4; 1.5.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 16-Oct-2005  uwe branches: 1.3.6;
Trim trailing whitespace.
 1.2 10-Jul-2005  christos pass the code out of getargs, so that ktracing __syscall using syscalls
works.
 1.1 10-Jul-2005  christos - add syscall_{plain,fancy}
- make it use mi_userret
 1.3.6.3 12-Nov-2005  skrll ktrsysret takes an lwp pointer. Noted by Christos.
 1.3.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.6.1 16-Oct-2005  skrll file syscall.c was added on branch ktrace-lwp on 2005-11-10 13:59:08 +0000
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.3 11-Aug-2006  yamt sync with head
 1.6.2.2 13-Mar-2006  yamt sync with head.
 1.6.2.1 05-Mar-2006  yamt file syscall.c was added on branch yamt-pdpolicy on 2006-03-13 09:07:02 +0000
 1.9.10.7 11-Feb-2008  yamt sync with head.
 1.9.10.6 21-Jan-2008  yamt sync with head
 1.9.10.5 03-Sep-2007  yamt sync with head.
 1.9.10.4 26-Feb-2007  yamt sync with head.
 1.9.10.3 30-Dec-2006  yamt sync with head.
 1.9.10.2 21-Jun-2006  yamt sync with head.
 1.9.10.1 07-Mar-2006  yamt file syscall.c was added on branch yamt-lazymbuf on 2006-06-21 14:56:12 +0000
 1.9.8.1 13-Jul-2006  gdamore Merge from HEAD.
 1.9.2.2 07-Mar-2006  thorpej Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
 1.9.2.1 07-Mar-2006  thorpej file syscall.c was added on branch elad-kernelauth on 2006-03-07 07:21:52 +0000
 1.12.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.12.4.1 12-Jan-2007  ad sparc MD changes.
 1.13.22.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.13.18.1 03-Sep-2007  skrll Sync with HEAD.
 1.13.14.1 03-Oct-2007  garbled Sync with HEAD
 1.13.6.1 20-Aug-2007  ad Sync with HEAD.
 1.14.2.3 23-Mar-2008  matt sync with HEAD
 1.14.2.2 09-Jan-2008  matt sync with HEAD
 1.14.2.1 06-Nov-2007  matt sync with HEAD
 1.15.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.15.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.17.8.2 17-Jun-2008  yamt sync with head.
 1.17.8.1 18-May-2008  yamt sync with head.
 1.17.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.17.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.6.1 18-Jun-2008  simonb Sync with head.
 1.18.4.3 14-Oct-2008  wrstuden Add a new vp-private flag, SAVP_FLAG_DELIVERING. This flag indicates
that the vp is in the process of delivering a new-thread upcall.
This is a BLOCKED or NEWPROC upcall. Do NOT generate any BLOCKED
upcalls while this is set. Set it at the end of sa_switchcall()
and clear it at syscall entry. Sadly, I have found no other
way to handle this. The old SA interface has no way for
userland to acknowledge that it got the upcall, so use syscall
entry as the indicator that libpthread got it.

This addresses the issue seen on current-users with firefox
dying with a blockedgen != unbockedgen error. The problem is we
deliver a BLOCKED upcall, but between the end of userret()
and when the CPU indicates that it's running in user mode, we take
a page fault. Said page fault blocks, blocking upcall delivery.
The original block, however, was short-lived, and the UNBLOCK
happens shortly. It happens before libpthread actually notices
the BLOCKED upcall. Boom!

Unfortunately a LOCKDEBUG/DIAGNOSTIC kernel still dies before
firefox opens. However this new issue is with uvm code calling
mtsleep when not holding a correct lock; sa_switch() is exploding
at KASSERT(lwp_locked(l, NULL)); before it's done _anything_.

Also, while here, add sa_system_disabled. This is an integer
that we examine when starting SA for a proc. If it's non-zero,
we error out. Once this is hooked into sysctl, you'll be able to
disable SA w/o recompiling.
 1.18.4.2 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.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.18.2.2 11-Mar-2010  yamt sync with head
 1.18.2.1 04-May-2009  yamt sync with head.
 1.19.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.19.2.1 19-Oct-2008  haad Sync with HEAD.
 1.21.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.22.2.2 21-Apr-2011  rmind sync with head
 1.22.2.1 05-Mar-2011  rmind sync with head
 1.23.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.25.8.2 24-Feb-2012  mrg sync to -current.
 1.25.8.1 18-Feb-2012  mrg merge to -current.
 1.25.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.25.4.1 17-Apr-2012  yamt sync with head
 1.27.2.2 03-Dec-2017  jdolecek update from HEAD
 1.27.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.10.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.29.18.1 10-Jun-2019  christos Sync with HEAD
 1.31.30.1 22-Mar-2023  martin Pull up following revision(s) (requested by hannken in ticket #124):

tests/lib/libc/sys/t_ptrace_syscall_wait.h: revision 1.3
sys/arch/sparc/sparc/syscall.c: revision 1.32
sys/arch/sparc/sparc/vm_machdep.c: revision 1.108

Adjust pc/npc before syscall allowing EJUSTRETURN to return
to the next instruction. Only ERESTART should return to
the same instruction. Differences to sparc64 reduced.

Test t_ptrace_wait:syscallemu1 now passes on sparc.

Fixes PR kern/52166 "syscallemu does not work on sparc (32-bit)"

Ok: Martin Husemann
 1.34 12-Jan-2018  mrg fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.33 12-Jan-2018  mrg fix time goes backwards problems on sparc.

there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.

to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)

the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.

also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
 1.32 19-Jan-2014  mrg branches: 1.32.4; 1.32.8; 1.32.16; 1.32.22;
remove schedintr_4m(), and go back to only having the level 14
timer call statclock/schedclock. the randomness for this clock
makes the hardclock() call very jittery.

instead of this, trigger a softintr IPI at level 10 on non-primary
CPUs from the primary CPU's clock interrupt (at level 10.) this
cleans up the generic sparc timer code a little as well.

this makes the time goes backwards problem *much* less frequent,
but i still see it sometimes.
 1.31 19-Oct-2013  mrg - remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.30 29-Jul-2012  matt branches: 1.30.2; 1.30.4;
Fix more -fno-common fallout.
 1.29 17-Jul-2011  mrg branches: 1.29.2; 1.29.8; 1.29.12; 1.29.14;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.28 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.27 14-Feb-2011  mrg use schedintr() (not schedintr_4m()) on MP or single CPU configurations.
 1.26 04-Jan-2010  mrg branches: 1.26.4; 1.26.6; 1.26.8;
rework the timer interrupt usage on MP sun4m systems a little. use
either schedintr() or schedintr_4m() and make sure we call hardclock()
and schedclock() appropriately. the level10 interrupt isn't used much
for MP sun4m systems anymore..

now, besides crazy interrupts panics, sparc smp is functionaly again.
 1.25 03-Jan-2010  mrg add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.24 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.23 03-Dec-2007  ad branches: 1.23.18; 1.23.26; 1.23.28; 1.23.32;
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.22 07-Jun-2006  kardel branches: 1.22.16; 1.22.34; 1.22.36; 1.22.42;
convert to timecounters (from branch simonb-timecounters)
 1.21 16-Nov-2005  uwe branches: 1.21.4; 1.21.6; 1.21.8; 1.21.14;
Drop trailing whitespace.
 1.20 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.19 13-Feb-2004  wiz branches: 1.19.16; 1.19.24;
Uppercase CPU, plural is CPUs.
 1.18 15-Jul-2003  lukem __KERNEL_RCSID()
 1.17 12-Mar-2003  jdc branches: 1.17.2;
Make this compile with only SUN4 defined.
 1.16 06-Jan-2003  pk Move schedintr() to clock.c and initialise schedhz in initclocks(), so
these are available to all timer implementations.
 1.15 31-Dec-2002  pk Make the schedintr() code common for all timers.
 1.14 10-Dec-2002  pk intr_establish() signature change: pass NULL for the `fast trap' argument.
 1.13 06-Dec-2002  pk Pass the `device class interrupt level' on to intr_establish() and use to
raise the ipl in the interrupt handlers to the appropriate level. This avoids
interrupt handler interference if one of the devices actually interrupts at
a lower hardware level than the maximum level assined to a device class.

Based on code from Art Grabowski in openbsd.
 1.12 28-Nov-2002  pk Move timer{match,attach}_mainbus() back into timer.c, since the `timer at
mainbus' configuration declaration is orthogonal to the configured SUN4[CM]
platform options.
 1.11 26-Nov-2002  pk The presence of the `timer at obio' attachment is independent of the
various CPU support settings.
 1.10 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.9 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 25-Aug-2002  thorpej Split the timer code up into Sun4/Sun4c, Sun4m, and MS-IIep bits, mostly
to make it more readable.
 1.6 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.5 17-Jul-2002  thorpej Remote CPU_ISSUN4OR4C and CPU_ISSUN4COR4M, and instead express them
as (CPU_ISSUN4 || CPU_ISSUN4C) and (CPU_ISSUN4C || CPU_ISSUN4M),
respectively. The compiler can still optimize as desired by expressing
them this way, and it simplifies adding new tests.

While here, just remove CPU_ISSUN4MOR4U; it's not used by anything.
 1.4 14-Jul-2002  thorpej Add a missing ":" when printing the delay constant message.
 1.3 28-Mar-2002  uwe branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8;
Oops, timermatch_msiiep() body now needs to be protected with #ifdef MSIIEP.
 1.2 28-Mar-2002  uwe Move ms-IIep PCIC driver into mspcic0 at msiiep0. msiiep0 now serves
as a stub bus that knows how to attach drivers for various functions
of PCIC.

This change is a follow up to timer0 at msiiep0 change, since all
children must share same attach arguments and so we no longer can
attach pci0 directly under msiiep0.
 1.1 28-Mar-2002  pk Untangle clock.c:
* put various time-of-day clock, timer and eeprom drivers in separate files
* avoid unnecessary overhead in interrupt handlers
* make the MSIIEP timer attach through the regular autoconf mechanisms
 1.3.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.3.8.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.8.1 28-Mar-2002  jdolecek file timer.c was added on branch kqueue on 2002-06-23 17:41:56 +0000
 1.3.6.2 22-Nov-2002  tron Pull up revision 1.6 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.3.6.1 15-Jul-2002  thorpej pullup-1-6 ticket #504 (thorpej).

Original log message:
Add a missing ":" when printing the delay constant message.
 1.3.4.3 31-Aug-2002  gehenna catch up with -current.
 1.3.4.2 21-Jul-2002  gehenna catch up with -current.
 1.3.4.1 17-Jul-2002  gehenna catch up with -current.
 1.3.2.9 06-Jan-2003  martin Catch up to -current.
 1.3.2.8 03-Jan-2003  thorpej LWP'ify new schedclock code.
 1.3.2.7 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.3.2.6 11-Dec-2002  thorpej Sync with HEAD.
 1.3.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.4 27-Aug-2002  nathanw Catch up to -current.
 1.3.2.3 01-Aug-2002  nathanw Catch up to -current.
 1.3.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.1 28-Mar-2002  nathanw file timer.c was added on branch nathanw_sa on 2002-04-01 07:42:56 +0000
 1.17.2.4 11-Dec-2005  christos Sync with head.
 1.17.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.24.1 22-Nov-2005  yamt sync with head.
 1.19.16.2 07-Dec-2007  yamt sync with head
 1.19.16.1 21-Jun-2006  yamt sync with head.
 1.21.14.1 19-Jun-2006  chap Sync with head.
 1.21.8.1 26-Jun-2006  yamt sync with head.
 1.21.6.3 03-Jun-2006  kardel adjust quality to 100 for interpolation capable counter implementations
0 would be used for interupt based counters
 1.21.6.2 28-May-2006  kardel make timecounter struct static
 1.21.6.1 27-May-2006  kardel convert to timecounters
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.22.42.1 08-Dec-2007  mjf Sync with HEAD.
 1.22.36.1 09-Jan-2008  matt sync with HEAD
 1.22.34.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.22.16.1 03-Dec-2007  ad Sync with HEAD.
 1.23.32.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.28.1 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.23.26.1 28-Apr-2009  skrll Sync with HEAD.
 1.23.18.2 11-Mar-2010  yamt sync with head
 1.23.18.1 04-May-2009  yamt sync with head.
 1.26.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.26.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.4.1 05-Mar-2011  rmind sync with head
 1.29.14.1 13-Mar-2018  snj Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.29.12.1 13-Mar-2018  snj Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.29.8.1 13-Mar-2018  snj Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.29.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.2.1 30-Oct-2012  yamt sync with head
 1.30.4.1 18-May-2014  rmind sync with head
 1.30.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.22.1 13-Jan-2018  snj Pull up following revision(s) (requested by mrg in ticket #504):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.32.16.1 12-Feb-2018  snj Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.32.8.1 12-Feb-2018  snj Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.32.4.1 12-Feb-2018  snj Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.29 25-Feb-2025  andvar Fix a few typos in the word 'offset' in comments and error message.
 1.28 16-Nov-2013  mrg branches: 1.28.66;
- convert CPU_INFO_ITERATOR in the !MP case to be __unused, and convert
all the iterators to use it
- print the right variables in nmi_hard_msiiep() (thanks set-but-unused)
- move variable inside usage #ifdef
- use (void) instead of a "volatile int" junk variable
- remove unused variables
 1.27 31-Jul-2012  martin branches: 1.27.2; 1.27.4;
Make KRUPS kernel buildable again
 1.26 17-Jul-2011  mrg branches: 1.26.2;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.25 04-Jan-2010  mrg curlwp is never NULL any more.
 1.24 03-Jan-2010  mrg add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.23 03-Dec-2007  ad branches: 1.23.18;
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.22 04-Mar-2007  uwe branches: 1.22.2; 1.22.18; 1.22.20; 1.22.26;
Don't mix code and declarations/defintions.
Use designated initialization for strict timecounter.
Misc cosmetics. Clean up whitespace.
 1.21 04-Mar-2007  uwe bandaid for a problem exposed by newlock2
the kernel enables interrupts and then sets up clocks. If we catch a timer
interrupt in between and call hardclock() we'll explode so for now just
bail when we get one while cold
 1.20 07-Jun-2006  kardel branches: 1.20.12;
convert to timecounters (from branch simonb-timecounters)
 1.19 08-Feb-2006  macallan branches: 1.19.2; 1.19.8;
use local junk variables instead of a global one
 1.18 08-Feb-2006  macallan add a junk variable to keep empty reads from getting eliminated.
Fixed panic in timerattach_msiiep()
 1.17 16-Nov-2005  uwe branches: 1.17.2; 1.17.4; 1.17.6;
Drop trailing whitespace.
 1.16 24-Sep-2005  uwe branches: 1.16.6;
Shuffle the code to be more readable. Simplify.
 1.15 23-Sep-2005  uwe Introduce mspcic_{read,write}_N instead of using struct syntax. This
is the first step to make PCIC run without byteswapping - which is
necessary for X server support. Current macros are still just a
kludgy shim over struct syntax, but accesses to PCIC in the .c files
are now marked up properly.
 1.14 01-Jul-2004  pk branches: 1.14.12;
Avoid unnecessary stores of discarded values.
 1.13 12-May-2004  pk Remove obsolete `timerok' code, which dates back to when the timer/counter
interrupt handlers were pre-wired.
 1.12 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.11 15-Jul-2003  lukem __KERNEL_RCSID()
 1.10 18-Jan-2003  thorpej branches: 1.10.2;
Merge the nathanw_sa branch.
 1.9 15-Jan-2003  pk Fix compiler warning induced by last change.
 1.8 14-Jan-2003  pk statintr: if interrupting code running below IPL_SCHED, call schedintr()
directly, saving the overhead of an extra soft interrupt.
 1.7 06-Jan-2003  pk Move schedintr() to clock.c and initialise schedhz in initclocks(), so
these are available to all timer implementations.
 1.6 31-Dec-2002  pk Make the schedintr() code common for all timers.
 1.5 10-Dec-2002  pk intr_establish() signature change: pass NULL for the `fast trap' argument.
 1.4 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.3 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 25-Aug-2002  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Split the timer code up into Sun4/Sun4c, Sun4m, and MS-IIep bits, mostly
to make it more readable.
 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 25-Aug-2002  jdolecek file timer_msiiep.c was added on branch kqueue on 2002-09-06 08:41:18 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 25-Aug-2002  gehenna file timer_msiiep.c was added on branch gehenna-devsw on 2002-08-31 14:52:25 +0000
 1.1.2.7 15-Jan-2003  thorpej Sync with HEAD.
 1.1.2.6 06-Jan-2003  martin Catch up to -current.
 1.1.2.5 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.1.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 25-Aug-2002  nathanw file timer_msiiep.c was added on branch nathanw_sa on 2002-08-27 23:45:46 +0000
 1.10.2.5 11-Dec-2005  christos Sync with head.
 1.10.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.12.3 07-Dec-2007  yamt sync with head
 1.14.12.2 03-Sep-2007  yamt sync with head.
 1.14.12.1 21-Jun-2006  yamt sync with head.
 1.16.6.1 22-Nov-2005  yamt sync with head.
 1.17.6.5 03-Jun-2006  kardel adjust quality to 100 for interpolation capable counter implementations
0 would be used for interupt based counters
 1.17.6.4 28-May-2006  kardel white space nits (thanks Masao Uebayashi)
 1.17.6.3 28-May-2006  kardel convert to timecounter - only compile tested due to lack of hardware
 1.17.6.2 27-May-2006  kardel convert to timecounters
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.17.2.1 18-Feb-2006  yamt sync with head.
 1.19.8.1 19-Jun-2006  chap Sync with head.
 1.19.2.1 26-Jun-2006  yamt sync with head.
 1.20.12.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.22.20.1 09-Jan-2008  matt sync with HEAD
 1.22.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.22.2.1 03-Dec-2007  ad Sync with HEAD.
 1.23.18.1 11-Mar-2010  yamt sync with head
 1.26.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.26.2.1 30-Oct-2012  yamt sync with head
 1.27.4.1 18-May-2014  rmind sync with head
 1.27.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.66.1 02-Aug-2025  perseant Sync with HEAD
 1.19 17-Jul-2011  mrg convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.18 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.17 04-Jan-2010  mrg curlwp is never NULL any more.
 1.16 03-Dec-2007  ad branches: 1.16.18;
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.15 24-Aug-2006  kardel branches: 1.15.12; 1.15.30; 1.15.32; 1.15.38;
Pass the correct (timer instead of stat counter) timer registers to timerattach().
History: This cleans up another long standing inconsistency where timerblurb for delay() was
calibrated against the stat timer instead the clock timer. Before timecounters
this didn't matter at al as both timer run with the same frequency and the
calibration was a frequency based calibration.

Misbehaving clock found by Fanch (at) kekpar dot net on current-users@ - Thanks.
Fix verified to work by Fanch.
 1.14 07-Jun-2006  kardel branches: 1.14.4;
convert to timecounters (from branch simonb-timecounters)
 1.13 16-Nov-2005  uwe branches: 1.13.4; 1.13.6; 1.13.8; 1.13.14;
Drop trailing whitespace.
 1.12 01-Jul-2004  pk branches: 1.12.12; 1.12.18;
Avoid unnecessary stores of discarded values.
 1.11 15-Jul-2003  lukem __KERNEL_RCSID()
 1.10 18-Jan-2003  thorpej branches: 1.10.2;
Merge the nathanw_sa branch.
 1.9 15-Jan-2003  pk Fix compiler warning induced by last change.
 1.8 14-Jan-2003  pk statintr: if interrupting code running below IPL_SCHED, call schedintr()
directly, saving the overhead of an extra soft interrupt.
 1.7 06-Jan-2003  pk Move schedintr() to clock.c and initialise schedhz in initclocks(), so
these are available to all timer implementations.
 1.6 31-Dec-2002  pk Make the schedintr() code common for all timers.
 1.5 28-Nov-2002  pk Move timer{match,attach}_mainbus() back into timer.c, since the `timer at
mainbus' configuration declaration is orthogonal to the configured SUN4[CM]
platform options.
 1.4 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.3 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 25-Aug-2002  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Split the timer code up into Sun4/Sun4c, Sun4m, and MS-IIep bits, mostly
to make it more readable.
 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 25-Aug-2002  jdolecek file timer_sun4.c was added on branch kqueue on 2002-09-06 08:41:18 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 25-Aug-2002  gehenna file timer_sun4.c was added on branch gehenna-devsw on 2002-08-31 14:52:25 +0000
 1.1.2.8 15-Jan-2003  thorpej Sync with HEAD.
 1.1.2.7 06-Jan-2003  martin Catch up to -current.
 1.1.2.6 03-Jan-2003  thorpej LWP'ify new schedclock code.
 1.1.2.5 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.1.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 25-Aug-2002  nathanw file timer_sun4.c was added on branch nathanw_sa on 2002-08-27 23:45:47 +0000
 1.10.2.4 11-Dec-2005  christos Sync with head.
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.18.1 22-Nov-2005  yamt sync with head.
 1.12.12.3 07-Dec-2007  yamt sync with head
 1.12.12.2 30-Dec-2006  yamt sync with head.
 1.12.12.1 21-Jun-2006  yamt sync with head.
 1.13.14.1 19-Jun-2006  chap Sync with head.
 1.13.8.2 03-Sep-2006  yamt sync with head.
 1.13.8.1 26-Jun-2006  yamt sync with head.
 1.13.6.1 27-May-2006  kardel convert to timecounters
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.14.4.1 28-Aug-2006  riz Pull up following revision(s) (requested by kardel in ticket #61):
sys/arch/sparc/sparc/timer_sun4.c: revision 1.15
Pass the correct (timer instead of stat counter) timer registers to timerattach().
History: This cleans up another long standing inconsistency where timerblurb for delay() was
calibrated against the stat timer instead the clock timer. Before timecounters
this didn't matter at al as both timer run with the same frequency and the
calibration was a frequency based calibration.
Misbehaving clock found by Fanch (at) kekpar dot net on current-users@ - Thanks.
Fix verified to work by Fanch.
 1.15.38.1 08-Dec-2007  mjf Sync with HEAD.
 1.15.32.1 09-Jan-2008  matt sync with HEAD
 1.15.30.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.15.12.1 03-Dec-2007  ad Sync with HEAD.
 1.16.18.1 11-Mar-2010  yamt sync with head
 1.33 02-Jun-2023  andvar follow the steps of Andrew Doran (ad) commit and fix more s/loose/lose/ typos.
also s/beyound/beyond/ and few others along the way, mainly in comments.
 1.32 04-Dec-2021  andvar fix typos in comments and log messages, mainly in establish(ed).
 1.31 12-Jan-2018  mrg fix time goes backwards problems on sparc.

there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.

to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)

the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.

also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
 1.30 19-Jan-2014  mrg branches: 1.30.4; 1.30.8; 1.30.16; 1.30.22;
remove schedintr_4m(), and go back to only having the level 14
timer call statclock/schedclock. the randomness for this clock
makes the hardclock() call very jittery.

instead of this, trigger a softintr IPI at level 10 on non-primary
CPUs from the primary CPU's clock interrupt (at level 10.) this
cleans up the generic sparc timer code a little as well.

this makes the time goes backwards problem *much* less frequent,
but i still see it sometimes.
 1.29 16-Nov-2013  mrg - convert CPU_INFO_ITERATOR in the !MP case to be __unused, and convert
all the iterators to use it
- print the right variables in nmi_hard_msiiep() (thanks set-but-unused)
- move variable inside usage #ifdef
- use (void) instead of a "volatile int" junk variable
- remove unused variables
 1.28 01-Sep-2011  martin branches: 1.28.2; 1.28.8; 1.28.12; 1.28.14; 1.28.16; 1.28.22;
Minor nit: avoid kpreempt_disable() if cold (as we return early and do
not reenable it; actually makes no difference but looks more balanced
this way)
 1.27 17-Jul-2011  mrg convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.26 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.25 15-Feb-2011  mrg sprinkle some kpreempt_{dis,en}able() in various strategic points
we will need when we get to actually enabling kernel preemption.
 1.24 14-Feb-2011  mrg call hardclock() the same way on cpu0 in MP and !MP cases.
 1.23 27-Jan-2011  mrg consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters. beyond the extra info, it seems to help avoid some
of these counters getting corrupted due to unlocked multiple accesses.

adjust the xcallintr() from xcall() hack so that we don't count these
events as interrupts. align the existing evcnt name to count this.
 1.22 13-Jan-2010  mrg branches: 1.22.4; 1.22.6; 1.22.8;
replace local ci_cpuname[] and use new cpu_name().
 1.21 06-Jan-2010  mrg fix an incomplete comment.
 1.20 04-Jan-2010  mrg rework the timer interrupt usage on MP sun4m systems a little. use
either schedintr() or schedintr_4m() and make sure we call hardclock()
and schedclock() appropriately. the level10 interrupt isn't used much
for MP sun4m systems anymore..

now, besides crazy interrupts panics, sparc smp is functionaly again.
 1.19 01-Jan-2010  mrg remove wrong if 0ed code
 1.18 20-Dec-2009  mrg add per-cpu event counters for lev10 and lev14 interrupts.
add some disabled MP code to poke other cpus on level 14 interrupts.
 1.17 10-Mar-2009  martin Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:

Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.

The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.16 25-Feb-2007  macallan branches: 1.16.46; 1.16.54; 1.16.56; 1.16.60; 1.16.64;
bandaid for a problem exposed by newlock2
the kernel enables interrupts and then sets up clocks. If we catch a timer
interrupt in between and call hardclock() we'll explode so for now just
bail when we get one while cold
 1.15 07-Jun-2006  kardel branches: 1.15.12;
convert to timecounters (from branch simonb-timecounters)
 1.14 16-Nov-2005  uwe branches: 1.14.4; 1.14.6; 1.14.8; 1.14.14;
Drop trailing whitespace.
 1.13 16-Jun-2005  briggs branches: 1.13.2; 1.13.8;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.12 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.11 01-Jul-2004  pk Avoid unnecessary stores of discarded values.
 1.10 01-Jul-2004  pk Revision 1.27 of clock.c applies to the Intersil interrupt, not sun4m timers.
 1.9 12-May-2004  pk Remove obsolete `timerok' code, which dates back to when the timer/counter
interrupt handlers were pre-wired.
 1.8 15-Jul-2003  lukem branches: 1.8.2;
__KERNEL_RCSID()
 1.7 18-Jan-2003  thorpej branches: 1.7.2;
Merge the nathanw_sa branch.
 1.6 14-Jan-2003  pk statintr: if interrupting code running below IPL_SCHED, call schedintr()
directly, saving the overhead of an extra soft interrupt.
 1.5 06-Jan-2003  pk Move schedintr() to clock.c and initialise schedhz in initclocks(), so
these are available to all timer implementations.
 1.4 31-Dec-2002  pk Make the schedintr() code common for all timers.
 1.3 31-Dec-2002  pk Use a soft interrupt scheme to schedule schedclock(), so we can make
splsched() less than splhigh().
 1.2 06-Dec-2002  pk ienab_bi[cs] are never used in a context common to both sun4/4c and sun4m,
so there's no point in constructing common entry points for them in locore.s.
 1.1 25-Aug-2002  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Split the timer code up into Sun4/Sun4c, Sun4m, and MS-IIep bits, mostly
to make it more readable.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 25-Aug-2002  jdolecek file timer_sun4m.c was added on branch kqueue on 2002-09-06 08:41:18 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 25-Aug-2002  gehenna file timer_sun4m.c was added on branch gehenna-devsw on 2002-08-31 14:52:25 +0000
 1.1.2.7 15-Jan-2003  thorpej Sync with HEAD.
 1.1.2.6 06-Jan-2003  martin Catch up to -current.
 1.1.2.5 03-Jan-2003  thorpej LWP'ify new schedclock code.
 1.1.2.4 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.1.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 25-Aug-2002  nathanw file timer_sun4m.c was added on branch nathanw_sa on 2002-08-27 23:45:48 +0000
 1.7.2.5 11-Dec-2005  christos Sync with head.
 1.7.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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 10-Jul-2004  tron Pull up revision 1.10 (requested by pk in ticket #637):
Revision 1.27 of clock.c applies to the Intersil interrupt, not sun4m timers.
 1.13.8.1 22-Nov-2005  yamt sync with head.
 1.13.2.2 26-Feb-2007  yamt sync with head.
 1.13.2.1 21-Jun-2006  yamt sync with head.
 1.14.14.1 19-Jun-2006  chap Sync with head.
 1.14.8.1 26-Jun-2006  yamt sync with head.
 1.14.6.1 27-May-2006  kardel convert to timecounters
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.12.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.16.64.1 21-Apr-2010  matt sync to netbsd-5
 1.16.60.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.56.3 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.16.56.2 16-Feb-2011  bouyer Apply patch, requested my mrg in ticket 1553:
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/pmap.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
- print the curpcb in ddb "mach cpu" output as well.
- bump the size of cpus[] by one, so we have a NULL pointer at the end,
from tsutsui
- for MP kernels, copy the loop to find the bootcpu in mainbus_attach()
into getcacheinfo_obp() so we can get cache properties on the bootcpu
before calling main()
- in getcpuinfo(), move the call of getmid() before the call to
getcacheinfo() so that the above change to getcacheinfo_obp() can work
- move the struct cpu_info setup to the end of the initial kernel page
setup and don't access this space until after we have switched to the
kernel pagetables
- revive most of the old CPUINFO_VA alignment/congruency code from the
old alloc_cpuinfo_global_va() function, and ensure that all cpuinfo
structures are sanely aligned. this makes hypersparc work again
- introduce a new way to free the wasted pages back to UVM, as we can't
simply uvm_unmap() them this early in bootstrap
- make sure to initialise the cpuinfo sz in all cases. noted by martin.
- add per-cpu event counters for lev10 and lev14 interrupts.
- make CPU_INFO_FOREACH() set the iterator count to '0' in the !MP case.
- add some disabled MP code to poke other cpus on level 14 interrupts.
- add a diagnostic to ensure that cpus[0] == cpu0's cpu_info->ci_self
- if a cpu doesn't have any mappings allocated, don't copy them. this
occurs if a cpu isn't attached (such as a MP kernel with only "cpu0"
listed in the config file..)
- fix the previous to compile !MULTIPROCESSOR.
 1.16.56.1 30-May-2009  snj Pull up following revision(s) (requested by mrg in ticket #776):
sys/arch/sparc/sparc/autoconf.c: revision 1.233 via patch
sys/arch/sparc/sparc/cpu.c: revision 1.213 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.76 via patch
sys/arch/sparc/sparc/db_interface.c: revision 1.83 via patch
sys/arch/sparc/sparc/intr.c: revision 1.102 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.325 via patch
sys/arch/sparc/sparc/timer_sun4m.c: revision 1.17 via patch
Work in progress from a colaborative effort of mrg and me (all bugs are
mine) - not quite working, but improves the situation for non-MULTIPROCESSOR
kernels (makes LOCKDEBUG kernels work) and does not make SMP kernels worse:
Rearange cpu_info access and hide the actual implementation of the mapping
from all parts of the code that do not directly deal with it. Do the
mapping early in pmap_bootstrap, so that post-vmlocking2 kernels have
a chance to work.
The actual mapping of the cpus array for SMP kernels has to be fixed still,
but both mrg and me ran out of time and this lay around in our trees far
too long.
 1.16.54.1 28-Apr-2009  skrll Sync with HEAD.
 1.16.46.2 11-Mar-2010  yamt sync with head
 1.16.46.1 04-May-2009  yamt sync with head.
 1.22.8.2 17-Feb-2011  bouyer Sync with HEAD
 1.22.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.22.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.22.4.1 05-Mar-2011  rmind sync with head
 1.28.22.1 13-Mar-2018  snj Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.28.16.1 18-May-2014  rmind sync with head
 1.28.14.1 13-Mar-2018  snj Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.28.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.8.1 13-Mar-2018  snj Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.28.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.30.22.1 13-Jan-2018  snj Pull up following revision(s) (requested by mrg in ticket #504):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.30.16.1 12-Feb-2018  snj Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.30.8.1 12-Feb-2018  snj Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.30.4.1 12-Feb-2018  snj Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.10 12-Jan-2018  mrg fix time goes backwards problems on sparc.

there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.

to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)

the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.

also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
 1.9 16-Nov-2005  uwe branches: 1.9.118; 1.9.124; 1.9.134; 1.9.140; 1.9.144; 1.9.152; 1.9.158;
Drop trailing whitespace.
 1.8 07-Aug-2003  agc branches: 1.8.16; 1.8.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 09-Apr-2001  pk branches: 1.7.8; 1.7.24;
Add macro to convert a counter register value to microseconds.
 1.6 28-Oct-1996  abrown branches: 1.6.28; 1.6.40;
Fix timer initialization so that we don't gain one extra microsecond per
second on Sun4m machines. Although this was in the noise of the unstable
Sun clock crystals before, the discrepancy amounted to about 100 ppm, and
thus made NTP perform poorly. NTP now works happily on my SS20...
 1.5 02-May-1996  pk Various simplifications and corrections from Chuck Cranor (makes `oclock'
calibration work.. thanks!).
 1.4 31-Mar-1996  pk Include support for sun4m timers and counters: hardware register layout
has changed. There is a counter for each CPU (currently, just one supported).
 1.3 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.6.40.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.28.1 21-Apr-2001  bouyer Sync with HEAD
 1.7.24.4 11-Dec-2005  christos Sync with head.
 1.7.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.24.1 03-Aug-2004  skrll Sync with HEAD
 1.7.8.2 09-Apr-2001  pk Add macro to convert a counter register value to microseconds.
 1.7.8.1 09-Apr-2001  pk file timerreg.h was added on branch nathanw_sa on 2001-04-09 21:17:34 +0000
 1.8.24.1 22-Nov-2005  yamt sync with head.
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.9.158.1 13-Jan-2018  snj Pull up following revision(s) (requested by mrg in ticket #504):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.9.152.1 12-Feb-2018  snj Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.9.144.1 12-Feb-2018  snj Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.9.140.1 12-Feb-2018  snj Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.9.134.1 13-Mar-2018  snj Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.9.124.1 13-Mar-2018  snj Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.9.118.1 13-Mar-2018  snj Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
the interrupt and the limit bit) and increasing the latest offset.
this can happen easily if an interrupt comes between the read and
the call to tickle_tc() that increases the offset (i obverved this
actually happening.)
- in early boot, sometimes the counter can cycle twice before the
tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
the previous value, and the offset hasn't changed, use the same
fixup as if the limit bit was set. this handles the first case
above.
- add a hard-workaround for never allowing returning a smaller
value (except during 32 bit overflow): if the result is less than
the last result, add fixups until it does (or until it would
overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous
 1.13 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.12 19-Jan-2014  mrg branches: 1.12.42;
remove schedintr_4m(), and go back to only having the level 14
timer call statclock/schedclock. the randomness for this clock
makes the hardclock() call very jittery.

instead of this, trigger a softintr IPI at level 10 on non-primary
CPUs from the primary CPU's clock interrupt (at level 10.) this
cleans up the generic sparc timer code a little as well.

this makes the time goes backwards problem *much* less frequent,
but i still see it sometimes.
 1.11 29-Jul-2012  matt branches: 1.11.2; 1.11.4;
Fix more -fno-common fallout.
 1.10 17-Jul-2011  mrg branches: 1.10.2;
convert all the sparc drivers that attach on my ss20 to use device_t,
cfdata_t and CFATTACH_DECL_NEW().

fd/fdc could use better testing, but i'm pretty sure i got it right.
 1.9 04-Jan-2010  mrg rework the timer interrupt usage on MP sun4m systems a little. use
either schedintr() or schedintr_4m() and make sure we call hardclock()
and schedclock() appropriately. the level10 interrupt isn't used much
for MP sun4m systems anymore..

now, besides crazy interrupts panics, sparc smp is functionaly again.
 1.8 07-Jun-2006  kardel branches: 1.8.64; 1.8.74;
convert to timecounters (from branch simonb-timecounters)
 1.7 24-Dec-2005  perry branches: 1.7.4; 1.7.6; 1.7.8; 1.7.14;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.6 16-Nov-2005  uwe Drop trailing whitespace.
 1.5 07-Aug-2003  agc branches: 1.5.16; 1.5.24;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 06-Jan-2003  pk branches: 1.4.2;
Move schedintr() to clock.c and initialise schedhz in initclocks(), so
these are available to all timer implementations.
 1.3 31-Dec-2002  pk Make the schedintr() code common for all timers.
 1.2 28-Nov-2002  pk Move timer{match,attach}_mainbus() back into timer.c, since the `timer at
mainbus' configuration declaration is orthogonal to the configured SUN4[CM]
platform options.
 1.1 25-Aug-2002  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Split the timer code up into Sun4/Sun4c, Sun4m, and MS-IIep bits, mostly
to make it more readable.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 25-Aug-2002  jdolecek file timervar.h was added on branch kqueue on 2002-09-06 08:41:19 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 25-Aug-2002  gehenna file timervar.h was added on branch gehenna-devsw on 2002-08-31 14:52:25 +0000
 1.1.2.5 06-Jan-2003  martin Catch up to -current.
 1.1.2.4 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.1.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 25-Aug-2002  nathanw file timervar.h was added on branch nathanw_sa on 2002-08-27 23:45:48 +0000
 1.4.2.4 11-Dec-2005  christos Sync with head.
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.24.1 22-Nov-2005  yamt sync with head.
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.7.14.1 19-Jun-2006  chap Sync with head.
 1.7.8.1 26-Jun-2006  yamt sync with head.
 1.7.6.1 27-May-2006  kardel convert to timecounters
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.74.1 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.8.64.1 11-Mar-2010  yamt sync with head
 1.10.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.2.1 30-Oct-2012  yamt sync with head
 1.11.4.1 18-May-2014  rmind sync with head
 1.11.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.42.1 03-Apr-2021  thorpej Sync with HEAD.
 1.201 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.200 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.199 14-Aug-2020  martin branches: 1.199.2;
PR port-sparc/55573: remove kernel message about disabled coprocessor
instructions - it is triggered by userland trying to detect availability
of sparcv9 VIS instructions.
 1.198 06-Apr-2019  thorpej branches: 1.198.4;
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.197 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.196 30-Dec-2016  christos branches: 1.196.14; 1.196.16;
- allocate state if we did not have any in fpregs
- make fpstate explicitly start with fpregs for better type checking
- use c11 initializers
 1.195 13-Dec-2015  christos branches: 1.195.2;
PR/50516: David Binderman: Add missing breaks
 1.194 11-Dec-2015  mlelstv PR 50516 bad switch case
 1.193 04-Oct-2015  joerg panic takes a format string.
 1.192 02-Mar-2015  martin Handle EINVAL in the fault path, send SIGSEGV on mmap access past EOF.
 1.191 01-Nov-2013  mrg branches: 1.191.6;
sprinkle some __diagused where appropriate.
 1.190 01-May-2012  martin branches: 1.190.2; 1.190.4;
On unaligned access, provide the data address to the signal handler, instead
of the faulting instructions address.
 1.189 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.188 30-Jul-2011  martin branches: 1.188.2; 1.188.6;
Get rid of #ifdef __sparc__ in uvm code - as noted by cgd back 1996,
now that we have __HAVE_CPU_VMSPACE_EXEC/cpu_vmspace_exec().
 1.187 18-Apr-2011  rmind Replace malloc with kmem, and remove M_SUBPROC.
 1.186 14-Jan-2011  rmind branches: 1.186.2;
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.185 13-Jan-2011  mrg introduce a hack to workaround the savefpstate IPI get's NULL
struct fpstate *.

add a new entry point ipi_savefpstate() that is used for this IPI
instead of the plain ipi_savefpstate(). check for %o0 being NULL,
and if so, just return.

add event counters for the savefpstate IPI, and another one for
when it detects the NULL problem.

make the cpu_info struct xmpsg be aligned to a single cache line.

with this change applied (and another minor change in testing) my
SS20 with dual SM75's has survived for 17 hours on build.sh -j5,
and has reported 7 NULL savefps. (the minor change seems to have
a significant effect at reducing this number, but more testing is
needed for it.)


XXX: this is horrible and we really need to find the real problem
XXX: but this should let people use sparc smp again, and fixes
XXX: for the real problem can be tested by seeing if any of the
XXX: savefp IPI null counter becomes non-zero.
 1.184 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.183 23-Apr-2010  rmind Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.
 1.182 20-Mar-2010  chs fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.181 29-Jan-2010  mrg branches: 1.181.2; 1.181.4;
don't set ksi_errno here. no other MD code does, and one
of the pthread tests demands it.
 1.180 10-Jan-2010  mrg put the cpu_number() into some messages.
 1.179 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.178 17-Dec-2008  cegger make this compile
 1.177 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.176 15-Oct-2008  wrstuden branches: 1.176.2; 1.176.4;
Merge wrstuden-revivesa into HEAD.
 1.175 24-Apr-2008  ad branches: 1.175.2; 1.175.4; 1.175.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.174 05-Jan-2008  martin branches: 1.174.6; 1.174.8;
Add missing include
 1.173 02-Jan-2008  ad Merge vmlocking2 to head.
 1.172 04-Mar-2007  christos branches: 1.172.20; 1.172.26; 1.172.28; 1.172.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.171 09-Feb-2007  ad branches: 1.171.2;
Merge newlock2 to head.
 1.170 23-Jul-2006  ad branches: 1.170.4;
Use the LWP cached credentials where sane.
 1.169 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.168 29-Jun-2006  martin The arguments to syscalls (struct args) need 64 bit alignment for some
syscalls (like mmap), and the same is true for return values (lseek).
Make both structs a union to force alignment. Thanks to uwe for helping
analyze this!
While there move the non syscall-related functions out of this file
(back to trap.c).

This makes kernels compiled with gcc4 and -Os work.
 1.167 15-May-2006  yamt branches: 1.167.4;
include kauth.h for kauth_cred_geteuid.
 1.166 14-May-2006  elad integrate kauth.
 1.165 15-Mar-2006  drochner branches: 1.165.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument
 1.164 07-Mar-2006  thorpej branches: 1.164.2;
Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.163 14-Nov-2005  uwe branches: 1.163.2; 1.163.6; 1.163.8; 1.163.10;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.162 27-Oct-2005  uwe DIAGNOSTIC code should not whine about software traps 0x90..0x9f that will
never be specified and thus are free for ABI conforming programs to use.
 1.161 26-Oct-2005  uwe Report T_RANGECHECK as ILL_ILLOPN.
 1.160 26-Oct-2005  uwe Move md_flags back to mdproc. MDP_FIXALIGN, the only flag we have, is
per-process, not per-lwp. We don't have per-lwp flags currently.
 1.159 10-Jul-2005  christos branches: 1.159.2;
- add syscall_{plain,fancy}
- make it use mi_userret
 1.158 01-Jul-2005  christos branches: 1.158.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.
 1.157 17-Jun-2005  hannken Avoid shadow warnings, const and __UNVOLATILE().
Kernel sparc/GENERIC.MP builds again.
 1.156 03-Feb-2005  chs sun4c hardware reports faults by the atomic load/store instructions as
read faults even if the problem was that the memory was read-only.
detect this case and relabel the fault as both read and write.
details cribbed from linux and openbsd.
part of PR 25633, PR 25896.
 1.155 28-Aug-2004  jdolecek branches: 1.155.4; 1.155.6;
use uvm_grow() to update stack segment size on stack page fault instead
of MD code
 1.154 13-Apr-2004  pk Handle `unimplemented flush' traps by flushing the entire I-cache (if
there is one).
 1.153 14-Mar-2004  cl branches: 1.153.2;
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.152 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.151 02-Jan-2004  cl kernel part of no-syscall upcall stack return: libpthread registers
an offset between ss_sp and struct sa_stackinfo_t (located in struct
__pthread_st) when calling sa_register. The kernel increments the
sast_gen counter in struct sastack when an upcall stack is used.
libpthread increments the sasi_stackgen counter in struct
sa_stackinfo_t when an upcall stack is freed. The kernel compares the
two counters to decide if a stack is free or in use.

- add struct sa_stackinfo_t with sasi_stackgen to count stack use in
userland
- add sast_gen to struct sastack to count stack use in kernel
- add SA_FLAG_STACKINFO to enable the stackinfo_offset argument in the
sa_register syscall
- add sa_stackinfo_offset to struct sadata for offset between ss_sp
and struct sa_stackinfo_t
- add ssize_t stackinfo_offset argument to sa_register, initialize
struct sadata's sa_stackinfo_offset from it if SA_FLAG_STACKINFO is
set
- add sa_getstack, sa_getstack0, sa_stackused and sa_setstackfree
functions to find/use/free upcall stacks and use these where
appropriate
- don't record stack for upcall in sa_upcall0
- pass sau to sa_switchcall instead of l2 (l2 = curlwp in sa_switchcall)
- add sa_vp_blocker to struct sadata to pass recently blocked lwp to
sa_switchcall
- delay finding a stack for blocked upcalls to sa_switchcall
- add sa_stacknext to struct sadata pointing to next most likely free
upcall stack; also g/c sa_stackslist in struct sadata and sast_list
in struct sastack
- add L_SA_WOKEN flag: LWP is on sa_woken queue
- add L_SA_RECYCLE flag: LWP should be recycled in sa_setwoken
- replace l_upcallstack with L_SA_WOKEN/L_SA_RECYCLE/L_SA_BLOCKING
flags
- g/c now unused sast_blocker in struct sastack
- make sa_switchcall, sa_upcall0 and sa_upcall_getstate static in
kern_sa.c
- call sa_upcall_userret only once in userret
- split sa_makeupcalls out of sa_upcall_userret and use to process
the sa_upcalls queue
- on process exit: mark LWPs sleeping in saunblock interruptible; also
there are no LWPs sleeping on l->l_upcallstack anymore; also clear
sa_wokenq_head to prevent unblocked upcalls

additional changes:
- cleanup timerupcall sa_vp == curlwp check
- add check in sa_yield if we didn't block on our way here and we
wouldn't any longer be the LWP on the VP
- invalidate sa_vp_ofaultaddr after resolving pagefault
 1.150 04-Nov-2003  pk * Set ksi_code to SI_NOINFO where we used to return zero.
* Fill in ksi_errno if we have an error code to report.
 1.149 01-Nov-2003  cl Avoid sneaking past signal delivery in sa_upcall_userret():
generate unblocked upcalls in sa_unblock_userret(), before signal
delivery/p_userret handling in userret().

Also defer getting state for preempted upcalls because on some ports
preemption can happen between sa_unblock_userret() and sa_upcall_userret().
 1.148 31-Oct-2003  simonb Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.
 1.147 15-Oct-2003  pk sun4m_access_fault: Treat text/data error traps as if they were text/data
exception traps, except that they're logged on the console.
 1.146 12-Oct-2003  pk Simplify fpu_cleanup() by having it return a code to indicate that a SIGFPE
is to be posted; let trap() deal with constructing the siginfo structure.
 1.145 12-Oct-2003  pk mem_access_fault_*: call KSI_INIT_TRAP() before filling in the siginfo fields.
 1.144 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.143 05-Oct-2003  pk sparc kernel support for SA_SIGINFO.
 1.142 16-Sep-2003  cl fix copy-paste oversight in MD part of SA/pthread pagefault handling
 1.141 16-Sep-2003  cl add MD part of SA/pthread pagefault handling on sparc
 1.140 07-Sep-2003  uwe DOH, sparc was not doing p_userret processing in userret()!
Adding it helps SA a great deal. E.g. ogg123 actually works now.
 1.139 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.138 12-Aug-2003  pk sun4/sun4 mem_fault(): on kernel faults we now need to try to page in a
a `pmeg' too. See also sparc/pmap.c, rev 1.265.
 1.137 15-Jul-2003  lukem __KERNEL_RCSID()
 1.136 29-Jun-2003  fvdl branches: 1.136.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.135 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.134 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.133 07-May-2003  pk GC old FPU code.
 1.132 08-Apr-2003  uwe Add names for v8 traps (cf page 76, table 7-1).
Fix coprocessor disabled/exception traps that were placed incorrectly:
cp_disabled == 0x24 (0t36) was placed at 0x36, ditto for cp_exception.
 1.131 26-Jan-2003  pk Release the kernel lock in upcallret() and startlwp().
 1.130 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.129 13-Jan-2003  pk Broadcast I-cache flush in the `Unimplemented Flush' trap handler.
 1.128 12-Jan-2003  pk fpulock: encapsulate required IPL raise in the FPU LOCK/UNLOCK macros.
 1.127 10-Jan-2003  pk Replace `want_resched' and `want_ast' globals by per-CPU variables.
 1.126 09-Jan-2003  mrg call splclock() around the FPU_LOCK().

XXX: pk suggests we can make the this a sleeping lock.
 1.125 07-Jan-2003  mrg - add a new message tag for level15 software NMI, and switch ddb to use this
rather than the level13 software intr xpmsg area. now DDB IPI's don't lock
the xpmsg_lock and we avoid recursion and more.
- don't actually use cpuinfo.msg.lock yet, xpmsg_lock suffices.
- reread the pending register on mbus hypersparc cpus to avoid bugs in the
h/w that cause IPI's to be missed.
 1.124 06-Jan-2003  pk Protect FPU context switching with its own lock.
 1.123 06-Jan-2003  mrg - md_fpumid = -1 => md_fpu = NULL, in some #ifdef FPU_DEBUG code
- only call KERNEL_PROC_UNLOCK() if we called KERNEL_PROC_LOCK() originally.
 1.122 05-Jan-2003  pk trap(T_FPE): reset the `p_md.md_fpu' when preempting the FPU.
 1.121 03-Jan-2003  pk Define a few XCALL? shorthand macros to avoid clutter.
 1.120 03-Jan-2003  pk Finish FPU context switching on SMP systems.
 1.119 31-Dec-2002  pk rwindow debug code: display the current cpu number.
 1.118 26-Dec-2002  martin Conditionalize T_DBPAUSE trap handling on #ifdef MULTIPROCESSOR to make
single CPU kernels compile again.
 1.117 23-Dec-2002  pk xcallintr() receive a `clockframe *' argument, not a `trapframe *'.
Setup a DDB context for paused CPUs by defining a soft trap (T_DBPAUSE)
which uses the generic trap handler code to get the trapframe constructed
and then calls on a debugger-defined `suspend' routine.
 1.116 21-Dec-2002  manu Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.
 1.115 17-Dec-2002  pk branches: 1.115.2;
Deal with an `unimplemented flush' trap from kernel mode.
 1.114 14-Dec-2002  christos release the kernel lock if trace_enter fails.
XXX[1]: We need to fix all platforms that do this.
XXX[2]: x86 does not check for MPSAFE syscalls before grabbing the lock.
 1.113 15-Nov-2002  manu Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.
 1.112 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.111 20-Jun-2002  christos remove syscall debugging code; thanks eduardo for fixing the code! looks
much nicer now.
 1.110 19-Jun-2002  agc Fix a typo introduced in the last commit.
 1.109 17-Jun-2002  christos MD systrace gluons.
 1.108 04-Dec-2001  darrenr branches: 1.108.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.107 28-Nov-2001  lukem use #ifdef DDB (for consistency with the rest of the kernel)
 1.106 07-Jul-2001  mrg branches: 1.106.2; 1.106.8;
lock xpmsg_lock around the safefpu ipi.
 1.105 08-Jun-2001  mrg use raise_ipi_wait_and_unlock().
 1.104 26-Mar-2001  pk Missing KERNEL_PROC_LOCK() in the WIN_OF trap code.
 1.103 21-Mar-2001  mrg only lock the kernel around sy_call if !SYCALL_MPSAFE
 1.102 18-Mar-2001  chs in mem_access_fault*(), when invoking the pcb_onfault mechanism, pass the
return value of uvm_fault() to the onfault routine via %o0. users of
pcb_onfault now return this value to their callers rather than always
returning EFAULT. this allows i/o errors in VOP_GETPAGES() to be returned
back to read(), etc.
 1.101 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.100 15-Mar-2001  mrg sprinkle KERNEL_LOCK() and KERNEL_PROC_LOCK() where they're missing. add
SYSCALL_DEBUG support to trap.c.
 1.99 05-Mar-2001  pk branches: 1.99.2;
Fix syntax error in previous change.
 1.98 03-Mar-2001  pk Sprinkle KERNEL_PROC_LOCK()s at the kernel entry points.
 1.97 01-Dec-2000  jdolecek check emul flags for EMUL_HAS_SYS___syscall instead of comparing
callp to sysent; the COMPAT_AOUT hack is gone
 1.96 27-Nov-2000  pk Undo most of rev 1.94 to make a.out emulation work again.
 1.95 23-Nov-2000  chs fix reversed keywords in previous commit.
 1.94 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.93 29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.92 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.91 27-May-2000  sommerfeld 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.90 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.89 24-May-2000  thorpej Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).
 1.88 08-Feb-2000  mycroft Add a bunch of debugging code, #ifdef FPU_DEBUG, which attempts to
trap FPU usage in the kernel.
 1.87 05-Dec-1999  ragge clrnd()/clbase() discarding.
 1.86 17-Sep-1999  thorpej branches: 1.86.2; 1.86.8;
Centralize the declaration and clearing of `cold'.
 1.85 28-Jun-1999  pk Ignore (but still generate a console warning) unhandled user-generated traps.
 1.84 24-Mar-1999  mrg branches: 1.84.4;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.83 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.82 18-Mar-1999  chs for emul_sunos processes, don't change vmspace->vm_maxsaddr
for faults within a fudge factor of the end of the stack.
the sunos ld.so maps some zero-fill memory there and uses
it while loading shared libs. ignoring these shenanigans
allows ps to report the correct stack usage for sunos programs.
 1.81 23-Feb-1999  pk Accept __syscall() in NetBSD a.out emulation.
 1.80 24-Jan-1999  pk Read & clear fault status register after probing translation.
 1.79 20-Jan-1999  pk Catch `Unimplemented Flush' traps.
 1.78 14-Dec-1998  kleink Also need to initialize the queue length of a newly allocated fpstate.
 1.77 12-Nov-1998  ws Typo
 1.76 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.75 12-Oct-1998  pk `cpcb' (pointer to current u.area) is now a per-CPU variable.
 1.74 30-Sep-1998  pk Make the current FPU owner (`fpproc') a per-CPU entity. Unresolved issue
as yet: lazy FPU context switching may require co-operation from other
CPUs.
 1.73 20-Sep-1998  pk Async arguments are no longer passed to the memory fault handler.
 1.72 07-Sep-1998  pk Adapt to cpuvar.h changes.
 1.71 06-Sep-1998  pk Sanitize memerr*() a bit.
 1.70 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.69 04-Jul-1998  jonathan defopt DDB.
 1.68 26-Jun-1998  thorpej defopt COMPAT_SVR4
 1.67 25-Jun-1998  thorpej defopt KTRACE
 1.66 12-Jun-1998  fair apply patch from PR#4626 to allow DDB to deal with kernel traps.
 1.65 06-May-1998  pk Do not request more privileges from vm_fault() than required, i.e. don't
request read access in addition to write access on a write fault.
 1.64 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.63 07-Feb-1998  chs fix initialized variable.
 1.62 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.61 28-Jan-1998  thorpej Use offsetof() from libkern.h
 1.60 27-Sep-1997  pk Move the "unimplemented software trap" message within `#ifdef DIAGNOSTIC'
and use uprintf() for the notification.
 1.59 20-Sep-1997  pk Do not skip over a break trap instruction, now that the DDB code can
do it properly.
 1.58 12-Sep-1997  pk Update syscall() and setregs() in the wake of the recent execve() changes.
 1.57 29-Jul-1997  fair branches: 1.57.2;
%x -> 0x%x
 1.56 06-Jul-1997  pk Have a patchable variable `ignore_bogus_traps' (0 by default) that
controls whether or we panic when receiving an unhandled trap.
 1.55 29-Jun-1997  pk Fix typo in last commit.
 1.54 28-Jun-1997  pk Accommodate non-VM_PMAP_HACK code.
 1.53 15-Mar-1997  pk Remove call to mmu_pagein4m(), which is of little use.
 1.52 14-Mar-1997  christos - move instruction emulation and alignment fixing to emul.c
- add sparc-v8 {s,u}{mul,div}{cc,} instruction emulation
 1.51 11-Mar-1997  pk 4m memory fault traps: simplify fault address logic, since per-CPU
fault-status reading stubs pre-cook the arguments.

illegal instruction trap: catch iflush instructions that cause this trap
on some CPU/MMU combinations.
 1.50 01-Dec-1996  pk branches: 1.50.6;
Handle T_IDIV0 like T_DIV0.
 1.49 16-Nov-1996  pk Remove "trap#29" debugging code. These traps have disappeared since a bug
was fixed in the pamp code ("stale PTEs", pmap.c rev. 1.62).
 1.48 13-Nov-1996  thorpej Use bitmask_snprintf().
 1.47 13-Oct-1996  christos backout previous kprintf change
 1.46 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.45 26-Sep-1996  christos Implement T_FIXALIGN by adding code to fix unaligned accesses and a bit
in md_flags. This should bring the solaris mac emulator software a step
closer to working.
 1.44 13-Jun-1996  pk Allow DIAGNOSTIC kernels a FLUSHWIN trap in order to record stack traces
(currently used by the nullfs filesystem code, noted by der mouse).
 1.43 27-May-1996  pk mmu_pagein() is only useful on sun4/sun4c. For now, keep a `mmu_pagein4m()'
within `#ifdef DEBUG' for monitoring.

Push user windows to stack in pmap_extract() if we need to switch contexts.
 1.42 16-May-1996  abrown branches: 1.42.4;
Copyright police (s/Harvard University/Harvard College/).
 1.41 14-May-1996  mrg KNF some debug statements.
 1.40 31-Mar-1996  pk Aaron's sun4m-related trap handling (memory faults).

Note that fork() no longer return in syscall() in the child.

Add a couple of `#ifdef DEBUG's.
 1.39 30-Mar-1996  christos Remove u_int casts from the printf %b formats.
 1.38 26-Mar-1996  pk Bitfields are unsigned.
 1.37 26-Mar-1996  pk Back to normal printf()s, now that gcc understands `%b'.
 1.36 18-Mar-1996  christos Avoid unused label warning.
 1.35 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.34 14-Mar-1996  pk Insert child_return() for the benefit of child return path from cpu_fork().
 1.33 04-Jul-1995  christos trap.c: Add svr4 software traps. Fix bug in errno mapping.
svr4_machdep.c: Add siginfo translation (from mrg), add some software traps.
 1.32 08-May-1995  pk Use VA_INHOLE().
Define arguments to mmu_pagein() in terms of MI VM constants; an idea from Theo.
 1.31 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.30 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.29 13-Apr-1995  mycroft EMUL_IBCS2_ELF -> EMUL_SVR4; EMUL_IBCS2_{COFF,XOUT} -> EMUL_IBCS2
 1.28 13-Apr-1995  pk Use `register_t'.
 1.27 31-Mar-1995  christos Moved KGDB trap 0x88 to 0x8a, and made 0x88 to be svr4 syscall [this is what
solaris uses]. Stubs for the missing and currently unused signal functions
stolen from the i386 code.
 1.26 26-Mar-1995  cgd invoke ktrsyscall with (vp, code, argsize, args) as args.
 1.25 06-Dec-1994  deraadt vm access permissions give SIGSEGV
alignment errors give SIGBUS
 1.24 20-Nov-1994  deraadt copyright/Id cleanup
 1.23 26-Oct-1994  deraadt sunos compat changes
 1.22 20-Oct-1994  cgd update for new syscall args description mechanism
 1.21 27-Sep-1994  deraadt USPACE
 1.20 26-Aug-1994  deraadt an annoying tab
 1.19 21-May-1994  deraadt vmmeter
 1.18 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.17 13-May-1994  deraadt setrunqueue
 1.16 07-May-1994  deraadt postsig
 1.15 05-May-1994  deraadt revert to sticks instead of stime
 1.14 05-May-1994  deraadt flag foo
 1.13 22-Apr-1994  pk small nit
 1.12 08-Apr-1994  deraadt oops with sysent
 1.11 04-Apr-1994  deraadt 64 bit syscalls
 1.10 23-Mar-1994  pk DDB support
 1.9 01-Feb-1994  deraadt sparc runs in current today
 1.8 01-Dec-1993  pk Make `ktrace' record the system call entries in addition to just a bunch
of return codes.
 1.7 27-Nov-1993  deraadt page fault debug code goes away
 1.6 10-Nov-1993  deraadt Duh.
 1.5 10-Nov-1993  deraadt use p_emul flag to indicate OS emulation
handle syscalls at standard sun place, ie. trap#80 not #89
add SunOS OMAGIC support
 1.4 27-Oct-1993  deraadt slightly better syscall diagnostics.
 1.3 11-Oct-1993  deraadt machdep.c: setregs() adjusts the stack correct and warns about problems
cpu_exec_aout_makecmds() that understands sunos ZMAGIC.
trap.c: just Theo's debugging stuff, delete later.
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.42.4.2 03-Jul-1996  jtc >Allow DIAGNOSTIC kernels a FLUSHWIN trap ...
 1.42.4.1 12-Jun-1996  pk Pull down from trunk:
> mmu_pagein() is only useful on sun4/sun4c ...
 1.50.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.57.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.57.2.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.57.2.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.84.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.86.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.86.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.86.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.86.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.86.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.86.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.99.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.99.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.106.8.27 16-Jan-2003  martin Fix merge botches.
 1.106.8.26 15-Jan-2003  thorpej Sync with HEAD.
 1.106.8.25 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.106.8.24 07-Jan-2003  thorpej Sync with HEAD.
 1.106.8.23 07-Jan-2003  martin Fix merge botch. Thanks to Matthew Green for testing.
 1.106.8.22 07-Jan-2003  martin Fix botch in #ifdef DEBUG output.
 1.106.8.21 06-Jan-2003  martin Catch up to -current.
 1.106.8.20 03-Jan-2003  thorpej Fix a couple of straggling fpproc's.
 1.106.8.19 03-Jan-2003  thorpej Sync with HEAD (again).
 1.106.8.18 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.106.8.17 29-Dec-2002  thorpej Sync with HEAD.
 1.106.8.16 19-Dec-2002  thorpej Sync with HEAD.
 1.106.8.15 11-Dec-2002  thorpej Sync with HEAD.
 1.106.8.14 18-Oct-2002  nathanw Catch up to -current.
 1.106.8.13 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.106.8.12 01-Aug-2002  nathanw Catch up to -current.
 1.106.8.11 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.106.8.10 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.106.8.9 21-Jun-2002  gmcgarry Pull in appropriate headers; LWPify some more
 1.106.8.8 20-Jun-2002  nathanw Catch up to -current.
 1.106.8.7 08-Jan-2002  nathanw Catch up to -current.
 1.106.8.6 17-Dec-2001  nathanw cpu_upcall() -> sa_upcall_userret().
 1.106.8.5 30-Nov-2001  pk Redo last more sensibly.
 1.106.8.4 29-Nov-2001  pk Avoid unused variable warning in child_return if KTRACE is not #defined.
 1.106.8.3 28-Nov-2001  pk No longer need to call lwp_exit() from userret().
 1.106.8.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.106.8.1 07-Jul-2001  pk file trap.c was added on branch nathanw_sa on 2001-11-20 16:31:59 +0000
 1.106.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.106.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.106.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.108.8.2 17-Jul-2002  gehenna catch up with -current.
 1.108.8.1 15-Jul-2002  gehenna catch up with -current.
 1.115.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.136.2.8 11-Dec-2005  christos Sync with head.
 1.136.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.136.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.136.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.136.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.136.2.3 03-Sep-2004  skrll Sync with HEAD
 1.136.2.2 03-Aug-2004  skrll Sync with HEAD
 1.136.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.153.2.2 16-Mar-2005  tron Pull up revision 1.156 (requested by chs in ticket #1158):
sun4c hardware reports faults by the atomic load/store instructions as
read faults even if the problem was that the memory was read-only.
detect this case and relabel the fault as both read and write.
part of PR 25633, PR 25896.
 1.153.2.1 24-Apr-2004  jdc branches: 1.153.2.1.2;
Pull up revision 1.154 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.153.2.1.2.1 16-Mar-2005  tron Pull up revision 1.156 (requested by chs in ticket #1158):
sun4c hardware reports faults by the atomic load/store instructions as
read faults even if the problem was that the memory was read-only.
detect this case and relabel the fault as both read and write.
part of PR 25633, PR 25896.
 1.155.6.1 12-Feb-2005  yamt sync with head.
 1.155.4.1 29-Apr-2005  kent sync with -current
 1.158.2.5 21-Jan-2008  yamt sync with head
 1.158.2.4 03-Sep-2007  yamt sync with head.
 1.158.2.3 26-Feb-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.159.2.1 02-Nov-2005  yamt sync with head.
 1.163.10.4 11-Aug-2006  yamt sync with head
 1.163.10.3 24-May-2006  yamt sync with head.
 1.163.10.2 01-Apr-2006  yamt sync with head.
 1.163.10.1 13-Mar-2006  yamt sync with head.
 1.163.8.2 01-Jun-2006  kardel Sync with head.
 1.163.8.1 22-Apr-2006  simonb Sync with head.
 1.163.6.1 09-Sep-2006  rpaulo sync with head
 1.163.2.2 14-Nov-2005  uwe ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.163.2.1 14-Nov-2005  uwe file trap.c was added on branch yamt-readahead on 2005-11-14 03:30:50 +0000
 1.164.2.3 19-Apr-2006  elad sync with head - hopefully this will work
 1.164.2.2 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.164.2.1 07-Mar-2006  elad file trap.c was added on branch elad-kernelauth on 2006-03-08 00:43:13 +0000
 1.165.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.167.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.170.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.170.4.1 12-Jan-2007  ad sparc MD changes.
 1.171.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.172.32.2 08-Jan-2008  bouyer Sync with HEAD
 1.172.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.172.28.1 01-Jan-2008  ad Locking changes for sparc.
 1.172.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.172.20.1 09-Jan-2008  matt sync with HEAD
 1.174.8.1 18-May-2008  yamt sync with head.
 1.174.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.174.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.175.8.1 19-Oct-2008  haad Sync with HEAD.
 1.175.4.3 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.175.4.2 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.175.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.175.2.3 11-Aug-2010  yamt sync with head.
 1.175.2.2 11-Mar-2010  yamt sync with head
 1.175.2.1 04-May-2009  yamt sync with head.
 1.176.4.1 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.176.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.181.4.3 21-Apr-2011  rmind sync with head
 1.181.4.2 05-Mar-2011  rmind sync with head
 1.181.4.1 30-May-2010  rmind sync with head
 1.181.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.186.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.188.6.2 02-Jun-2012  mrg sync to latest -current.
 1.188.6.1 24-Feb-2012  mrg sync to -current.
 1.188.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.188.2.2 23-May-2012  yamt sync with head.
 1.188.2.1 17-Apr-2012  yamt sync with head
 1.190.4.1 18-May-2014  rmind sync with head
 1.190.2.2 03-Dec-2017  jdolecek update from HEAD
 1.190.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.191.6.3 05-Feb-2017  skrll Sync with HEAD
 1.191.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.191.6.1 06-Apr-2015  skrll Sync with HEAD
 1.195.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.196.16.1 10-Jun-2019  christos Sync with HEAD
 1.196.14.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.198.4.1 31-Mar-2021  martin Pull up following revision(s) (requested by christos in ticket #1240):

sys/arch/sparc/sparc/trap.c: revision 1.199

PR port-sparc/55573: remove kernel message about disabled coprocessor
instructions - it is triggered by userland trying to detect availability
of sparcv9 VIS instructions.
 1.199.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.11 10-Dec-2001  uwe Fixed VA for microSPARC-IIep PCI controller.
 1.10 04-Jan-2000  pk branches: 1.10.8; 1.10.12;
* Expand IOMMU DVMA space to top of address space.
* Remove confusing comments.
 1.9 23-Aug-1998  pk branches: 1.9.6; 1.9.12;
Rename DVMA constants.
 1.8 10-Mar-1997  pk Move VA of the sun4/sun4c Interrupt Enable register from locore.
Define VA for the per-CPU `cpuinfo' structure.
 1.7 16-May-1996  abrown branches: 1.7.8;
Copyright police (s/Harvard University/Harvard College/).
 1.6 31-Mar-1996  pk Add sun4m VA definitions (for clock and interrupt).
Make these generic for all architectures (i.e. avoid `#if defined(SUN4*)'s).
 1.5 06-Dec-1994  deraadt place message buffer in low physical memory, so that it can survive a
warm boot. the sun4 boot program corrupts some memory there so adjust
upwards on the sun4. (from chuck)
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 25-Aug-1994  deraadt tmpmap page for sun4
 1.2 20-Aug-1994  deraadt TIMERREG_VA is passed to locore.s (via genassym). Since NBPG can be
a variable, it cannot be part of this macro.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.7.8.1 12-Mar-1997  is Merge in changes from The Trunk
 1.9.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.6.1 16-Jan-2000  he Pull up revision 1.10 (requested by pk):
Allow old sbus cards with 24-bit devices (e.g. lance) to be
configured correctly on sun4m machines.
 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.108 20-Mar-2023  hannken Adjust pc/npc before syscall allowing EJUSTRETURN to return
to the next instruction. Only ERESTART should return to
the same instruction. Differences to sparc64 reduced.

Test t_ptrace_wait:syscallemu1 now passes on sparc.

Fixes PR kern/52166 "syscallemu does not work on sparc (32-bit)"

Ok: Martin Husemann
 1.107 19-Feb-2012  rmind branches: 1.107.70;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.106 18-Apr-2011  rmind branches: 1.106.4; 1.106.8;
Replace malloc with kmem, and remove M_SUBPROC.
 1.105 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.104 10-Feb-2011  pooka Make vmapbuf() return success/error and make physio deal with a
failure.
 1.103 14-Jan-2011  rmind branches: 1.103.2; 1.103.4;
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.102 13-Jan-2011  mrg introduce a hack to workaround the savefpstate IPI get's NULL
struct fpstate *.

add a new entry point ipi_savefpstate() that is used for this IPI
instead of the plain ipi_savefpstate(). check for %o0 being NULL,
and if so, just return.

add event counters for the savefpstate IPI, and another one for
when it detects the NULL problem.

make the cpu_info struct xmpsg be aligned to a single cache line.

with this change applied (and another minor change in testing) my
SS20 with dual SM75's has survived for 17 hours on build.sh -j5,
and has reported 7 NULL savefps. (the minor change seems to have
a significant effect at reducing this number, but more testing is
needed for it.)


XXX: this is horrible and we really need to find the real problem
XXX: but this should let people use sparc smp again, and fixes
XXX: for the real problem can be tested by seeing if any of the
XXX: savefp IPI null counter becomes non-zero.
 1.101 21-Nov-2009  rmind branches: 1.101.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.100 29-May-2009  mrg fix up cpu_setfunc() as noted by uwe:

- don't call lwp_startup for cpu_setfunc() users
- introduce lwp_setfunc_trampoline instead
- no need to set the "new" lwp for setfunc
 1.99 27-May-2009  mrg sync this a little with sparc64: use cpu_setfunc() at the end of cpu_lwp_fork()
 1.98 16-May-2009  cegger KNF, same object code generated.
 1.97 18-Mar-2009  cegger bcopy -> memcpy
 1.96 19-Nov-2008  ad branches: 1.96.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.95 16-Oct-2008  martin branches: 1.95.2; 1.95.4; 1.95.8;
Resurrect cpu_setfunc(), adapted to new world order.
 1.94 05-Jan-2008  martin branches: 1.94.6; 1.94.10; 1.94.16;
Add missing include
 1.93 17-Oct-2007  garbled branches: 1.93.2; 1.93.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.92 19-May-2007  mrg branches: 1.92.10;
fix the two problems i introduced with yamt-idlelwp:

- in lwp_trampoline, oldlwp is already in %o0. don't save or the wrongly
saved copy from cpu_lwp_fork(). as repeatedly pointed out my uwe.

- in cpu_idle use retl not ret. as pointed out by martin.


thanks to uwe/martin/tnn for all the real debugging work.
 1.91 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.90 04-Mar-2007  christos branches: 1.90.2; 1.90.4; 1.90.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.89 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.88 09-Feb-2007  ad branches: 1.88.2;
Merge newlock2 to head.
 1.87 31-Aug-2006  matt branches: 1.87.2;
Make cpu_coredump dependent on COREDUMP
 1.86 16-Nov-2005  uwe branches: 1.86.4; 1.86.8;
Drop trailing whitespace.
 1.85 14-Nov-2005  uwe branches: 1.85.2;
ANSIify. Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.84 27-Oct-2005  uwe We need to init p_md.md_flags on fork, so implement cpu_proc_fork().
 1.83 10-Jun-2005  matt branches: 1.83.2; 1.83.4;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.
 1.82 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.81 17-Sep-2004  skrll branches: 1.81.4; 1.81.6;
There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.80 28-Aug-2004  thorpej Garbage-collect pagemove(); nothing use it anymore (YAY!!!)
 1.79 02-May-2004  pk The cpu_exit() detour is no longer necessary.
 1.78 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.77 15-Jul-2003  lukem __KERNEL_RCSID()
 1.76 29-Jun-2003  fvdl branches: 1.76.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.75 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.74 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.73 07-May-2003  pk cpu_exit(): keep the MD FPU pointers in a consistent state since the thread
structure will linger for a while on various zombie lists.
 1.72 07-May-2003  pk Fixup comment on cpu_exit().
 1.71 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.70 12-Jan-2003  pk fpulock: encapsulate required IPL raise in the FPU LOCK/UNLOCK macros.
 1.69 09-Jan-2003  mrg remove a line accidentally commited in previous.
 1.68 09-Jan-2003  mrg call splclock() around the FPU_LOCK().

XXX: pk suggests we can make the this a sleeping lock.
 1.67 06-Jan-2003  pk Protect FPU context switching with its own lock.
 1.66 03-Jan-2003  pk Define a few XCALL? shorthand macros to avoid clutter.
 1.65 03-Jan-2003  pk Finish FPU context switching on SMP systems.
 1.64 16-Dec-2002  pk The cache flush routines now take a CPU context parameter. This is going
to be necessary in SMP kernels.
 1.63 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.62 30-Dec-2001  pk In cpu_fork() set tf_npc as well in case a signal is taken in child_return()
which will cause the values of tf_pc and tf_npc set here in cpu_fork()
to be restored and used to return to user space from sigreturn() eventually
(before that the tf_pc and tf_npc set in sendsig() will be used in
proc_trampoline()).

Also, the fork system call never uses the SYSCALL_G2RFLAG shortcut, so drop
the code handling that.
 1.61 30-Dec-2001  pk Change interface between cpu_fork() and proc_trampoline() so that `tf_pc'
(instead of `tf_npc') contains the user-space return address. This ensures
entering the signal trampoline code correctly in case we take handled
signal during child_return().
 1.60 10-Sep-2001  chris branches: 1.60.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.59 19-Aug-2001  chs branches: 1.59.2;
in vunmapbuf(), call pmap_*remove() explicitly since uvm_km_free_wakeup()
will soon no longer do it for us.
 1.58 29-Jul-2001  chs use pmap_k* for buffer cache pages.
 1.57 24-Apr-2001  thorpej branches: 1.57.2;
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.56 29-Jun-2000  mrg branches: 1.56.2;
remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.55 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.54 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.53 17-May-2000  pk branches: 1.53.2;
vmapbuf: should not map the kernel address uncacheable.
 1.52 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.51 20-Jan-2000  sommerfeld 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.50 04-Dec-1999  ragge CL* discarding.
 1.49 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.48 08-Jul-1999  thorpej branches: 1.48.2; 1.48.4; 1.48.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.47 26-May-1999  thorpej Generally update the comment above vunmapbuf().
 1.46 26-May-1999  thorpej Generally update the comment above the vmapbuf() implementations.
 1.45 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.44 26-Mar-1999  mycroft branches: 1.44.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.43 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.42 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.41 30-Sep-1998  pk Make the current FPU owner (`fpproc') a per-CPU entity. Unresolved issue
as yet: lazy FPU context switching may require co-operation from other
CPUs.
 1.40 09-Sep-1998  thorpej In cpu_coredump(), use MID_MACHINE rather than MID_* (whatever it expands
to).
 1.39 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.38 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.37 31-Jul-1998  pk dvma_malloc(), dvma_mapin() and dvma_mapout() are gone; all drivers
the use bus_dma(9) interface now.
 1.36 28-Jul-1998  thorpej branches: 1.36.2;
Don't cast the null residual pointer passed to vn_rdwr().
 1.35 17-Jul-1998  pk In dvma_mapout(), make sure to not overrun the buffer when flushing the cache.
 1.34 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.33 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the sparc portion.

this will be KNF'd shortly. :-)
 1.32 18-Oct-1997  gwr Make sure vunmapbuf will kmem_free_wakeup() the same VA range
that came from kmem_alloc_wait(). (Same problem as PR#4120).
 1.31 27-Sep-1997  pk Insert a hack to allocate IOMMU addresses congruent to the kernel virtual
address that being DVMAed to.
 1.30 10-Mar-1997  pk branches: 1.30.4;
Use cache flush routines provided in `cpuinfo'.
 1.29 28-Oct-1996  pk branches: 1.29.6;
Call kvm_uncache() from dvma_malloc() where it belongs and make sure
it's called when SUN4M is nor defined.
Merge in changes from Jason to make dvma_mapin() work on (sun4c) machines
with a write-back cache.
 1.28 02-Aug-1996  pk Fill in `pcb_psr' in the PCB before copying it to the new child PCB.
 1.27 16-May-1996  abrown branches: 1.27.4;
Copyright police (s/Harvard University/Harvard College/).
 1.26 22-Apr-1996  christos remove include of <sys/cpu.h>
 1.25 04-Apr-1996  abrown Add back support for cached DVMA on SuperSPARC (sun4m) machines that was lost
during merge
 1.24 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.23 15-Mar-1996  christos Fix prototypes that were added with the latest kpc changes.
 1.22 14-Mar-1996  christos Add prototypes and fix bugs:
- softclock was called with extra argument.
- missing %x formats in printf's
- kgdb_copy called with only two arguments.

Fix conf.c so that it used the _conf.h files from other places instead of
rolling its own.
 1.21 14-Mar-1996  pk Implement cpu_set_kpc() and use its machinery to by-pass a child out
of the kernel from cpu_fork().
 1.20 27-Feb-1996  pk Be sure to malloc() in page-sized units.
 1.19 05-Feb-1996  christos vm prototype changes.
 1.18 11-Dec-1995  pk Agree with prototype.
 1.17 11-Dec-1995  pk The return of dvma_malloc/dvma_free in a different shape.
 1.16 07-Dec-1995  pk Don't forget to flush the cache in vunmapbuf().
 1.15 06-Dec-1995  pk Have v[un]mapbuf() allocate from plain kernel map instead of dvma space.
Remove dvma_malloc/dvma_free; drivers should allocate kernel memory and
use dvma_mapin/dvma_mapout to double map it in DVMA space.

Make the resource map `dvmamap' responsible for all DVMA allocation.
The VM map `physmap' only serves the role of placeholder in the VM system.
 1.14 26-Jun-1995  pk Define dvma_map{in,out}() to map a buffer into DVMA space. These are
safe for use at interrupt time.

Implement vmapbuf() and vunmapbuf() in terms of these new functions.
 1.13 19-May-1995  pk cpu_swapout() not needed after all.
 1.12 08-May-1995  pk implement cpu_swapout()
 1.11 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.10 23-Feb-1995  pk cache_flush() only if vactype!=VAC_NONE
 1.9 20-Nov-1994  deraadt copyright/Id cleanup
 1.8 27-Sep-1994  deraadt USPACE
 1.7 25-May-1994  pk New style core dumps.
 1.6 24-May-1994  deraadt registers coredump crud, going away soon
 1.5 19-May-1994  deraadt no u_md
 1.4 19-May-1994  deraadt enable cpu_coredump
 1.3 19-May-1994  deraadt catchup to 4.4-lite and delete some debug stuff
 1.2 11-Oct-1993  deraadt pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek
autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
setregs() sets pc/npc/stack, note: signal delivery code needs
fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.27.4.1 02-Aug-1996  jtc Pulled up from rev 1.28 by request from Paul Kranenburg
 1.29.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.30.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.44.4.3 11-Aug-1999  chs add casts for trunc_page() and round_page() args.
 1.44.4.2 02-Aug-1999  thorpej Update from trunk.
 1.44.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.48.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.48.4.1 15-Nov-1999  fvdl Sync with -current
 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.53.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.56.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.57.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.57.2.4 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.57.2.3 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.57.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.57.2.1 03-Aug-2001  lukem update to -current
 1.59.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.60.4.13 16-Jan-2003  martin Fix merge botches.
 1.60.4.12 15-Jan-2003  thorpej Sync with HEAD.
 1.60.4.11 06-Jan-2003  martin Catch up to -current.
 1.60.4.10 03-Jan-2003  thorpej Pass exit2 or lwp_exit2 to switchexit(), as is suggested in comments,
and eliminate switchlwpexit().
 1.60.4.9 03-Jan-2003  thorpej Sync with HEAD (again).
 1.60.4.8 19-Dec-2002  thorpej Sync with HEAD.
 1.60.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.60.4.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.60.4.5 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.60.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.60.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.60.4.2 20-Nov-2001  pk Convert to SA framework.
Compilable, but some core functionality stubbed out still.
 1.60.4.1 10-Sep-2001  pk file vm_machdep.c was added on branch nathanw_sa on 2001-11-20 16:31:59 +0000
 1.76.2.7 11-Dec-2005  christos Sync with head.
 1.76.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.76.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.76.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.76.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.76.2.2 03-Sep-2004  skrll Sync with HEAD
 1.76.2.1 03-Aug-2004  skrll Sync with HEAD
 1.81.6.1 12-Feb-2005  yamt use new apis.
 1.81.4.1 29-Apr-2005  kent sync with -current
 1.83.4.1 02-Nov-2005  yamt sync with head.
 1.83.2.5 21-Jan-2008  yamt sync with head
 1.83.2.4 03-Sep-2007  yamt sync with head.
 1.83.2.3 26-Feb-2007  yamt sync with head.
 1.83.2.2 30-Dec-2006  yamt sync with head.
 1.83.2.1 21-Jun-2006  yamt sync with head.
 1.85.2.2 22-Nov-2005  yamt sync with head.
 1.85.2.1 14-Nov-2005  yamt file vm_machdep.c was added on branch yamt-readahead on 2005-11-22 16:08:03 +0000
 1.86.8.1 03-Sep-2006  yamt sync with head.
 1.86.4.1 09-Sep-2006  rpaulo sync with head
 1.87.2.1 12-Jan-2007  ad sparc MD changes.
 1.88.2.3 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.88.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.88.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.90.10.1 22-May-2007  matt Update to HEAD.
 1.90.4.1 11-Jul-2007  mjf Sync with head.
 1.90.2.1 27-May-2007  ad Sync with head.
 1.92.10.2 09-Jan-2008  matt sync with HEAD
 1.92.10.1 06-Nov-2007  matt sync with HEAD
 1.93.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.93.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.94.16.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.94.16.1 19-Oct-2008  haad Sync with HEAD.
 1.94.10.3 11-Mar-2010  yamt sync with head
 1.94.10.2 20-Jun-2009  yamt sync with head
 1.94.10.1 04-May-2009  yamt sync with head.
 1.94.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.95.8.1 21-Apr-2010  matt sync to netbsd-5
 1.95.4.3 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.95.4.2 09-Jan-2010  snj Pull up following revision(s) (requested by mrg in ticket #1223):
sys/arch/sparc/include/cpu.h: revision 1.86
sys/arch/sparc/sparc/locore.s: revision 1.246
sys/arch/sparc/sparc/vm_machdep.c: revision 1.100
fix up cpu_setfunc() as noted by uwe:
- don't call lwp_startup for cpu_setfunc() users
- introduce lwp_setfunc_trampoline instead
- no need to set the "new" lwp for setfunc
 1.95.4.1 09-Jan-2010  snj Pull up following revision(s) (requested by mrg in ticket #1223):
sys/arch/sparc/sparc/vm_machdep.c: revision 1.99
sync this a little with sparc64: use cpu_setfunc() at the end of cpu_lwp_fork()
 1.95.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.95.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.96.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.101.4.2 21-Apr-2011  rmind sync with head
 1.101.4.1 05-Mar-2011  rmind sync with head
 1.103.4.2 05-Mar-2011  bouyer Sync with HEAD
 1.103.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.103.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.106.8.1 24-Feb-2012  mrg sync to -current.
 1.106.4.1 17-Apr-2012  yamt sync with head
 1.107.70.1 22-Mar-2023  martin Pull up following revision(s) (requested by hannken in ticket #124):

tests/lib/libc/sys/t_ptrace_syscall_wait.h: revision 1.3
sys/arch/sparc/sparc/syscall.c: revision 1.32
sys/arch/sparc/sparc/vm_machdep.c: revision 1.108

Adjust pc/npc before syscall allowing EJUSTRETURN to return
to the next instruction. Only ERESTART should return to
the same instruction. Differences to sparc64 reduced.

Test t_ptrace_wait:syscallemu1 now passes on sparc.

Fixes PR kern/52166 "syscallemu does not work on sparc (32-bit)"

Ok: Martin Husemann
 1.22 13-Dec-2009  nakayama System utilities, boot programs and kernel modules are machine
(port) specific not CPU, so use MACHINE not MACHINE_ARCH.
 1.21 14-Feb-2009  abs Convert more MACHINE tests to MACHINE_ARCH
 1.20 11-Dec-2005  christos branches: 1.20.78; 1.20.86; 1.20.92;
merge ktrace-lwp.
 1.19 07-Dec-2003  mrg merge ultrasparc ofwboot / ofwboot.net.
 1.18 17-May-2003  nakayama branches: 1.18.2;
Don't traverse here in case of sparc64 32-bit environment.
 1.17 07-May-2002  lukem decommission old installboot; it doesn't work on bootxx anymore anyway.
 1.16 04-Mar-2001  mrg branches: 1.16.4; 1.16.8;
build sparc64 bootblk, ofwboot, & ofwboot.net on sparc
 1.15 01-Jun-1997  mrg branches: 1.15.22;
Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.14 07-May-1997  mycroft Don't use _SUBDIRUSE outside of bsd.subdir.mk.
 1.13 24-Jan-1997  pk Adapt to sys/lib/lib{sa,kern}/Makefile.inc changes
 1.12 18-Oct-1996  thorpej Use ${INSTALL}.
 1.11 05-Oct-1996  mrg update for kern/sa lib Makefile.inc changes.
 1.10 09-Oct-1995  pk Brr.. libkern.o is way too big for our bootxx..
 1.9 05-Oct-1995  pk Script to assist installing second-stage boot programs.
 1.8 30-Sep-1995  pk Make this work with OBJ dirs.
 1.7 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.6 26-Jun-1995  pk Adapt to new lib{sa,kern} regime.
 1.5 25-Nov-1994  deraadt support obj directory
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 20-Jul-1994  pk Make it work for V0 proms.
First cut at two stage bootstrap.
 1.2 01-Jul-1994  pk Adapt to current libsa.
 1.1 26-Feb-1994  pk Sparc bootblocks (a tight fit)
 1.15.22.1 12-Mar-2001  bouyer Sync with HEAD.
 1.16.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.16.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 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.20.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.86.1 03-Mar-2009  skrll Sync with HEAD.
 1.20.78.2 11-Mar-2010  yamt sync with head
 1.20.78.1 04-May-2009  yamt sync with head.
 1.32 01-Oct-2016  christos deal with PIE and SSP
 1.31 10-Mar-2016  martin branches: 1.31.2;
Add a few includes of bsd.own.mk to avoid broken test conditions
on ACTIVE_CC - this might not be the correct fix for PR 50930,
but it avoids the issue.
 1.30 27-Feb-2016  joerg When building with clang, optimise for minimal size and skip frame
pointers when possible.
 1.29 12-Aug-2013  joerg branches: 1.29.6;
Build boot loaders without unwind tables.
 1.28 25-Aug-2010  christos branches: 1.28.8; 1.28.18; 1.28.22;
factor out the floppy detection code.
 1.27 27-May-2010  dholland Introduce .WAIT into the cleandir rule for blasting the libsa/libkern/etc.
trees, because it can race with the libsa/libkern/etc. makefiles' own
cleandir rules. I think I've found all of the uses of the offending idiom...
Closes PR 43360.
 1.26 27-Nov-2009  tsutsui branches: 1.26.2; 1.26.4;
Add src/common/include to -Ipath for proplib(3) so that build works
even without installed DESTDIR.
 1.25 29-Mar-2009  tsutsui Use <bsd.klinks.mk> to create machine and ${MACHINE_ARCH} symlinks.
 1.24 23-Mar-2009  tsutsui - use -Os to shrink bianries
- remove local shrinked memcpy() from bootxx.c bacause
now it's identical with __OPTIMIZE_SIZE__ libsa one
derived from src/common/lib/libc/string/bcopy.c.

Tested netboot from le0 and bootxx + boot from sd0 on SS1+.
 1.23 11-Dec-2005  christos branches: 1.23.78; 1.23.86; 1.23.92;
merge ktrace-lwp.
 1.22 21-Jun-2004  jmc Ignore errors on some rm -rf's for platforms that aren't quite
POSIX compliant
and return errors on r/o source (FreeBSD) for -rf. Fixes PR#25022
 1.21 30-Jul-2003  mrg branches: 1.21.2;
sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.20 17-May-2003  nakayama branches: 1.20.2;
Make sure to remove lib directories.
 1.19 01-Mar-2003  pk Add support for large kernels by searching for a physical memory segment
to fit it in. As a bonus, the kernel is now also mapped to the virtual
address (i.e. KERNBASE) it is linked at.
 1.18 20-Jul-2002  mrg make sparc64 friendly.
 1.17 12-Dec-2001  tv branches: 1.17.8;
MKfoo=no -> NOfoo
 1.16 22-Nov-2001  jmc Don't make the symlinks on clean rules as well as obj rules. Breaks r/o source
trees that haven't gotten to the make obj recursion part of make build
otherwise.
 1.15 31-Oct-2000  pk branches: 1.15.4; 1.15.8;
Change the relocation address of `boot' once again to steer clear of
memory used by the PROM on sun4 and early sun4c machines.
 1.14 20-Oct-2000  pk Change to relocation addresses that currently work on all machines.
boot programs at alternative addresses no longer built and installed
by default.
 1.13 28-Aug-2000  pk Pull down from 1.4 branch: default relocation address = 3E0000
 1.12 21-Feb-2000  pk branches: 1.12.4;
SUN_BOOTPARAM compile-time option is no longer used.
 1.11 21-Feb-2000  pk bootxx links at 0x340000
2nd-stage boot programs choices: 0x200000,0x300000,0x400000,0x700000 (default: 0x300000)
 1.10 21-Feb-2000  pk Build several versions of the second-stage boot program, each linked
to run at a different base address. Boot image build procedures can
pick one which is least likely to fail..

The default boot program is again build to run at 0x340000.
 1.9 23-Jan-2000  mycroft Clean up the machine symlink stuff ever so slightly. Needs to be
standardized between files.
 1.8 25-Nov-1999  pk Suppress the `machine' symlink when making target `obj'.
Also add it to the clean target list.
 1.7 12-Jun-1999  pk branches: 1.7.2; 1.7.8;
Initialize the heap (for alloc()) explicitly, since the `end' symbol
is not necessarily double-word aligned.
 1.6 28-Apr-1999  christos Checkpoint of elf boot stuff:
- Use loadfile for both boot and installboot
- Fix problems with linking in bootxx
- Make installboot work with both a.out and ELF bootxx
- *WILL NOT BOOT YET ELF KERNELS* (a.out kernels work) I am working on it.
 1.5 15-Feb-1999  pk branches: 1.5.2; 1.5.4;
Install the `machine' link again; it went missing a while ago.
Add `-I.' to CPPFLAGS to use it.
 1.4 15-Feb-1999  pk * Add promlib.c to common sources.
* Compile with prototype warnings turned on.
 1.3 13-Feb-1999  lukem convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.2 06-Feb-1999  hannken Define _STANDALONE instead of STANDALONE.
 1.1 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.2 09-Jul-2000  he Apply patch (requested by he, approved by pk):
Move the sparc boot loader close to the 4M limit, so that we
can boot the sysinst kernel without bumping into the boot
loader, and without exceeding the first 4M physical memory
bank. Fixes PR#10059.
 1.5.2.1 22-Feb-2000  he Apply patch (requested by pk):
Make several sparc boot programs to run at different relocated
addresses. The boot build procedures can then pick the one which
is least likely to fail.
 1.7.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.2.2 22-Nov-2000  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.12.4.2 01-Nov-2000  tv Pullup 1.15 [pk]:
Change the relocation address of `boot' once again to steer clear of
memory used by the PROM on sun4 and early sun4c machines.
 1.12.4.1 19-Oct-2000  tv Commit by patch [pk]:
- boot floppy image out of space: use a two disk system
- update INSTALL kernel
- updates/fixes to miniroot image
- support for building CD image
- update installation doc
 1.15.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.15.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.15.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.15.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.8.1 31-Aug-2002  gehenna catch up with -current.
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.2.1 22-Jun-2004  tron Pull up revision 1.22 (requested by jmc in ticket #531):
Ignore errors on some rm -rf's for platforms that aren't quite
POSIX compliant
and return errors on r/o source (FreeBSD) for -rf. Fixes PR#25022
 1.23.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.86.1 28-Apr-2009  skrll Sync with HEAD.
 1.23.78.4 09-Oct-2010  yamt sync with head
 1.23.78.3 11-Aug-2010  yamt sync with head.
 1.23.78.2 11-Mar-2010  yamt sync with head
 1.23.78.1 04-May-2009  yamt sync with head.
 1.26.4.2 05-Mar-2011  rmind sync with head
 1.26.4.1 30-May-2010  rmind sync with head
 1.26.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.26.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.28.22.1 28-Aug-2013  rmind sync with head
 1.28.18.2 03-Dec-2017  jdolecek update from HEAD
 1.28.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.8.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.6.2 05-Oct-2016  skrll Sync with HEAD
 1.29.6.1 19-Mar-2016  skrll Sync with HEAD
 1.31.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.14 01-Oct-2016  christos deal with PIE and SSP
 1.13 19-May-2016  christos branches: 1.13.2;
We don't want PIE!
 1.12 10-Mar-2016  martin Add a few includes of bsd.own.mk to avoid broken test conditions
on ACTIVE_CC - this might not be the correct fix for PR 50930,
but it avoids the issue.
 1.11 27-Feb-2016  joerg Ignore unused arguments for clang as we pass assembler flags and the
like to the preprocessor-only mode. Conditionalize GCC flags that are
not known to clang accordingly.
 1.10 11-Dec-2005  christos branches: 1.10.122; 1.10.142;
merge ktrace-lwp.
 1.9 30-Oct-2005  sekiya sparc needs mostly the same compilation flags for standalone build as does
sparc64. Move them out of the sparc64 conditional.

Okayed by martin@
 1.8 30-Jul-2003  mrg branches: 1.8.16; 1.8.18;
sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.7 20-Aug-2000  mrg branches: 1.7.24;
add/merge sparc64 support.
 1.6 01-Jun-1997  mrg branches: 1.6.22; 1.6.32;
Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.5 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.4 09-Oct-1995  pk Brr.. libkern.o is way too big for our bootxx..
 1.3 30-Sep-1995  pk Make this work with OBJ dirs.
 1.2 18-Sep-1995  chuck Fixed RELOC's to be hex numbers (as expected) rather than decimal.
(e.g. s/340000/0x340000/). Fixes DVMA panic on my sun-4/280 when
booted diskless.
 1.1 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.6.32.1 26-Aug-2000  mrg pull up 1.7. approved by thorpej:
>add/merge sparc64 support.
 1.6.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.24.1 03-Aug-2004  skrll Sync with HEAD
 1.8.18.1 02-Nov-2005  yamt sync with head.
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.10.142.3 05-Oct-2016  skrll Sync with HEAD
 1.10.142.2 29-May-2016  skrll Sync with HEAD
 1.10.142.1 19-Mar-2016  skrll Sync with HEAD
 1.10.122.1 03-Dec-2017  jdolecek update from HEAD
 1.13.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.6 30-Sep-1995  pk Refer to installboot(8)
 1.5 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 20-Jul-1994  pk Make it work for V0 proms.
First cut at two stage bootstrap.
 1.2 27-Feb-1994  pk bootblocks must be stripped.
 1.1 26-Feb-1994  pk A one liner for now.
 1.5 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.4 29-Nov-1996  pk ffs bootblock install can be simplified since installboot(8) handles that now.
To install a TFTPable boot image, we have to play the header tricks here.
 1.3 07-Apr-1996  thorpej Fix typo that caused sun4 machines to be misidentified as sun4c-class.
Fixes reported problem of binstall not stripping the a.out header from
the boot block on sun4 machines.
 1.2 11-Oct-1995  pk Sync filesystem before running installboot.
 1.1 05-Oct-1995  pk branches: 1.1.2;
Script to assist installing second-stage boot programs.
 1.1.2.1 13-Oct-1995  pk Update from trunk: sync filesystem.
 1.14 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.13 17-Sep-1995  pk Correct some prototypes.
 1.12 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.11 25-Jun-1995  pk Reserve arguments 2-4 for SunOS loaders; pass DDB stuff in args 5 and 6.
 1.10 22-Feb-1995  mycroft Use the twiddle() from libsa.
 1.9 11-Dec-1994  pk Follow prototype changes in libsa.
 1.8 06-Dec-1994  pk cosmetic change.
 1.7 25-Nov-1994  deraadt round text segment to __LDPGSZ
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 30-Jul-1994  pk Use PROM node properties to determine device type.
 1.4 20-Jul-1994  pk Make it work for V0 proms.
First cut at two stage bootstrap.
 1.3 01-Jul-1994  pk Adapt to current libsa.
 1.2 20-Mar-1994  pk DDB support
 1.1 26-Feb-1994  pk Sparc bootblocks (a tight fit)
 1.8 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.7 27-Sep-1995  pk Avoid reading the filesystem superblock in bootxx; all info now prepared
by installboot (per Gordon Ross).
 1.6 18-Sep-1995  pk Adapt to libsa changes & some other minor nits.
 1.5 18-Sep-1995  chuck read superblock into &sblock rather than LOADADDR. we can't read
into LOADADDR because it can't be mapped into DVMA space. this fixes
a dvma panic on a sun4 boot from an xd disk.
 1.4 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.3 22-Feb-1995  mycroft Use the twiddle() from libsa.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 20-Jul-1994  pk Make it work for V0 proms.
First cut at two stage bootstrap.
 1.3 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.2 18-Sep-1995  pk Adapt to libsa changes & some other minor nits.
 1.1 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.4 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.3 26-Jun-1995  pk Do away with ROM printf.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 20-Jul-1994  pk Make it work for V0 proms.
First cut at two stage bootstrap.
 1.3 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.2 17-Sep-1995  pk Correct some prototypes.
 1.1 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.3 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 01-Jul-1994  pk Adapt to current libsa.
 1.3 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 26-Feb-1994  pk Sparc bootblocks (a tight fit)
 1.3 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.2 20-Oct-1996  pk Document `-a karch' option.
Fix a formatting nit.
 1.1 30-Sep-1995  pk Manual page for installboot(8).
 1.14 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.13 29-Nov-1996  pk installboot(8) now handles required a.out header munging.
Also, the munging is extended by inserting an instruction that branches
past the header, so the same boot image can be used on all supported
sun platforms.
 1.12 20-Oct-1996  pk Add `-a <arch>' switch to force the target architecture. Retain `-h' for
compatibility.
 1.11 08-Nov-1995  pk UFS => FFS conversion.
 1.10 07-Nov-1995  pk Correct test for sun4 machines (thanks Chuck).
Since uname currently does not allow to discriminate different sparc
models, we use `sysctl.hw.cpumodel' to do this somewhat heuristicly:
if the returned strings starts with "SUN4-" a sun4 architecture is
assumed. This information is used to determine whether or not to strip
the a.out header off the 1st-stage bootblocks.
 1.9 27-Sep-1995  pk branches: 1.9.2;
Avoid reading the filesystem superblock in bootxx; all info now prepared
by installboot (per Gordon Ross).
 1.8 18-Sep-1995  pk sync filesystems just prior to writing the bootblocks to the raw device.
 1.7 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.6 18-Aug-1995  pk Include exec header in length computation.
 1.5 18-Jun-1995  cgd don't assume the f_fsnamelen is nul-truncated or longer than MFSNAMELEN
 1.4 16-May-1995  pk Prototype internal function.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 13-Aug-1994  pk Remove bogus fsstat().
 1.1 20-Jul-1994  pk Make it work for V0 proms.
First cut at two stage bootstrap.
 1.9.2.1 08-Nov-1995  pk Update from trunk: SUN4 detection & FFS conversion.
 1.5 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.4 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.3 04-May-1996  pk branches: 1.3.8;
mountroot: return error code to caller, not -1.
 1.2 18-Sep-1995  pk Adapt to libsa changes & some other minor nits.
 1.1 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.3.8.1 07-Mar-1997  is Use libsa copy of oldstyle if_ether.h for now
 1.4 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.3 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.2 18-Sep-1995  pk branches: 1.2.10;
Adapt to libsa changes & some other minor nits.
 1.1 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.2.10.1 07-Mar-1997  is Use libsa copy of oldstyle if_ether.h for now
 1.17 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.16 14-Nov-1995  pk Not all v2 proms understand the `mac-address' word (from Theo).
 1.15 10-Oct-1995  pk Check input channel in gettick(); for `L1-A' processing.
 1.14 26-Sep-1995  chuck branches: 1.14.2;
make sure devopen() sets pd->devtype properly when BOOTXX is defined
(should be DT_BLOCK). otherwise the bootxx boot block will fail if
you are on a system with a v2 openprom [because it will not do the
v2_seek in obp_strategy()]. fixes the problem recently noted on
the port-sparc list by matthew green <mrg@eterna.com.au>. i tested
fix on a ss2 with a v2 prom.
 1.13 18-Sep-1995  pk Adapt to libsa changes & some other minor nits.
 1.12 17-Sep-1995  pk Correct some prototypes.
 1.11 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.10 08-May-1995  pk Adapt declaration to stand.h; PR #1036
 1.9 22-Feb-1995  mycroft Use the twiddle() from libsa.
 1.8 11-Dec-1994  pk Follow prototype changes in libsa.
 1.7 25-Nov-1994  deraadt putchar is void
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 13-Aug-1994  pk Keep those pointers moving.
 1.4 30-Jul-1994  pk Use PROM node properties to determine device type.
 1.3 20-Jul-1994  pk Make it work for V0 proms.
First cut at two stage bootstrap.
 1.2 01-Jul-1994  pk Adapt to current libsa.
 1.1 26-Feb-1994  pk Sparc bootblocks (a tight fit)
 1.14.2.2 14-Nov-1995  pk Update from trunk: the `mac-address' word and v2 proms.
 1.14.2.1 13-Oct-1995  pk Update from trunk: check for L1-A more often.
 1.4 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.3 18-Sep-1995  pk Adapt to libsa changes & some other minor nits.
 1.2 17-Sep-1995  pk Correct some prototypes.
 1.1 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.8 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.7 18-Oct-1996  thorpej Clarify the comment about enabling interrupts above level 11, suggested
by Andrew Gillham.
 1.6 23-May-1996  pk Enable just enough interrupts to get "L1-A" through. Patch from Jason to
avoid spurious floppy interrupts on Jason's machine...
 1.5 13-Dec-1995  pk branches: 1.5.4;
Enable interrupts; some ROM versions apparently turn them off.
 1.4 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 20-Jul-1994  pk Make it work for V0 proms.
First cut at two stage bootstrap.
 1.1 26-Feb-1994  pk Sparc bootblocks (a tight fit)
 1.5.4.2 17-Jul-1996  jtc Patch from PK to repair previous patch
 1.5.4.1 03-Jul-1996  jtc Patch from PK:
* Enable interrupts above level 11. This enables "L1-A", but
* avoids spurious interrupt bites from most other devices.
 1.6 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.5 04-May-1997  pk Bump version number to celebrate the fact that the bootblocks can be used
unmodified across all platforms.
 1.4 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 20-Jul-1994  pk Make it work for V0 proms.
First cut at two stage bootstrap.
 1.1 26-Feb-1994  pk Sparc bootblocks (a tight fit)
 1.3 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.2 13-Feb-1999  lukem branches: 1.2.22; 1.2.26;
convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.1 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.2.26.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18 22-Sep-2018  kre Convert from getopt to getopts (script is slightly smaller as a
result, but not enough to save a block ... but if /usr/bin/getopt is
not used elsewhere, and it should not be, it will no longer be required.)
 1.17 16-Sep-2018  kre General cleanups...
Better quote usage
No more need for sed
(should be no need for getopt either, but did not do that one)
 1.16 16-Sep-2018  kre PR install/53610

Remove use of -a in test(1) - deprecated in standard, and no
longer supported in SMALL (install media) versions of test in /bin/sh
 1.15 12-Jul-2006  he branches: 1.15.148; 1.15.150;
Omit specifying the secondary bootloader on the installboot command line
for sparc64 systems. This should fix PR#33987.

Also adapt to the way sparc64 32-bit kernels now report its CPU
architecture -- these still need the sparc64 boot loader, but now
report hw.machine = sparc. Adapt by testing machdep.cpu_arch
instead.

Hints from martin and mrg.
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.8; 1.14.16;
merge ktrace-lwp.
 1.13 07-Dec-2003  mrg branches: 1.13.16;
ofwboot.net is gone. from hannken@
 1.12 10-Jul-2003  lukem shell coding tweaks
 1.11 07-May-2002  pk branches: 1.11.10;
Patch up to work with MI installboot(8).
 1.10 02-Jan-2002  mrg - add a -i path-to-installboot option
- also recognise $INSTALLBOOT from the environment
- update Usage & share the option list with Help.
 1.9 31-Dec-2001  mrg clarify usage. idea from david obrien.
 1.8 19-Feb-2001  jmc branches: 1.8.4; 1.8.8;
Add -f option. If used it will perform the low level block operations on the
file rather than requiring a raw device. Useful when dealing with vnd's
images and building snapshots. Also allows snapshots to be built in
securelevel > 0.
 1.7 20-Aug-2000  mrg fix ultrasparc support.
 1.6 10-Aug-2000  mrg remove some ".sparc64" file suffixes that are not necessary.
 1.5 10-Aug-2000  mrg add sparc64 support.
 1.4 15-Feb-2000  pk branches: 1.4.4;
Allow second-stage boot program to be specified on the command line.
 1.3 01-Mar-1999  kim branches: 1.3.2; 1.3.8;
Try not to run when kernel is in secure mode.
 1.2 31-Oct-1997  pk Header magic is now done in stand/boot/Makefile.
 1.1 01-Jun-1997  mrg branches: 1.1.8;
Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.1.8.1 04-Nov-1997  mellon Pull rev 1.2 up from trunk (pk)
 1.3.8.2 12-Mar-2001  bouyer Sync with HEAD.
 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.3.2.1 22-Feb-2000  he Pull up revision 1.4 (requested by pk):
Make several sparc boot programs to run at different relocated
addresses. The boot build procedures can then pick the one which
is least likely to fail.
 1.4.4.2 20-Mar-2002  he Pull up revision 1.8 (requested by he):
Add ``-f'' option to binstall.sh and use it. This is allows boot
media construction when securelevel > 0.
 1.4.4.1 26-Aug-2000  mrg pull up 1.5, 1.6, 1.7. approved by thorpej:
1.5
>add sparc64 support.
1.6
>remove some ".sparc64" file suffixes that are not necessary.
1.7
>fix ultrasparc support.
 1.8.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.8.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.8.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.10.1 03-Aug-2004  skrll Sync with HEAD
 1.13.16.1 30-Dec-2006  yamt sync with head.
 1.14.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.14.8.1 11-Aug-2006  yamt sync with head
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.150.1 10-Jun-2019  christos Sync with HEAD
 1.15.148.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.46 03-Jun-2023  lukem adapt to ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

Simplify CWARNFLAGS to use ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
which works for both clang and gcc, and remove compiler-specific
equivalents.
 1.45 03-Jun-2023  lukem bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER

Provide a single variable
CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
CLANG_NO_ADDR_OF_PACKED_MEMBER
CC_NO_ADDR_OF_PACKED_MEMBER
GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.44 06-Sep-2020  mrg add support for new GCC 9 warnings that may be too much to fix
right now. new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree. mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it. (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.) clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
 1.43 03-Jun-2020  rin Appease clang -Waddress-of-packed-member for <ufs/lfs/lfs_accessors.h>,
in the same manner as done for sparc64; pointer substitution is just for
sanity check and harmless there.
 1.42 28-Apr-2017  christos Also move bootjs.net after we've evaluated $OBJS (thanks gson@)
 1.41 09-Apr-2017  christos branches: 1.41.4;
move .for generated rules after OBJS have been set.
 1.40 08-Apr-2017  christos centralize vers.c building for standalone programs.
 1.39 10-Mar-2016  martin branches: 1.39.2; 1.39.4;
Strip debug symbols from boot code
 1.38 28-Aug-2011  mrg branches: 1.38.12; 1.38.30;
emit some linker -Map files so that we can figure out what symbols
in the boot loaders are.
 1.37 22-Jan-2011  joerg Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.36 13-Dec-2009  nakayama branches: 1.36.4; 1.36.6; 1.36.8;
System utilities, boot programs and kernel modules are machine
(port) specific not CPU, so use MACHINE not MACHINE_ARCH.
 1.35 14-Feb-2009  abs Convert more MACHINE tests to MACHINE_ARCH
 1.34 11-Dec-2005  christos branches: 1.34.78; 1.34.86; 1.34.92;
merge ktrace-lwp.
 1.33 10-Jul-2005  martin Add SUPPORT_DHCP - otherwise bootp does not work (packet is too short for
root-path). From Christos.
 1.32 15-Dec-2003  martin branches: 1.32.14; 1.32.16;
Rename the JavaStation network boot loader: bootjs.elf -> bootjs.net.
 1.31 12-Dec-2003  martin Add support to build bootjs.elf - the secondary bootstrap used to netboot
JavaStations. Based on patches from Valeriy E. Ushakov.
 1.30 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.29 30-Jul-2003  mrg sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.28 01-Mar-2003  pk branches: 1.28.2;
Add support for large kernels by searching for a physical memory segment
to fit it in. As a bonus, the kernel is now also mapped to the virtual
address (i.e. KERNBASE) it is linked at.
 1.27 04-Dec-2001  thorpej Don't declare which exec formats to support in loadfile_machdep.h.
Instead, give each user of loadfile() control over which exec formats
it wants to support.
 1.26 22-Sep-2001  tv branches: 1.26.4;
objcopy -> ${OBJCOPY}; remove redundant definitions of OBJCOPY?= (it is
now in bsd.own.mk).
 1.25 22-Sep-2001  mrg use the 32-bit compiler on sparc64 (but not yet enabled.)
 1.24 21-Jun-2001  uwe branches: 1.24.2; 1.24.4;
Add PROM patches (forth code) as a table indexed with root node name
and prom version. Little tweaks to prom during secondary boot are
much easier then fragile work-arounds in the kernel. Currently this
is used for JavaStation 1 with OBP3.
 1.23 31-Oct-2000  pk Dispose of `boot.net.big'.
 1.22 21-Jul-2000  jdolecek switch to sys/conf/newvers_stand.sh for generation of version file
sync the message in boot/version with other ports using newvers_stand.sh
 1.21 03-Jul-2000  sommerfeld Build a boot_big.net (based at 700000) in addition to boot.net,
allowing you to netboot a kernel with a ramdisk inside on systems
where memory is laid out to allow this.
 1.20 13-Mar-2000  mycroft branches: 1.20.4;
Make dependall work.
 1.19 26-Feb-2000  pk Revert to using <bsd.prog.mk> again, so we support all targets that may
be presented when building the system (noticed by Juergen Hannken-Illjes).
 1.18 25-Feb-2000  pk We need <bsd.obj.mk>.
 1.17 21-Feb-2000  pk Build several versions of the second-stage boot program, each linked
to run at a different base address. Boot image build procedures can
pick one which is least likely to fail..

The default boot program is again build to run at 0x340000.
 1.16 09-Nov-1999  mycroft branches: 1.16.2;
Move the boot block load address from 3MB to 7MB. The INSTALL kernel is
already too large, and GENERIC won't be far behind.
 1.15 21-Aug-1999  sommerfeld branches: 1.15.2; 1.15.4; 1.15.6;
Use ${SIZE}, ${OBJCOPY} rather than size and objcopy.
 1.14 03-May-1999  pk Better pad the artificial header to exactly 32 bytes.
 1.13 30-Apr-1999  christos Add bootinfo struct to pass symtab arguments.
XXX: This does not work with ELF yet, but I don't understand why...
 1.12 28-Apr-1999  christos Checkpoint of elf boot stuff:
- Use loadfile for both boot and installboot
- Fix problems with linking in bootxx
- Make installboot work with both a.out and ELF bootxx
- *WILL NOT BOOT YET ELF KERNELS* (a.out kernels work) I am working on it.
 1.11 05-Mar-1999  pk branches: 1.11.2; 1.11.4;
Use `-Ttext' switch & collect ld options in LINKFLAGS.
 1.10 15-Feb-1999  pk Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.9 18-Dec-1997  pk Clean vers.c & vers.o.
 1.8 15-Nov-1997  pk Use DESTDIR consistently when constructing `boot.net'.
 1.7 12-Nov-1997  pk Change load address to avoid cache-aliasing on machines with Harvard-style
cache implementations (notably the Hypersparcs).
 1.6 31-Oct-1997  pk Install a version of the secondary boot block in /usr/mdec that is
suitable for use on a server for diskless booting. Done mostly to
simplify the installation notes and avoid questions ...
 1.5 01-Jun-1997  mrg branches: 1.5.8;
Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.4 29-Nov-1996  pk remove header munging hack.
 1.3 05-Oct-1996  mrg update for kern/sa lib Makefile.inc changes.
 1.2 30-Sep-1995  pk Make this work with OBJ dirs.
 1.1 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.5.8.3 15-Nov-1997  mellon Pull rev 1.8 up from trunk (pk)
 1.5.8.2 14-Nov-1997  mellon Pull rev 1.7 up from trunk (pk)
 1.5.8.1 04-Nov-1997  mellon Pull rev 1.6 up from trunk (pk)
 1.11.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.2.3 28-Feb-2000  he Apply patch (requested by toddpw):
Add an include target so that ``make build'' works.
 1.11.2.2 28-Feb-2000  he Pull up revision 1.18 (requested by pk):
Make sure ``make obj'' works.
 1.11.2.1 22-Feb-2000  he Apply patch (requested by pk):
Make several sparc boot programs to run at different relocated
addresses. The boot build procedures can then pick the one which
is least likely to fail.
 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 22-Nov-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.16.2.2 09-Nov-1999  mycroft Move the boot block load address from 3MB to 7MB. The INSTALL kernel is
already too large, and GENERIC won't be far behind.
 1.16.2.1 09-Nov-1999  mycroft file Makefile was added on branch comdex-fall-1999 on 1999-11-09 18:39:42 +0000
 1.20.4.1 26-Aug-2000  mrg "pull up" (via patch) fixes for sparc64 vs sparc boot blocks. (this is
resolved on the trunk with newvers_stand.sh). approved by thorpej.
 1.24.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.24.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.26.4.1 22-Sep-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-01-08 00:27:54 +0000
 1.28.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.28.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.16.1 21-Jun-2006  yamt sync with head.
 1.32.14.1 10-Jul-2005  tron Pull up revision 1.33 (requested by christos in ticket #567):
Add SUPPORT_DHCP - otherwise bootp does not work (packet is too short for
root-path). From Christos.
 1.34.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.86.1 03-Mar-2009  skrll Sync with HEAD.
 1.34.78.2 11-Mar-2010  yamt sync with head
 1.34.78.1 04-May-2009  yamt sync with head.
 1.36.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.36.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.36.4.1 05-Mar-2011  rmind sync with head
 1.38.30.2 28-Aug-2017  skrll Sync with HEAD
 1.38.30.1 19-Mar-2016  skrll Sync with HEAD
 1.38.12.1 03-Dec-2017  jdolecek update from HEAD
 1.39.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.39.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.41.4.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.30 11-Jun-2016  dholland PR 51200 gets in libsa considered harmful: use kgets
 1.29 27-Nov-2015  joerg Don't use dynamically sized unions, they are a horrible GNUism. Just use
the existing upper limit all the time.
 1.28 28-May-2012  martin branches: 1.28.2; 1.28.16;
Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.
 1.27 22-Jan-2011  joerg branches: 1.27.4; 1.27.8; 1.27.10;
Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.26 25-Aug-2010  christos branches: 1.26.2; 1.26.4;
factor out the floppy detection code.
 1.25 25-Aug-2010  christos Don't LOAD_BACKWARDS for floppies.
 1.24 04-Mar-2007  christos branches: 1.24.44; 1.24.64; 1.24.66;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 13-Jul-2006  uwe branches: 1.23.10;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.22 11-Dec-2005  christos branches: 1.22.4; 1.22.8;
merge ktrace-lwp.
 1.21 03-Jun-2005  martin branches: 1.21.2;
constify
 1.20 27-Apr-2005  martin Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.19 08-Apr-2004  pk branches: 1.19.4; 1.19.10;
compat mode: skip double map at VA 0 if the physical load address is 0.
This allows a much wider range of historic kernels to be booted (w/ `-C').
 1.18 07-Aug-2003  agc branches: 1.18.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.17 30-Jul-2003  mrg sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.16 10-Jul-2003  pk compat mode:
* print warning if kernel image is too large.
* adjust `required space' computation to be more compatible to
what it was before.
* since there's still no code to recognise `old kernels', provide
a way to turn on `compatmode' manually, using the `-C' boot option.
 1.15 01-Mar-2003  pk branches: 1.15.2;
Add support for large kernels by searching for a physical memory segment
to fit it in. As a bonus, the kernel is now also mapped to the virtual
address (i.e. KERNBASE) it is linked at.
 1.14 25-Feb-2003  pk * Use fdloadfile() to avoid opening the the underlying device twice.
* Cleanup old stuff.
 1.13 11-Dec-2002  pk * loadfile() return a file descriptor that must be closed.
* check the kernel size before loading
 1.12 09-Nov-2002  uwe Use BOOT_FLAG() macro to process flags.
 1.11 28-Mar-2002  pk Pass actual loaded kernel file in bootinfo[].
 1.10 21-Jun-2001  uwe branches: 1.10.2; 1.10.8;
Add PROM patches (forth code) as a table indexed with root node name
and prom version. Little tweaks to prom during secondary boot are
much easier then fragile work-arounds in the kernel. Currently this
is used for JavaStation 1 with OBP3.
 1.9 08-Nov-1999  pk Include <sys/exec.h> instead of <a.out.h>/
 1.8 12-Jun-1999  pk branches: 1.8.2; 1.8.4; 1.8.8;
Initialize the heap (for alloc()) explicitly, since the `end' symbol
is not necessarily double-word aligned.
 1.7 03-May-1999  christos Casts for PROM_LOADADDR which is not casted anymore.
 1.6 30-Apr-1999  christos Add bootinfo struct to pass symtab arguments.
XXX: This does not work with ELF yet, but I don't understand why...
 1.5 28-Apr-1999  christos Checkpoint of elf boot stuff:
- Use loadfile for both boot and installboot
- Fix problems with linking in bootxx
- Make installboot work with both a.out and ELF bootxx
- *WILL NOT BOOT YET ELF KERNELS* (a.out kernels work) I am working on it.
 1.4 15-Feb-1999  pk branches: 1.4.4;
Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.3 29-Aug-1998  mrg add support for finding kernels other than `netbsd'. the list is:
netbsd, netbsd.gz, netbsd.old, netbsd.old.gz, onetbsd, onetbsd.gz
and vmunix, in that order. this is used by the bootable `bootfs'
image (suitable for floppies and cdroms), which contains a netbsd.gz
by default.
while i'm here, fix up `boot [device] -s' which got broke when
booting kernels with a - in their name was fixed..
 1.2 14-Sep-1997  pk branches: 1.2.2;
Do not use KERNBASE to calculate the `end of symbols' location. Instead
use the `a_entry' field from the kernel's header as a base.

Pass on a new DDB magic number to the kernel, so kernels linked for a
different KERNBASE value can apply a correction when booted from old
bootblocks.
 1.1 01-Jun-1997  mrg branches: 1.1.4;
Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.1.4.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 19-Jan-1999  cgd pull up rev 1.3 from trunk (mrg)
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.4.1 15-Nov-1999  fvdl Sync with -current
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.8.4 11-Dec-2002  thorpej Sync with HEAD.
 1.10.8.3 11-Nov-2002  nathanw Catch up to -current
 1.10.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.10.8.1 21-Jun-2001  nathanw file boot.c was added on branch nathanw_sa on 2002-04-01 07:42:56 +0000
 1.10.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.18.2.1 08-Apr-2004  jdc branches: 1.18.2.1.2;
Pull up revision 1.19 (requested by pk in ticket #95)

compat mode: skip double map at VA 0 if the physical load address is 0.
This allows a much wider range of historic kernels to be booted (w/ `-C').
 1.18.2.1.2.1 12-May-2005  riz Pull up revision 1.20 (requested by martin in ticket #1484):
Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.19.10.1 28-Apr-2005  tron Pull up revision 1.20 (requested by martin in ticket #210):
Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.21.2.2 03-Sep-2007  yamt sync with head.
 1.21.2.1 30-Dec-2006  yamt sync with head.
 1.22.8.1 11-Aug-2006  yamt sync with head
 1.22.4.1 09-Sep-2006  rpaulo sync with head
 1.23.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.66.1 05-Mar-2011  rmind sync with head
 1.24.64.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.24.44.1 09-Oct-2010  yamt sync with head
 1.26.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.26.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.27.10.1 05-Jun-2012  jdc Pull up revisions:
src/sys/arch/sparc/include/bootinfo.h revision 1.6
src/sys/arch/sparc/sparc/autoconf.c revision 1.243
src/sys/arch/sparc/stand/boot/boot.c revision 1.28
src/sys/arch/sparc/stand/ofwboot/boot.c revision 1.29
src/sys/arch/sparc64/include/bootinfo.h revision 1.6-1.7
src/sys/arch/sparc64/sparc64/autoconf.c revision 1.186
(requested by martin in ticket #289).

Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.

Ooops, remove definitions duplicated in <sparc/bootinfo.h>
 1.27.8.1 02-Jun-2012  mrg sync to latest -current.
 1.27.4.1 30-Oct-2012  yamt sync with head
 1.28.16.2 09-Jul-2016  skrll Sync with HEAD
 1.28.16.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.28.2.1 03-Dec-2017  jdolecek update from HEAD
 1.3 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.2 28-Apr-2008  martin branches: 1.2.8; 1.2.14;
Remove clause 3 and 4 from TNF licenses
 1.1 30-Apr-1999  christos branches: 1.1.2; 1.1.140; 1.1.142; 1.1.144;
Add bootinfo struct to pass symtab arguments.
XXX: This does not work with ELF yet, but I don't understand why...
 1.1.144.2 04-May-2009  yamt sync with head.
 1.1.144.1 16-May-2008  yamt sync with head.
 1.1.142.1 18-May-2008  yamt sync with head.
 1.1.140.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 13-Jul-2006  uwe branches: 1.2.58; 1.2.60; 1.2.62;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.1 30-Apr-1999  christos branches: 1.1.2; 1.1.54; 1.1.68; 1.1.72;
Add bootinfo struct to pass symtab arguments.
XXX: This does not work with ELF yet, but I don't understand why...
 1.1.72.1 11-Aug-2006  yamt sync with head
 1.1.68.1 09-Sep-2006  rpaulo sync with head
 1.1.54.1 30-Dec-2006  yamt sync with head.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.62.1 16-May-2008  yamt sync with head.
 1.2.60.1 18-May-2008  yamt sync with head.
 1.2.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 14-Aug-2005  uwe Constify. Make (the only) submatch function static.
Prettify some comments.
 1.10 14-Aug-2005  macallan add a prom patch that creates a device node for the Krups' audio chip
in case it's missing ( like with OF 3.11.10 ) - makes audiocs at ebus work
on these machines.
 1.9 18-Mar-2004  hannken branches: 1.9.14; 1.9.16;
Rename PROM_getpropstring* => prom_getpropstring*
 1.8 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.7 30-Jul-2003  mrg sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.6 16-Dec-2002  jdc branches: 1.6.6;
Extend the matching routine to take a function pointer, so that additional
(arbitrary) matching can be done.
Add match function and patch for Cycle 5 IP (Sparc 5 clone).

Reviewed by Uwe.
 1.5 11-Jan-2002  uwe OBP 2.30 in JS1 is romvec version 3, so g/c PROM_OBP_V2 entry.
Add bare-bones "8042" (pckbc) node and rename bogus zs nodes out of
the way to prevent them from matching.
 1.4 11-Dec-2001  aymeric add support for OBP 3.x as seen on some JavaStation 1's
 1.3 22-Nov-2001  uwe Add patches for Mr.Coffee with OBP2.
Miscellaneous cosmetic changes.
 1.2 26-Sep-2001  eeh branches: 1.2.4;
getprop* -> PROM_getprop*
 1.1 21-Jun-2001  uwe branches: 1.1.2; 1.1.4;
Add PROM patches (forth code) as a table indexed with root node name
and prom version. Little tweaks to prom during secondary boot are
much easier then fragile work-arounds in the kernel. Currently this
is used for JavaStation 1 with OBP3.
 1.1.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.5 19-Dec-2002  thorpej Sync with HEAD.
 1.2.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.3 11-Jan-2002  nathanw More catchup.
 1.2.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.4.1 26-Sep-2001  nathanw file prompatch.c was added on branch nathanw_sa on 2002-01-08 00:27:54 +0000
 1.6.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.9.16.1 21-Jun-2006  yamt sync with head.
 1.9.14.1 15-Aug-2005  tron Pull up revision 1.10 (requested by macallan in ticket #664):
add a prom patch that creates a device node for the Krups' audio chip
in case it's missing ( like with OF 3.11.10 ) - makes audiocs at ebus work
on these machines.
 1.19 11-Dec-2005  christos merge ktrace-lwp.
 1.18 14-Aug-2005  macallan add a prom patch that creates a device node for the Krups' audio chip
in case it's missing ( like with OF 3.11.10 ) - makes audiocs at ebus work
on these machines.
 1.17 01-Mar-2003  pk branches: 1.17.2; 1.17.16; 1.17.18;
Add support for large kernels by searching for a physical memory segment
to fit it in. As a bonus, the kernel is now also mapped to the virtual
address (i.e. KERNBASE) it is linked at.
 1.16 16-Dec-2002  jdc Increment version number for match function and Cycle 5 IP changes.
 1.15 21-Mar-2002  uwe PROM patches for JavaStation-1.
 1.14 09-Nov-2001  scw Bump the version numbers of all bootloaders which use loadfile_elfXX() now
that it tries hard to avoid backwards seeks.
 1.13 02-Aug-2001  bjh21 branches: 1.13.4; 1.13.6;
Bump version numbers of all bootloaders that use loadfile/ELF, to account for
my changes to symbol loading. I should probably have done this at the time,
but it's better late than never.
 1.12 21-Jul-2000  jdolecek branches: 1.12.4;
switch to sys/conf/newvers_stand.sh for generation of version file
sync the message in boot/version with other ports using newvers_stand.sh
 1.11 30-Apr-1999  christos branches: 1.11.2;
Add bootinfo struct to pass symtab arguments.
XXX: This does not work with ELF yet, but I don't understand why...
 1.10 28-Apr-1999  christos Checkpoint of elf boot stuff:
- Use loadfile for both boot and installboot
- Fix problems with linking in bootxx
- Make installboot work with both a.out and ELF bootxx
- *WILL NOT BOOT YET ELF KERNELS* (a.out kernels work) I am working on it.
 1.9 15-Jan-1999  mrg branches: 1.9.4;
look for /^Version:/ to find the boot block version, rather than using
the "version" file's RCS id (which is useless for branches).
 1.8 29-Aug-1998  mrg add support for finding kernels other than `netbsd'. the list is:
netbsd, netbsd.gz, netbsd.old, netbsd.old.gz, onetbsd, onetbsd.gz
and vmunix, in that order. this is used by the bootable `bootfs'
image (suitable for floppies and cdroms), which contains a netbsd.gz
by default.
while i'm here, fix up `boot [device] -s' which got broke when
booting kernels with a - in their name was fixed..
 1.7 01-Jun-1997  mrg branches: 1.7.8;
need to bump this back to version 1.7 (last one).
 1.6 01-Jun-1997  mrg need to bump this back to version 1.7.
 1.5 01-Jun-1997  mrg need to bump this back to version 1.7.
 1.4 01-Jun-1997  mrg need to bump this back to version 1.7.
 1.3 01-Jun-1997  mrg need to bump this back to version 1.7.
 1.2 01-Jun-1997  mrg need to bump this back to version 1.7.
 1.1 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.7.8.1 19-Jan-1999  cgd pull up revs 1.8-1.9 from trunk (mrg)
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.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.12.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.12.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.4.1 03-Aug-2001  lukem update to -current
 1.13.6.4 19-Dec-2002  thorpej Sync with HEAD.
 1.13.6.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.13.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.13.6.1 02-Aug-2001  nathanw file version was added on branch nathanw_sa on 2002-01-08 00:27:54 +0000
 1.13.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.17.18.1 21-Jun-2006  yamt sync with head.
 1.17.16.1 15-Aug-2005  tron Pull up revision 1.18 (requested by macallan in ticket #664):
add a prom patch that creates a device node for the Krups' audio chip
in case it's missing ( like with OF 3.11.10 ) - makes audiocs at ebus work
on these machines.
 1.17.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17 29-Mar-2019  christos no more _LKM -> _MODULE
 1.16 01-Oct-2016  christos branches: 1.16.16;
deal with PIE and SSP
 1.15 04-Mar-2014  joerg branches: 1.15.6; 1.15.10;
Add GENASSYM_CPPFLAGS in two more places.
 1.14 21-Aug-2013  matt Use <bsd.klinks.mk>
 1.13 13-Feb-2010  eeh branches: 1.13.10; 1.13.20; 1.13.24;
Major overhaul:

1) Add support for multiple filesystems including ffsv1, ffsv2, lfsv1 and lfsv2.
(ffsv1 and lfsv2 are known to work. ffv2 support needs more work. lfsv1 is
probably untested.)

2) Only 32-bit Fcodes are used. All 64-bit math uses two cells. This means it
should work on 32-bit machines.

Additional work to consider:

1) Rename genfth.cf to genffs.cf, or keep it and move the ffs symbols to genffs.cf

2) Move the ffs code and the lfs code to different source files so you can
selectively fload the just the filesystems you want.

3) Add code to load ELF files directly instead of relying on the host firmware
ELF support. But, since the binary is now 7250 bytes there may not be room.
 1.12 06-Apr-2009  tsutsui branches: 1.12.2;
assym.fth.h also requires sparc symlink. Fix build without DESTDIR.
 1.11 19-Oct-2008  apb branches: 1.11.2; 1.11.8;
Use ${TOOL_AWK} instead of ${AWK} or plain "awk" in make commands.
Pass AWK=${TOOL_AWK:Q} to shell scripts that use awk.
 1.10 28-Aug-2006  tsutsui branches: 1.10.56; 1.10.60; 1.10.66;
Add src/common/include to include header search path since
<sys/device.h> includes <prop/proplib.h>.
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.8;
merge ktrace-lwp.
 1.8 30-May-2005  thorpej branches: 1.8.2;
Use TOOL_GENASSYM. Part of PR toolchain/30350
 1.7 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.6 30-Jul-2003  mrg sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.5 10-Jul-2003  lukem Rename a large chunk of the make(1) variables which refer to a
program/tool from "FOO" to "TOOL_FOO". The new variables are:
TOOL_ASN1_COMPILE TOOL_CAP_MKDB TOOL_CAT TOOL_CKSUM TOOL_COMPILE_ET
TOOL_CONFIG TOOL_CRUNCHGEN TOOL_CTAGS TOOL_DB TOOL_EQN TOOL_FGEN
TOOL_GENCAT TOOL_GROFF TOOL_HEXDUMP TOOL_INDXBIB TOOL_INSTALLBOOT
TOOL_INSTALL_INFO TOOL_M4 TOOL_MAKEFS TOOL_MAKEINFO TOOL_MAKEWHATIS
TOOL_MDSETIMAGE TOOL_MENUC TOOL_MKCSMAPPER TOOL_MKESDB
TOOL_MKLOCALE TOOL_MKMAGIC TOOL_MKTEMP TOOL_MSGC TOOL_MTREE
TOOL_PAX TOOL_PIC TOOL_PREPMKBOOTIMAGE TOOL_PWD_MKDB TOOL_REFER
TOOL_ROFF_ASCII TOOL_ROFF_DVI TOOL_ROFF_HTML TOOL_ROFF_PS
TOOL_ROFF_RAW TOOL_RPCGEN TOOL_SOELIM TOOL_SUNLABEL TOOL_TBL
TOOL_UUDECODE TOOL_VGRIND TOOL_ZIC

For each, provide default in <bsd.sys.mk> of the form:
TOOL_FOO?= foo
and for the ${USETOOLS}=="yes" case in <bsd.own.mk>, provide override:
TOOL_FOO= ${TOOLDIR}/bin/${_TOOL_PREFIX}foo

Document all of these in bsd.README.

This cleans up a chunk of potential (and actual) namespace collision
within our build infrastructure, as well as improves consistency in
the share/mk documentation and provision of appropriate defaults for
each of these variables.
 1.4 28-May-2002  bjh21 branches: 1.4.6;
Use ${FGEN} rather than fgen.
 1.3 13-Dec-2001  tv branches: 1.3.8;
Fix problem introduced with the MKMAN->NOMAN conversion.
 1.2 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.8; 1.1.12;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.12.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file Makefile was added on branch thorpej_scsipi on 2000-11-20 20:35:38 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file Makefile was added on branch netbsd-1-5 on 2000-08-26 00:05:22 +0000
 1.3.8.1 30-May-2002  gehenna Catch up with -current.
 1.4.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.2.1 30-Dec-2006  yamt sync with head.
 1.9.8.1 03-Sep-2006  yamt sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.10.66.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.60.2 11-Mar-2010  yamt sync with head
 1.10.60.1 04-May-2009  yamt sync with head.
 1.10.56.1 17-Jan-2009  mjf Sync with HEAD.
 1.11.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.12.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.13.24.2 18-May-2014  rmind sync with head
 1.13.24.1 28-Aug-2013  rmind sync with head
 1.13.20.2 03-Dec-2017  jdolecek update from HEAD
 1.13.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.10.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.10.1 04-Nov-2016  pgoyette Sync with HEAD
 1.15.6.1 05-Oct-2016  skrll Sync with HEAD
 1.16.16.1 10-Jun-2019  christos Sync with HEAD
 1.18 28-Feb-2025  andvar Fix various typos in comments.
 1.17 17-Nov-2022  chs branches: 1.17.8;
Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.16 24-Jul-2021  andvar Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
 1.15 20-Aug-2015  dholland branches: 1.15.34;
Use lfs32_dinode_SIZEOF instead of ufs1_dinode_SIZEOF for lfs. These
are the same so it doesn't make any difference, but technically one
should use lfs parts with lfs.
 1.14 16-Aug-2015  jdc Make these compile again after changes to LFS.
 1.13 24-Jun-2010  eeh branches: 1.13.18; 1.13.36;
indir-block needs to be the size of a filesystem block or bad things can happen.
 1.12 11-Mar-2010  eeh branches: 1.12.2;
Fix shifting by zero.
 1.11 17-Feb-2010  eeh Fix ffsv2 support.
 1.10 13-Feb-2010  eeh Major overhaul:

1) Add support for multiple filesystems including ffsv1, ffsv2, lfsv1 and lfsv2.
(ffsv1 and lfsv2 are known to work. ffv2 support needs more work. lfsv1 is
probably untested.)

2) Only 32-bit Fcodes are used. All 64-bit math uses two cells. This means it
should work on 32-bit machines.

Additional work to consider:

1) Rename genfth.cf to genffs.cf, or keep it and move the ffs symbols to genffs.cf

2) Move the ffs code and the lfs code to different source files so you can
selectively fload the just the filesystems you want.

3) Add code to load ELF files directly instead of relying on the host firmware
ELF support. But, since the binary is now 7250 bytes there may not be room.
 1.9 19-Oct-2009  snj branches: 1.9.2;
Move Eduardo Horvath's license to 2 clause. OK eeh@.
 1.8 29-Jun-2008  jdc Instead of bailing out with "Inode not directory", assume that the disk is
a RAIDframe mirror, apply the RAID boot offset, and try to boot again.

Fixes the problem where disks would be unbootable if partitioned normally
and then converted to RAID 1 without being zeroed first.
 1.7 11-Dec-2005  christos branches: 1.7.24; 1.7.68; 1.7.74; 1.7.78; 1.7.80; 1.7.82;
merge ktrace-lwp.
 1.6 18-Jun-2004  martin branches: 1.6.10; 1.6.20; 1.6.22;
Use RF_PROTECTED_SECTORS instead of a (wrong) magic value.
The bootblock now is able to load ofwboot from a raid1 root.
 1.5 05-Apr-2003  he branches: 1.5.2; 1.5.4;
Track changes introduced when UFS2 was merged, so that this builds again.
 1.4 12-Jun-2002  eeh Dynamically allocate the buffer we use for filesystem deblocking based on
the filesystem blocksize in the super block. Allows us to read filesystems
with block sizes > 8KB.
 1.3 15-Aug-2001  eeh branches: 1.3.6; 1.3.14; 1.3.16;
Support for raidframe roots. I hope. (Someone needs to test this.)
 1.2 13-Jun-2001  wiz branches: 1.2.2;
withough -> without
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.6;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file bootblk.fth was added on branch thorpej_scsipi on 2000-11-20 20:35:39 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file bootblk.fth was added on branch netbsd-1-5 on 2000-08-26 00:05:22 +0000
 1.2.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.3.16.1 13-Jun-2002  lukem Pull up revision 1.4 (requested by eeh in ticket #259):
Dynamically allocate the buffer we use for filesystem deblocking based on
the filesystem blocksize in the super block. Allows us to read filesystems
with block sizes > 8KB.
 1.3.14.1 15-Jul-2002  gehenna catch up with -current.
 1.3.6.2 20-Jun-2002  nathanw Catch up to -current.
 1.3.6.1 15-Aug-2001  nathanw file bootblk.fth was added on branch nathanw_sa on 2002-06-20 03:41:13 +0000
 1.5.4.1 19-Jun-2004  grant Pull up revision 1.6 (requested by martin in ticket #510):

Use RF_PROTECTED_SECTORS instead of a (wrong) magic value.
The bootblock now is able to load ofwboot from a raid1 root.
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.22.1 15-Jan-2009  bouyer Pull up following revision(s) (requested by jdc in ticket #1986):
sys/arch/sparc/stand/bootblk/bootblk.fth: revision 1.8
Instead of bailing out with "Inode not directory", assume that the disk is
a RAIDframe mirror, apply the RAID boot offset, and try to boot again.
Fixes the problem where disks would be unbootable if partitioned normally
and then converted to RAID 1 without being zeroed first.
 1.6.20.1 15-Jan-2009  bouyer Pull up following revision(s) (requested by jdc in ticket #1986):
sys/arch/sparc/stand/bootblk/bootblk.fth: revision 1.8
Instead of bailing out with "Inode not directory", assume that the disk is
a RAIDframe mirror, apply the RAID boot offset, and try to boot again.
Fixes the problem where disks would be unbootable if partitioned normally
and then converted to RAID 1 without being zeroed first.
 1.6.10.1 15-Jan-2009  bouyer Pull up following revision(s) (requested by jdc in ticket #1986):
sys/arch/sparc/stand/bootblk/bootblk.fth: revision 1.8
Instead of bailing out with "Inode not directory", assume that the disk is
a RAIDframe mirror, apply the RAID boot offset, and try to boot again.
Fixes the problem where disks would be unbootable if partitioned normally
and then converted to RAID 1 without being zeroed first.
 1.7.82.1 03-Jul-2008  simonb Sync with head.
 1.7.80.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.78.3 11-Aug-2010  yamt sync with head.
 1.7.78.2 11-Mar-2010  yamt sync with head
 1.7.78.1 04-May-2009  yamt sync with head.
 1.7.74.1 02-Jul-2008  mjf Sync with HEAD.
 1.7.68.1 15-Jan-2009  bouyer Pull up following revision(s) (requested by jdc in ticket #1251):
sys/arch/sparc/stand/bootblk/bootblk.fth: revision 1.8
Instead of bailing out with "Inode not directory", assume that the disk is
a RAIDframe mirror, apply the RAID boot offset, and try to boot again.
Fixes the problem where disks would be unbootable if partitioned normally
and then converted to RAID 1 without being zeroed first.
 1.7.24.1 15-Jan-2009  bouyer Pull up following revision(s) (requested by jdc in ticket #1251):
sys/arch/sparc/stand/bootblk/bootblk.fth: revision 1.8
Instead of bailing out with "Inode not directory", assume that the disk is
a RAIDframe mirror, apply the RAID boot offset, and try to boot again.
Fixes the problem where disks would be unbootable if partitioned normally
and then converted to RAID 1 without being zeroed first.
 1.9.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.12.2.1 03-Jul-2010  rmind sync with head
 1.13.36.1 22-Sep-2015  skrll Sync with HEAD
 1.13.18.1 03-Dec-2017  jdolecek update from HEAD
 1.15.34.1 01-Aug-2021  thorpej Sync with HEAD.
 1.17.8.1 02-Aug-2025  perseant Sync with HEAD
 1.3 30-May-2005  thorpej Use TOOL_GENASSYM. Part of PR toolchain/30350
 1.2 15-Dec-2003  jmc Clean up tmp files on exit. Fixes PR#23723
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.28;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.28.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.28.1 03-Aug-2004  skrll Sync with HEAD
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file genassym.sh was added on branch thorpej_scsipi on 2000-11-20 20:35:39 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file genassym.sh was added on branch netbsd-1-5 on 2000-08-26 00:05:23 +0000
 1.10 17-Nov-2022  chs Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.9 10-Jun-2013  hannken Move member di_inumber from ufs1_dinode to ulfs1_dinode.

No functional change intended. Tested on sparc64.
 1.8 22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.7 13-Feb-2010  eeh branches: 1.7.10; 1.7.20;
Major overhaul:

1) Add support for multiple filesystems including ffsv1, ffsv2, lfsv1 and lfsv2.
(ffsv1 and lfsv2 are known to work. ffv2 support needs more work. lfsv1 is
probably untested.)

2) Only 32-bit Fcodes are used. All 64-bit math uses two cells. This means it
should work on 32-bit machines.

Additional work to consider:

1) Rename genfth.cf to genffs.cf, or keep it and move the ffs symbols to genffs.cf

2) Move the ffs code and the lfs code to different source files so you can
selectively fload the just the filesystems you want.

3) Add code to load ELF files directly instead of relying on the host firmware
ELF support. But, since the binary is now 7250 bytes there may not be room.
 1.6 02-May-2008  martin branches: 1.6.20;
Move TNF licenses to 2 clause form
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.76; 1.5.78;
merge ktrace-lwp.
 1.4 18-Jun-2004  martin Use RF_PROTECTED_SECTORS instead of a (wrong) magic value.
The bootblock now is able to load ofwboot from a raid1 root.
 1.3 05-Apr-2003  he branches: 1.3.2; 1.3.4;
Track changes introduced when UFS2 was merged, so that this builds again.
 1.2 03-Apr-2003  christos try to make this work with ufs1 only.
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file genfth.cf was added on branch thorpej_scsipi on 2000-11-20 20:35:40 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file genfth.cf was added on branch netbsd-1-5 on 2000-08-26 00:05:23 +0000
 1.3.4.1 19-Jun-2004  grant Pull up revision 1.4 (requested by martin in ticket #510):

Use RF_PROTECTED_SECTORS instead of a (wrong) magic value.
The bootblock now is able to load ofwboot from a raid1 root.
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.78.2 11-Mar-2010  yamt sync with head
 1.5.78.1 16-May-2008  yamt sync with head.
 1.5.76.1 18-May-2008  yamt sync with head.
 1.5.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.7.20.2 23-Jun-2013  tls resync from head
 1.7.20.1 25-Feb-2013  tls resync with head
 1.7.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.7.10.1 23-Jan-2013  yamt sync with head
 1.4 20-Aug-2015  dholland adjust comments slightly
 1.3 16-Aug-2015  jdc Make these compile again after changes to LFS.
 1.2 10-Jun-2013  hannken branches: 1.2.10;
Move member di_inumber from ufs1_dinode to ulfs1_dinode.

No functional change intended. Tested on sparc64.
 1.1 13-Feb-2010  eeh branches: 1.1.2; 1.1.6; 1.1.14; 1.1.24;
Major overhaul:

1) Add support for multiple filesystems including ffsv1, ffsv2, lfsv1 and lfsv2.
(ffsv1 and lfsv2 are known to work. ffv2 support needs more work. lfsv1 is
probably untested.)

2) Only 32-bit Fcodes are used. All 64-bit math uses two cells. This means it
should work on 32-bit machines.

Additional work to consider:

1) Rename genfth.cf to genffs.cf, or keep it and move the ffs symbols to genffs.cf

2) Move the ffs code and the lfs code to different source files so you can
selectively fload the just the filesystems you want.

3) Add code to load ELF files directly instead of relying on the host firmware
ELF support. But, since the binary is now 7250 bytes there may not be room.
 1.1.24.2 03-Dec-2017  jdolecek update from HEAD
 1.1.24.1 23-Jun-2013  tls resync from head
 1.1.14.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.6.1 13-Feb-2010  uebayasi file genlfs.cf was added on branch uebayasi-xip on 2010-04-30 14:39:50 +0000
 1.1.2.2 11-Mar-2010  yamt sync with head
 1.1.2.1 13-Feb-2010  yamt file genlfs.cf was added on branch yamt-nfs-mp on 2010-03-11 15:02:59 +0000
 1.2.10.1 22-Sep-2015  skrll Sync with HEAD
 1.21 03-Jun-2023  lukem adapt to ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

Simplify CWARNFLAGS to use ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
which works for both clang and gcc, and remove compiler-specific
equivalents.
 1.20 03-Jun-2023  lukem bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER

Provide a single variable
CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
CLANG_NO_ADDR_OF_PACKED_MEMBER
CC_NO_ADDR_OF_PACKED_MEMBER
GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.19 06-Sep-2020  mrg add support for new GCC 9 warnings that may be too much to fix
right now. new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree. mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it. (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.) clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
 1.18 23-Apr-2020  joerg Uses LFS boot code
 1.17 12-Jan-2014  tsutsui branches: 1.17.40;
Add empty LIBCRTI= as LIBCRT0 to build sa programs without installed DESTDIR.

XXX: probabry we should have bsd.saprog.mk or something.
 1.16 11-Dec-2005  christos branches: 1.16.112; 1.16.122; 1.16.128;
merge ktrace-lwp.
 1.15 28-Jul-2004  simonb Define LIB{CRT0,C,CRTBEGIN,CRTEND} as nothing, we don't need to link
against them.
 1.14 07-May-2002  pk branches: 1.14.10;
Convert `bootxx' to raw binary format which is what the MI installboot(8)
program needs.
 1.13 21-Feb-2000  pk branches: 1.13.8; 1.13.12;
bootxx links at 0x340000
2nd-stage boot programs choices: 0x200000,0x300000,0x400000,0x700000 (default: 0x300000)
 1.12 21-Feb-2000  pk RELOC -> RELOC_DEFAULT
 1.11 21-Aug-1999  sommerfeld branches: 1.11.2;
Use ${SIZE}, ${OBJCOPY} rather than size and objcopy.
 1.10 28-Apr-1999  christos Add -DLIBSA_NO_CLOSE
 1.9 05-Mar-1999  pk branches: 1.9.2; 1.9.4;
Use `-Ttext' switch & collect ld options in LINKFLAGS.
 1.8 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.7 17-Apr-1997  thorpej STRIP -> STRIPFLAG
 1.6 29-Nov-1996  pk remove header munging hack.
 1.5 10-Oct-1995  pk We don't need `rem.o'.
 1.4 09-Oct-1995  pk branches: 1.4.2;
Brr.. libkern.o is way too big for our bootxx..
 1.3 30-Sep-1995  pk Make this work with OBJ dirs.
 1.2 18-Sep-1995  pk Don't strip bootxx on installation.
 1.1 16-Sep-1995  pk Network booting; "oldmon" support; combine all functionality in single images.
Many thanks to Gordon Ross and Chuck Cranor for figuring out and testing
the old monitor (sun4) stuff.
 1.4.2.1 13-Oct-1995  pk Update from trunk: remove rem.o
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.2.1 22-Feb-2000  he Apply patch (requested by pk):
Make several sparc boot programs to run at different relocated
addresses. The boot build procedures can then pick the one which
is least likely to fail.
 1.11.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.12.1 20-Jun-2002  nathanw Catch up to -current.
 1.13.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.10.1 03-Aug-2004  skrll Sync with HEAD
 1.16.128.1 18-May-2014  rmind sync with head
 1.16.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.112.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.17.40.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.26 08-Oct-2015  joerg Don't check if an array is (not) NULL, check if the string is empty.
 1.25 26-Oct-2009  cegger branches: 1.25.22; 1.25.40;
kill extra whitespaces
reviewed by tsutsui@
 1.24 23-Aug-2009  he We need an explicit include of <sys/exec_aout.h> here as well.
 1.23 23-Mar-2009  tsutsui - use -Os to shrink bianries
- remove local shrinked memcpy() from bootxx.c bacause
now it's identical with __OPTIMIZE_SIZE__ libsa one
derived from src/common/lib/libc/string/bcopy.c.

Tested netboot from le0 and bootxx + boot from sd0 on SS1+.
 1.22 19-Mar-2009  he Now that the stand/ code was converted to use memcpy(), the private
implementation of bcopy() needs to become memcpy() as well. The
simpler local implementation is needed so that the boot code doesn't
overflow the available space.
 1.21 18-Mar-2009  cegger bcopy -> memcpy
 1.20 28-Apr-2008  martin branches: 1.20.8; 1.20.14;
Remove clause 3 and 4 from TNF licenses
 1.19 08-Mar-2007  he branches: 1.19.40; 1.19.42; 1.19.44;
Make the loadboot() declaration consistent, use char* because it
does pointer arithmetic on the argument.
 1.18 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 13-Jul-2006  uwe branches: 1.17.10;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.16 14-Jun-2006  uwe Nothing in this file needs <sys/time.h>
 1.15 14-Jun-2006  uwe Get strcpy prototype from libkern.h, not string.h
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.8; 1.14.14;
merge ktrace-lwp.
 1.13 03-Jun-2005  martin branches: 1.13.2;
constify
 1.12 28-Apr-2005  martin Ooops, missed this file when changing the bootdevice signature.
Pointed out by Juergen Hannken-Illjes.
 1.11 15-May-2002  lukem branches: 1.11.10; 1.11.16; 1.11.18; 1.11.24;
bootblock.h:
- unify sparc_bbinfo (1064 bytes, with 256 block entries)
and sun68k_bbinfo (296 byte, with 64 block entries)
into shared_bbinfo (512 bytes, with 118 block entries),
which will be also shared by future bbinfo-using platforms
(including macppc)
- add datestamp to *_BBINFO_MAGIC strings, to prevent installboot vs
bootxx version skew.
- add macppc support

*/bootxx.c:
- migrate to new shared_bbinfo structure

installboot:
- add macppc support (still needs applepartmap support and testing)
- improve and add some more warnings & errors to installboot
- implement shared_bbinfo_clearboot() and shared_bbinfo_setboot(), which
perform the majority of the work for bbinfo-using back-ends
(rather than replicating that across multiple back-ends).
 1.10 07-May-2002  lukem convert to <sys/bootblock.h>
 1.9 30-Oct-2001  thorpej Rather than using nlist(3), use a magic structure with a magic
number that installboot(8) can search for. Suggested by cgd@netbsd.org.
 1.8 13-Mar-2000  soren branches: 1.8.8; 1.8.10; 1.8.12;
Fix doubled 'the's in comments.
 1.7 08-Nov-1999  pk Include <sys/exec.h> instead of <a.out.h>/
 1.6 12-Jun-1999  pk branches: 1.6.2; 1.6.4; 1.6.8;
Initialize the heap (for alloc()) explicitly, since the `end' symbol
is not necessarily double-word aligned.
 1.5 03-May-1999  christos Casts for PROM_LOADADDR which is not casted anymore.
 1.4 15-Feb-1999  pk branches: 1.4.4;
Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.3 05-Sep-1998  pk Assign my copyrights to TNF.
 1.2 14-Sep-1997  pk Call the device close routine when we're done reading.
 1.1 01-Jun-1997  mrg branches: 1.1.4;
Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.1.4.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 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.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.12.2 20-Jun-2002  nathanw Catch up to -current.
 1.8.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.8.10.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.8.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.24.1 28-Apr-2005  tron Pull up revision 1.12 (requested by martin in ticket #211):
Ooops, missed this file when changing the bootdevice signature.
Pointed out by Juergen Hannken-Illjes.
 1.11.18.1 29-Apr-2005  kent sync with -current
 1.11.16.1 12-May-2005  riz Pull up new patch (requested by martin in ticket #1484):
Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.11.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.3 03-Sep-2007  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.14.14.1 19-Jun-2006  chap Sync with head.
 1.14.8.2 11-Aug-2006  yamt sync with head
 1.14.8.1 26-Jun-2006  yamt sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.17.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.44.4 11-Mar-2010  yamt sync with head
 1.19.44.3 16-Sep-2009  yamt sync with head
 1.19.44.2 04-May-2009  yamt sync with head.
 1.19.44.1 16-May-2008  yamt sync with head.
 1.19.42.1 18-May-2008  yamt sync with head.
 1.19.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.40.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.25.22.1 03-Dec-2017  jdolecek update from HEAD
 1.12 07-Feb-2024  msaitoh Fix typo of "following" in comment.
 1.11 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.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 04-Mar-2007  christos branches: 1.9.40; 1.9.42; 1.9.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 13-Jul-2006  uwe branches: 1.8.10;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.7 04-Mar-2006  uwe branches: 1.7.2;
s/u_intN_t/uintN_t/
 1.6 24-Dec-2005  perry branches: 1.6.4; 1.6.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 03-Jun-2005  martin branches: 1.4.2;
constify
 1.3 26-Feb-2003  pk branches: 1.3.2;
Move all `ID prom' stuff into the prom library.
 1.2 03-May-1999  christos Casts for PROM_LOADADDR which is not casted anymore.
 1.1 15-Feb-1999  pk branches: 1.1.4;
Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.1.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.3 03-Sep-2007  yamt sync with head.
 1.4.2.2 30-Dec-2006  yamt sync with head.
 1.4.2.1 21-Jun-2006  yamt sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.7.2.1 11-Aug-2006  yamt sync with head
 1.8.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.44.1 16-May-2008  yamt sync with head.
 1.9.42.1 18-May-2008  yamt sync with head.
 1.9.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.2 07-May-2002  lukem decommission old installboot; it doesn't work on bootxx anymore anyway.
 1.1 30-Oct-2001  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Rather than using nlist(3), use a magic structure with a magic
number that installboot(8) can search for. Suggested by cgd@netbsd.org.
 1.1.6.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.1 30-Oct-2001  thorpej file bbinfo.h was added on branch kqueue on 2002-01-10 19:49:09 +0000
 1.1.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.1.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.4.1 30-Oct-2001  nathanw file bbinfo.h was added on branch nathanw_sa on 2002-01-08 00:27:55 +0000
 1.1.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.2.1 30-Oct-2001  thorpej file bbinfo.h was added on branch thorpej-mips-cache on 2001-11-12 21:17:33 +0000
 1.2 05-Apr-2008  tsutsui Add support booting from UFS2 partition for sparc.
Tested on tme emulating SS2.

Closes PR port-sparc/36068.
 1.1 01-Jun-1997  mrg branches: 1.1.70; 1.1.108; 1.1.124; 1.1.158;
Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.1.158.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.124.1 03-Jun-2008  skrll Sync with netbsd-4.
 1.1.108.1 08-May-2008  jdc Pull up revisions:
src/sys/arch/sparc/stand/common/conf.c 1.2
src/sys/arch/sparc/stand/common/promdev.c 1.21
(requested by tsutsui in ticket #1132).

Add support booting from UFS2 partition for sparc.
Tested on tme emulating SS2.

Closes PR port-sparc/36068.
 1.1.70.2 08-May-2008  jdc Revert revisiion 1.1.70.1 and apply patch from ticket #1928 correctly.
 1.1.70.1 08-May-2008  jdc Pull up revisions:
src/sys/arch/sparc/stand/common/conf.c 1.2
src/sys/arch/sparc/stand/common/promdev.c 1.21
(requested by tsutsui in ticket #1928).

Add support booting from UFS2 partition for sparc.
Tested on tme emulating SS2.

Closes PR port-sparc/36068.
 1.15 21-Oct-2009  snj Drop 3rd and 4th clauses. Approved by gwr@ (copyright holder).
 1.14 13-Jul-2006  uwe branches: 1.14.62;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.13 25-Jan-2006  uwe branches: 1.13.2; 1.13.6;
It's free -> dealloc, not free -> size_t (hi, Christos :).
 1.12 25-Jan-2006  christos free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.11 11-Dec-2005  christos branches: 1.11.2;
merge ktrace-lwp.
 1.10 10-Nov-2003  wiz branches: 1.10.16;
Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.
 1.9 31-Oct-2000  pk branches: 1.9.24;
Align the DVMA mapping on NBPSG boundaries.
 1.8 18-Jun-2000  fvdl branches: 1.8.2;
Rearrange previous slightly to avoid getting values that are too low;
the only goal here is to leave some space for the stack.
 1.7 18-Jun-2000  fvdl Account for the stack when computing the base va. This makes the
bootblocks work again on the 4/110.
 1.6 14-Apr-2000  pk branches: 1.6.2;
dvma_init: avoid integer variable overflow
 1.5 15-Feb-2000  pk Determine base address at run time.
 1.4 15-Feb-2000  pk Nuke unused code.
 1.3 15-Feb-1999  pk branches: 1.3.2; 1.3.8;
Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.2 12-Oct-1998  pk Move around a few PTE-manipulating macros.
 1.1 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.3.8.2 22-Nov-2000  bouyer Sync with HEAD.
 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.3.2.3 27-Jul-2000  he Revert previous, and pull up revisions 1.7-1.8 (requested by pk):
Account for stack when computing base VA; fixes booting on sun4
systems. Fixes PR#9906 and PR#10165
(Previous patch had bug as submitted.)
 1.3.2.2 23-Jul-2000  he Pull up revisions 1.7-1.8 (via patch, requested by pk):
Account for stack when computing base VA; fixes booting on sun4
systems. Fixes PR#9906 and PR#10165
 1.3.2.1 27-Jun-2000  he Apply patch (requested by pk):
Fix lossage of the bootstrap program on sun4 machines, at least
when booting from disk. Fixes PR#9906.
 1.6.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.2.1 01-Nov-2000  tv Pullup 1.9 [pk]:
Align the DVMA mapping on NBPSG boundaries.
 1.9.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.24.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.2 30-Dec-2006  yamt sync with head.
 1.10.16.1 21-Jun-2006  yamt sync with head.
 1.11.2.1 01-Feb-2006  yamt sync with head.
 1.13.6.1 11-Aug-2006  yamt sync with head
 1.13.2.1 09-Sep-2006  rpaulo sync with head
 1.14.62.1 11-Mar-2010  yamt sync with head
 1.1 25-Aug-2010  christos branches: 1.1.2; 1.1.4; 1.1.10;
factor out the floppy detection code.
 1.1.10.2 05-Mar-2011  rmind sync with head
 1.1.10.1 25-Aug-2010  rmind file isfloppy.c was added on branch rmind-uvmplock on 2011-03-05 20:52:04 +0000
 1.1.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.1.4.1 25-Aug-2010  uebayasi file isfloppy.c was added on branch uebayasi-xip on 2010-10-22 07:21:33 +0000
 1.1.2.2 09-Oct-2010  yamt sync with head
 1.1.2.1 25-Aug-2010  yamt file isfloppy.c was added on branch yamt-nfs-mp on 2010-10-09 03:31:53 +0000
 1.1 25-Aug-2010  christos branches: 1.1.2; 1.1.4; 1.1.10;
factor out the floppy detection code.
 1.1.10.2 05-Mar-2011  rmind sync with head
 1.1.10.1 25-Aug-2010  rmind file isfloppy.h was added on branch rmind-uvmplock on 2011-03-05 20:52:04 +0000
 1.1.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.1.4.1 25-Aug-2010  uebayasi file isfloppy.h was added on branch uebayasi-xip on 2010-10-22 07:21:33 +0000
 1.1.2.2 09-Oct-2010  yamt sync with head
 1.1.2.1 25-Aug-2010  yamt file isfloppy.h was added on branch yamt-nfs-mp on 2010-10-09 03:31:53 +0000
 1.9 26-Mar-2014  christos kill sprintf
 1.8 28-Apr-2008  martin branches: 1.8.34; 1.8.44; 1.8.50;
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 19-Jun-2005  thorpej Move common Sun ID PROM definitions into <dev/sun/idprom.h>.
 1.5 23-Jan-2005  pk Make pmap_map() work on sun4 machines.
Thanks to Matthew and Julian for finding this.
 1.4 24-Oct-2003  pk branches: 1.4.2; 1.4.6; 1.4.8;
pmap_map_srmmu: use the `map-pages' Forth word to let prom map all pages
at once.
 1.3 10-Jul-2003  pk pmap_map(): round up size to compute # of pages.
 1.2 27-Jun-2003  uwe branches: 1.2.2;
Drop redundant argument to printf("\n"). Obvious pasto.
 1.1 01-Mar-2003  pk Add support for large kernels by searching for a physical memory segment
to fit it in. As a bonus, the kernel is now also mapped to the virtual
address (i.e. KERNBASE) it is linked at.
 1.2.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.4.6.1 16-Mar-2005  tron Pull up revision 1.5 (requested by pk in ticket #1118):
Make pmap_map() work on sun4 machines.
Thanks to Matthew and Julian for finding this.
 1.4.2.1 16-Mar-2005  tron Pull up revision 1.5 (requested by pk in ticket #1118):
Make pmap_map() work on sun4 machines.
Thanks to Matthew and Julian for finding this.
 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.8.50.1 18-May-2014  rmind sync with head
 1.8.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.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.11 12-Apr-2021  mrg remove shadowed (common) declarations of various libsa variables
from various boot programs. for macppc and zaurus, avoid building
with -fcommon any more.
 1.10 23-Apr-2020  joerg branches: 1.10.4;
rootpath is owned by libsa
 1.9 21-Oct-2009  snj branches: 1.9.74;
Drop 3rd and 4th clauses. Approved by gwr@ (copyright holder).
 1.8 13-Jul-2006  uwe branches: 1.8.62;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.7 25-Feb-2003  pk branches: 1.7.18; 1.7.32; 1.7.36;
Note which network boot protocol we're trying.
 1.6 14-May-2002  lukem - Enable NFS_BOOT_DHCP (as well as the existing NFS_BOOT_BOOTPARAM).
DHCP/Bootp is tried before bootparams in the MI nfs mountroot code.
- Change the order in boot.net from "bootparams then bootp" to
"bootp then bootparams", to be consistent with the MI nfs mountroot code.

(Consistency with other NetBSD ports is good, and things still work
for sites that run bootparams but not dhcp/bootp, although I'd argue that
dhcp/bootp is much easier to setup and manage and is easier to debug
than our rpc.bootparamd...)

Per discussion with Paul Kranenburg and Matt Green.
 1.5 22-Jan-2000  pk branches: 1.5.8; 1.5.12;
Try both the BOOTPARAMS and BOOTP protocol (in that order). This also
takes care of PR#8738.
 1.4 07-May-1999  drochner branches: 1.4.2;
include <lib/libkern/libkern.h> for intoa()/inet_ntoa()
 1.3 15-Feb-1999  pk branches: 1.3.4;
Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.2 22-Jul-1997  drochner Don't use <lib/libsa/if_ether.h> anymore. This was a copy of the
old (before ARP changes) <netinet/if_ether.h>, intended for
temporary use.
 1.1 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.3.4.1 21-Jun-1999  thorpej Sync w/ -current.
 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.12.1 20-Jun-2002  nathanw Catch up to -current.
 1.5.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.36.1 11-Aug-2006  yamt sync with head
 1.7.32.1 09-Sep-2006  rpaulo sync with head
 1.7.18.1 30-Dec-2006  yamt sync with head.
 1.8.62.1 11-Mar-2010  yamt sync with head
 1.9.74.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.10.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.12 21-Oct-2009  snj Drop 3rd and 4th clauses. Approved by gwr@ (copyright holder).
 1.11 18-Mar-2009  cegger bzero -> memset
 1.10 12-Jan-2009  tsutsui branches: 1.10.2;
Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.9 13-Jul-2006  uwe branches: 1.9.58; 1.9.62; 1.9.70;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.8;
merge ktrace-lwp.
 1.7 15-Mar-2004  pk branches: 1.7.16;
Replace myetheraddr() by prom_getether(). Convert the file descriptor to
deivce tree node (if possible) to support the "local-mac-address' property.
 1.6 13-Mar-2003  hannken branches: 1.6.2;
Explicit cast for netif.

Approved by: Matthias Drochner <drochner@netbsd.org>
 1.5 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.4 08-Nov-1999  pk Remove inclusion of unused headers.
 1.3 15-Feb-1999  pk branches: 1.3.8; 1.3.10; 1.3.14;
Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.2 22-Jul-1997  drochner Don't use <lib/libsa/if_ether.h> anymore. This was a copy of the
old (before ARP changes) <netinet/if_ether.h>, intended for
temporary use.
 1.1 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.3.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.10.1 15-Nov-1999  fvdl Sync with -current
 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.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 30-Dec-2006  yamt sync with head.
 1.8.8.1 11-Aug-2006  yamt sync with head
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.9.70.2 28-Apr-2009  skrll Sync with HEAD.
 1.9.70.1 19-Jan-2009  skrll Sync with HEAD.
 1.9.62.2 11-Mar-2010  yamt sync with head
 1.9.62.1 04-May-2009  yamt sync with head.
 1.9.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.10.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3 21-Jul-2000  jdolecek switch to sys/conf/newvers_stand.sh for generation of version file
sync the message in boot/version with other ports using newvers_stand.sh
 1.2 15-Jan-1999  mrg branches: 1.2.8; 1.2.18;
look for /^Version:/ to find the boot block version, rather than using
the "version" file's RCS id (which is useless for branches).
 1.1 01-Jun-1997  mrg branches: 1.1.8;
Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.1.8.1 19-Jan-1999  cgd pull up rev 1.2 from trunk (mrg)
 1.2.18.1 26-Aug-2000  mrg "pull up" (via patch) fixes for sparc64 vs sparc boot blocks. (this is
resolved on the trunk with newvers_stand.sh). approved by thorpej.
 1.2.8.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.31 17-Jan-2025  riastradh sparc promdev.c: Nix trailing whitespace. Fix intertoken space.

No functional change intended.
 1.30 13-Jan-2025  jdc Move the check for RAID boot into the strategy routines.
This avoids a Data Access Exception at boot time on older PROM versions.
 1.29 03-Feb-2019  mrg branches: 1.29.36;
don't compare string pointers against \0
 1.28 25-Mar-2017  martin branches: 1.28.14;
Virtio block devices may have a "scsi" device_type instead of "block",
so accept both.
 1.27 30-Dec-2013  martin branches: 1.27.6; 1.27.10; 1.27.14;
Avoid buffer overruns (no practical difference for any sane firmware
properties, but better be safe).
 1.26 02-Sep-2010  uwe branches: 1.26.8; 1.26.18; 1.26.22;
Fix printf formats in -DDEBUG_PROM to make it compile.

XXX: print daddr_t after casting it to int since libsa is not built
with LIBSA_PRINTF_LONGLONG_SUPPORT by default.
 1.25 25-Aug-2010  christos factor out the floppy detection code.
 1.24 25-Aug-2010  christos Don't LOAD_BACKWARDS for floppies.
 1.23 18-Oct-2009  tsutsui branches: 1.23.2; 1.23.4;
Don't try to read disklabel to check FS_RAID on floppy boot since
reopening floppy could cause Data Access Exception later.
Fixes PR port-sparc/42186, ok'ed by mrg@.
 1.22 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.21 05-Apr-2008  tsutsui branches: 1.21.4; 1.21.12; 1.21.14; 1.21.20;
Add support booting from UFS2 partition for sparc.
Tested on tme emulating SS2.

Closes PR port-sparc/36068.
 1.20 13-Jul-2006  uwe branches: 1.20.8; 1.20.24; 1.20.58;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.19 20-Jun-2006  jdc Add support to the 2nd stage boot loader for booting from RAID
partitions. We do this by checking the NetBSD label to see if the
boot partition is of type RAID. If so, we offset reads from the
disk so that the kernel image can be read.

Note that with this code, sun4 machines (with PROM monitor) will only
boot from RAID if the RAID partition is the first one on the disk.

Tested on a SPARCstation 20, a SPARCstation 2 and a 4/330.
 1.18 20-May-2006  mrg branches: 1.18.2;
struct filesystem is now struct fs_ops, since i don't know when.
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.6; 1.17.8; 1.17.12; 1.17.14;
merge ktrace-lwp.
 1.16 27-Apr-2005  martin branches: 1.16.2;
Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.15 30-Jul-2003  mrg branches: 1.15.6; 1.15.8; 1.15.14;
sprinkle some: libkern.h, some -ffreestanding and some cast-y goodness,
all for the pleasure of the gcc 3 :-)
 1.14 26-Feb-2003  pk branches: 1.14.2;
Move all `ID prom' stuff into the prom library.
 1.13 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.12 26-Sep-2001  eeh branches: 1.12.4;
getprop* -> PROM_getprop*
 1.11 05-Aug-2001  mrg branches: 1.11.2;
avoid an unused variable warning
 1.10 04-Apr-2001  pk branches: 1.10.2;
* Missing PROM_OPENFIRM: case in getdevtype() and prom_getether().
* In getdevtype(), use prom_instance_to_package() to get to the device node.

From Valeriy E. Ushakov on port-sparc@netbsd.org.
 1.9 18-Jan-2001  pk branches: 1.9.2;
On V0 proms, read the `idprom' property at the root node to get to the
station's ethernet address.
 1.8 28-Apr-1999  christos branches: 1.8.2; 1.8.12;
Include <sys/systm.h> to get prototype for memset.
 1.7 15-Feb-1999  pk branches: 1.7.4;
Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.6 12-Oct-1998  pk Move around a few PTE-manipulating macros.
 1.5 05-Oct-1998  christos rename getprop routine to avoid conflict with the one in bsd_openprom.h
 1.4 15-Sep-1998  pk Can't afford a 1K buffer in the data segment.
 1.3 29-Aug-1998  mrg add support for finding kernels other than `netbsd'. the list is:
netbsd, netbsd.gz, netbsd.old, netbsd.old.gz, onetbsd, onetbsd.gz
and vmunix, in that order. this is used by the bootable `bootfs'
image (suitable for floppies and cdroms), which contains a netbsd.gz
by default.
while i'm here, fix up `boot [device] -s' which got broke when
booting kernels with a - in their name was fixed..
 1.2 27-May-1998  pk Properly split boot spec into file name and arguments.
 1.1 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.7.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.12.1 03-Feb-2001  he Pull up revision 1.9 (requested by pk):
On V0 proms, read the ``idprom'' property at the root node to
get to the station's ethernet address. Fixes netbooting on some
older SPARCstations where the boot program would otherwise crash.
 1.8.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.8.2.1 11-Feb-2001  bouyer Sync with HEAD.
 1.9.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.10.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.11.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.12.4.2 18-Oct-2002  nathanw Catch up to -current.
 1.12.4.1 26-Sep-2001  nathanw file promdev.c was added on branch nathanw_sa on 2002-10-18 02:40:01 +0000
 1.14.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.15.14.3 08-May-2008  jdc Pull up revisions:
src/sys/arch/sparc/stand/common/conf.c 1.2
src/sys/arch/sparc/stand/common/promdev.c 1.21
(requested by tsutsui in ticket #1928).

Add support booting from UFS2 partition for sparc.
Tested on tme emulating SS2.

Closes PR port-sparc/36068.
 1.15.14.2 10-Nov-2006  ghen Pull up following revision(s) (requested by jdc in ticket #1527):
sys/arch/sparc/stand/common/promdev.c: revision 1.19
share/man/man8/man8.sparc/boot.8: revision 1.29 + patch
share/man/man8/man8.sparc/boot.8: revision 1.30
Add support to the 2nd stage boot loader for booting from RAID
partitions. We do this by checking the NetBSD label to see if the
boot partition is of type RAID. If so, we offset reads from the
disk so that the kernel image can be read.
Note that with this code, sun4 machines (with PROM monitor) will only
boot from RAID if the RAID partition is the first one on the disk.
Tested on a SPARCstation 20, a SPARCstation 2 and a 4/330.
Add some PROM monitor and Open Boot PROM boot-related commands and a
BUGS section describing boot limitations.
Drop trailing whitespace.
 1.15.14.1 28-Apr-2005  tron Pull up revision 1.16 (requested by martin in ticket #210):
Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.15.8.1 29-Apr-2005  kent sync with -current
 1.15.6.1 12-May-2005  riz Pull up revision 1.16 (requested by martin in ticket #1484):
Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.16.2.2 30-Dec-2006  yamt sync with head.
 1.16.2.1 21-Jun-2006  yamt sync with head.
 1.17.14.1 19-Jun-2006  chap Sync with head.
 1.17.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.17.8.3 11-Aug-2006  yamt sync with head
 1.17.8.2 26-Jun-2006  yamt sync with head.
 1.17.8.1 24-May-2006  yamt sync with head.
 1.17.6.1 01-Jun-2006  kardel Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.18.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.20.58.2 17-Jan-2009  mjf Sync with HEAD.
 1.20.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.24.1 03-Jun-2008  skrll Sync with netbsd-4.
 1.20.8.2 27-Jan-2010  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1379):
sys/arch/sparc/sparc/auxreg.h: revision 1.13
distrib/sparc/ramdisk/dot.profile: revision 1.20
sys/arch/sparc/stand/common/promdev.c: revision 1.23
Don't try to read disklabel to check FS_RAID on floppy boot since
reopening floppy could cause Data Access Exception later.
Fixes PR port-sparc/42186, ok'ed by mrg@.
Use /dev/fd0a rather than /dev/rfd0a to read instfs.tgz image from floppy.
It looks newer (appearred after 1.6) gzip tries to read less than DEV_BSIZE
(to check header?) so we can't use raw device directly.
(note sparc bootfs ramdisk doesn't have dd(1))
Workaround for PR port-sparc/42193, and would also fix PR install/28734.
Explicitly clear AUXIO4M_FTC bit in FTC_FLIP macro used on
pseudo-dma for floppy, as well as AUXIO4C_FTC bit for sun4c.
A comment in the macro says AUXIO4M_FTC bit is auto-clear,
but my two SS20s (including compatible) with 150MHz hyperSPARCs
get data_overrun without it, and no bad side effect on SS5
(works with and without this change).
Closes PR port-sparc/42516, which is the last one of a bunch of
floppy issue on NetBSD/sparc since NetBSD 2.0 days. See
http://mail-index.NetBSD.org/port-sparc/2009/12/20/msg000484.html
for details.
 1.20.8.1 08-May-2008  jdc Pull up revisions:
src/sys/arch/sparc/stand/common/conf.c 1.2
src/sys/arch/sparc/stand/common/promdev.c 1.21
(requested by tsutsui in ticket #1132).

Add support booting from UFS2 partition for sparc.
Tested on tme emulating SS2.

Closes PR port-sparc/36068.
 1.21.20.1 21-Apr-2010  matt sync to netbsd-5
 1.21.14.1 23-Jan-2010  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1251):
sys/arch/sparc/sparc/auxreg.h: revision 1.13
distrib/sparc/ramdisk/dot.profile: revision 1.20
sys/arch/sparc/dev/audioamd.c: revision 1.25
sys/arch/sparc/dev/fd.c: revision 1.147
sys/arch/sparc/stand/common/promdev.c: revision 1.23
distrib/sparc/miniroot/Makefile.inc: revision 1.16
Build miniroot binaries for sparc with -Os to shrink instfs.tgz
for the second boot floppy which use miniroot objects.
This is workaround for PR install/42146, and ok'ed by mrg@.
Don't try to read disklabel to check FS_RAID on floppy boot since
reopening floppy could cause Data Access Exception later.
Fixes PR port-sparc/42186, ok'ed by mrg@.
Disable "fast trap" handlers which invoke software interrupts
in sparc/amd7930intr.s and sparc/bsd_fdintr.s until they are
rewritten to adapt new MI softint(9) API.
No particular comments on PR port-sparc/42192, but
this fixes timeout problem on floppy access on my SPARCstation 1+.
XXX: floppy support on sun4m seems to have another problem (data overrun).
Use /dev/fd0a rather than /dev/rfd0a to read instfs.tgz image from floppy.
It looks newer (appearred after 1.6) gzip tries to read less than DEV_BSIZE
(to check header?) so we can't use raw device directly.
(note sparc bootfs ramdisk doesn't have dd(1))
Workaround for PR port-sparc/42193, and would also fix PR install/28734.
Explicitly clear AUXIO4M_FTC bit in FTC_FLIP macro used on
pseudo-dma for floppy, as well as AUXIO4C_FTC bit for sun4c.
A comment in the macro says AUXIO4M_FTC bit is auto-clear,
but my two SS20s (including compatible) with 150MHz hyperSPARCs
get data_overrun without it, and no bad side effect on SS5
(works with and without this change).
Closes PR port-sparc/42516, which is the last one of a bunch of
floppy issue on NetBSD/sparc since NetBSD 2.0 days. See
http://mail-index.NetBSD.org/port-sparc/2009/12/20/msg000484.html
for details.
 1.21.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.4.3 09-Oct-2010  yamt sync with head
 1.21.4.2 11-Mar-2010  yamt sync with head
 1.21.4.1 04-May-2009  yamt sync with head.
 1.23.4.1 05-Mar-2011  rmind sync with head
 1.23.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.26.22.1 18-May-2014  rmind sync with head
 1.26.18.2 03-Dec-2017  jdolecek update from HEAD
 1.26.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.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.27.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.27.10.1 26-Apr-2017  pgoyette Sync with HEAD
 1.27.6.1 28-Aug-2017  skrll Sync with HEAD
 1.28.14.1 10-Jun-2019  christos Sync with HEAD
 1.29.36.1 02-Aug-2025  perseant Sync with HEAD
 1.16 25-Aug-2010  christos factor out the floppy detection code.
 1.15 25-Aug-2010  christos Don't LOAD_BACKWARDS for floppies.
 1.14 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.13 28-Apr-2008  martin branches: 1.13.8;
Remove clause 3 and 4 from TNF licenses
 1.12 13-Jul-2006  uwe branches: 1.12.58; 1.12.60; 1.12.62;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.11 11-Dec-2005  christos branches: 1.11.4; 1.11.8;
merge ktrace-lwp.
 1.10 27-Apr-2005  martin branches: 1.10.2;
Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.9 01-Mar-2003  pk branches: 1.9.2; 1.9.8; 1.9.10; 1.9.16;
Add support for large kernels by searching for a physical memory segment
to fit it in. As a bonus, the kernel is now also mapped to the virtual
address (i.e. KERNBASE) it is linked at.
 1.8 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.7 27-May-1999  pk `xmit' & `recv' return `ssize_t'
 1.6 30-Apr-1999  christos Add bootinfo struct to pass symtab arguments.
XXX: This does not work with ELF yet, but I don't understand why...
 1.5 15-Feb-1999  pk branches: 1.5.4;
Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.4 12-Oct-1998  pk Move around a few PTE-manipulating macros.
 1.3 05-Sep-1998  pk Assign my copyrights to TNF.
 1.2 14-Sep-1997  pk Define a new DDB magic number to pass to the kernel.
 1.1 01-Jun-1997  mrg branches: 1.1.4;
Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.1.4.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.16.1 28-Apr-2005  tron Pull up revision 1.10 (requested by martin in ticket #210):
Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.9.10.1 29-Apr-2005  kent sync with -current
 1.9.8.1 12-May-2005  riz Pull up revision 1.10 (requested by martin in ticket #1484):
Do not rely on strings to which pointers are returned by promlib functions
to persist accross further promlib calls.
This fixes (at least) bootjs.net.
 1.9.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.1 30-Dec-2006  yamt sync with head.
 1.11.8.1 11-Aug-2006  yamt sync with head
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.12.62.2 04-May-2009  yamt sync with head.
 1.12.62.1 16-May-2008  yamt sync with head.
 1.12.60.1 18-May-2008  yamt sync with head.
 1.12.58.2 17-Jan-2009  mjf Sync with HEAD.
 1.12.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.12 10-Mar-2016  martin Deal with _edata not being 4-byte aligned
 1.11 28-Apr-2008  martin branches: 1.11.44; 1.11.64;
Remove clause 3 and 4 from TNF licenses
 1.10 11-Dec-2005  christos branches: 1.10.74; 1.10.76; 1.10.78;
merge ktrace-lwp.
 1.9 23-Mar-2004  pk Add openfirmware() entry point.
 1.8 28-Jun-2003  uwe branches: 1.8.2;
Only JavaStations have OFW, so set cpu type to CPU_SUN4M in is_openfirm.
 1.7 21-Nov-2001  uwe Skip relocation if OpenFirmware already loaded us at the right address.
 1.6 20-May-2001  uwe branches: 1.6.2; 1.6.8;
Save OpenFirmware client interface handler in romp, where it is
expected to be. GC unused opf_romp variable.
 1.5 19-Oct-2000  pk branches: 1.5.2;
When relocating, there's no need to copy the BSS area.
 1.4 05-Mar-1999  pk branches: 1.4.8;
Use <machine/asm.h> to construct C identifiers.
 1.3 15-Feb-1999  pk Transfer copyright to TNF.
 1.2 15-Feb-1999  pk Use PROMLIB to streamline this code. This also provides the bulk of
Open Firmware boot code.
 1.1 01-Jun-1997  mrg Completely rearrange SPARC boot code, modeling it after alpha and hp300
ports' boot programs. Also added support for loading gzip'd kernels,
useful for booting from floppy. From Jason R. Thorpe <thorpej@nas.nasa.gov>,
tested by Matthew Green <mrg@eterna.com.au> and Erik Fair <fair@clock.org>.
 1.4.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.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.6.8.1 20-May-2001  nathanw file srt0.S was added on branch nathanw_sa on 2002-01-08 00:27:56 +0000
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.10.78.1 16-May-2008  yamt sync with head.
 1.10.76.1 18-May-2008  yamt sync with head.
 1.10.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.64.1 19-Mar-2016  skrll Sync with HEAD
 1.11.44.1 03-Dec-2017  jdolecek update from HEAD
 1.17 14-May-2022  hgutch PR 56829: Fix "map" call to Open Firmware and no longer mess up OFW stack.
This unbreaks miniroot.fs.

Thanks to Björn Johannesson for originally pointing this out and to
mrg@ for pointing out the actual issue and suggesting a fix.
 1.16 15-Sep-2017  martin Add more details about the boot device as a new bootinfo record type.
From within the bootloader, when we have readily accessible instance
handles of the boot device, it is easy to query more details like SCSI
LUN, target, and FC-AL wwn from the firmware.
The kernel later would have a hard time getting theses, but can make good
use to match the boot device.
 1.15 10-Oct-2015  martin Add compile time asserts to make sure we have properly picked up types
for a 64bit cpu and 64bit openfirmware.
 1.14 27-Mar-2015  nakayama Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
 1.13 18-Dec-2013  martin branches: 1.13.4; 1.13.6;
The "close" call returns no arguments
 1.12 21-May-2011  tsutsui branches: 1.12.4; 1.12.10; 1.12.14; 1.12.16; 1.12.18; 1.12.24;
WARNSfy and fix dumb bugs noticed by warnings.
 1.11 18-May-2009  nakayama branches: 1.11.4; 1.11.6;
Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.10 17-Oct-2007  garbled branches: 1.10.20; 1.10.30; 1.10.40; 1.10.44;
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 19-Sep-2007  martin Some aliases (like "cdrom") expand to a path that includes a partition -
deal with them.
 1.8 13-Jul-2006  uwe branches: 1.8.14; 1.8.22; 1.8.32; 1.8.34;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.7 27-Jan-2006  cdi branches: 1.7.2; 1.7.6;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.6 11-Dec-2005  christos branches: 1.6.2;
merge ktrace-lwp.
 1.5 01-Jun-2005  martin branches: 1.5.2;
Adapt to constification
 1.4 16-Jan-2005  chs remove some dead code, simplify and wrap some long lines.
 1.3 27-Sep-2002  provos branches: 1.3.6; 1.3.14;
remove trailing \n in panic(). approved perry.
 1.2 06-Jun-2002  martin Follow changes in libsa/stand.h: exit(void) -> exit(int) (one in a #if
0 block), to make it compile again.
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.8; 1.1.12; 1.1.20;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.20.1 15-Jul-2002  gehenna catch up with -current.
 1.1.12.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.12.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file Locore.c was added on branch thorpej_scsipi on 2000-11-20 20:25:50 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file Locore.c was added on branch netbsd-1-5 on 2000-08-26 00:05:15 +0000
 1.3.14.1 29-Apr-2005  kent sync with -current
 1.3.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.6.1 17-Jan-2005  skrll Sync with HEAD.
 1.5.2.3 27-Oct-2007  yamt sync with head.
 1.5.2.2 30-Dec-2006  yamt sync with head.
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.6.2.1 01-Feb-2006  yamt sync with head.
 1.7.6.1 11-Aug-2006  yamt sync with head
 1.7.2.1 09-Sep-2006  rpaulo sync with head
 1.8.34.1 06-Nov-2007  matt sync with HEAD
 1.8.32.1 02-Oct-2007  joerg Sync with HEAD.
 1.8.22.1 03-Oct-2007  garbled Sync with HEAD
 1.8.14.1 09-Oct-2007  ad Sync with head.
 1.10.44.2 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.10.44.1 17-Apr-2015  msaitoh Pull up following revision(s) (requested by nakayama in ticket #1958):
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
 1.10.40.2 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.10.40.1 17-Apr-2015  msaitoh Pull up following revision(s) (requested by nakayama in ticket #1958):
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
 1.10.30.2 19-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.10.30.1 17-Apr-2015  msaitoh Pull up following revision(s) (requested by nakayama in ticket #1958):
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
 1.10.20.1 20-Jun-2009  yamt sync with head
 1.11.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.11.4.1 31-May-2011  rmind sync with head
 1.12.24.1 16-Apr-2015  msaitoh Pull up following revision(s) (requested by nakayama in ticket #1285):
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
 1.12.18.1 18-May-2014  rmind sync with head
 1.12.16.1 16-Apr-2015  msaitoh Pull up following revision(s) (requested by nakayama in ticket #1285):
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
 1.12.14.2 03-Dec-2017  jdolecek update from HEAD
 1.12.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.10.1 16-Apr-2015  msaitoh Pull up following revision(s) (requested by nakayama in ticket #1285):
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
 1.12.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.13.6.1 06-Apr-2015  skrll Sync with HEAD
 1.13.4.1 29-Mar-2015  martin Pull up following revision(s) (requested by nakayama in ticket #649):
sys/arch/sparc/sparc/openfirm.c: revision 1.20
sys/arch/sparc/include/openfirm.h: revision 1.8
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
Sync sparc64 kernel's OF_seek with ofwboot's one, but sparc version
is not changed.
 1.42 03-Jun-2023  lukem adapt to ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

Simplify CWARNFLAGS to use ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
which works for both clang and gcc, and remove compiler-specific
equivalents.
 1.41 03-Jun-2023  lukem bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER

Provide a single variable
CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
CLANG_NO_ADDR_OF_PACKED_MEMBER
CC_NO_ADDR_OF_PACKED_MEMBER
GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.40 06-Sep-2020  mrg add support for new GCC 9 warnings that may be too much to fix
right now. new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree. mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it. (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.) clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
 1.39 20-Apr-2020  riastradh More -Wno-error=address-of-packed-member to placate clang.
 1.38 08-Apr-2017  christos branches: 1.38.14; 1.38.24;
centralize vers.c building for standalone programs.
 1.37 01-Oct-2016  christos branches: 1.37.2;
deal with PIE and SSP
 1.36 26-Oct-2015  mrg branches: 1.36.2;
force -mcpu=v9 for ofwboot, which demands v9 cpus.
 1.35 10-Oct-2015  martin Simplify, get rid of manual _LP64 define.
Do not pass a SUN4U define, as that is no longer used in the relevant headers.
Instead tell the compiler we are compiling for a v9 CPU (so it internally
defines everything we need).
 1.34 02-Oct-2015  joerg Support per-target AFLAGS.
 1.33 11-Jan-2015  martin Strip debug symbols from ofwboot.

The forth bootsector loading this file when booting from disk is
"simplistic" and does not skip non loadable sections. The five times
bigger file with debug info overruns some important memory contents
with some firmware versions otherwise.
 1.32 12-Jan-2014  tsutsui branches: 1.32.4; 1.32.6;
Add empty LIBCRTI= as LIBCRT0 to build sa programs without installed DESTDIR.

XXX: probabry we should have bsd.saprog.mk or something.
 1.31 08-Dec-2013  palle Add support for running ofwboot on sun4v. Please note that the kernel on sun4v will be loaded properly but when the kernel takes over it will crash immediately since the kernel is not sun4v ready yet
 1.30 21-Aug-2013  matt Use <bsd.klinks.mk>
 1.29 21-May-2011  tsutsui branches: 1.29.4; 1.29.14; 1.29.18;
WARNSfy and fix dumb bugs noticed by warnings.
 1.28 23-Jan-2011  nakayama Redo previous.
bsd.own.mk must be included after NOMAN=.
 1.27 22-Jan-2011  joerg Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.26 17-Jan-2011  joerg branches: 1.26.2;
Move SPARC and SPARC64 to modern CPP. Update UPDATING note for this and
Alpha.
 1.25 25-Aug-2010  christos branches: 1.25.2;
factor out the floppy detection code.
 1.24 27-May-2010  dholland Introduce .WAIT into the cleandir rule for blasting the libsa/libkern/etc.
trees, because it can race with the libsa/libkern/etc. makefiles' own
cleandir rules. I think I've found all of the uses of the offending idiom...
Closes PR 43360.
 1.23 02-Apr-2010  martin Add support for /boot.cfg. Implement a single command for now: override
the boot partition, which will be used for bootable CDs. Add cd9660
support.
 1.22 27-Nov-2009  tsutsui branches: 1.22.2; 1.22.4;
Add src/common/include to -Ipath for proplib(3) so that build works
even without installed DESTDIR.
 1.21 17-Oct-2007  garbled branches: 1.21.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.20 29-Sep-2007  martin Enable booting from news Solaris ufs partitions.
 1.19 14-Sep-2007  martin branches: 1.19.2;
Rename the option to enable ISO 9660 file system support from ..._HSFS
to ..._CD9660.
 1.18 27-Jan-2006  cdi branches: 1.18.28; 1.18.36; 1.18.46; 1.18.48;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.17 27-Jan-2006  uwe Use the same code to create machine, sparc and sparc64 symlinks that
../Makefile.buildboot uses.
 1.16 22-Jan-2006  dsl Add an explicit -I for sys/lib/libsa so that we find the <iodesc.h>
requested inside sys/lib/libsa/net.h
This used to be "iodesc.h" but another build needs to override it with
a local copy.
 1.15 11-Dec-2005  christos branches: 1.15.2;
merge ktrace-lwp.
 1.14 10-Jul-2005  christos Turn on dhcp support.
 1.13 28-Jul-2004  simonb branches: 1.13.10; 1.13.12;
Define LIB{CRT0,C,CRTBEGIN,CRTEND} as nothing, we don't need to link
against them.
 1.12 21-Jun-2004  jmc Ignore errors on some rm -rf's for platforms that aren't quite
POSIX compliant
and return errors on r/o source (FreeBSD) for -rf. Fixes PR#25022
 1.11 21-Mar-2004  martin branches: 1.11.2;
Create a symlink for <sparc/...> include paths as well, the new openfirm.h
needs it.
 1.10 07-Dec-2003  mrg merge ultrasparc ofwboot / ofwboot.net.
 1.9 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.8 01-Jun-2003  thorpej branches: 1.8.2;
Add -ffreestanding.
 1.7 17-May-2003  nakayama Make sure to remove lib directories.
 1.6 17-May-2003  nakayama Make sure to remove proper link.
 1.5 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.4 04-Dec-2001  thorpej Don't declare which exec formats to support in loadfile_machdep.h.
Instead, give each user of loadfile() control over which exec formats
it wants to support.
 1.3 22-Sep-2001  tv branches: 1.3.4;
objcopy -> ${OBJCOPY}; remove redundant definitions of OBJCOPY?= (it is
now in bsd.own.mk).
 1.2 04-Mar-2001  mrg branches: 1.2.2; 1.2.4;
this is a sparc64 program. so -DSUN4U, machine -> sparc64. cleanup.
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.4.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file Makefile was added on branch thorpej_scsipi on 2000-11-20 20:25:50 +0000
 1.1.2.3 26-Aug-2000  mrg "pull up" (via patch) fixes for sparc64 vs sparc boot blocks. (this is
resolved on the trunk with newvers_stand.sh). approved by thorpej.
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file Makefile was added on branch netbsd-1-5 on 2000-08-26 00:05:15 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.4.1 22-Sep-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-01-08 00:27:56 +0000
 1.8.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.2.1 22-Jun-2004  tron Pull up revision 1.12 (requested by jmc in ticket #531):
Ignore errors on some rm -rf's for platforms that aren't quite
POSIX compliant
and return errors on r/o source (FreeBSD) for -rf. Fixes PR#25022
 1.13.12.2 27-Oct-2007  yamt sync with head.
 1.13.12.1 21-Jun-2006  yamt sync with head.
 1.13.10.1 10-Jul-2005  tron Pull up revision 1.14 (requested by christos in ticket #567):
Turn on dhcp support.
 1.15.2.1 01-Feb-2006  yamt sync with head.
 1.18.48.1 06-Nov-2007  matt sync with HEAD
 1.18.46.1 02-Oct-2007  joerg Sync with HEAD.
 1.18.36.1 03-Oct-2007  garbled Sync with HEAD
 1.18.28.1 09-Oct-2007  ad Sync with head.
 1.19.2.1 06-Oct-2007  yamt sync with head.
 1.21.20.3 09-Oct-2010  yamt sync with head
 1.21.20.2 11-Aug-2010  yamt sync with head.
 1.21.20.1 11-Mar-2010  yamt sync with head
 1.22.4.3 31-May-2011  rmind sync with head
 1.22.4.2 05-Mar-2011  rmind sync with head
 1.22.4.1 30-May-2010  rmind sync with head
 1.22.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.22.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.22.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.25.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.29.18.2 18-May-2014  rmind sync with head
 1.29.18.1 28-Aug-2013  rmind sync with head
 1.29.14.2 03-Dec-2017  jdolecek update from HEAD
 1.29.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.32.6.4 28-Aug-2017  skrll Sync with HEAD
 1.32.6.3 05-Oct-2016  skrll Sync with HEAD
 1.32.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.32.6.1 06-Apr-2015  skrll Sync with HEAD
 1.32.4.1 12-Jan-2015  snj Pull up following revision(s) (requested by martin in ticket #411):
sys/arch/sparc/stand/ofwboot/Makefile: revision 1.33
Strip debug symbols from ofwboot.
The forth bootsector loading this file when booting from disk is
"simplistic" and does not skip non loadable sections. The five times
bigger file with debug info overruns some important memory contents
with some firmware versions otherwise.
 1.36.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.36.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.37.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.38.24.1 20-Apr-2020  bouyer Sync with HEAD
 1.38.14.1 21-Apr-2020  martin Sync with HEAD
 1.5 19-May-2011  christos handle prototype for freeall
 1.4 28-Apr-2008  martin branches: 1.4.22; 1.4.28;
Remove clause 3 and 4 from TNF licenses
 1.3 27-Jan-2006  uwe branches: 1.3.72; 1.3.74; 1.3.76;
Sync clean up changes with other copies of ofwboot/alloc.c.
Expand copyright/license by Jason R. Thorpe as in others too.
 1.2 25-Jan-2006  christos free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.44; 1.1.56;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.56.1 01-Feb-2006  yamt sync with head.
 1.1.44.1 21-Jun-2006  yamt sync with head.
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file alloc.c was added on branch thorpej_scsipi on 2000-11-20 20:25:50 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file alloc.c was added on branch netbsd-1-5 on 2000-08-26 00:05:16 +0000
 1.3.76.1 16-May-2008  yamt sync with head.
 1.3.74.1 18-May-2008  yamt sync with head.
 1.3.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.22.1 31-May-2011  rmind sync with head
 1.35 15-Sep-2017  martin Add more details about the boot device as a new bootinfo record type.
From within the bootloader, when we have readily accessible instance
handles of the boot device, it is easy to query more details like SCSI
LUN, target, and FC-AL wwn from the firmware.
The kernel later would have a hard time getting theses, but can make good
use to match the boot device.
 1.34 31-Aug-2016  martin Init the markers array to all 0 - pointed out by Mark Cave-Ayland.
 1.33 11-Jun-2016  dholland PR 51200 gets in libsa considered harmful: use kgets
 1.32 30-May-2016  martin David Binderman in PR port-sparc/51188: simplify while condition
 1.31 28-Jun-2014  rtr branches: 1.31.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.
 1.30 30-Dec-2013  martin branches: 1.30.2;
Improve debugging output
 1.29 28-May-2012  martin branches: 1.29.2; 1.29.4;
Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.
 1.28 21-May-2011  tsutsui branches: 1.28.4; 1.28.8; 1.28.10;
WARNSfy and fix dumb bugs noticed by warnings.
 1.27 22-Jan-2011  joerg Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.26 06-Nov-2010  mrg branches: 1.26.2; 1.26.4;
add a "-T" option to disable the twiddler, which can help booting
with serial output slowness i've seen.
 1.25 25-Aug-2010  christos factor out the floppy detection code.
 1.24 25-Aug-2010  christos kill LOAD_MINIMAL.
 1.23 25-Aug-2010  christos Try to detect if we are doing a floppy boot from the device name and if
we are, load the minimal set to avoid backwards seeks.
 1.22 02-Apr-2010  martin Add support for /boot.cfg. Implement a single command for now: override
the boot partition, which will be used for bootable CDs. Add cd9660
support.
 1.21 27-Jan-2010  martin branches: 1.21.2; 1.21.4;
Properly close the firmware handle before starting the kernel.
This makes netbooting via bge* work.
 1.20 26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.19 18-Mar-2009  cegger bcopy -> memcpy
 1.18 17-Oct-2007  garbled branches: 1.18.20; 1.18.28; 1.18.34;
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.17 20-Sep-2007  martin Make the device name include the partition, if filename returned one.
 1.16 19-Sep-2007  martin If we can not find a filepath when splitting a single argument, the whole
thing certainly has to be a device name.
 1.15 16-Sep-2007  martin Change "Boot:" prompt option parsing to be more in line with the default
(no prompt) behaviour - it is now possible to "boot net:dhcp -a" and then
say "disk" at the "Boot:" prompt - result should be equivalent to "boot disk",
but the ofwboot was loaded from the network.
While there fix a few minor errors, and one significant: if the "a" partition
should not start at the beginning of the disk, the previous code failed
to read a disklabel. Use the "c" partition now to find the disklabel now
always.
 1.14 05-Jun-2007  martin branches: 1.14.8; 1.14.10;
Use the new loadfile() marker MARK_DATA to optimize the loaded kernel
mappings before calling the entry point - change text mappings to read
only and only insert those into the iTLB.
While there remove a few magic constants by information queried from
the firmware.
 1.13 13-Jul-2006  uwe branches: 1.13.14; 1.13.16; 1.13.22;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.12 27-Jan-2006  cdi branches: 1.12.2; 1.12.6;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.11 27-Jan-2006  uwe Constify kernel names.
 1.10 11-Dec-2005  christos branches: 1.10.2;
merge ktrace-lwp.
 1.9 15-Feb-2005  christos branches: 1.9.6;
Don't always increment i, because when we reach the end of the array we'll
die.
 1.8 16-Jan-2005  chs branches: 1.8.2;
remove some dead code, simplify and wrap some long lines.
 1.7 18-Jun-2004  martin branches: 1.7.4;
Better support for booting from partitions != a or at the start of the
disk, allow commands like "boot disk:d disk:d/netbsd" to work.
Use the real RF_PROTECTED_SECTORS define instead of a local magic number.
While there, minor cosmetics in diagnostics/output format.
 1.6 04-Dec-2003  keihan netbsd.org -> NetBSD.org

All "netbsd.org" is now gone from src/sys/arch.
 1.5 20-Oct-2002  martin branches: 1.5.6;
Allow hyphen in kernel names. Bump version.
Should fix PR 13429 and PR 18691.
 1.4 06-Jun-2002  martin Follow changes in libsa/stand.h: exit(void) -> exit(int) (one in a #if
0 block), to make it compile again.
 1.3 31-May-2001  mrg branches: 1.3.2; 1.3.8; 1.3.16; 1.3.18;
drop to prom on "halt" as well.
 1.2 24-Sep-2000  jdolecek branches: 1.2.2; 1.2.4;
add new macro BOOT_FLAG() (defined in <sys/boot_flag.h>) - this
maps standard boot flags to corresponding RB_* values
use BOOT_FLAG() in port's MD code as appropriate

as discussed on tech-kern, add new boot flags -v, -q for booting
verbosely or quietly, and corresponding AB_VERBOSE/AB_QUIET
boot flags; also add FreeBSD-compatible bootverbose macro and
NetBSD-specific bootquiet macro

for hpcmips, use new bootverbose instead of it's own hpcmips_verbose

Tested on i386, and to limited extend (compile of affected files) also for
mvme68k, hp300, luna68k, sun3.
 1.1 20-Aug-2000  mrg branches: 1.1.2;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file boot.c was added on branch netbsd-1-5 on 2000-08-26 00:05:16 +0000
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 24-Sep-2000  bouyer file boot.c was added on branch thorpej_scsipi on 2000-11-20 20:25:50 +0000
 1.3.18.1 06-May-2004  jmc Pullup rev 1.5 (requested by martin in ticket #1684)

Allow hyphen in kernel names.
When calculating the allocated symbol table size, round up the section
sizes with ELF_ALIGN(). PR#13429 PR#18691 PR#25429
 1.3.16.1 15-Jul-2002  gehenna catch up with -current.
 1.3.8.3 11-Nov-2002  nathanw Catch up to -current
 1.3.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.3.8.1 31-May-2001  nathanw file boot.c was added on branch nathanw_sa on 2002-06-20 03:41:16 +0000
 1.3.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.6.5 15-Feb-2005  skrll Sync with HEAD.
 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.7.4.1 29-Apr-2005  kent sync with -current
 1.8.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.6.4 27-Oct-2007  yamt sync with head.
 1.9.6.3 03-Sep-2007  yamt sync with head.
 1.9.6.2 30-Dec-2006  yamt sync with head.
 1.9.6.1 21-Jun-2006  yamt sync with head.
 1.10.2.1 01-Feb-2006  yamt sync with head.
 1.12.6.1 11-Aug-2006  yamt sync with head
 1.12.2.1 09-Sep-2006  rpaulo sync with head
 1.13.22.2 03-Oct-2007  garbled Sync with HEAD
 1.13.22.1 26-Jun-2007  garbled Sync with HEAD.
 1.13.16.1 11-Jul-2007  mjf Sync with head.
 1.13.14.2 09-Oct-2007  ad Sync with head.
 1.13.14.1 09-Jun-2007  ad Sync with head.
 1.14.10.1 06-Nov-2007  matt sync with HEAD
 1.14.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.18.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.18.20.4 09-Oct-2010  yamt sync with head
 1.18.20.3 11-Aug-2010  yamt sync with head.
 1.18.20.2 11-Mar-2010  yamt sync with head
 1.18.20.1 04-May-2009  yamt sync with head.
 1.21.4.3 31-May-2011  rmind sync with head
 1.21.4.2 05-Mar-2011  rmind sync with head
 1.21.4.1 30-May-2010  rmind sync with head
 1.21.2.3 09-Nov-2010  uebayasi Sync with HEAD.
 1.21.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.21.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.26.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.28.10.1 05-Jun-2012  jdc Pull up revisions:
src/sys/arch/sparc/include/bootinfo.h revision 1.6
src/sys/arch/sparc/sparc/autoconf.c revision 1.243
src/sys/arch/sparc/stand/boot/boot.c revision 1.28
src/sys/arch/sparc/stand/ofwboot/boot.c revision 1.29
src/sys/arch/sparc64/include/bootinfo.h revision 1.6-1.7
src/sys/arch/sparc64/sparc64/autoconf.c revision 1.186
(requested by martin in ticket #289).

Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.

Ooops, remove definitions duplicated in <sparc/bootinfo.h>
 1.28.8.1 02-Jun-2012  mrg sync to latest -current.
 1.28.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.28.4.1 30-Oct-2012  yamt sync with head
 1.29.4.1 18-May-2014  rmind sync with head
 1.29.2.2 03-Dec-2017  jdolecek update from HEAD
 1.29.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.2.1 10-Aug-2014  tls Rebase.
 1.31.4.2 05-Oct-2016  skrll Sync with HEAD
 1.31.4.1 09-Jul-2016  skrll Sync with HEAD
 1.11 15-Sep-2017  martin Add more details about the boot device as a new bootinfo record type.
From within the bootloader, when we have readily accessible instance
handles of the boot device, it is easy to query more details like SCSI
LUN, target, and FC-AL wwn from the firmware.
The kernel later would have a hard time getting theses, but can make good
use to match the boot device.
 1.10 20-Feb-2014  joerg Add prototype for main.
 1.9 01-Jun-2011  tsutsui branches: 1.9.4; 1.9.14; 1.9.18;
- remove extern from function declarations
- some KNF
 1.8 19-May-2011  hauke Fix a tyop.
The intentions were good...
 1.7 19-May-2011  christos handle prototype for freeall
 1.6 22-Jan-2011  joerg Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.5 28-Apr-2008  martin branches: 1.5.22; 1.5.28; 1.5.30;
Remove clause 3 and 4 from TNF licenses
 1.4 17-Oct-2007  garbled branches: 1.4.16; 1.4.18; 1.4.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.3 16-Sep-2007  martin Change "Boot:" prompt option parsing to be more in line with the default
(no prompt) behaviour - it is now possible to "boot net:dhcp -a" and then
say "disk" at the "Boot:" prompt - result should be equivalent to "boot disk",
but the ofwboot was loaded from the network.
While there fix a few minor errors, and one significant: if the "a" partition
should not start at the beginning of the disk, the previous code failed
to read a disklabel. Use the "c" partition now to find the disklabel now
always.
 1.2 05-Jun-2007  martin branches: 1.2.8; 1.2.10;
Use the new loadfile() marker MARK_DATA to optimize the loaded kernel
mappings before calling the entry point - change text mappings to read
only and only insert those into the iTLB.
While there remove a few magic constants by information queried from
the firmware.
 1.1 27-Jan-2006  cdi branches: 1.1.4; 1.1.18; 1.1.32; 1.1.34; 1.1.40;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.1.40.2 03-Oct-2007  garbled Sync with HEAD
 1.1.40.1 26-Jun-2007  garbled Sync with HEAD.
 1.1.34.1 11-Jul-2007  mjf Sync with head.
 1.1.32.2 09-Oct-2007  ad Sync with head.
 1.1.32.1 09-Jun-2007  ad Sync with head.
 1.1.18.4 27-Oct-2007  yamt sync with head.
 1.1.18.3 03-Sep-2007  yamt sync with head.
 1.1.18.2 21-Jun-2006  yamt sync with head.
 1.1.18.1 27-Jan-2006  yamt file boot.h was added on branch yamt-lazymbuf on 2006-06-21 14:56:40 +0000
 1.1.4.2 01-Feb-2006  yamt sync with head.
 1.1.4.1 27-Jan-2006  yamt file boot.h was added on branch yamt-uio_vmspace on 2006-02-01 14:51:37 +0000
 1.2.10.1 06-Nov-2007  matt sync with HEAD
 1.2.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.4.20.1 16-May-2008  yamt sync with head.
 1.4.18.1 18-May-2008  yamt sync with head.
 1.4.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.30.1 08-Feb-2011  bouyer Sync with HEAD
 1.5.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.22.3 12-Jun-2011  rmind sync with head
 1.5.22.2 31-May-2011  rmind sync with head
 1.5.22.1 05-Mar-2011  rmind sync with head
 1.9.18.1 18-May-2014  rmind sync with head
 1.9.14.2 03-Dec-2017  jdolecek update from HEAD
 1.9.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 13-Jul-2006  uwe branches: 1.2.58; 1.2.60; 1.2.62;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.1 27-Jan-2006  cdi branches: 1.1.2; 1.1.4; 1.1.8; 1.1.18;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.1.18.3 30-Dec-2006  yamt sync with head.
 1.1.18.2 21-Jun-2006  yamt sync with head.
 1.1.18.1 27-Jan-2006  yamt file bootinfo.c was added on branch yamt-lazymbuf on 2006-06-21 14:56:40 +0000
 1.1.8.1 11-Aug-2006  yamt sync with head
 1.1.4.2 01-Feb-2006  yamt sync with head.
 1.1.4.1 27-Jan-2006  yamt file bootinfo.c was added on branch yamt-uio_vmspace on 2006-02-01 14:51:37 +0000
 1.1.2.1 09-Sep-2006  rpaulo sync with head
 1.2.62.1 16-May-2008  yamt sync with head.
 1.2.60.1 18-May-2008  yamt sync with head.
 1.2.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.9 27-Jan-2006  cdi Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.8 25-Jan-2006  christos free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.7 11-Dec-2005  christos branches: 1.7.2;
merge ktrace-lwp.
 1.6 18-Jan-2005  he branches: 1.6.8;
Remove extraneous parenthesis, so that this compiles again.
 1.5 16-Jan-2005  chs remove some dead code, simplify and wrap some long lines.
 1.4 02-May-2004  martin branches: 1.4.4;
When calculating the allocated symbol table size, round up the section
sizes with ELF_ALIGN().
Fixes PR port-sparc64/25429.
 1.3 30-Aug-2001  eeh branches: 1.3.6; 1.3.16; 1.3.22; 1.3.24;
Handle kernels with data+BSS segments larger than 4MB.
 1.2 15-Aug-2001  eeh Make the loader extend the data+BSS segment to 4MB so we don't need to
shuffle it around in pmap_bootstrap().
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.8;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.8.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.8.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file elfXX_exec.c was added on branch thorpej_scsipi on 2000-11-20 20:25:50 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file elfXX_exec.c was added on branch netbsd-1-5 on 2000-08-26 00:05:16 +0000
 1.3.24.1 06-May-2004  jmc Pullup rev 1.4 (requested by martin in ticket #248)

When calculating the allocated symbol table size, round up the section
sizes with ELF_ALIGN(). PR#25429
 1.3.22.5 24-Jan-2005  skrll Sync with HEAD.
 1.3.22.4 17-Jan-2005  skrll Sync with HEAD.
 1.3.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.22.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 06-May-2004  jmc Pullup rev 1.4 (requested by martin in ticket #1684)

Allow hyphen in kernel names.
When calculating the allocated symbol table size, round up the section
sizes with ELF_ALIGN(). PR#13429 PR#18691 PR#25429
 1.3.6.2 30-Aug-2001  eeh Handle kernels with data+BSS segments larger than 4MB.
 1.3.6.1 30-Aug-2001  eeh file elfXX_exec.c was added on branch nathanw_sa on 2001-08-30 23:00:20 +0000
 1.4.4.1 29-Apr-2005  kent sync with -current
 1.6.8.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 01-Feb-2006  yamt sync with head.
 1.17 29-Apr-2022  rin Fix fallout from libsa change; stand.h includes <sys/param.h> now.

- Stop redefining roundup2().
- Compare kvamap->start (uint64_t) with 0 instead of NULL.
- Include <sys/param.h> explicitly.

Thanks gson@ for notification.
 1.16 04-Nov-2016  macallan fix remaining *_TSB_DATA() uses
 1.15 15-Aug-2016  maxv Uninitialized var, found by brainy; not tested, but obvious enough
 1.14 14-Jun-2015  martin branches: 1.14.2;
Fix available length calculation in kvamap_extract when reusing existing
mappings.
 1.13 21-Apr-2014  palle branches: 1.13.2; 1.13.4;
sun4v: Update TTE data in sparc64_finalize_tlb_sun4v() - sun4v has no L (locked) bit + ensure that the ITLB has the EP (executable) bit set
 1.12 21-Feb-2014  palle branches: 1.12.2;
sun4v: Rename TLB_ defines to SUN4U_TLB_ so entries created using TSB_DATA() are properly setup for sun4u and sun4v. Relocate the cputyp variable from autoconf.c to locore.s and make it const in param.h so optimized code can be generated. Parts from OpenBSD. Optimization suggested by nakayama@. OK martin@, mrg@, nakayama@
 1.11 08-Dec-2013  palle Add support for running ofwboot on sun4v. Please note that the kernel on sun4v will be loaded properly but when the kernel takes over it will crash immediately since the kernel is not sun4v ready yet
 1.10 21-May-2011  nakayama branches: 1.10.4; 1.10.14; 1.10.18;
Fix debug build.
 1.9 21-May-2011  tsutsui WARNSfy and fix dumb bugs noticed by warnings.
 1.8 20-May-2011  he Put the external functions from net.c in it's own header file and
include it, and do some other minimal adjustments to bring this
back to a buildable state.

OK'ed by martin@
 1.7 18-May-2009  nakayama branches: 1.7.4; 1.7.6;
Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6 25-Aug-2008  martin branches: 1.6.4; 1.6.14; 1.6.18;
Deal with kernels that have a combined text/data segment. Output a big
warning when booting them.
 1.5 28-Apr-2008  martin branches: 1.5.2; 1.5.6;
Remove clause 3 and 4 from TNF licenses
 1.4 17-Oct-2007  garbled branches: 1.4.16; 1.4.18; 1.4.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.3 05-Jun-2007  martin branches: 1.3.10;
Use the new loadfile() marker MARK_DATA to optimize the loaded kernel
mappings before calling the entry point - change text mappings to read
only and only insert those into the iTLB.
While there remove a few magic constants by information queried from
the firmware.
 1.2 04-Mar-2006  uwe branches: 1.2.12; 1.2.26; 1.2.28; 1.2.34;
s/u_intN_t/uintN_t/
 1.1 27-Jan-2006  cdi branches: 1.1.2; 1.1.4; 1.1.6;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.1.6.1 22-Apr-2006  simonb Sync with head.
 1.1.4.2 01-Feb-2006  yamt sync with head.
 1.1.4.1 27-Jan-2006  yamt file loadfile_machdep.c was added on branch yamt-uio_vmspace on 2006-02-01 14:51:37 +0000
 1.1.2.1 09-Sep-2006  rpaulo sync with head
 1.2.34.1 26-Jun-2007  garbled Sync with HEAD.
 1.2.28.1 11-Jul-2007  mjf Sync with head.
 1.2.26.1 09-Jun-2007  ad Sync with head.
 1.2.12.3 03-Sep-2007  yamt sync with head.
 1.2.12.2 21-Jun-2006  yamt sync with head.
 1.2.12.1 04-Mar-2006  yamt file loadfile_machdep.c was added on branch yamt-lazymbuf on 2006-06-21 14:56:40 +0000
 1.3.10.1 06-Nov-2007  matt sync with HEAD
 1.4.20.3 20-Jun-2009  yamt sync with head
 1.4.20.2 04-May-2009  yamt sync with head.
 1.4.20.1 16-May-2008  yamt sync with head.
 1.4.18.1 18-May-2008  yamt sync with head.
 1.4.16.2 28-Sep-2008  mjf Sync with HEAD.
 1.4.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.6.1 19-Oct-2008  haad Sync with HEAD.
 1.5.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.6.18.1 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6.14.1 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6.4.1 19-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.7.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.4.1 31-May-2011  rmind sync with head
 1.10.18.1 18-May-2014  rmind sync with head
 1.10.14.2 03-Dec-2017  jdolecek update from HEAD
 1.10.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12.2.1 10-Aug-2014  tls Rebase.
 1.13.4.3 05-Dec-2016  skrll Sync with HEAD
 1.13.4.2 05-Oct-2016  skrll Sync with HEAD
 1.13.4.1 22-Sep-2015  skrll Sync with HEAD
 1.13.2.1 20-Jul-2015  snj Pull up following revision(s) (requested by martin in ticket #842):
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c: revision 1.14
sys/arch/sparc/stand/ofwboot/version: revision 1.21
sys/arch/sparc64/include/cpu.h: revision 1.115
sys/arch/sparc64/sparc64/autoconf.c: revision 1.203
sys/arch/sparc64/sparc64/mp_subr.S: revision 1.9 via patch
sys/arch/sparc64/sparc64/pmap.c: revisions 1.295, 1.295 via patch
Fix available length calculation in kvamap_extract when reusing existing
mappings.
--
Bump version now that we can load kernels with sizeof(.data)+sizeof(.bss)> 4 MB
--
Do not hardcode the assumption that .data and .bss fit together in a single
4 MB page. This allows booting kernels with options USB_DEBUG again.
--
Slightly optimize the ITLB usage on secondary processors
 1.14.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.6 01-Jun-2011  tsutsui Remove unused header.
 1.5 13-Jul-2006  uwe branches: 1.5.84; 1.5.90;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.4 04-Mar-2006  uwe branches: 1.4.2;
s/u_intN_t/uintN_t/
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.6;
merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.28;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.28.1 03-Aug-2004  skrll Sync with HEAD
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file md5.h was added on branch thorpej_scsipi on 2000-11-20 20:25:51 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file md5.h was added on branch netbsd-1-5 on 2000-08-26 00:05:17 +0000
 1.2.16.2 30-Dec-2006  yamt sync with head.
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.2.1 11-Aug-2006  yamt sync with head
 1.5.90.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.84.1 12-Jun-2011  rmind sync with head
 1.10 12-Apr-2021  mrg remove shadowed (common) declarations of various libsa variables
from various boot programs. for macppc and zaurus, avoid building
with -fcommon any more.
 1.9 23-Apr-2020  joerg branches: 1.9.4;
rootpath is owned by libsa
 1.8 16-Jul-2012  tsutsui branches: 1.8.50;
Fix tftpboot which was broken by my botched WARNSfy in last year.
Also add comments that mention libsa tftp requires network device socket
in f_devdata in struct open_file, from spz@ in PR port-sparc64/46652.
Briefly tested tftpboot and nfsboot on Ultra5.
 1.7 21-May-2011  tsutsui branches: 1.7.4; 1.7.10;
WARNSfy and fix dumb bugs noticed by warnings.
 1.6 21-May-2011  christos more missing includes
 1.5 07-May-2009  roy branches: 1.5.4; 1.5.6;
Make 3 attempts at bootp before trying bootparams which allows slow
bridges a chance to work.
Clear variables when changing bootp/bootparams.
Displayed variables are cleaned up so they don't overflow the right of
the screen.

ok: martin
 1.4 12-May-2008  mlelstv branches: 1.4.12;
add support for booting a kernel by tftp. Syntax is similar
to other systems, e.g.: boot net tftp:netbsd
 1.3 13-Jul-2006  uwe branches: 1.3.58; 1.3.60; 1.3.62; 1.3.64;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.2 14-May-2002  lukem branches: 1.2.26; 1.2.40; 1.2.44;
- Enable NFS_BOOT_DHCP (as well as the existing NFS_BOOT_BOOTPARAM).
DHCP/Bootp is tried before bootparams in the MI nfs mountroot code.
- Change the order in boot.net from "bootparams then bootp" to
"bootp then bootparams", to be consistent with the MI nfs mountroot code.

(Consistency with other NetBSD ports is good, and things still work
for sites that run bootparams but not dhcp/bootp, although I'd argue that
dhcp/bootp is much easier to setup and manage and is easier to debug
than our rpc.bootparamd...)

Per discussion with Paul Kranenburg and Matt Green.
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.8; 1.1.12;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.12.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file net.c was added on branch thorpej_scsipi on 2000-11-20 20:25:51 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file net.c was added on branch netbsd-1-5 on 2000-08-26 00:05:17 +0000
 1.2.44.1 11-Aug-2006  yamt sync with head
 1.2.40.1 09-Sep-2006  rpaulo sync with head
 1.2.26.1 30-Dec-2006  yamt sync with head.
 1.3.64.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.3.62.2 16-May-2009  yamt sync with head
 1.3.62.1 16-May-2008  yamt sync with head.
 1.3.60.1 18-May-2008  yamt sync with head.
 1.3.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.4.1 31-May-2011  rmind sync with head
 1.7.10.1 21-Jul-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #433):
sys/arch/sparc/stand/ofwboot/net.h: revision 1.3
sys/arch/sparc/stand/ofwboot/net.c: revision 1.8
sys/arch/sparc/stand/ofwboot/ofdev.c: revision 1.33
Fix tftpboot which was broken by my botched WARNSfy in last year.
Also add comments that mention libsa tftp requires network device socket
in f_devdata in struct open_file, from spz@ in PR port-sparc64/46652.
Briefly tested tftpboot and nfsboot on Ultra5.
 1.7.4.1 30-Oct-2012  yamt sync with head
 1.8.50.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.9.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.3 16-Jul-2012  tsutsui Fix tftpboot which was broken by my botched WARNSfy in last year.
Also add comments that mention libsa tftp requires network device socket
in f_devdata in struct open_file, from spz@ in PR port-sparc64/46652.
Briefly tested tftpboot and nfsboot on Ultra5.
 1.2 21-May-2011  tsutsui branches: 1.2.2; 1.2.6; 1.2.8; 1.2.14;
WARNSfy and fix dumb bugs noticed by warnings.
 1.1 20-May-2011  he Put the external functions from net.c in it's own header file and
include it, and do some other minimal adjustments to bring this
back to a buildable state.

OK'ed by martin@
 1.2.14.1 21-Jul-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #433):
sys/arch/sparc/stand/ofwboot/net.h: revision 1.3
sys/arch/sparc/stand/ofwboot/net.c: revision 1.8
sys/arch/sparc/stand/ofwboot/ofdev.c: revision 1.33
Fix tftpboot which was broken by my botched WARNSfy in last year.
Also add comments that mention libsa tftp requires network device socket
in f_devdata in struct open_file, from spz@ in PR port-sparc64/46652.
Briefly tested tftpboot and nfsboot on Ultra5.
 1.2.8.1 30-Oct-2012  yamt sync with head
 1.2.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.6.1 21-May-2011  jruoho file net.h was added on branch jruoho-x86intr on 2011-06-06 09:06:48 +0000
 1.2.2.2 31-May-2011  rmind sync with head
 1.2.2.1 21-May-2011  rmind file net.h was added on branch rmind-uvmplock on 2011-05-31 03:04:18 +0000
 1.9 30-Jul-2011  jakllsch printf fixes for ifdef NETIF_DEBUG
 1.8 21-May-2011  tsutsui WARNSfy and fix dumb bugs noticed by warnings.
 1.7 18-Mar-2009  cegger branches: 1.7.4; 1.7.6;
bzero -> memset
 1.6 12-Jan-2009  tsutsui branches: 1.6.2;
Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.5 07-May-2008  mlelstv branches: 1.5.8;
return the length without padding.
 1.4 13-Jul-2006  uwe branches: 1.4.58; 1.4.60; 1.4.62;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.3 27-Jan-2006  cdi branches: 1.3.2; 1.3.6;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.2 13-Mar-2003  hannken branches: 1.2.18; 1.2.30;
Explicit cast for netif.

Approved by: Matthias Drochner <drochner@netbsd.org>
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file netif_of.c was added on branch thorpej_scsipi on 2000-11-20 20:25:51 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file netif_of.c was added on branch netbsd-1-5 on 2000-08-26 00:05:18 +0000
 1.2.30.1 01-Feb-2006  yamt sync with head.
 1.2.18.2 30-Dec-2006  yamt sync with head.
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.3.6.1 11-Aug-2006  yamt sync with head
 1.3.2.1 09-Sep-2006  rpaulo sync with head
 1.4.62.2 04-May-2009  yamt sync with head.
 1.4.62.1 16-May-2008  yamt sync with head.
 1.4.60.1 18-May-2008  yamt sync with head.
 1.4.58.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.5.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.4.1 31-May-2011  rmind sync with head
 1.37 15-Sep-2017  martin Add more details about the boot device as a new bootinfo record type.
From within the bootloader, when we have readily accessible instance
handles of the boot device, it is easy to query more details like SCSI
LUN, target, and FC-AL wwn from the firmware.
The kernel later would have a hard time getting theses, but can make good
use to match the boot device.
 1.36 25-Mar-2017  martin Virtio block devices may have a "scsi" device_type instead of "block",
so accept both.
 1.35 20-Feb-2014  joerg branches: 1.35.6; 1.35.10; 1.35.14;
Zero the block on failure, not just the first pointer in it.
 1.34 16-Apr-2013  martin branches: 1.34.4;
Make a "panic" message slightly more verbose
 1.33 16-Jul-2012  tsutsui branches: 1.33.2;
Fix tftpboot which was broken by my botched WARNSfy in last year.
Also add comments that mention libsa tftp requires network device socket
in f_devdata in struct open_file, from spz@ in PR port-sparc64/46652.
Briefly tested tftpboot and nfsboot on Ultra5.
 1.32 01-Jun-2011  tsutsui branches: 1.32.4; 1.32.10;
Fix harmless merge botch.
 1.31 21-May-2011  nakayama Fix debug build.
 1.30 21-May-2011  tsutsui WARNSfy and fix dumb bugs noticed by warnings.
 1.29 20-May-2011  he Put the external functions from net.c in it's own header file and
include it, and do some other minimal adjustments to bring this
back to a buildable state.

OK'ed by martin@
 1.28 04-Apr-2010  martin branches: 1.28.2;
Turn a printf into a DPRINTF(), since we will very likely recover from
the condition (and it happens on stock install CDs)
 1.27 02-Apr-2010  martin Add support for /boot.cfg. Implement a single command for now: override
the boot partition, which will be used for bootable CDs. Add cd9660
support.
 1.26 17-Feb-2010  eeh branches: 1.26.2;
Add support for ffsv2 and lfs.
 1.25 27-Jan-2010  martin branches: 1.25.2;
Properly close the firmware handle before starting the kernel.
This makes netbooting via bge* work.
 1.24 26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.23 18-Mar-2009  cegger bcopy -> memcpy
 1.22 18-Mar-2009  cegger bzero -> memset
 1.21 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.20 18-May-2008  mlelstv branches: 1.20.6; 1.20.12;
put back NetBSD tag
 1.19 12-May-2008  mlelstv add support for booting a kernel by tftp. Syntax is similar
to other systems, e.g.: boot net tftp:netbsd
 1.18 17-Oct-2007  garbled branches: 1.18.16; 1.18.18; 1.18.20; 1.18.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.17 20-Sep-2007  martin Make filename() only return a partition if it actually found one in
the path.
 1.16 19-Sep-2007  martin Some aliases (like "cdrom") expand to a path that includes a partition -
deal with them.
 1.15 16-Sep-2007  martin Change "Boot:" prompt option parsing to be more in line with the default
(no prompt) behaviour - it is now possible to "boot net:dhcp -a" and then
say "disk" at the "Boot:" prompt - result should be equivalent to "boot disk",
but the ofwboot was loaded from the network.
While there fix a few minor errors, and one significant: if the "a" partition
should not start at the beginning of the disk, the previous code failed
to read a disklabel. Use the "c" partition now to find the disklabel now
always.
 1.14 14-Sep-2007  martin Rename the option to enable ISO 9660 file system support from ..._HSFS
to ..._CD9660.
 1.13 14-Sep-2007  martin Make sure the buffer used to read from disk is properly aligned to cast
it into a struct disklabel pointer w/o alignement problems.
(Bug did not hit by pure luck with our default optimization settings)
 1.12 13-Jul-2006  uwe branches: 1.12.14; 1.12.22; 1.12.32; 1.12.34;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.11 11-May-2006  mrg don't shadow the kernel's devsw unnecessarily.
 1.10 27-Jan-2006  cdi branches: 1.10.2; 1.10.4; 1.10.6; 1.10.8; 1.10.10;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.9 11-Dec-2005  christos branches: 1.9.2;
merge ktrace-lwp.
 1.8 23-Jun-2005  junyoung branches: 1.8.2;
Use FS_OPS() macro.
 1.7 22-Jun-2005  junyoung Remove trailing spaces.
 1.6 13-Nov-2004  grant tweak an error message.
 1.5 18-Jun-2004  martin Better support for booting from partitions != a or at the start of the
disk, allow commands like "boot disk:d disk:d/netbsd" to work.
Use the real RF_PROTECTED_SECTORS define instead of a local magic number.
While there, minor cosmetics in diagnostics/output format.
 1.4 01-Jan-2003  mrg branches: 1.4.2;
KNF.
 1.3 20-Oct-2002  martin Allow hyphen in kernel names. Bump version.
Should fix PR 13429 and PR 18691.
 1.2 29-Jul-2002  mrg bump offset by RF_PROTECTED_SECTORS if FS_RAID
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.8; 1.1.12; 1.1.20; 1.1.22;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.22.1 06-May-2004  jmc Pullup rev 1.3 (requested by martin in ticket #1684)

Allow hyphen in kernel names.
When calculating the allocated symbol table size, round up the section
sizes with ELF_ALIGN(). PR#13429 PR#18691 PR#25429
 1.1.20.1 31-Aug-2002  gehenna catch up with -current.
 1.1.12.3 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.1.12.2 11-Nov-2002  nathanw Catch up to -current
 1.1.12.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file ofdev.c was added on branch thorpej_scsipi on 2000-11-20 20:25:51 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file ofdev.c was added on branch netbsd-1-5 on 2000-08-26 00:05:18 +0000
 1.4.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.2.3 27-Oct-2007  yamt sync with head.
 1.8.2.2 30-Dec-2006  yamt sync with head.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 01-Feb-2006  yamt sync with head.
 1.10.10.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.10.8.1 11-May-2006  elad sync with head
 1.10.6.2 11-Aug-2006  yamt sync with head
 1.10.6.1 24-May-2006  yamt sync with head.
 1.10.4.1 01-Jun-2006  kardel Sync with head.
 1.10.2.1 09-Sep-2006  rpaulo sync with head
 1.12.34.1 06-Nov-2007  matt sync with HEAD
 1.12.32.1 02-Oct-2007  joerg Sync with HEAD.
 1.12.22.1 03-Oct-2007  garbled Sync with HEAD
 1.12.14.1 09-Oct-2007  ad Sync with head.
 1.18.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.20.4 11-Aug-2010  yamt sync with head.
 1.18.20.3 11-Mar-2010  yamt sync with head
 1.18.20.2 04-May-2009  yamt sync with head.
 1.18.20.1 16-May-2008  yamt sync with head.
 1.18.18.2 04-Jun-2008  yamt sync with head
 1.18.18.1 18-May-2008  yamt sync with head.
 1.18.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.2.3 12-Jun-2011  rmind sync with head
 1.26.2.2 31-May-2011  rmind sync with head
 1.26.2.1 30-May-2010  rmind sync with head
 1.28.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.32.10.1 21-Jul-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #433):
sys/arch/sparc/stand/ofwboot/net.h: revision 1.3
sys/arch/sparc/stand/ofwboot/net.c: revision 1.8
sys/arch/sparc/stand/ofwboot/ofdev.c: revision 1.33
Fix tftpboot which was broken by my botched WARNSfy in last year.
Also add comments that mention libsa tftp requires network device socket
in f_devdata in struct open_file, from spz@ in PR port-sparc64/46652.
Briefly tested tftpboot and nfsboot on Ultra5.
 1.32.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.32.4.1 30-Oct-2012  yamt sync with head
 1.33.2.3 03-Dec-2017  jdolecek update from HEAD
 1.33.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.2.1 23-Jun-2013  tls resync from head
 1.34.4.1 18-May-2014  rmind sync with head
 1.35.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.35.10.1 26-Apr-2017  pgoyette Sync with HEAD
 1.35.6.1 28-Aug-2017  skrll Sync with HEAD
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file ofdev.h was added on branch thorpej_scsipi on 2000-11-20 20:25:51 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file ofdev.h was added on branch netbsd-1-5 on 2000-08-26 00:05:18 +0000
 1.6 15-Sep-2017  martin Add more details about the boot device as a new bootinfo record type.
From within the bootloader, when we have readily accessible instance
handles of the boot device, it is easy to query more details like SCSI
LUN, target, and FC-AL wwn from the firmware.
The kernel later would have a hard time getting theses, but can make good
use to match the boot device.
 1.5 21-May-2011  tsutsui branches: 1.5.14;
WARNSfy and fix dumb bugs noticed by warnings.
 1.4 18-May-2009  nakayama branches: 1.4.4; 1.4.6;
Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.3 13-Jul-2006  uwe branches: 1.3.62; 1.3.72; 1.3.82; 1.3.86;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.2 27-Jan-2006  cdi branches: 1.2.2; 1.2.6;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.44; 1.1.56;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.56.1 01-Feb-2006  yamt sync with head.
 1.1.44.2 30-Dec-2006  yamt sync with head.
 1.1.44.1 21-Jun-2006  yamt sync with head.
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file openfirm.h was added on branch thorpej_scsipi on 2000-11-20 20:25:51 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file openfirm.h was added on branch netbsd-1-5 on 2000-08-26 00:05:19 +0000
 1.2.6.1 11-Aug-2006  yamt sync with head
 1.2.2.1 09-Sep-2006  rpaulo sync with head
 1.3.86.1 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.3.82.1 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.3.72.1 19-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.3.62.1 20-Jun-2009  yamt sync with head
 1.4.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.4.1 31-May-2011  rmind sync with head
 1.5.14.1 03-Dec-2017  jdolecek update from HEAD
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 13-Jul-2006  uwe branches: 1.2.58; 1.2.60; 1.2.62;
De-__P. ANSIify.

Same object code is generated (except in prf.c, where putchar argument
type was changed to int to match the prototype and one instrcution
changes accordingly).

strategy() in ofdev.c was not ANSIified in this sweep, b/c that
changes code generated at call sites!
 1.1 27-Jan-2006  cdi branches: 1.1.2; 1.1.4; 1.1.8; 1.1.18;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.1.18.3 30-Dec-2006  yamt sync with head.
 1.1.18.2 21-Jun-2006  yamt sync with head.
 1.1.18.1 27-Jan-2006  yamt file prf.c was added on branch yamt-lazymbuf on 2006-06-21 14:56:40 +0000
 1.1.8.1 11-Aug-2006  yamt sync with head
 1.1.4.2 01-Feb-2006  yamt sync with head.
 1.1.4.1 27-Jan-2006  yamt file prf.c was added on branch yamt-uio_vmspace on 2006-02-01 14:51:37 +0000
 1.1.2.1 09-Sep-2006  rpaulo sync with head
 1.2.62.1 16-May-2008  yamt sync with head.
 1.2.60.1 18-May-2008  yamt sync with head.
 1.2.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.3 21-May-2011  tsutsui WARNSfy and fix dumb bugs noticed by warnings.
 1.2 28-Apr-2008  martin branches: 1.2.22; 1.2.28;
Remove clause 3 and 4 from TNF licenses
 1.1 27-Jan-2006  cdi branches: 1.1.4; 1.1.18; 1.1.76; 1.1.78; 1.1.80;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.1.80.1 16-May-2008  yamt sync with head.
 1.1.78.1 18-May-2008  yamt sync with head.
 1.1.76.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.18.2 21-Jun-2006  yamt sync with head.
 1.1.18.1 27-Jan-2006  yamt file promlib.c was added on branch yamt-lazymbuf on 2006-06-21 14:56:40 +0000
 1.1.4.2 01-Feb-2006  yamt sync with head.
 1.1.4.1 27-Jan-2006  yamt file promlib.c was added on branch yamt-uio_vmspace on 2006-02-01 14:51:37 +0000
 1.2.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.22.1 31-May-2011  rmind sync with head
 1.8 28-Nov-2019  martin Provide a mostly-zeroed page at the start of the text segment, to work around
an OpenBIOS bug, see PR port-sparc64/54719 for details.
 1.7 23-Aug-2015  joerg branches: 1.7.18;
Remove .proc 1, it has been ignored by gas for ages.
 1.6 17-Oct-2007  garbled branches: 1.6.64; 1.6.84;
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.5 05-Jun-2007  martin branches: 1.5.10;
Use the new loadfile() marker MARK_DATA to optimize the loaded kernel
mappings before calling the entry point - change text mappings to read
only and only insert those into the iTLB.
While there remove a few magic constants by information queried from
the firmware.
 1.4 04-Mar-2006  uwe branches: 1.4.24; 1.4.26; 1.4.32;
s/u_intN_t/uintN_t/
 1.3 27-Jan-2006  cdi branches: 1.3.2; 1.3.4;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.2 30-Oct-2002  petrov branches: 1.2.22; 1.2.34;
Compile with an ISO C preprocessor.
 1.1 20-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.12;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.12.1 11-Nov-2002  nathanw Catch up to -current
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 20-Aug-2000  bouyer file srt0.s was added on branch thorpej_scsipi on 2000-11-20 20:25:51 +0000
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file srt0.s was added on branch netbsd-1-5 on 2000-08-26 00:05:19 +0000
 1.2.34.1 01-Feb-2006  yamt sync with head.
 1.2.22.2 03-Sep-2007  yamt sync with head.
 1.2.22.1 21-Jun-2006  yamt sync with head.
 1.3.4.1 22-Apr-2006  simonb Sync with head.
 1.3.2.1 09-Sep-2006  rpaulo sync with head
 1.4.32.1 26-Jun-2007  garbled Sync with HEAD.
 1.4.26.1 11-Jul-2007  mjf Sync with head.
 1.4.24.1 09-Jun-2007  ad Sync with head.
 1.5.10.1 06-Nov-2007  matt sync with HEAD
 1.6.84.1 22-Sep-2015  skrll Sync with HEAD
 1.6.64.1 03-Dec-2017  jdolecek update from HEAD
 1.7.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.23 15-Sep-2017  martin Add more details about the boot device as a new bootinfo record type.
From within the bootloader, when we have readily accessible instance
handles of the boot device, it is easy to query more details like SCSI
LUN, target, and FC-AL wwn from the firmware.
The kernel later would have a hard time getting theses, but can make good
use to match the boot device.
 1.22 25-Mar-2017  martin Bump version - virtio support added
 1.21 14-Jun-2015  martin branches: 1.21.2; 1.21.4;
Bump version now that we can load kernels with sizeof(.data)+sizeof(.bss)> 4 MB
 1.20 08-Dec-2013  palle branches: 1.20.4; 1.20.6;
Add support for running ofwboot on sun4v. Please note that the kernel on sun4v will be loaded properly but when the kernel takes over it will crash immediately since the kernel is not sun4v ready yet
 1.19 02-Apr-2010  martin branches: 1.19.8; 1.19.18; 1.19.22;
Bump version
 1.18 27-Jan-2010  martin branches: 1.18.2; 1.18.4;
Properly close the firmware handle before starting the kernel.
This makes netbooting via bge* work.
 1.17 07-May-2009  roy Make 3 attempts at bootp before trying bootparams which allows slow
bridges a chance to work.
Clear variables when changing bootp/bootparams.
Displayed variables are cleaned up so they don't overflow the right of
the screen.

ok: martin
 1.16 25-Aug-2008  martin branches: 1.16.8;
Deal with kernels that have a combined text/data segment. Output a big
warning when booting them.
 1.15 17-Oct-2007  garbled branches: 1.15.16; 1.15.20; 1.15.22; 1.15.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.14 29-Sep-2007  martin Enable booting from news Solaris ufs partitions.
 1.13 20-Sep-2007  martin branches: 1.13.2;
Bump version
 1.12 05-Jun-2007  martin branches: 1.12.8; 1.12.10;
Use the new loadfile() marker MARK_DATA to optimize the loaded kernel
mappings before calling the entry point - change text mappings to read
only and only insert those into the iTLB.
While there remove a few magic constants by information queried from
the firmware.
 1.11 27-Jan-2006  cdi branches: 1.11.28; 1.11.30; 1.11.36;
Alter sparc64 bootstrap:

- Map kernel with permanent 4MB pages to ease kernel's life
- Pass mappings down to the kernel as part of bootinfo structure
- Try to detect whether kernel is aware of the new boot scheme or not and
in the former case map the kernel using OpenFirmware and do not pass
bootinfo structure
- Provide -C switch to force compatibility mode if autodetection fails
- While on this, fix PR #25763: If load of default kernel fails, try one by
one those specified in compiled-in list

Much inspired by the bootloader of FreeBSD, with some imported code from there.
 1.10 11-Dec-2005  christos branches: 1.10.2;
merge ktrace-lwp.
 1.9 18-Jun-2004  martin branches: 1.9.12;
Better support for booting from partitions != a or at the start of the
disk, allow commands like "boot disk:d disk:d/netbsd" to work.
Use the real RF_PROTECTED_SECTORS define instead of a local magic number.
While there, minor cosmetics in diagnostics/output format.
 1.8 02-May-2004  martin When calculating the allocated symbol table size, round up the section
sizes with ELF_ALIGN().
Fixes PR port-sparc64/25429.
 1.7 20-Oct-2002  martin branches: 1.7.6; 1.7.8;
Allow hyphen in kernel names. Bump version.
Should fix PR 13429 and PR 18691.
 1.6 30-Aug-2001  eeh branches: 1.6.6; 1.6.16;
Handle kernels with data+BSS segments larger than 4MB.
 1.5 16-Aug-2001  eeh Bump version.
 1.4 02-Aug-2001  bjh21 Undo version bump. The sparc ofwboot doesn't use loadfile().
 1.3 02-Aug-2001  bjh21 Bump version numbers of all bootloaders that use loadfile/ELF, to account for
my changes to symbol loading. I should probably have done this at the time,
but it's better late than never.
 1.2 24-Sep-2000  jdolecek branches: 1.2.2; 1.2.6;
note support for verbose/quiet boot (-v, -q flags)
 1.1 20-Aug-2000  mrg branches: 1.1.2;
move ofwboot & bootblk here; add a Makefile to build ofwboot.net
 1.1.2.2 26-Aug-2000  mrg move these from arch/sparc64/stand; approved by thorpej.
 1.1.2.1 20-Aug-2000  mrg file version was added on branch netbsd-1-5 on 2000-08-26 00:05:20 +0000
 1.2.6.3 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.6.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.2.6.1 03-Aug-2001  lukem update to -current
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 24-Sep-2000  bouyer file version was added on branch thorpej_scsipi on 2000-11-20 20:25:51 +0000
 1.6.16.1 06-May-2004  jmc Pullup rev 1.7-1-8 (requested by martin in ticket #1684)

Allow hyphen in kernel names.
When calculating the allocated symbol table size, round up the section
sizes with ELF_ALIGN(). PR#13429 PR#18691 PR#25429
 1.6.6.2 11-Nov-2002  nathanw Catch up to -current
 1.6.6.1 30-Aug-2001  nathanw file version was added on branch nathanw_sa on 2002-11-11 22:04:40 +0000
 1.7.8.1 06-May-2004  jmc Pullup rev 1.8 (requested by martin in ticket #248)

When calculating the allocated symbol table size, round up the section
sizes with ELF_ALIGN(). PR#25429
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.12.3 27-Oct-2007  yamt sync with head.
 1.9.12.2 03-Sep-2007  yamt sync with head.
 1.9.12.1 21-Jun-2006  yamt sync with head.
 1.10.2.1 01-Feb-2006  yamt sync with head.
 1.11.36.2 03-Oct-2007  garbled Sync with HEAD
 1.11.36.1 26-Jun-2007  garbled Sync with HEAD.
 1.11.30.1 11-Jul-2007  mjf Sync with head.
 1.11.28.2 09-Oct-2007  ad Sync with head.
 1.11.28.1 09-Jun-2007  ad Sync with head.
 1.12.10.1 06-Nov-2007  matt sync with HEAD
 1.12.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.13.2.1 06-Oct-2007  yamt sync with head.
 1.15.26.1 19-Oct-2008  haad Sync with HEAD.
 1.15.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.15.20.4 11-Aug-2010  yamt sync with head.
 1.15.20.3 11-Mar-2010  yamt sync with head
 1.15.20.2 16-May-2009  yamt sync with head
 1.15.20.1 04-May-2009  yamt sync with head.
 1.15.16.1 28-Sep-2008  mjf Sync with HEAD.
 1.16.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.4.1 30-May-2010  rmind sync with head
 1.18.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.19.22.1 18-May-2014  rmind sync with head
 1.19.18.2 03-Dec-2017  jdolecek update from HEAD
 1.19.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.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.20.6.2 28-Aug-2017  skrll Sync with HEAD
 1.20.6.1 22-Sep-2015  skrll Sync with HEAD
 1.20.4.1 20-Jul-2015  snj Pull up following revision(s) (requested by martin in ticket #842):
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c: revision 1.14
sys/arch/sparc/stand/ofwboot/version: revision 1.21
sys/arch/sparc64/include/cpu.h: revision 1.115
sys/arch/sparc64/sparc64/autoconf.c: revision 1.203
sys/arch/sparc64/sparc64/mp_subr.S: revision 1.9 via patch
sys/arch/sparc64/sparc64/pmap.c: revisions 1.295, 1.295 via patch
Fix available length calculation in kvamap_extract when reusing existing
mappings.
--
Bump version now that we can load kernels with sizeof(.data)+sizeof(.bss)> 4 MB
--
Do not hardcode the assumption that .data and .bss fit together in a single
4 MB page. This allows booting kernels with options USB_DEBUG again.
--
Slightly optimize the ITLB usage on secondary processors
 1.21.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.21.2.1 26-Apr-2017  pgoyette Sync with HEAD

RSS XML Feed