Home | History | Annotate | only in /src/sys/arch/sparc64
History log of /src/sys/arch/sparc64
RevisionDateAuthorComments
 1.18 19-May-2009  dyoung Use ${FINDCOMM} to avoid 'Arguments list too long'-related failure
of 'tags' target.
 1.17 25-Oct-2008  apb Use ${TOOL_SED} instead if plain sed in Makefiles.
 1.16 17-Oct-2007  garbled branches: 1.16.16; 1.16.20; 1.16.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.15 09-Jun-2007  dyoung branches: 1.15.10;
Remove redundant TAGS rule and variable assignments.
 1.14 08-Jun-2007  dyoung Make the 'tags' target work.
 1.13 06-Jan-2003  lukem branches: 1.13.18; 1.13.60; 1.13.62; 1.13.68;
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.12 20-Jul-2002  mrg install "sparc" includes for sparc64 as well
 1.11 13-Sep-2001  eeh branches: 1.11.4; 1.11.12;
Define SYSDIR if not already defined.
 1.10 03-Apr-2001  jhawk branches: 1.10.2; 1.10.4;
Remove gratuitous setting of SYSDIR;
it is set in sys/kern/Make.tags.inc
 1.9 28-Sep-2000  eeh branches: 1.9.2;
Fix bad path specifier for finding fpu sources.
 1.8 31-Jul-2000  eeh Look for fpu files in the sparc subdirectory where they now reside.
 1.7 09-May-1999  eeh branches: 1.7.2; 1.7.12;
Fixup non-DEBUG kernels.
 1.6 08-Oct-1998  eeh branches: 1.6.8;
Fix more syscall32 and signal breakage.
 1.5 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.4 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.3 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.6.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.12.1 07-Aug-2000  mrg pull up 1.8 (approved by thorpej):
>Look for fpu files in the sparc subdirectory where they now reside.
 1.7.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.7.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.10.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.10.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.10.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.12.1 31-Aug-2002  gehenna catch up with -current.
 1.11.4.3 07-Jan-2003  thorpej Sync with HEAD.
 1.11.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.11.4.1 13-Sep-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-08-01 02:43:33 +0000
 1.13.68.1 26-Jun-2007  garbled Sync with HEAD.
 1.13.62.1 11-Jul-2007  mjf Sync with head.
 1.13.60.1 15-Jul-2007  ad Sync with head.
 1.13.18.1 03-Sep-2007  yamt sync with head.
 1.15.10.1 06-Nov-2007  matt sync with HEAD
 1.16.26.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.20.2 20-Jun-2009  yamt sync with head
 1.16.20.1 04-May-2009  yamt sync with head.
 1.16.16.1 17-Jan-2009  mjf Sync with HEAD.
 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 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.32;
Import of sparc64.
 1.1.1.1.32.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:23:28 +0000
 1.9 14-Aug-2001  mrg this machine is no more.
 1.8 04-Mar-2001  mrg branches: 1.8.4;
sync with GENERIC; add COMPAT_SVR4_32
 1.7 27-Jul-2000  mrg branches: 1.7.2;
include the 32-bit kernel, not myself
 1.6 27-Jul-2000  mrg do the 32 bit / 64 bit name swap, as per GENERIC.
 1.5 27-Jul-2000  mrg remove COMPAT_AOUT option.
 1.4 27-Jul-2000  mrg add commented LOCKDEBUG
 1.3 07-Jul-2000  mrg BUFCACHE=20
 1.2 15-Jun-2000  mrg branches: 1.2.2; 1.2.4;
turn off softdep for now; we have enough other things to worry about.
 1.1 15-Jun-2000  mrg my Ultra-1
 1.2.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.4.1 15-Jun-2000  minoura file EVERGLADES was added on branch minoura-xpg4dl on 2000-06-22 17:04:16 +0000
 1.2.2.2 07-Aug-2000  mrg pull up config file changes (approved by thorpej):

rename the POWEROFSEVEN & EVERGLADES kernels inline with the GENERIC/GENERIC32
naming.
 1.2.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.7.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.7.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.7.2.1 27-Jul-2000  bouyer file EVERGLADES was added on branch thorpej_scsipi on 2000-11-20 20:26:40 +0000
 1.8.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.10 14-Aug-2001  mrg this machine is no more.
 1.9 08-Jul-2001  abs branches: 1.9.2;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.8 19-Mar-2001  mrg kill QUOTA on everglades.
 1.7 02-Mar-2001  mrg branches: 1.7.2;
sync with GENERIC32.
 1.6 17-Feb-2001  mrg sync with reality.
 1.5 02-Feb-2001  mrg bump NMBLUSTERS now this machine has NFS server tasks.
 1.4 27-Nov-2000  soren Removed increased BUFCACHE/BUFPAGES.
 1.3 19-Nov-2000  mrg branches: 1.3.2;
update to reality. sync with GENERIC32.
 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 27-Jul-2000  mrg branches: 1.1.2;
do the 32 bit / 64 bit name swap, as per GENERIC.
 1.1.2.2 07-Aug-2000  mrg pull up config file changes (approved by thorpej):

rename the POWEROFSEVEN & EVERGLADES kernels inline with the GENERIC/GENERIC32
naming.
 1.1.2.1 27-Jul-2000  mrg file EVERGLADES32 was added on branch netbsd-1-5 on 2000-08-07 02:32:02 +0000
 1.3.2.7 27-Mar-2001  bouyer Sync with HEAD.
 1.3.2.6 12-Mar-2001  bouyer Sync with HEAD.
 1.3.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.4 08-Dec-2000  bouyer Sync with HEAD.
 1.3.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.3.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 19-Nov-2000  bouyer file EVERGLADES32 was added on branch thorpej_scsipi on 2000-11-20 20:26:40 +0000
 1.7.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.9.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.243 27-Mar-2025  riastradh virtio(4): Consolidate kernel configs.

No functional change intended.

Leave `# XXX ?' comments where I don't know why the driver in
question is excluded. (Typical reason is that PAGE_SIZE is not 4096
but I didn't investigate -- if you do investigate, please either
update the comment if you determine a reason, or enable the driver if
you don't.)

PR kern/59211: vio9p(4): missing from various GENERICs and MAKEDEVs
 1.242 24-Feb-2025  andvar s/architecure/architecture/ and few other typos in comments.
 1.241 16-Jul-2024  riastradh viocon(4): Add to various kernel configs.
 1.240 02-Apr-2024  charlotte branches: 1.240.2;
Mention DKWEDGE_METHOD_TOS in several kernel config files
 1.239 09-Feb-2023  abs Adjust _all_ cinclude of *.local files

- Ensure always at end
- Use tab rather than spaces
- Add consistent comment
"Pull in optional local configuration - always at end"

The only functional change is that a local file which tried to
override an existing setting (eg with "no foo") would have failed
in some cases before, but now will work
 1.238 09-Feb-2023  abs Ensure GENERIC.local is always at the end of GENERIC

Where a GENERIC config had an existing inclusion of GENERIC.local,
ensure it is always at the end of the file, with a consistent
comment:

# Pull in optional local configuration
cinclude "arch/landisk/conf/GENERIC.local"

This allows GENERIC.local to correctly override all options

(This pass does not affect any GENERIC which did not already have
an include of GENERIC.local)
 1.237 29-Sep-2022  riastradh branches: 1.237.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.236 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.235 04-Mar-2021  palle sun4v: add vnet driver from openbsd - compiles but probably does not work yet - still WIP
 1.234 31-Jan-2021  martin Allow local builds to add configuration changes via GENERIC.local
 1.233 30-Oct-2020  jdc branches: 1.233.2;
Add pcagpio and pcf8574io - hardware status monitors on V210/V240 and E250.
 1.232 26-Oct-2020  martin Backout previous, PR 54810 has been fixed.
 1.231 25-Oct-2020  martin Temporarily disable NTFS for an internal test.
 1.230 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.229 01-Aug-2020  maxv Remove references to BRIDGE_IPF, it is now compiled in by default.
 1.228 13-May-2020  martin Remove local USB device declarations, include the central list instead
 1.227 11-May-2020  jdc Add "wb at ebus" and sdmmc, ld for the SD card reader on SPARCle.
 1.226 28-Mar-2020  isaki 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.
 1.225 16-Mar-2020  nia Lower blk_ms on more ports that are even slightly likely to play video
 1.224 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.223 25-Jan-2020  thorpej Retire "le* at pci?" from the shipped kernel configs:
- If the config had both an le@pci and a pcn, simply remove le@pci
(pcn would match at a higher priority anyway).
- If the config had le@pci enabled, but no pcn, change le@pci to pcn.
- If the config had le@pci commented out, but no pcn, change le@pci
to pcn and leave it commented out.

The pcn driver supports more chips than le@pci and does DMA directly
to/from mbufs rather than memory copies.
 1.222 20-Jan-2020  thorpej Remove FDDI support.
 1.221 19-Jan-2020  thorpej Remove Token Ring support.
 1.220 19-Jan-2020  thorpej Remove HIPPI support and the esh(4) driver that uses it. There have not
been any users of HIPPI for some time, and it is unlikely to be resurrected.
 1.219 19-Jan-2020  thorpej Remove the strip(4) - Starmode Radio IP - pseudo-device driver. It is
long since obsolete.
 1.218 05-Nov-2019  martin branches: 1.218.2;
Add GPT wedge autodiscovery
 1.217 05-Nov-2019  martin Add siisata* at pci (no idea why it was missing)
 1.216 06-May-2019  sevan branches: 1.216.2;
Use filesystems.config to reduce duplication
 1.215 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.214 06-Feb-2019  rin Add ure(4) to kernel config files. Also add PHY drivers where necessary.
 1.213 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.212 14-Dec-2018  nakayama Remove comment about removed lmc*.
 1.211 12-Dec-2018  maxv Remove references to "lmc" in the kernel configurations.
 1.210 02-Nov-2018  macallan add jbusi2c
 1.209 23-Oct-2018  jdolecek remove the 'wd* at umass?' for the non-standardized and rare (extinct?)
In-System Design ATA protocol over Bulk-Only devices from most kernels,
leave only in i386/amd64 ALL; it's unmaintained and likely currently broken,
lack of test hardware makes it impossible to support
 1.208 13-Oct-2018  macallan add tadpmu
 1.207 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.206 25-Aug-2018  rin Add (commented out) mue(4) to where appropriate.
Also add MII/PHY drivers for USB NICs if missing.
 1.205 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.204 05-Feb-2018  maxv branches: 1.204.2; 1.204.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.203 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.202 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.201 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.200 30-Jul-2017  maxv Disable svr4 and svr4_32 on sparc, sparc64 and amiga - the only places
where they were still enabled.
 1.199 29-Jul-2017  maxv Remove TCP_COMPAT_42 from the config files. Pass 3.
 1.198 25-Mar-2017  martin branches: 1.198.6;
Add virtio PCI devices, some of them mostly untested so far
 1.197 23-Mar-2017  martin Comment out PAX_MPROTECT options completely, instead of just turning them
off globaly. This will make the automatic tests not even try to enable
mprotect, which can't work for our current PLT format and shared binaries.
 1.196 13-Dec-2016  christos branches: 1.196.2;
wildcard speaker attachments, now that we can handle many of them.
 1.195 10-Dec-2016  christos remove VAUDIOSPEAKER for now, will be done differently.
 1.194 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.193 26-Nov-2016  christos mention PAX_SEGVGUARD dependency on FILEASSOC
 1.192 19-Aug-2016  palle sun4v: vdsk and ldc drivers - from OpenBSD, but heavily adapted to NetBSD scsipi - access to a virtual disk served from a ldom primary domain now works
 1.191 22-Jun-2016  palle branches: 1.191.2;
sun4v: add cbus driver - from OpenBSD
 1.190 17-Jun-2016  palle sun4v: vbus and vrtc drivers - from OpenBSD
 1.189 26-May-2016  nakayama Add more CardBus devices.
 1.188 26-May-2016  nakayama sort
 1.187 25-May-2016  nakayama tabify, fix indent and remove trailing whitespace.
 1.186 24-May-2016  martin Update comment explaining why PAX_MPROTECT is disabled here
 1.185 19-May-2016  christos Turn on ASLR for sparc64
 1.184 19-Mar-2016  gdt Disable uscanner in all kernel configs

As discussed on current-users@, SANE uses ugen via libusb and not
uscanner, so users are not well served by having uscanner. Consensus
is that addressing how to adjust permissions for scanners should not
block restoring basic functionionality.

(Compile-tested only, but there are multiple reports of this being the
right approach.)
 1.183 16-Dec-2015  jdc Add adm1026hm* for V210, V240, and V440 environmental monitoring.
 1.182 26-Sep-2015  maxv Remove KMEMSTATS. Normally it's ok now.
 1.181 11-Aug-2015  msaitoh Add ixg(4).
 1.180 12-Feb-2015  palle sun4v: vpci driver - initial (and incomplete) version of virtual PCIe host bridge driver for sun4v systems. Based on the NetBSD pyro driver and OpenBSD vpci driver. Future work will include integrating code from the OpenBSD vpci driver.
 1.179 07-Jan-2015  macallan enable genfb at sbus
output may not be pretty but it has a halfway decent chance to work at
least to some degree on otherwise unsupported graphics hardware
 1.178 06-Jan-2015  macallan add mgx driver
 1.177 16-Nov-2014  manu branches: 1.177.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.176 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.175 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.174 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.173 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.172 16-Aug-2014  apb Add "options COMPAT_70" to all kernel configuration files that
already had "options COMPAT_60".
 1.171 24-Mar-2014  szptvlfn branches: 1.171.4;
fix manual section numbering of sysctl.
thanks wiz@
 1.170 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.169 24-Sep-2013  jdc Remove spdmem entries for indirect configuration on SPARCle. This is now
handled in sparc64/autoconf.c (since r1.192).
 1.168 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.167 05-Jun-2013  christos branches: 1.167.2;
remove obsolete networking options
 1.166 05-Jun-2013  jnemeth enable FFS_EI
 1.165 27-Apr-2013  christos the bogus number police
 1.164 27-Apr-2013  christos remove confusing numeric locators where they are unused.
 1.163 12-Mar-2013  christos turn on MODULAR by default
 1.162 02-Mar-2013  christos Under FAST_IPSEC, IPSEC_ESP is mandatory; GC it.
 1.161 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.160 21-Feb-2013  martin Remove duplciate WSDISPLAY_COMPAT_PCVT - no idea how that sneaked in.
Thanks to Nick Hudson for the quick catch.
 1.159 21-Feb-2013  martin Add PCVT compat (for X console switching) and another font (purely
esthetical). From maccalan@.
 1.158 20-Feb-2013  macallan add WSDISPLAY_COMPAT_PCVT
 1.157 08-Feb-2013  jdc Add seeprom(4). Tested on Blade 2000 and Fire 280R.
 1.156 07-Dec-2012  jdc Add uthum (tested on U60 with Belkin F5U508 USB 2 and SB2000 built-in USB 1).
 1.155 02-Nov-2012  jdc Add indirectly configured spdmem devices for Tadpole SPARCle.
 1.154 17-Oct-2012  apb Add "options COMPAT_60" to all kernel configuration files
that already had "options COMPAT_50".
 1.153 13-Oct-2012  jdc Add pckbc at ebus.
 1.152 01-Sep-2012  jakllsch branches: 1.152.2;
Rename RT2500USB driver to ural(4) as it was originally in OpenBSD,
as ural(4) and ral(4) do not actually share any code.

Enable ural(4) in hpcarm WZERO3 kernel too, as it will now build.

Fixes PR#43520.
 1.151 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.150 11-Mar-2012  nakayama Remove stray comments for LKM.
 1.149 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.148 17-Jan-2012  jakllsch branches: 1.148.2;
+gsip(4)
 1.147 25-Dec-2011  martin Enable cgd(4)
 1.146 18-Dec-2011  dholland WABPL is no longer considered experimental (has not been for some time)
so update its comment in config files.
 1.145 22-Nov-2011  tls branches: 1.145.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.144 12-Aug-2011  mrg branches: 1.144.2;
add auacer, present on the ultra45.
 1.143 07-Aug-2011  jakllsch Trailing whitespace, what trailing whitespace?
 1.142 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.141 23-Jul-2011  jakllsch Enable or note aubtfwl(4) wherever ubt(4) is enabled or noted.
 1.140 23-Jul-2011  martin Enable DIAGNOSTIC by default
 1.139 17-May-2011  martin Disable DEBUG=-g by default again (accidently slipped in with last changes).
Ok: mrg
 1.138 17-May-2011  mrg move and rename the uvm history code out of uvm_stat to "kernhist".

rename "UVMHIST" option to enable the uvm histories.

TODO:
- make UVMHIST properly depend upon KERNHIST
- enable dynamic registration of histories. this is mostly just
allocating something in a bitmap, and is only for viewing multiple
histories in a merged form.


tested on amd64 and sparc64.
 1.137 12-May-2011  mrg remove a sparc-specific comment.
 1.136 04-Apr-2011  martin Add gem at sbus (works since quite some time).
 1.135 20-Mar-2011  mrg enable pci@pryo@mainbus and ebus@mainbus attachments.

pryo still isn't fully working, but i'm able to talk to disk and com
properly. bge, ohci/ehci, aceride and wm (pcie card) interrupts
are not working yet.
 1.134 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.133 16-Dec-2010  martin branches: 1.133.2; 1.133.4;
Ooops, backout intended part of previous change, pointed out by
Masao Uebayashi.
 1.132 11-Dec-2010  martin Add bnx @ pci
 1.131 08-Dec-2010  mrg add dbcool(4) - there are two of them on the SB2500.
fix a spelling error.
 1.130 23-Nov-2010  hannken Remove unused count from pseudo-device md.
 1.129 22-May-2010  plunky add btmagic(4) where other Bluetooth drivers are listed
 1.128 22-May-2010  tsutsui Enable bwtwo(4).
 1.127 12-May-2010  nakayama Remove obsolete comment about a data corruption on IDE controllers
in Blade 100/Netra X1.

Workaround for a data corruption was commited as rev. 1.16 of
src/sys/dev/pci/aceride.c in 2005.
 1.126 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.125 29-Apr-2010  chs add mpt.
 1.124 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.123 13-Mar-2010  mrg branches: 1.123.2;
convert sparc64 to MULTIPROCESSOR kernel by default, and introduce
s/MP/UP/ kernels were otherwise in place.

in my testing on a U60, i couldn't really notice any different in
speed, but we need testing on a U1/U5/U10 systems to be sure that
GENERIC.UP isn't necessary.

for sparc64, this is some what required as USIIIi systems have the
memory controller on the CPU, and unless the CPU is spunup, a UP
kernel will not function on these systems. (we obviously need to
join the NUMA-for-netbsd camp now, too! :-)


this should enable the installer to function on all systems that we
support, but also give the option for people to install GENERIC.UP
on their single-cpu systems if they choose.


XXX: i haven't actually tested sysinst with this, but i have built
both sparc and sparc64 release iso's successfully with this change
(sans having to comment out kern_ctf.c.)
 1.122 12-Mar-2010  roy Revert part of last patch. Didn't mean to enable pf by default.
 1.121 12-Mar-2010  roy Change the default console from wsemul_sun/sun-ss5 to wsemul_vt100/wsvt25.
This allows for a colour console, fixes home/end keys not working and
works with the embedded wsvt25 description in libterminfo.
 1.120 10-Mar-2010  macallan enable wcfb now that it's actually useful
This driver has been tested on Sun XVR-500 and XVR-1200 boards but it should
work on most ( all? ) Wildcat-based boards.
 1.119 07-Mar-2010  plunky add uhso(4) device where appropriate
- follow the lead of other USB driver declarations wrt commented out
- (cross-)build tested all these kernels
 1.118 28-Feb-2010  martin Remove the envctrl driver, it is superseeded by the more general pcfiic @
ebus. Add the SB1000/SB2000 fan controll driver (tda). From OpenBSD.
Move config files over to direct configuration of i2c devices.
 1.117 13-Feb-2010  mrg enable schizo, bge, fwohci/sbp and ffb@upa, all as seen in SCHIZO config.
 1.116 07-Jan-2010  jdc branches: 1.116.2;
Add cas, gentbi and gphyter for Sun Cassini/Cassini+ Ethernet.
 1.115 29-Dec-2009  macallan add gfb at mainbus
 1.114 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.113 26-Nov-2009  macallan cgthree works on sparc64 so let's enable it for those poor souls who can't
find at least a CG6
 1.112 28-Oct-2009  macallan add radeonfb ( has been working for ages with my XVR-100 ) and pm2fb ( for
PGX32 / TechSource Raptor GFX 8P )
We should probably enable cgthree as well since it grew wsdisplay support a
while ago.
 1.111 02-Oct-2009  nakayama Port lom(4) driver for LOMlite lights out management hardware monitor
and watchdog timer from OpenBSD.

It supports the LOMlite found on Sun Netra t1 and the LOMlite2 found
on Sun Netra T1/X1 and Sun Fire V100/V120.
 1.110 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.109 24-Jan-2009  mrg branches: 1.109.2;
add COMPAT_50 to all the configs with COMPAT_40.
 1.108 11-Dec-2008  hauke I tested spif(4) in an Ultra 1 - enable it.
 1.107 09-Dec-2008  nakayama Sync PCMCIA and CardBus devices with i386/conf/GENERIC.
 1.106 24-Nov-2008  ad Remove softdep, pass 1. We are focused on improving journalling.

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

Proposed on tech-kern@.
 1.104 29-Oct-2008  jkunz branches: 1.104.2;
Enable the newly inported device drivers alipm(4) and admtemp(4).
 1.103 22-Oct-2008  jnemeth branches: 1.103.2;
add pseudo-device drvctl
 1.102 10-Aug-2008  tls Add accept filters to GENERIC kernels where they exist.
 1.101 31-Jul-2008  simonb Add "options WAPBL" to standard GENERIC/INSTALL type configs.
 1.100 30-May-2008  tsutsui branches: 1.100.4;
Add options COMPAT_40 to files which have options COMPAT_30.
 1.99 24-Mar-2008  ad branches: 1.99.2; 1.99.4; 1.99.6;
+pseudo-device lockstat since there is a cycle counter. Ok martin@.
 1.98 02-Feb-2008  tron branches: 1.98.6;
Add brgphy(4). It works with a 3Com 3C996B-T in my ULTRA60.
Approved by Martin Husemann.
 1.97 05-Jan-2008  jdc Add bmtphy* (for gem*).
 1.96 31-Dec-2007  ad Remove systrace. Ok core@.
 1.95 02-Dec-2007  kiyohara branches: 1.95.6;
Add bcsp(4).
 1.94 19-Nov-2007  macallan add genfb at pci
This should work with all firmware-supported PCI framebuffers but so far it's
only been tested with a PGX
 1.93 17-Oct-2007  garbled branches: 1.93.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.92 24-Sep-2007  mrg branches: 1.92.2;
add mskc/msk & skc/sk network drivers.

reported to work by Chris Ross on port-sparc64.
 1.91 24-Sep-2007  martin add DDB_VERBOSE_HELP
 1.90 21-Aug-2007  kiyohara branches: 1.90.2; 1.90.4;
Add slhci at pcmcia.
And reorder.
 1.89 20-Aug-2007  kiyohara Add btbc(4).
 1.88 06-Aug-2007  adrianp Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.87 11-Jun-2007  kiyohara branches: 1.87.2; 1.87.4; 1.87.8;
zyd was known to not work on big endian systems.
 1.86 09-Jun-2007  kiyohara Add zyd(4).
 1.85 04-Jun-2007  martin Add pseudo-device agr to all GENERIC kernels where it might make sense
(commented out in some).
 1.84 14-Apr-2007  tnn branches: 1.84.2;
Add envctrl(4): Sun Ultra Enterprise 450 environmental monitoring driver.
Also add accompanying i2c controller driver, pcf8584.
Both written by me. Some cosmetic improvements from Iain Hibbert.
ok <martin>
 1.83 14-Mar-2007  drochner It doesn't make sense to specify "configuration" and "interface"
locators for uhub because a hub can't have sub-devices.
This might be sanity-checked eventually.
Same for ubt now after the change to device attachment.
 1.82 01-Mar-2007  kiyohara branches: 1.82.2; 1.82.4;
Add btuart(4).
 1.81 11-Dec-2006  yamt branches: 1.81.2;
- remove a static configuration, FILEASSOC_NHOOKS. do it dynamically instead.
- make fileassoc_t a pointer and remove FILEASSOC_INVAL.
- clean up kern_fileassoc.c. unify duplicated code.
- unexport fileassoc_init using RUN_ONCE(9).
- plug memory leaks in fileassoc_file_delete and fileassoc_table_delete.
- always call callbacks, regardless of the value of the associated data.

ok'ed by elad.
 1.80 04-Dec-2006  elad sparc64: don't enable PaX MPROTECT by default for now.
sparc: add commented out 'FILEASSOC'.
 1.79 04-Dec-2006  dyoung Compile gre(4) into the GENERIC kernel.
 1.78 26-Nov-2006  tsutsui branches: 1.78.2;
- add working vge* at pci? and ciphy* at mii?
- remove an obsolete comment
 1.77 11-Nov-2006  jmmv Enable TMPFS by default. OK'ed by core@.

I'm leaving those platforms with few users and those whose machines are
not very powerful untouched per uwe@'s suggestion. The port masters or
the real users of those ports are better suited to make the decision of
enabling it.
 1.76 11-Nov-2006  jmmv Remove tmpfs's experimental status. OK'ed by core@.
 1.75 09-Nov-2006  tsutsui Add rgephy at mii and rlphy at mii.
Tested on Ultra5 with RTL8139C (not plus) and RTL8169S.
 1.74 09-Nov-2006  tsutsui More cleanup of sparc64 clock stuff:
- split mkclock attachment from sparc64/clock.c into dev/mkclock.c
(now clock.s only contains clock interrupt and timecounter stuff)
- rename match/attach functions of rtc at ebus to match the device name
- update some comments around clock devices in GENERIC

No objection on port-sparc64 for a month.
 1.73 26-Oct-2006  elad Compile in Veriexec by default on some popular archs (amd64, i386, sparc64)
so it's more accessible and less of a hassle to put to use. Also enable
fileassoc(9) by default as a result, which for itself may open the door for
a lot of cool stuff. (stay tuned. :)

I recommend port masters of other archs to consider doing the same.
Personally I don't know which ports are considered more of a legacy than
in-production, so I'm leaving it for someone else for now...

No objections on tech-kern.
 1.72 21-Oct-2006  bouyer Add support for the Intel 80003 Gigabit Ethernet controller (found e.g. in
newer server chipsets) to wm(4), from the FreeBSD em(4) driver.
While there, add a few other Intel Ethernet controller that should work as
is.
Properly update the RX error and TX collision counters.
Add ikphy(4), a driver for the Intel i82563 Kumeran 10/100/1000 Ethernet PHYs
 1.71 19-Oct-2006  martin Sync (commented out) kgdb options with reality.
(Not that it works at all - the locore.s support is not done yet)
 1.70 06-Oct-2006  jnemeth Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.69 01-Oct-2006  itohy Use ATA timing, instead of busmaster wait, for adding waits.
Use default wait value 0x01.
 1.68 26-Sep-2006  elad Oops! forgot "options" in previous commit. Pointed out by freza@, thanks!
 1.67 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.66 10-Sep-2006  plunky branches: 1.66.2;
add bluetooth support to sparc64, built by default in GENERIC
 1.65 07-Sep-2006  itohy branches: 1.65.2;
Add njata* at cardbus?
 1.64 26-Aug-2006  christos PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.63 26-Aug-2006  tsutsui Remove obsolete #options VERIFIED_EXEC, found by grep(1).
 1.62 23-Aug-2006  jnemeth fix DDB_ONPANIC option
 1.61 21-Aug-2006  jnemeth move 'PCI cryptographic devices' out of the middle of the Disk section
 1.60 14-Aug-2006  skrll s/adpater/adapter/

Prompted by PR/34195
 1.59 12-Aug-2006  christos Disable SYSTRACE by default on all kernels (discussed with core)
 1.58 31-Jul-2006  hubertf branches: 1.58.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.57 26-Jul-2006  cube Remove "atapibus* at umass?" and "scsibus* at umass?" when there is
already an attachment to the interface attribute (atapi and scsi).

Part of PR#34085, although it is the contrary to what the submitter
suggests (which shows that having both in a config file can be confusing).
 1.56 15-Jul-2006  elad add (commented out) fileassoc(9) kernel options on some popular archs.
 1.55 10-Jul-2006  gdamore New psm driver for use on Ultrabook IIi. Right now it supports the power
button and lid switch. I will add environmentals (battery, etc.) later.
 1.54 01-Jul-2006  nakayama Uncomment "midi* at midibus?" to make umidi work.
 1.53 30-Jun-2006  tsutsui Make GENERIC config really generic and change GENERIC32 config for 32 bit
compat kernel to include the GENERIC and use "no" keywords of config(1).
Also merge std.sparc64-64 into std.sparc64 and prepare std.sparc64-32
which uses "no" keywords for 32 bit kernels. OK'ed by mrg.
 1.52 10-Dec-2005  tsutsui branches: 1.52.4; 1.52.8; 1.52.16;
Move veriexec stuff from GENERIC to (common) GENERIC32.
 1.51 09-Dec-2005  elad Add (commented out) Veriexec options and pseudo-device to GENERIC kernels,
and remove the i386 GENERIC_VERIEXEC config.
 1.50 12-Feb-2003  martin branches: 1.50.2; 1.50.18;
Remove DEBUG and -g.
Output with DEBUG enabled is anoying these days and we don't want to
scare away users of the INSTALL kernel.
 1.49 19-Sep-2002  grant remove USERCONF and PIPE_SOCKETPAIR, as these are already in GENERIC32.
 1.48 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.47 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.46 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.45 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.44 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.43 24-Oct-2001  thorpej branches: 1.43.2;
Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.42 11-Feb-2001  eeh branches: 1.42.4; 1.42.6;
Add COMPAT_SVR4_32.
 1.41 21-Sep-2000  eeh Add support for the `com' driver and Sun Keyboard/Mouse line disciplines.
 1.40 07-Jul-2000  eeh Rename GENERIC to GENERIC32 and GENERIC64 to GENERIC to allow snapshots to
build properly.
 1.39 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.38 02-Jul-2000  pk Add `ahc' (Adaptec 2940, et.al. SCSI controller); it is known to work.
 1.37 30-Jun-2000  itojun add PULLDOWN_TEST for all the platforms.
XXX should be moved to somewhere else when stabilized
 1.36 22-Jun-2000  fvdl Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.35 19-Jun-2000  eeh branches: 1.35.2;
Have separate data and text segments, make text read-only.
 1.34 14-Jun-2000  veego Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.33 19-May-2000  eeh branches: 1.33.2;
Use the new emergency fallback PROM console driver.
 1.32 08-May-2000  augustss Add (sometimes commented out) MIIVERBOSE option.
 1.31 19-Apr-2000  itojun add stf pseudo interface (commented out due to possible security risks)
 1.30 15-Apr-2000  mrg - auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.29 13-Apr-2000  mrg - do the "options<space><tab>" thing everywhere.
- disable COMPAT_AOUT.
- enable hme at sbus/pci
- enable bpp at sbus
- clean up esp attachments
- enable all xxphy's
- sync GENERIC & GENERIC64.
 1.28 05-Apr-2000  mrg enable auxio at ebus.
 1.27 05-Apr-2000  mrg add "hme at pci" support. also, add "nsphy at mii" and other mii stuff
 1.26 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.25 29-Feb-2000  simonb Do the "<space><tab>" thing with the RAID_AUTOCONFIG option.
 1.24 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.23 23-Jan-2000  hubertf Add commented out "ident"-command
 1.22 20-Jan-2000  wrstuden Add overlay to kernel configs.
 1.21 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.20 15-Nov-1999  fvdl Add commented out option SOFTDEP to all GENERIC kernels.
 1.19 12-Sep-1999  chs branches: 1.19.2; 1.19.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.18 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.17 18-Jul-1999  eeh Switch to NetBSD/sparc ELF for 32-bit userland.
 1.16 05-Jun-1999  eeh Fix things up so they compile again.
 1.15 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.14 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.13 27-Mar-1999  eeh branches: 1.13.2; 1.13.4;
We don't have a default binary format: EXEC_AOUT is used for NetBSD/sparc pre 1.4,
EXEC_ELF64 is used for NetBSD/sparc64, and EXEC_ELF32 is used for NetBSD/sparc_elf.

We really need a way to turn these on and off depending on whether we're building
a 32-bit or 64-bit kernel...
 1.12 26-Mar-1999  eeh COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.11 23-Jan-1999  eeh Need to disable 64-bit only options in 32-bit GENERIC.
 1.10 23-Jan-1999  eeh Synchronize config files.
 1.9 20-Jan-1999  mrg enable a few more network and compat options, few more devices, both pseudo and real, that hvae appeared in the tree.
 1.8 25-Nov-1998  hwr Add (commented out) 'gre' pseudo device line. Feedback is welcome.
Inspired by Klaus Klein.
 1.7 16-Nov-1998  oster Added a (commented out) configuration line for the RAIDframe device driver.
 1.6 02-Sep-1998  mrg take out UVM_PAGE_TRKOWN and comment UVMHIST
 1.5 27-Aug-1998  mrg move isp sbus attachment to dev/sbus and support it on the sparc64
 1.4 26-Aug-1998  mrg - use UVM by default.
- clean up the Makefile a bit to be less solaris-centric :)
- add support for compat_sparc32 (32bit compat module for NetBSD/sparc). this
isn't yet fully tested but it mostly written and compiles if not totally
links yet.
 1.3 26-Aug-1998  mrg make this actually work
 1.2 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.13.4.2 02-Aug-1999  thorpej Update from trunk.
 1.13.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.2 05-Jul-2000  he Pull up revision 1.39 (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.13.2.1 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.19.8.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.19.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.19.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.19.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.33.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.35.2.3 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.35.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.35.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.42.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.42.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.42.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.42.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.42.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.43.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.43.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.43.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.43.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.43.2.1 24-Oct-2001  nathanw file GENERIC was added on branch nathanw_sa on 2002-01-08 00:27:57 +0000
 1.50.18.6 04-Feb-2008  yamt sync with head.
 1.50.18.5 21-Jan-2008  yamt sync with head
 1.50.18.4 07-Dec-2007  yamt sync with head
 1.50.18.3 27-Oct-2007  yamt sync with head.
 1.50.18.2 03-Sep-2007  yamt sync with head.
 1.50.18.1 30-Dec-2006  yamt sync with head.
 1.50.2.1 11-Dec-2005  christos Sync with head.
 1.52.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.52.8.3 14-Sep-2006  yamt sync with head.
 1.52.8.2 03-Sep-2006  yamt sync with head.
 1.52.8.1 11-Aug-2006  yamt sync with head
 1.52.4.1 09-Sep-2006  rpaulo sync with head
 1.58.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.58.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.65.2.2 12-Jan-2007  ad Sync with head.
 1.65.2.1 18-Nov-2006  ad Sync with head.
 1.66.2.3 18-Dec-2006  yamt sync with head.
 1.66.2.2 10-Dec-2006  yamt sync with head.
 1.66.2.1 22-Oct-2006  yamt sync with head
 1.78.2.6 24-Mar-2009  bouyer Pullup the following revisions (requested by msaitoh in ticket #1284):
distrib/sets/lists/base/mi 1.706-707,1.797
distrib/sets/lists/man/mi 1.1006
etc/mtree/NetBSD.dist 1.340
share/man/man4/Makefile 1.432
sys/arch/amd64/conf/GENERIC 1.149 via patch
sys/arch/i386/conf/ALL 1.103
sys/arch/i386/conf/GENERIC 1.832
sys/arch/i386/conf/GENERIC_LAPTOP 1.237
sys/arch/macppc/conf/GENERIC 1.257
sys/arch/sparc64/conf/GENERIC 1.86
sys/dev/usb/usbdevs 1.468,1.479-480 via patch
sys/dev/usb/usbdevs.h regen
sys/dev/usb/usbdevs_data.h regen
sys/dev/microcode/Makefile 1.7
sys/dev/usb/files.usb patch
share/man/man4/zyd.4 1.1 via patch
sys/dev/microcode/zyd/Makefile 1.1-1.2
sys/dev/microcode/zyd/build.c 1.1
sys/dev/microcode/zyd/microcode.h 1.1
sys/dev/microcode/zyd/zd1211-license 1.1
sys/dev/microcode/zyd/zyd-zd1211 1.1
sys/dev/microcode/zyd/zyd-zd1211b 1.1
sys/dev/usb/if_zyd.c patch
sys/dev/usb/if_zydreg.h 1.1-1.2

Add ZyDAS ZD1211/ZD1211B USB IEEE 802.11b/g wireless network device support
 1.78.2.5 17-May-2008  bouyer Pull up following revision(s) (requested by jdc in ticket #1145):
src/share/man/man4/gem.4 1.5,1.6 via patch
src/sys/arch/sparc64/conf/GENERIC 1.97 via patch
src/sys/dev/ic/gem.c 1.59,1.61-1.68,1.70-1.73 via patch
src/sys/dev/ic/gemreg.h 1.11 via patch
src/sys/dev/ic/gemvar.h 1.16,1.18 via patch
src/sys/dev/mii/bmtphy.c 1.24 via patch
src/sys/dev/pci/if_gem_pci.c 1.25,1.27 via patch
src/sys/dev/pci/pcidevs 1.12 via patch
src/sys/dev/pci/pcidevs.h regenerate
src/sys/dev/pci/pcidevs_data.h regenerate
Add support for Sun PCI X1141A (SX fibre) cards.
Add improvements to the driver.
Disable HW UDP4 and RX TCP4 checksums because they are buggy (PR#34799)
Add improvements to bmtphy.
 1.78.2.4 25-Sep-2007  xtraeme Pull up following revision(s) (requested by mrg in ticket #901):
sys/arch/sparc64/conf/GENERIC: revision 1.92

add mskc/msk & skc/sk network drivers.
reported to work by Chris Ross on port-sparc64.
 1.78.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.78.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.78.2.1 09-Dec-2006  bouyer branches: 1.78.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.78.2.1.2.3 03-Jun-2008  skrll Sync with netbsd-4.
 1.78.2.1.2.2 30-Sep-2007  wrstuden Catch up on netbsd-4 as of a few days ago.
 1.78.2.1.2.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.81.2.3 15-Apr-2007  yamt sync with head.
 1.81.2.2 24-Mar-2007  yamt sync with head.
 1.81.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.82.4.1 11-Jul-2007  mjf Sync with head.
 1.82.2.7 03-Dec-2007  ad Sync with HEAD.
 1.82.2.6 09-Oct-2007  ad Sync with head.
 1.82.2.5 20-Aug-2007  ad Sync with HEAD.
 1.82.2.4 15-Jul-2007  ad Sync with head.
 1.82.2.3 09-Jun-2007  ad Sync with head.
 1.82.2.2 27-May-2007  ad Sync with head.
 1.82.2.1 10-Apr-2007  ad Sync with head.
 1.84.2.2 03-Oct-2007  garbled Sync with HEAD
 1.84.2.1 26-Jun-2007  garbled Sync with HEAD.
 1.87.8.5 03-Dec-2007  joerg Sync with HEAD.
 1.87.8.4 21-Nov-2007  joerg Sync with HEAD.
 1.87.8.3 02-Oct-2007  joerg Sync with HEAD.
 1.87.8.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.87.8.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.87.4.2 03-Sep-2007  skrll Sync with HEAD.
 1.87.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.87.2.1 07-Aug-2007  matt Sync with HEAD.
 1.90.4.1 06-Oct-2007  yamt sync with head.
 1.90.2.3 23-Mar-2008  matt sync with HEAD
 1.90.2.2 09-Jan-2008  matt sync with HEAD
 1.90.2.1 06-Nov-2007  matt sync with HEAD
 1.92.2.1 21-Nov-2007  bouyer Sync with HEAD
 1.93.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.93.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.95.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.95.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.98.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.98.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.98.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.98.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.99.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.99.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.99.4.3 11-Aug-2010  yamt sync with head.
 1.99.4.2 11-Mar-2010  yamt sync with head
 1.99.4.1 04-May-2009  yamt sync with head.
 1.99.2.1 04-Jun-2008  yamt sync with head
 1.100.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.100.4.1 19-Oct-2008  haad Sync with HEAD.
 1.103.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.103.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.103.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.104.2.3 21-Nov-2010  riz Pull up following revision(s) (requested by plunky in ticket #1407):
sys/dev/bluetooth/btdev.h: revision 1.9
sys/arch/iyonix/conf/GENERIC: revision 1.60
sys/arch/sparc64/conf/GENERIC: revision 1.129
sys/dev/usb/hid.c: revision 1.30
sys/dev/usb/hid.h: revision 1.13
sys/arch/i386/conf/GENERIC: revision 1.983
usr.sbin/btdevctl/print.c: revision 1.10
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.16
sys/arch/alpha/conf/GENERIC: revision 1.337
sys/dev/bluetooth/files.bluetooth: revision 1.14
sys/arch/evbarm/conf/GUMSTIX: revision 1.49
sys/dev/usb/usbdevs: revision 1.550
sys/arch/evbppc/conf/OPENBLOCKS266_OPT: revision 1.14
sys/arch/hpcsh/conf/GENERIC: revision 1.91
sys/dev/bluetooth/btmagic.c: revision 1.1
distrib/sets/lists/man/mi: revision 1.1210
sys/arch/amd64/conf/GENERIC: revision 1.279
sys/arch/i386/conf/ALL: revision 1.258
sys/arch/amd64/conf/XEN3_DOM0: revision 1.54
sys/arch/hpcarm/conf/JORNADA720: revision 1.78
sys/dev/usb/hid.c: revision 1.29
share/man/man4/btmagic.4: revision 1.1
hid_get_data() does not work if the size of data is less than
a byte and crosses a byte boundary, and it always returns a
sign-extended value.
fix this by using the algorithm from libusbhid to read bytes,
and provide a hid_get_udata() function to return unsigned data
values.
while here, const args
update DPRINTF to reflect actual function name
add Apple Magic Mouse product-id
regen for Magic Mouse id
allow for vendor-id and product-id properties, passing them
through to child devices
add Magic Mouse driver and manpage btmagic(4)
additionally query the "PnP Information" service record to discover
any USB Forum vendor-id and product-id values and store them in the
property list if found.
add btmagic(4) where other Bluetooth drivers are listed
 1.104.2.2 16-Oct-2009  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #1064):
distrib/sets/lists/man/mi: revision 1.1161
share/man/man4/man4.sparc64/Makefile: revision 1.5
share/man/man4/man4.sparc64/lom.4: revision 1.1-1.2
sys/arch/sparc64/conf/GENERIC: revision 1.111
sys/arch/sparc64/conf/files.sparc64: revision 1.121
sys/arch/sparc64/dev/lom.c: revision 1.1
sys/dev/DEVNAMES: revision 1.252

Add a driver for LOMlite lights out management hardware monitor and watchdog
timer.
 1.104.2.1 19-Feb-2009  snj branches: 1.104.2.1.4;
Apply patch (requested by pooka in ticket #453):
Add puffs and putter to amd64, i386, macppc, and sparc64 GENERIC kernels.
 1.104.2.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.109.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.116.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.116.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.123.2.4 31-May-2011  rmind sync with head
 1.123.2.3 21-Apr-2011  rmind sync with head
 1.123.2.2 05-Mar-2011  rmind sync with head
 1.123.2.1 30-May-2010  rmind sync with head
 1.133.4.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.133.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.144.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.144.2.3 16-Jan-2013  yamt sync with (a bit old) head
 1.144.2.2 30-Oct-2012  yamt sync with head
 1.144.2.1 17-Apr-2012  yamt sync with head
 1.145.2.3 05-Apr-2012  mrg sync to latest -current.
 1.145.2.2 11-Mar-2012  mrg sync to latest -current
 1.145.2.1 18-Feb-2012  mrg merge to -current.
 1.148.2.3 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.148.2.2 15-Aug-2012  sborrill branches: 1.148.2.2.4; 1.148.2.2.6;
Pull up the following revisions(s) (requested by martin in ticket #502):
sys/arch/cobalt/conf/GENERIC: patch
sys/arch/i386/conf/GENERIC: patch
sys/arch/i386/conf/XEN3_DOM0: patch
sys/arch/i386/conf/XEN3_DOMU: patch
sys/arch/mvmeppc/conf/GENERIC: patch
sys/arch/shark/conf/GENERIC: patch
sys/arch/sparc64/conf/GENERIC: patch
sys/arch/sparc64/conf/GENERIC.DEBUG: patch
sys/arch/zaurus/conf/GENERIC: patch

Switch off DIAGNOSTIC and/or DEBUG on release kernels.
Enable DIAGNOSTIC in DEBUG kernels to allow for option
being switched off in GENERIC.
 1.148.2.1 12-Jun-2012  riz 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.148.2.2.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.148.2.2.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.152.2.5 03-Dec-2017  jdolecek update from HEAD
 1.152.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.152.2.3 23-Jun-2013  tls resync from head
 1.152.2.2 25-Feb-2013  tls resync with head
 1.152.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.167.2.2 18-May-2014  rmind sync with head
 1.167.2.1 28-Aug-2013  rmind sync with head
 1.171.4.5 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.171.4.4 15-May-2015  snj branches: 1.171.4.4.2; 1.171.4.4.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.171.4.3 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.171.4.2 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.171.4.1 10-Oct-2014  snj Apply patch (requested by bouyer/martin in ticket #116):
Disable DIAGNOSTIC and/or DEBUG.
 1.171.4.4.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.171.4.4.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.177.2.10 28-Aug-2017  skrll Sync with HEAD
 1.177.2.9 05-Feb-2017  skrll Sync with HEAD
 1.177.2.8 05-Dec-2016  skrll Sync with HEAD
 1.177.2.7 05-Oct-2016  skrll Sync with HEAD
 1.177.2.6 09-Jul-2016  skrll Sync with HEAD
 1.177.2.5 29-May-2016  skrll Sync with HEAD
 1.177.2.4 22-Apr-2016  skrll Sync with HEAD
 1.177.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.177.2.2 22-Sep-2015  skrll Sync with HEAD
 1.177.2.1 06-Apr-2015  skrll Sync with HEAD
 1.191.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.191.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.196.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.198.6.5 18-Apr-2018  martin Requested by skrll in ticket #60:
sys/arch/amd64/conf/GENERIC
sys/arch/amd64/conf/XEN3_DOM0
sys/arch/amd64/conf/XEN3_DOMU
sys/arch/cobalt/conf/GENERIC
sys/arch/evbarm/conf/BEAGLEBONE
sys/arch/evbarm/conf/BEAGLEBOARD
sys/arch/evbarm/conf/BEAGLEBOARDXM
sys/arch/evbarm/conf/GENERIC.common
sys/arch/i386/conf/GENERIC
sys/arch/i386/conf/XEN3_DOM0
sys/arch/i386/conf/XEN3_DOMU
sys/arch/mvmeppc/conf/GENERIC
sys/arch/shark/conf/GENERIC
sys/arch/sparc64/conf/GENERIC
sys/arch/zaurus/conf/GENERIC

Remove option DIAGNOSTIC.
 1.198.6.4 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.198.6.3 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.198.6.2 29-Aug-2017  martin Requested by skrll in ticket #60:
sys/arch/amd64/conf/GENERIC
sys/arch/amd64/conf/XEN3_DOM0
sys/arch/amd64/conf/XEN3_DOMU
sys/arch/cobalt/conf/GENERIC
sys/arch/evbarm/conf/BEAGLEBONE
sys/arch/evbarm/conf/BEAGLEBOARD
sys/arch/evbarm/conf/BEAGLEBOARDXM
sys/arch/evbarm/conf/GENERIC.common
sys/arch/i386/conf/GENERIC
sys/arch/i386/conf/XEN3_DOM0
sys/arch/i386/conf/XEN3_DOMU
sys/arch/mvmeppc/conf/GENERIC
sys/arch/shark/conf/GENERIC
sys/arch/sparc64/conf/GENERIC
sys/arch/zaurus/conf/GENERIC


Re-enable option DIAGNOSTIC for now, will remove it again later.
 1.198.6.1 05-Jul-2017  martin Remove options DIAGNOSTIC/DEBUG and PAX debug options.
Requested by snj in #60.
 1.204.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.204.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.204.4.1 10-Jun-2019  christos Sync with HEAD
 1.204.2.5 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.204.2.4 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.204.2.3 20-Oct-2018  pgoyette Sync with head
 1.204.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.204.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.216.2.1 21-Nov-2019  martin In preparation for the upcoming release, turn off DIAGNOSTIC in most
kernel configs, modules and libc.
 1.218.2.2 29-Feb-2020  ad Sync with head.
 1.218.2.1 25-Jan-2020  ad Sync with head.
 1.233.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.237.4.1 09-Oct-2023  snj Apply patch (requested by martin in ticket #401):
Disable DIAGNOSTIC/DEBUG.
 1.240.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 25-May-2016  nakayama tabify, fix indent and remove trailing whitespace.
 1.2 26-Dec-2011  martin branches: 1.2.2; 1.2.4; 1.2.16; 1.2.18;
DIAGNOSTIC is enabled in GENERIC already, don't do it again here
 1.1 13-Mar-2010  mrg branches: 1.1.4; 1.1.6; 1.1.14; 1.1.18;
convert sparc64 to MULTIPROCESSOR kernel by default, and introduce
s/MP/UP/ kernels were otherwise in place.

in my testing on a U60, i couldn't really notice any different in
speed, but we need testing on a U1/U5/U10 systems to be sure that
GENERIC.UP isn't necessary.

for sparc64, this is some what required as USIIIi systems have the
memory controller on the CPU, and unless the CPU is spunup, a UP
kernel will not function on these systems. (we obviously need to
join the NUMA-for-netbsd camp now, too! :-)


this should enable the installer to function on all systems that we
support, but also give the option for people to install GENERIC.UP
on their single-cpu systems if they choose.


XXX: i haven't actually tested sysinst with this, but i have built
both sparc and sparc64 release iso's successfully with this change
(sans having to comment out kern_ctf.c.)
 1.1.18.1 18-Feb-2012  mrg merge to -current.
 1.1.14.1 17-Apr-2012  yamt sync with head
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 13-Mar-2010  yamt file GENERIC.DEBUG was added on branch yamt-nfs-mp on 2010-08-11 22:52:46 +0000
 1.1.4.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.4.1 13-Mar-2010  uebayasi file GENERIC.DEBUG was added on branch uebayasi-xip on 2010-04-30 14:39:50 +0000
 1.2.18.1 29-May-2016  skrll Sync with HEAD
 1.2.16.1 10-Oct-2014  snj Apply patch (requested by bouyer/martin in ticket #116):
Disable DIAGNOSTIC and/or DEBUG.
 1.2.4.1 03-Dec-2017  jdolecek update from HEAD
 1.2.2.1 15-Aug-2012  sborrill Pull up the following revisions(s) (requested by martin in ticket #502):
sys/arch/cobalt/conf/GENERIC: patch
sys/arch/i386/conf/GENERIC: patch
sys/arch/i386/conf/XEN3_DOM0: patch
sys/arch/i386/conf/XEN3_DOMU: patch
sys/arch/mvmeppc/conf/GENERIC: patch
sys/arch/shark/conf/GENERIC: patch
sys/arch/sparc64/conf/GENERIC: patch
sys/arch/sparc64/conf/GENERIC.DEBUG: patch
sys/arch/zaurus/conf/GENERIC: patch

Switch off DIAGNOSTIC and/or DEBUG on release kernels.
Enable DIAGNOSTIC in DEBUG kernels to allow for option
being switched off in GENERIC.
 1.7 13-Mar-2010  mrg convert sparc64 to MULTIPROCESSOR kernel by default, and introduce
s/MP/UP/ kernels were otherwise in place.

in my testing on a U60, i couldn't really notice any different in
speed, but we need testing on a U1/U5/U10 systems to be sure that
GENERIC.UP isn't necessary.

for sparc64, this is some what required as USIIIi systems have the
memory controller on the CPU, and unless the CPU is spunup, a UP
kernel will not function on these systems. (we obviously need to
join the NUMA-for-netbsd camp now, too! :-)


this should enable the installer to function on all systems that we
support, but also give the option for people to install GENERIC.UP
on their single-cpu systems if they choose.


XXX: i haven't actually tested sysinst with this, but i have built
both sparc and sparc64 release iso's successfully with this change
(sans having to comment out kern_ctf.c.)
 1.6 29-Jun-2008  nakayama branches: 1.6.10; 1.6.16;
Add 32-bit kernel configuration with SMP support.
 1.5 14-Mar-2008  nakayama branches: 1.5.4; 1.5.6; 1.5.8;
SMP support for sparc64 now works, so make GENERIC.MP kernel build
by default.
 1.4 24-Jan-2007  mrg branches: 1.4.24; 1.4.40; 1.4.44;
add a LOUD comment that this kernel does not work yet.
 1.3 30-Jun-2006  tsutsui branches: 1.3.4;
Make GENERIC config really generic and change GENERIC32 config for 32 bit
compat kernel to include the GENERIC and use "no" keywords of config(1).
Also merge std.sparc64-64 into std.sparc64 and prepare std.sparc64-32
which uses "no" keywords for 32 bit kernels. OK'ed by mrg.
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.8; 1.2.16;
merge ktrace-lwp.
 1.1 15-Nov-2003  petrov branches: 1.1.4; 1.1.18;
Generic SMP configuration.
 1.1.18.3 17-Mar-2008  yamt sync with head.
 1.1.18.2 26-Feb-2007  yamt sync with head.
 1.1.18.1 30-Dec-2006  yamt 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 15-Nov-2003  skrll file GENERIC.MP was added on branch ktrace-lwp on 2004-08-03 10:41:23 +0000
 1.2.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.2.8.1 11-Aug-2006  yamt sync with head
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.4.1 01-Feb-2007  ad Sync with head.
 1.4.44.2 29-Jun-2008  mjf Sync with HEAD.
 1.4.44.1 03-Apr-2008  mjf Sync with HEAD.
 1.4.40.1 24-Mar-2008  keiichi sync with head.
 1.4.24.1 23-Mar-2008  matt sync with HEAD
 1.5.8.1 03-Jul-2008  simonb Sync with head.
 1.5.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.4.2 11-Aug-2010  yamt sync with head.
 1.5.4.1 04-May-2009  yamt sync with head.
 1.6.16.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.6.10.1 24-Oct-2010  jym Sync with HEAD
 1.2 25-May-2016  nakayama tabify, fix indent and remove trailing whitespace.
 1.1 13-Mar-2010  mrg branches: 1.1.4; 1.1.6; 1.1.24; 1.1.42;
convert sparc64 to MULTIPROCESSOR kernel by default, and introduce
s/MP/UP/ kernels were otherwise in place.

in my testing on a U60, i couldn't really notice any different in
speed, but we need testing on a U1/U5/U10 systems to be sure that
GENERIC.UP isn't necessary.

for sparc64, this is some what required as USIIIi systems have the
memory controller on the CPU, and unless the CPU is spunup, a UP
kernel will not function on these systems. (we obviously need to
join the NUMA-for-netbsd camp now, too! :-)


this should enable the installer to function on all systems that we
support, but also give the option for people to install GENERIC.UP
on their single-cpu systems if they choose.


XXX: i haven't actually tested sysinst with this, but i have built
both sparc and sparc64 release iso's successfully with this change
(sans having to comment out kern_ctf.c.)
 1.1.42.1 29-May-2016  skrll Sync with HEAD
 1.1.24.1 03-Dec-2017  jdolecek update from HEAD
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 13-Mar-2010  yamt file GENERIC.UP was added on branch yamt-nfs-mp on 2010-08-11 22:52:46 +0000
 1.1.4.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.4.1 13-Mar-2010  uebayasi file GENERIC.UP was added on branch uebayasi-xip on 2010-04-30 14:39:50 +0000
 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:23:16 +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.142 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.141 25-May-2016  nakayama branches: 1.141.16; 1.141.18;
tabify, fix indent and remove trailing whitespace.
 1.140 30-Jun-2006  tsutsui branches: 1.140.102; 1.140.106; 1.140.108; 1.140.118; 1.140.126;
Make GENERIC config really generic and change GENERIC32 config for 32 bit
compat kernel to include the GENERIC and use "no" keywords of config(1).
Also merge std.sparc64-64 into std.sparc64 and prepare std.sparc64-32
which uses "no" keywords for 32 bit kernels. OK'ed by mrg.
 1.139 29-Jun-2006  liamjfoy Add CARP to further platforms

ok christos, julian coleman and matthew green
 1.138 05-Jun-2006  gdamore branches: 1.138.2;
Import new HAL 0.9.17.2. Approved by sam@

New HAL includes some driver changes to register accesses.
Adds support for WLAN devices on AR5312 family devices.
Adds support 32-bit SPARC ath devices (untested).
ath enabled in SPARC64 GENERIC builds.
This HAL is tested and known to work for i386 PCI devices, SPARC64 PCI devices,
and AR5312 WiSoC devices. MIPS PCI devices appear to be busted (possibly only
on Alchemy hardware, unconfirmed), and cardbus support is untested due to
lack of test hardware.

Please report any new problems with this import to garrett@.
 1.137 14-May-2006  elad branches: 1.137.2;
integrate kauth.
 1.136 13-Apr-2006  tron Add makphy(4). Tested with an Intel PRO/1000 MT in a Tadpole Voyager.
 1.135 28-Mar-2006  pavel Add stf to all kernel configs which have INET6 and gif, except the INSTALL
ones and those for specific machines of developers. PR 32304.

OK'ed by rpaulo.

N.B. stf is a cloning device, so it still must be enabled by
"ifconfig stf0 create".
 1.134 09-Mar-2006  hubertf branches: 1.134.2;
Add & enable smbfs
Patch by Michael-John Turner <mj@turner.org.za> on port-sparc64@,

Reviewed & OK'd by martin@
 1.133 04-Mar-2006  nakayama branches: 1.133.2; 1.133.4;
Add ath(4), ral(4).
Tested on my Ultra60 with ath at cardbus and ral at uhub.

XXX ath at pci now commented out since no 32-bit athhal.
 1.132 03-Mar-2006  nakayama - remove untested marks from some CardBus/PCMCIA cards.
- add acphy(4) found on tlp based CardBus card.
 1.131 05-Feb-2006  cube Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.130 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.129 03-Feb-2006  tsutsui branches: 1.129.2;
Add commented out file-system TMPFS and UDF.

XXX Is it better to make GENERIC really generic and change GENERIC32
XXX to use "no options" and "no makeoptions" features of newer config(1)?
 1.128 15-Jan-2006  chs branches: 1.128.2;
allow multiple sbuses.
 1.127 15-Jan-2006  mrg add re(4): Realtek 8139C+/8169/8169S/8110S ethernet. been working for
a long time on my U10.
 1.126 13-Jan-2006  chs the esp driver has been working well with tagged queuing for
quite some time, remove the flags that disable it by default.
add a comment describing those flags. ok'd by martin and andrey.
 1.125 20-Dec-2005  mrg branches: 1.125.2;
enable sip@pci. it seems to work now, tested on a U10/440.
 1.124 10-Dec-2005  tsutsui Move veriexec stuff from GENERIC to (common) GENERIC32.
 1.123 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.122 04-Dec-2005  sekiya Add wm and igphy -- tested on my E250, fully functional.
 1.121 25-Nov-2005  thorpej swcr -> swcrypto
 1.120 25-Nov-2005  thorpej "pseudo-device crypto" really refers to the /dev/crypto API to the
opencrypto framework, not the framework itself. Update the comment
accordingly.
 1.119 25-Nov-2005  thorpej Add "pseudo-device swcr" (commented out if "pseudo-device crypto" is also
commented out).
 1.118 09-Sep-2005  drochner branches: 1.118.6;
remove "dev" locators from cardbus device definitions, it doesn't
make sense technically and might be removed
 1.117 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.116 19-Aug-2005  christos 64 bit inode changes.
 1.115 05-Aug-2005  skrll Add (commented out) ucycom to various kernel configs.
 1.114 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.113 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.112 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.111 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.110 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.109 25-Jun-2005  rpaulo branches: 1.109.2;
Add file-system PTYFS (commented out) so that people know its existence.

Ok'ed by Christos Zoulas and Hubert Feyrer.
 1.108 15-Jun-2005  tron Remove commented out "upa" attachments because NetBSD doesn't have a
driver for that anyway. Approved by Martin Husemann.
 1.107 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.106 01-Jun-2005  macallan changed wsdisplay* attachment so the console display will always be
wsdisplay0
 1.105 31-May-2005  tron Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.104 23-May-2005  martin Rename REALWHITE to SNOWWHITE.
While there, add LIGHT versions of the other predefined colours as well.
 1.103 22-May-2005  martin Use the new WSCOL_REALWHITE as default background color.
 1.102 03-May-2005  martin Add wsmux and wsfont pseudo devices.
 1.101 29-Apr-2005  martin Add all missing USB stuff (from i386 GENERIC).
 1.100 28-Apr-2005  martin Use wscons/wskbd/wsmouse/wsdisplay by default.
 1.99 15-Apr-2005  itohy Add ukyopon(4).
 1.98 25-Feb-2005  martin branches: 1.98.2;
Nuke options RASTERCONSOLE for sparc64
 1.97 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.96 11-Feb-2005  jdc Add some PCMCIA devices that were missing.
Add/fix comments.
 1.95 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.94 06-Feb-2005  martin Add uhci.
 1.93 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.92 17-Jan-2005  cube branches: 1.92.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.91 24-Nov-2004  bouyer branches: 1.91.4;
pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) serie of
controllers. Tested with a PDC20375 (2 SATA, one PATA) controller on sparc64.
Added to all kernel config file which had pdcide(4).
 1.90 10-Nov-2004  christos Add COMPAT_BSDPTY to the rest of the config files.
 1.89 23-Oct-2004  augustss s/uax/axe/
 1.88 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.87 26-Aug-2004  itohy Add njs to some generic config files (I tested on i386 and sparc64).
 1.86 01-Aug-2004  mrg add commented entries for the magma and spif sbus multiport serial/parallel
cards (they're not tested afaik.)
 1.85 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.84 26-Jun-2004  abs Add (commented out) ALTQ options to all GENERIC-like files
 1.83 22-Jun-2004  itojun have pf and pflog pseudo-device (commented out).
reviewed by matt, perry, christos
 1.82 18-Jun-2004  christos ptm is now mandatory, depends on pty, and can be disabled with -DNO_DEV_PTM
 1.81 09-Jun-2004  martin Add pseudo-device ptm.
 1.80 02-May-2004  christos add COMPAT_20
 1.79 26-Feb-2004  petrov branches: 1.79.2;
Correct ffb attachment.
 1.78 14-Jan-2004  jonathan Add support for opencrypto, PCI accelerators to sys/arch/*/conf/GENERIC
files for machines I know to have genuine PCI slots. As sent to tech-kern
for feedback in December 2003. Based on feedback, opencrypto is commented
out in the macppc GENERIC (due to absense of GENERIC_SOFTINT support),
and added to the sparc64 config (sys/arch/sparc64/conf/GENERIC32).
 1.77 14-Dec-2003  thorpej Split the Intel i31244 SATA controller ("Artisea") driver out of piixide
into its own driver (artsata).
 1.76 13-Dec-2003  thorpej Split out the Silicon Image SATALink support into its own driver,
"satalink".
 1.75 26-Nov-2003  nakayama "wd* at wdc?" is no longer needed.
 1.74 27-Oct-2003  christos add posix semaphores
 1.73 18-Oct-2003  lukem Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.72 08-Oct-2003  bouyer Add new per-chip pciide drivers.
 1.71 08-Oct-2003  bouyer Add atabus.
 1.70 07-Aug-2003  bouyer Add esiop at pci to GENERIC which already have siop at pci.
esiop has been tested enouth now.
esiop not added to INSTALL kernels because of possible space constraint.
siop should be able to drive all adapters supported by esiop.
 1.69 20-Jun-2003  nakayama branches: 1.69.2;
s/options\t/options \t/
 1.68 19-Jun-2003  martin Ooops, I didn't intend to enable kgdb by default here.
(Since the related changes are not yet commited, it doesn't even compile)
 1.67 18-Jun-2003  martin Add missing COMPAT_ options.
 1.66 29-Apr-2003  nakayama - Add ehci at pci.
- Correct locator names for fwnode, and add sbpscsi at fwnode.
 1.65 29-Apr-2003  nakayama Use device attributes, atapi, audiobus and midibus,
instead of each devices.
 1.64 26-Apr-2003  ragge Add pseudo-device ksyms.
 1.63 10-Apr-2003  christos Bye Bye UCONSOLE
 1.62 05-Apr-2003  tsutsui Comment out le at pci that doesn't work. (device timeout)
Probably bus_dmamap_sync() calls are required in
copy{from,to}{buf,desc}() functions..
 1.61 05-Apr-2003  tsutsui - remove "UT" (untested) from some working devices (ahc, pcscp, ex and epic)
- comment out sip which causes uncorrectable DMA error on TX.
- add commented out pcn which also causes DMA error.
 1.60 22-Mar-2003  nakayama PCI-CardBus bridge support for sparc64:
- add CardBus and PCMCIA devices configrations.
- add workaround for internal compiler error on dev/ic/elink3.c.
 1.59 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.58 20-Feb-2003  seb Add vlan(4) pseudo device. Approved by martin@
 1.57 16-Feb-2003  augustss Add uax(4) (and url(4) in some cases).
 1.56 10-Feb-2003  grant add wi at pci.
 1.55 22-Nov-2002  wiz Fix typo (responsiness -> responsiveness).
 1.54 18-Oct-2002  junyoung Add NEW_BUFQ_STRATEGY (disabled by default).
 1.53 18-Oct-2002  grant remove 'UT' from fxp and rtk, as these have been tested and known
to work. some whitespace cleanup.
 1.52 18-Oct-2002  grant add comment about pciide and wd flags (from i386 GENERIC).
 1.51 14-Oct-2002  elric Added commented out cgd(4)s to GENERIC configs.
 1.50 12-Oct-2002  provos add SYSTRACE
 1.49 04-Oct-2002  martin Disable tagged queuing for the esp driver, with a comment describing
why and how to re-enable it. The driver is broken, and can currently
cause data corruption.

Since this file is included by the INSTALL config, enabling tagged queueing
could prevent first time installation (and creation of a custom kernel
with these settings changed)
 1.48 29-Sep-2002  chs enable DHCP netbooting support.
 1.47 25-Sep-2002  martti Add one space between "#option" and "<tab>IPFILTER_DEFAULT_BLOCK"
 1.46 20-Sep-2002  martti Added (commented out) IPFILTER_DEFAULT_BLOCK.
 1.45 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.44 29-Aug-2002  chs Add `audio* at uaudio?' so that uaudio is actually useful. PR 15610.
 1.43 16-Aug-2002  petrov Enable sab.
 1.42 29-Jul-2002  mrg clean up esp & isp attachment lines.
 1.41 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.40 05-Jun-2002  martin Add audiocs at ebus.
 1.39 16-May-2002  thorpej branches: 1.39.2; 1.39.4;
* 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.38 13-May-2002  eeh Add rtc@ebus.
 1.37 06-May-2002  eeh Switch to ofpci.
 1.36 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.35 17-Apr-2002  mycroft Switch from de to tlp by default.
 1.34 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.33 29-Mar-2002  bouyer tl* at pci? now works.
 1.32 10-Feb-2002  wiz Update description for icsphy.
 1.31 05-Feb-2002  eeh Add a sound driver for Blade 100s (which doesn't seem to do much. All I
get is the sound of silecne.)
 1.30 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.29 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.28 30-Dec-2001  augustss Make uhidev change.
 1.27 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.26 05-Dec-2001  mrg add commented BLINK option.
 1.25 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.24 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.23 03-Nov-2001  tsutsui branches: 1.23.2;
Add iha and trm at pci, and mark untested SCSI controllers "UT".
 1.22 24-Oct-2001  thorpej Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.21 21-Sep-2001  eeh branches: 1.21.2;
Workaround for machines with the Acer Labs chipsets.
 1.20 16-Sep-2001  eeh Enable GEM, USB and Firewire drivers.
 1.19 01-Sep-2001  atatat branches: 1.19.2;
Add bridge pseudo devices to GENERIC configs
 1.18 20-Jul-2001  eeh PCI overhaul.
 1.17 10-Jul-2001  matt Add tlp* at pci? (for Netra X1).
 1.16 08-Jul-2001  abs branches: 1.16.2;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.15 29-Mar-2001  petrov add fas configuration
 1.14 02-Mar-2001  mrg branches: 1.14.2;
- no need to hard wire pci busses or hme0 anymore
- clean up some comments
- __ELF__ is defined by the compiler
 1.13 28-Feb-2001  mjacob add SES device
 1.12 11-Feb-2001  eeh Add COMPAT_SVR4_32.
 1.11 30-Dec-2000  mjacob Enable Qlogic PCI cards
 1.10 03-Dec-2000  fvdl TRAPWIN is defined by default in trap.c, don't define it here.
 1.9 19-Nov-2000  mrg branches: 1.9.2;
fix some comments.
 1.8 09-Nov-2000  eeh Enable clean up keyboard attach and make formatting prettier.
 1.7 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.6 21-Sep-2000  eeh Add support for the `com' driver and Sun Keyboard/Mouse line disciplines.
 1.5 22-Aug-2000  pk These devices will never be found on sun4u machines.
 1.4 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.3 31-Jul-2000  mrg hardcode onboard "hme" to "hme0"
 1.2 27-Jul-2000  mrg remove COMPAT_AOUT option.
 1.1 07-Jul-2000  eeh branches: 1.1.2;
Rename GENERIC to GENERIC32 and GENERIC64 to GENERIC to allow snapshots to
build properly.
 1.1.2.4 16-Mar-2001  he Pull up revision 1.11 (requested by mjacob):
Enable PCI Qlogic cards.
 1.1.2.3 07-Aug-2000  mrg pull up 1.3 (approved by thorpej):
>hardcode onboard "hme" to "hme0"
 1.1.2.2 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.1.2.1 07-Jul-2000  mrg file GENERIC32 was added on branch netbsd-1-5 on 2000-07-18 16:23:16 +0000
 1.9.2.8 21-Apr-2001  bouyer Sync with HEAD
 1.9.2.7 12-Mar-2001  bouyer Sync with HEAD.
 1.9.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.9.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.9.2.4 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.9.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.9.2.1 19-Nov-2000  bouyer file GENERIC32 was added on branch thorpej_scsipi on 2000-11-20 20:26:40 +0000
 1.14.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.16.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.16.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.16.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.16.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.16.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.16.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.16.2.1 03-Aug-2001  lukem update to -current
 1.19.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.21.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.23.2.11 11-Dec-2002  thorpej Sync with HEAD.
 1.23.2.10 11-Nov-2002  nathanw Catch up to -current
 1.23.2.9 18-Oct-2002  nathanw Catch up to -current.
 1.23.2.8 17-Sep-2002  nathanw Catch up to -current.
 1.23.2.7 27-Aug-2002  nathanw Catch up to -current.
 1.23.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.23.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.23.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.23.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.23.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.23.2.1 03-Nov-2001  nathanw file GENERIC32 was added on branch nathanw_sa on 2002-01-08 00:27:57 +0000
 1.39.4.5 26-Oct-2005  jmc Pullup (via patch) requested in ticket #5754 by itohy

Provide a backport for ukyopon(4) and pullup umodem(4) updates.
 1.39.4.4 30-Nov-2002  he Pull up revision 1.44 (requested by chs in ticket #769):
Add ``audio* at uaudio?'' so that uaudio is actually useful.
Fixes PR#15610.
 1.39.4.3 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.39.4.2 01-Aug-2002  lukem Pull up revision 1.41 (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.39.4.1 10-Jun-2002  tv Pull up revision 1.40 (requested by 186 in ticket #0):
Add audiocs at ebus.
 1.39.2.4 31-Aug-2002  gehenna catch up with -current.
 1.39.2.3 31-Aug-2002  gehenna catch up with -current.
 1.39.2.2 15-Jul-2002  gehenna catch up with -current.
 1.39.2.1 16-May-2002  gehenna file GENERIC32 was added on branch gehenna-devsw on 2002-07-15 01:21:37 +0000
 1.69.2.14 11-Dec-2005  christos Sync with head.
 1.69.2.13 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.69.2.12 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.69.2.11 15-Feb-2005  skrll Sync with HEAD.
 1.69.2.10 07-Feb-2005  skrll Sunc with HEAD.
 1.69.2.9 04-Feb-2005  skrll Sync with HEAD.
 1.69.2.8 24-Jan-2005  skrll Sync with HEAD.
 1.69.2.7 29-Nov-2004  skrll Sync with HEAD.
 1.69.2.6 14-Nov-2004  skrll Sync with HEAD.
 1.69.2.5 02-Nov-2004  skrll Sync with HEAD.
 1.69.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.69.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.69.2.2 03-Sep-2004  skrll Sync with HEAD
 1.69.2.1 03-Aug-2004  skrll Sync with HEAD
 1.79.2.4 11-Aug-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11356):
sys/arch/acorn32/conf/GENERIC 1.80 via patch
sys/arch/amd64/conf/GENERIC 1.154 via patch
sys/arch/amiga/conf/GENERIC.in 1.61 via patch
sys/arch/arc/conf/GENERIC 1.148 via patch
sys/arch/atari/conf/GENERIC.in 1.68 via patch
sys/arch/cats/conf/GENERIC 1.116 via patch
sys/arch/hp300/conf/GENERIC 1.141 via patch
sys/arch/hp700/conf/GENERIC patch
sys/arch/i386/conf/GENERIC 1.840 via patch
sys/arch/i386/conf/GENERIC_LAPTOP 1.239 via patch
sys/arch/i386/conf/GENERIC.MPACPI patch
sys/arch/mac68k/conf/GENERIC 1.182 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x 1.68 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x 1.66 via patch
sys/arch/sparc/conf/GENERIC 1.200 via patch
sys/arch/sparc64/conf/GENERIC32 patch
sys/arch/xen/conf/GENERIC patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.79.2.3 30-Aug-2004  tron branches: 1.79.2.3.2;
Pull up revision 1.87 (requested by itohy in ticket #800):
Add njs to some generic config files (I tested on i386 and sparc64).
 1.79.2.2 15-Jul-2004  he Pull up revision 1.85 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.79.2.1 30-Jun-2004  jdc Pull up revision 1.84 (requested by abs in ticket #567).

Add (commented out) ALTQ options to all GENERIC-like files
 1.79.2.3.2.3 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.79.2.3.2.2 21-Jul-2005  riz branches: 1.79.2.3.2.2.2;
Pull up revision 1.99 (requested by itohy in ticket #1430):
Add ukyopon(4).
 1.79.2.3.2.1 02-Apr-2005  he Pull up revision 1.91 (requested by bouyer in ticket #1019):
Add pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) series of
controllers.
 1.79.2.3.2.2.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.91.4.1 29-Apr-2005  kent sync with -current
 1.92.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.92.2.1 12-Feb-2005  yamt sync with head.
 1.98.2.14 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.98.2.13 20-Apr-2006  snj branches: 1.98.2.13.2;
Pull up following revision(s) (requested by tron in ticket #1267):
sys/arch/sparc64/conf/GENERIC32: revision 1.136
Add makphy(4). Tested with an Intel PRO/1000 MT in a Tadpole Voyager.
 1.98.2.12 20-Apr-2006  snj Pull up following revision(s) (requested by tron in ticket #1267):
sys/arch/sparc64/conf/GENERIC32: revision 1.122
Add wm and igphy -- tested on my E250, fully functional.
 1.98.2.11 14-Aug-2005  riz branches: 1.98.2.11.2;
Pull up revision 1.112 (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.98.2.10 18-Jul-2005  riz Pull up revision 1.110 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.98.2.9 18-Jun-2005  riz Pull up revision 1.108 (requested by tron in ticket #457):
Remove commented out "upa" attachments because NetBSD doesn't have a
driver for that anyway. Approved by Martin Husemann.
 1.98.2.8 07-Jun-2005  tron Pull up revision 1.106 (requested by martin in ticket #375):
changed wsdisplay* attachment so the console display will always be
wsdisplay0
 1.98.2.7 07-Jun-2005  tron Pull up revision 1.104 (requested by martin in ticket #373):
Rename REALWHITE to SNOWWHITE.
While there, add LIGHT versions of the other predefined colours as well.
 1.98.2.6 07-Jun-2005  tron Pull up revision 1.103 (requested by martin in ticket #372):
Use the new WSCOL_REALWHITE as default background color.
 1.98.2.5 03-Jun-2005  riz Pull up revision 1.102 (requested by martin in ticket #369):
Add wsmux and wsfont pseudo devices.
 1.98.2.4 03-Jun-2005  riz Pull up revision 1.101 (requested by martin in ticket #368):
Add all missing USB stuff (from i386 GENERIC).
 1.98.2.3 03-Jun-2005  riz Pull up revision 1.100 (requested by martin in ticket #367):
Use wscons/wskbd/wsmouse/wsdisplay by default.
 1.98.2.2 01-Jun-2005  riz Pull up revision 1.105 (requested by tron in ticket #362):
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.98.2.1 17-Apr-2005  tron Pull up revision 1.99 (requested by itohy in ticket #160):
Add ukyopon(4).
 1.98.2.13.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.98.2.11.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.109.2.2 30-Dec-2006  yamt sync with head.
 1.109.2.1 21-Jun-2006  yamt sync with head.
 1.118.6.1 29-Nov-2005  yamt sync with head.
 1.125.2.3 18-Feb-2006  yamt sync with head.
 1.125.2.2 01-Feb-2006  yamt sync with head.
 1.125.2.1 15-Jan-2006  yamt sync with head.
 1.128.2.1 09-Sep-2006  rpaulo sync with head
 1.129.2.2 07-Jun-2006  kardel Sync with head.
 1.129.2.1 22-Apr-2006  simonb Sync with head.
 1.133.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.133.2.5 11-Aug-2006  yamt sync with head
 1.133.2.4 26-Jun-2006  yamt sync with head.
 1.133.2.3 24-May-2006  yamt sync with head.
 1.133.2.2 01-Apr-2006  yamt sync with head.
 1.133.2.1 13-Mar-2006  yamt sync with head.
 1.134.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.134.2.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.137.2.1 19-Jun-2006  chap Sync with head.
 1.138.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.140.126.1 29-May-2016  skrll Sync with HEAD
 1.140.118.1 07-Jun-2018  martin Fix fallout from ticket #1500: COMPAT_SVR4* has been disabled, do not
disable it here again.
 1.140.108.1 07-Jun-2018  martin Fix fallout from ticket #1500: COMPAT_SVR4* has been disabled, do not
disable it here again.
 1.140.106.1 03-Dec-2017  jdolecek update from HEAD
 1.140.102.1 07-Jun-2018  martin Fix fallout from ticket #1500: COMPAT_SVR4* has been disabled, do not
disable it here again.
 1.141.18.1 10-Jun-2019  christos Sync with HEAD
 1.141.16.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.2 13-Mar-2010  mrg convert sparc64 to MULTIPROCESSOR kernel by default, and introduce
s/MP/UP/ kernels were otherwise in place.

in my testing on a U60, i couldn't really notice any different in
speed, but we need testing on a U1/U5/U10 systems to be sure that
GENERIC.UP isn't necessary.

for sparc64, this is some what required as USIIIi systems have the
memory controller on the CPU, and unless the CPU is spunup, a UP
kernel will not function on these systems. (we obviously need to
join the NUMA-for-netbsd camp now, too! :-)


this should enable the installer to function on all systems that we
support, but also give the option for people to install GENERIC.UP
on their single-cpu systems if they choose.


XXX: i haven't actually tested sysinst with this, but i have built
both sparc and sparc64 release iso's successfully with this change
(sans having to comment out kern_ctf.c.)
 1.1 29-Jun-2008  nakayama branches: 1.1.2; 1.1.4; 1.1.8; 1.1.16; 1.1.20; 1.1.24;
Add 32-bit kernel configuration with SMP support.
 1.1.24.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.20.3 11-Aug-2010  yamt sync with head.
 1.1.20.2 04-May-2009  yamt sync with head.
 1.1.20.1 29-Jun-2008  yamt file GENERIC32.MP was added on branch yamt-nfs-mp on 2009-05-04 08:11:57 +0000
 1.1.16.1 24-Oct-2010  jym Sync with HEAD
 1.1.8.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.8.1 29-Jun-2008  wrstuden file GENERIC32.MP was added on branch wrstuden-revivesa on 2008-09-18 04:33:34 +0000
 1.1.4.2 03-Jul-2008  simonb Sync with head.
 1.1.4.1 29-Jun-2008  simonb file GENERIC32.MP was added on branch simonb-wapbl on 2008-07-03 18:37:55 +0000
 1.1.2.2 29-Jun-2008  mjf Sync with HEAD.
 1.1.2.1 29-Jun-2008  mjf file GENERIC32.MP was added on branch mjf-devfs2 on 2008-06-29 09:33:00 +0000
 1.2 25-May-2016  nakayama tabify, fix indent and remove trailing whitespace.
 1.1 13-Mar-2010  mrg branches: 1.1.4; 1.1.6; 1.1.24; 1.1.42;
convert sparc64 to MULTIPROCESSOR kernel by default, and introduce
s/MP/UP/ kernels were otherwise in place.

in my testing on a U60, i couldn't really notice any different in
speed, but we need testing on a U1/U5/U10 systems to be sure that
GENERIC.UP isn't necessary.

for sparc64, this is some what required as USIIIi systems have the
memory controller on the CPU, and unless the CPU is spunup, a UP
kernel will not function on these systems. (we obviously need to
join the NUMA-for-netbsd camp now, too! :-)


this should enable the installer to function on all systems that we
support, but also give the option for people to install GENERIC.UP
on their single-cpu systems if they choose.


XXX: i haven't actually tested sysinst with this, but i have built
both sparc and sparc64 release iso's successfully with this change
(sans having to comment out kern_ctf.c.)
 1.1.42.1 29-May-2016  skrll Sync with HEAD
 1.1.24.1 03-Dec-2017  jdolecek update from HEAD
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 13-Mar-2010  yamt file GENERIC32.UP was added on branch yamt-nfs-mp on 2010-08-11 22:52:46 +0000
 1.1.4.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.4.1 13-Mar-2010  uebayasi file GENERIC32.UP was added on branch uebayasi-xip on 2010-04-30 14:39:50 +0000
 1.14 07-Jul-2000  eeh Rename GENERIC to GENERIC32 and GENERIC64 to GENERIC to allow snapshots to
build properly.
 1.13 15-Apr-2000  mrg branches: 1.13.4;
- auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.12 13-Apr-2000  mrg - do the "options<space><tab>" thing everywhere.
- disable COMPAT_AOUT.
- enable hme at sbus/pci
- enable bpp at sbus
- clean up esp attachments
- enable all xxphy's
- sync GENERIC & GENERIC64.
 1.11 05-Apr-2000  mrg enable auxio at ebus.
 1.10 05-Apr-2000  mrg add "hme at pci" support. also, add "nsphy at mii" and other mii stuff
 1.9 15-Nov-1999  fvdl Add commented out option SOFTDEP to all GENERIC kernels.
 1.8 12-Sep-1999  chs branches: 1.8.2; 1.8.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.7 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.6 18-Jul-1999  eeh Switch to NetBSD/sparc ELF for 32-bit userland.
 1.5 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.4 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.3 27-Mar-1999  eeh branches: 1.3.2; 1.3.4;
We don't have a default binary format: EXEC_AOUT is used for NetBSD/sparc pre 1.4,
EXEC_ELF64 is used for NetBSD/sparc64, and EXEC_ELF32 is used for NetBSD/sparc_elf.

We really need a way to turn these on and off depending on whether we're building
a 32-bit or 64-bit kernel...
 1.2 26-Mar-1999  eeh COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.1 23-Jan-1999  eeh Need a config file for a 64-bit generic kernel
 1.3.4.2 02-Aug-1999  thorpej Update from trunk.
 1.3.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.1 05-Jul-2000  he Apply patch (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.8.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.13.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.34 23-Jul-2025  christos bump for clang/llvm
 1.33 17-Jan-2025  martin PR 59001: bump ramdisk images size slightly for clang builds
 1.32 09-Jan-2025  martin Fine tune memory disk size and fix comments
 1.31 09-Jan-2025  martin Bump ramdisk size to deal with bigger image for new pppd
 1.30 25-May-2016  nakayama branches: 1.30.54;
tabify, fix indent and remove trailing whitespace.
 1.29 15-Dec-2013  christos branches: 1.29.6;
Add -Wno-uninitialized with -Os so that we don't get spurious gcc warnings.
 1.28 10-Jul-2011  mrg branches: 1.28.2; 1.28.12; 1.28.16;
sparc64 with GCC 4.5 has about a 2% code bloat, unfortunately.

bump the instfs size to 9MB.
 1.27 22-May-2010  tsutsui GENERIC32 -> GENERIC in comment.
 1.26 12-Mar-2010  martin branches: 1.26.2;
Provide full terminfo.db on install media
 1.25 06-Feb-2009  jym branches: 1.25.4;
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.24 02-Oct-2006  chs branches: 1.24.56; 1.24.64;
remove MALLOC_NOINLINE, it doesn't do anything anymore.
 1.23 29-Sep-2006  martin Sysinst now properly ignores eon0 interfaces - so there is no need to
avoid ISO networking and EON in this kernel anymore.
 1.22 27-Aug-2006  sekiya branches: 1.22.2; 1.22.4;
Zap reference to XNS.
 1.21 18-Aug-2006  martin Remove ISO and NS networking - the eon0 device is pretty confusing
in sysinst. XXX - we actually should remove it from GENERIC too.
 1.20 30-Jun-2006  tsutsui branches: 1.20.2;
Make GENERIC config really generic and change GENERIC32 config for 32 bit
compat kernel to include the GENERIC and use "no" keywords of config(1).
Also merge std.sparc64-64 into std.sparc64 and prepare std.sparc64-32
which uses "no" keywords for 32 bit kernels. OK'ed by mrg.
 1.19 07-Dec-2005  tsutsui branches: 1.19.4; 1.19.8; 1.19.16;
Remove obsolete options VNODE_OP_NOINLINE.
 1.18 19-Sep-2003  martin branches: 1.18.16;
Use -Os (now that it works) for install media.
 1.17 10-Sep-2003  martin Remove rnd here and add a prominent note at the top of the file -
this config includes GENERIC32, only additional stuff goes in here.
 1.16 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.15 20-Jun-2003  nakayama branches: 1.15.2;
s/options\t/options \t/
 1.14 12-Feb-2003  martin Remove DEBUG and -g.
Output with DEBUG enabled is anoying these days and we don't want to
scare away users of the INSTALL kernel.
 1.13 19-Sep-2002  grant remove USERCONF, as it is already in GENERIC32.
 1.12 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.11 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.10 12-Apr-2002  gmcgarry branches: 1.10.2;
Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.9 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.8 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.7 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.6 21-Jan-2002  mrg - reduce INSTALL size by 2.5MB.
 1.5 20-Jan-2002  mrg convert sparc64 to use `makefs' rather than vnd/newfs/mount. this severely
cleans up a lot of the processing here.


XXX: note that the sparc64 "INSTALL" kernel's file system has a copy of
GENERIC in /netbsd. fix this shortly.
 1.4 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.3 24-Oct-2001  thorpej branches: 1.3.2;
Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.2 18-Aug-2001  eeh branches: 1.2.4;
Make the kernel a tad bigger.
 1.1 21-Jun-2001  eeh branches: 1.1.2;
Add an install kernel w/room for a miniroot.
 1.1.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.1.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.2.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.3.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.3.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.2.1 24-Oct-2001  nathanw file INSTALL was added on branch nathanw_sa on 2002-01-08 00:27:57 +0000
 1.10.2.1 17-Jul-2002  gehenna catch up with -current.
 1.15.2.4 11-Dec-2005  christos 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.18.16.2 30-Dec-2006  yamt sync with head.
 1.18.16.1 21-Jun-2006  yamt sync with head.
 1.19.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.19.8.2 03-Sep-2006  yamt sync with head.
 1.19.8.1 11-Aug-2006  yamt sync with head
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.20.2.1 21-Aug-2006  tron Pull up following revision(s) (requested by martin in ticket #36):
sys/arch/sparc64/conf/INSTALL: revision 1.21
Remove ISO and NS networking - the eon0 device is pretty confusing
in sysinst. XXX - we actually should remove it from GENERIC too.
 1.22.4.1 22-Oct-2006  yamt sync with head
 1.22.2.1 18-Nov-2006  ad Sync with head.
 1.24.64.1 03-Mar-2009  skrll Sync with HEAD.
 1.24.56.2 11-Aug-2010  yamt sync with head.
 1.24.56.1 04-May-2009  yamt sync with head.
 1.25.4.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.25.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.2.1 30-May-2010  rmind sync with head
 1.28.16.1 18-May-2014  rmind sync with head
 1.28.12.2 03-Dec-2017  jdolecek update from HEAD
 1.28.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 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.29.6.1 29-May-2016  skrll Sync with HEAD
 1.30.54.1 02-Aug-2025  perseant Sync with HEAD
 1.8 25-Mar-2020  jdolecek remove 'file-system SMBFS' and 'pseudo-device nsmb' from all kernel configs
to prepare for their eventual removal
 1.7 29-Jul-2017  maxv branches: 1.7.4;
Remove TCP_COMPAT_42 from the config files. Pass 2.
 1.6 25-May-2016  nakayama tabify, fix indent and remove trailing whitespace.
 1.5 12-Mar-2013  christos branches: 1.5.14;
is defined now in GENERIC
 1.4 12-Mar-2013  christos turn on MODULAR by default
 1.3 05-Jan-2011  martin branches: 1.3.6; 1.3.10; 1.3.20;
Duh, actually make it modular
 1.2 05-Jan-2011  martin Untill modules are first class citizens, we need to run MODULAR kernels
insecure.
 1.1 05-Jan-2011  jnemeth Sample MODULAR kernel configuration.

approved by: martin@
 1.3.20.2 03-Dec-2017  jdolecek update from HEAD
 1.3.20.1 23-Jun-2013  tls resync from head
 1.3.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.3.6.2 05-Mar-2011  rmind sync with head
 1.3.6.1 05-Jan-2011  rmind file MODULAR was added on branch rmind-uvmplock on 2011-03-05 20:52:05 +0000
 1.5.14.2 28-Aug-2017  skrll Sync with HEAD
 1.5.14.1 29-May-2016  skrll Sync with HEAD
 1.7.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.85 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.84 10-Dec-2017  christos branches: 1.84.2; 1.84.4;
- Allow multiple .BEGIN targets
- Make their protection consistent
 1.83 04-Dec-2017  martin We use .BEGIN for our own cleanup and won't ever need DTS support - so
avoid inclusion of dts.mk by defining _SKIP_DTS
 1.82 19-Mar-2016  martin Default kernel builds to USE_SSP=yes.
 1.81 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.80 31-Aug-2015  martin Revert previous, not needed after sys/conf/Makefile.kern.inc rev. 1.215.
 1.79 30-Aug-2015  martin We preprocess .s files, so add ${INCLUDES} to AFLAGS
 1.78 24-Aug-2015  uebayasi Define ${LINKSCRIPT} in one place.
 1.77 18-Aug-2015  uebayasi Adjust paths to ${KERNLDSCRIPT} files so that dependency is resolved.
 1.76 18-Aug-2015  uebayasi Use ${KERNLDSCRIPT} instead of ${KERN_LDSCRIPT}. The former is added
to ${SYSTEM_DEP} if defined.
 1.75 15-Nov-2014  uebayasi branches: 1.75.2;
Use LINKSCRIPT.
 1.74 21-Feb-2014  joerg Use code model small for LLVM, it should be equivalent to GCC's medlow.
 1.73 19-Mar-2013  christos branches: 1.73.6;
Need assym.h for libkern
 1.72 10-Mar-2013  christos Explicitly set KERN_AS (this could be done in /usr/src/sys/conf/Makefile.*)
so that modules work, on config files that did not set it explicitly. All
the files now use the standard logic, except the ones that set KERN_AS=obj
and Makefile.usermode which sets KERN_AS=library.
 1.71 03-Mar-2012  nakayama branches: 1.71.2;
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.70 17-Jan-2011  joerg branches: 1.70.6; 1.70.10; 1.70.12;
Move SPARC and SPARC64 to modern CPP. Update UPDATING note for this and
Alpha.
 1.69 23-May-2010  martin branches: 1.69.2;
Split copy related functions out of locore.s into copy.S, move functions
only needed on multiprocessors into mp_subr.S.
 1.68 11-Dec-2008  alc branches: 1.68.4; 1.68.6;
Clean-up makefile stub used to include in the build the binary HAL object
 1.67 30-Aug-2008  martin branches: 1.67.2; 1.67.4; 1.67.8; 1.67.10;
We are not creating a.out NMAGIC files, and handling the required alignement
of sections explicitly in the ldscript, so do not pass -n to ld.
This fixes the strange combined text/data sections seen with certain
(smaller) kernels as explained on tech-toolchain.
Found by Nick Hudson, ok: matthew green.
 1.66 18-Feb-2008  joerg branches: 1.66.6; 1.66.10; 1.66.12; 1.66.16;
Add assym.h dependencies.
 1.65 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.64 17-Oct-2007  garbled branches: 1.64.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.63 04-Jun-2007  chs branches: 1.63.10;
instead of specifying the start of the data section in the makefile,
just round it up to the next 4MB boundary in the ldscript.
this prevents parts of the kernel-image range from being left unmapped.
fixes PR 36388.
 1.62 04-Apr-2006  gdamore branches: 1.62.12; 1.62.18; 1.62.20; 1.62.26; 1.62.28;
Convert existing ath users to new Makefile, except for amd64, which needs
the rules due to needing to conditionally postprocess the HAL object file.

Macppc needs a a non-ELF HAL (EABI) object, so take care of that by default
in the atheros include file.
 1.61 02-Apr-2006  gdamore Reorganize ath layout as requested by sam@ and suggested by dyoung@ in
http://mail-index.netbsd.org/tech-net/2006/03/15/0000.html.

The new layout almost precisely matches FreeBSD, and should make
future imports much easier.

At the same time, import the current 0.9.16.16 HAL from FreeBSD. According
to sam@, this is the proper version we should be using.
 1.60 08-Mar-2006  dyoung branches: 1.60.2;
config(8) creates opt_ah.h, no need to do so here.
 1.59 03-Mar-2006  he branches: 1.59.2; 1.59.4;
Before symlinking opt_ah.h, make sure the target doesn't already exist.
This fixes a build problem with UPDATE set.
 1.58 02-Mar-2006  martin Add glue to make ath* usable on sparc64.
 1.57 11-Dec-2005  christos branches: 1.57.4; 1.57.6;
merge ktrace-lwp.
 1.56 31-May-2005  christos branches: 1.56.2;
s/GENASSYM/GENASSYM_CONF/ so we can use "GENASSYM" as the program name.
 1.55 04-Jun-2004  thorpej Add the %MAKEOPTIONSAPPEND token at the end of the file, after the
common Makefile.kern.inc has been included.
 1.54 22-Mar-2004  martin branches: 1.54.4;
Realy disable optimization for 32bit kernels when compiling uvm_bio.c.
 1.53 21-Mar-2004  martin Disable optimization when compiling uvm_bio.c with a 32 bit compiler.
 1.52 09-Nov-2003  martin Fix a comment (there is no bzero/bcopy any more)
 1.51 27-Oct-2003  christos fix make -jn by adding explicit dependency of in_cksum.o to assym.h
 1.50 19-Sep-2003  martin Remove workarounds for bugs in the old compiler.
 1.49 26-Nov-2002  thorpej branches: 1.49.6;
The traditional C preprocessor is fixed in GCC 3.3 now, so no need
to skip -traditional-cpp for HAVE_GCC3.
 1.48 06-Sep-2002  jdolecek put an explicit .MAIN target before the .if make() condition; apparently
.MAIN must be defined for the implicit target rule to kick in
this fixes compilation with call like 'make', i.e. without specified target

another option would be to move the .if make() condition after config(8)
generated goo, since config(8) implicitly generates a .MAIN: directive too,
but the MD .if make() really belongs into (7) misc settings section IMHO
 1.47 20-Jul-2002  mrg create a "sparc" symlink as well. sync kernels.
 1.46 04-Jun-2002  thorpej Don't use -traditional-cpp if HAVE_GCC3.
 1.45 19-Mar-2002  eeh branches: 1.45.4;
Fix up compiler options:

1) Get things right for 32-bit kernels

2) Always use medium any memory model for 64-bit kernels for the moment.
 1.44 09-Dec-2001  atatat Roll the rest of the ports over to the new MI kernel build machinery.
Any problems reported by testers have been fixed, and massive
cross-compiling of kernels has shown that any problems that remain
with actually building kernels are not related to this.
 1.43 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.42 26-Oct-2001  jmc branches: 1.42.2;
Change defaults for kernel compiles. Default all to USETOOLS?=no and have
the etc Makefile override that by putting USETOOLS into $.MAKEOVERRIDES
This way the default for kernel compiles is still to use the installed
toolchain instead of depending on $TOOLDIR. $TOOLDIR can be used by
simply adding USETOOLS=yes to the command line as usual.

Adjust each ports template to set the default no setting and also pull in
bsd.own.mk if they weren't already to ensure they'll build correctly
with the new toolchain setup.
 1.41 24-Oct-2001  thorpej Per request of mrg@netbsd.org, use MACHINE_ARCH of "sparc" for 32-bit
sparc64 kernels, thus defaulting to using the 32-bit "sparc" target
toolchain.
 1.40 24-Oct-2001  thorpej Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.39 21-Oct-2001  thorpej branches: 1.39.2;
Normalize the sparc64 kernel Makefile.
 1.38 19-Jul-2001  eeh Make a bigger hole between kernel text and data.
 1.37 29-May-2001  mrg branches: 1.37.2;
define _KERNEL_OPT as well as _KERNEL. we will use this in the future to
get kernel "opt_foo.h" headers, rather than _KERNEL && !_LKM.
 1.36 19-Apr-2001  mrg -Dsparc64
 1.35 04-Mar-2001  mrg branches: 1.35.2;
deal with 32 bit kernels.
 1.34 28-Feb-2001  mrg add and user a linker script.
 1.33 17-Dec-2000  jdolecek delete obsolete comment
 1.32 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.31 28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.30 02-Aug-2000  eeh Get kernel profiling to work. Now if only gprof worked....
 1.29 24-Jul-2000  mycroft Er, eliminate the -p link option as well, which just outputs huge amounts
of spooge.
 1.28 24-Jul-2000  mycroft Nuke lderr.
 1.27 24-Jul-2000  mycroft Slight rearrangement.
 1.26 19-Jun-2000  eeh branches: 1.26.2;
Have separate data and text segments, make text read-only.
 1.25 09-Jun-2000  eeh Separate COPTS from CFLAGS to fix problems w/unoptimized files, and add
lfs_loop.c to the list that breaks optimization.
 1.24 08-Jun-2000  eeh Override optimization for files that break gcc.
 1.23 09-May-2000  hubertf branches: 1.23.2;
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.22 13-Apr-2000  eeh Make /etc/mk.conf optional for kernel builds.
 1.21 13-Apr-2000  mrg copy the "sparc" clean/cleandir target code, so that "cleandir" actually does a "clean"
 1.20 08-Apr-2000  mrg don't use -Wuninitialized
 1.19 31-Jan-2000  eeh Fix a couple more references to STRIPPROG.
 1.18 26-Jan-2000  eeh Use STRIP instead of STRIPPROG since install uses STRIP and I don't want to
define two different variables.
 1.17 24-Jan-2000  tron Add "dependall" target for comfort.
 1.16 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.15 19-Jan-2000  tsutsui Change STRIPFLAGS=-g for cross-toolchains.
 1.14 30-Dec-1999  eeh Switch libkern back to a library 'cause bzero's back in locore.s.
 1.13 21-Nov-1999  eeh Move KERNBASE down from 0xf8000000 to 0xf1000000, just beyond the PROM.
 1.12 26-Jul-1999  cgd branches: 1.12.2; 1.12.8;
be more efficient when doing the SYSTEM_LD_TAIL for -g kernels: don't
copy them just to strip them, use strip -o.
 1.11 18-Jul-1999  eeh Switch over to NetBSD/sparc ELF for 32-bit userland.
 1.10 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.9 05-Jun-1999  mrg only set LD to /usr/ccs/bin/ld if it exists. avoid empty SFILES.
 1.8 15-Mar-1999  mrg branches: 1.8.4;
remove lderr in "make clean"
 1.7 08-Jan-1999  augustss Add -Wpointer-arith warning since `void *' arithmetic is not ANSI C.
 1.6 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.5 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.4 26-Aug-1998  mrg - use UVM by default.
- clean up the Makefile a bit to be less solaris-centric :)
- add support for compat_sparc32 (32bit compat module for NetBSD/sparc). this
isn't yet fully tested but it mostly written and compiles if not totally
links yet.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 30-Jul-1998  mrg allow ${SIZE} to be set from the environment, also allow using genassym.sh (both for cross compiling).
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.1.1.1.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.8.4.2 02-Aug-1999  thorpej Update from trunk.
 1.8.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.12.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.23.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.26.2.3 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.26.2.2 07-Aug-2000  mrg pull up 1.30 (approved by thorpej):
>Get kernel profiling to work. Now if only gprof worked....
 1.26.2.1 27-Jul-2000  mycroft Approved by thorpej:
A bit of cleanup.

syssrc/sys/arch/sparc64/conf/Makefile.sparc64 1.26 -> 1.29
 1.35.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.37.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.37.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.37.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.37.2.1 03-Aug-2001  lukem update to -current
 1.39.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.42.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.42.2.6 17-Sep-2002  nathanw Catch up to -current.
 1.42.2.5 01-Aug-2002  nathanw Catch up to -current.
 1.42.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.42.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.42.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.42.2.1 26-Oct-2001  nathanw file Makefile.sparc64 was added on branch nathanw_sa on 2002-01-08 00:27:57 +0000
 1.45.4.2 31-Aug-2002  gehenna catch up with -current.
 1.45.4.1 15-Jul-2002  gehenna catch up with -current.
 1.49.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.49.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.49.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.49.6.1 03-Aug-2004  skrll Sync with HEAD
 1.54.4.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.56.2.4 27-Feb-2008  yamt sync with head.
 1.56.2.3 04-Feb-2008  yamt sync with head.
 1.56.2.2 03-Sep-2007  yamt sync with head.
 1.56.2.1 21-Jun-2006  yamt sync with head.
 1.57.6.1 22-Apr-2006  simonb Sync with head.
 1.57.4.1 09-Sep-2006  rpaulo sync with head
 1.59.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.59.2.2 11-Apr-2006  yamt sync with head
 1.59.2.1 13-Mar-2006  yamt sync with head.
 1.60.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.62.28.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.62.26.1 26-Jun-2007  garbled Sync with HEAD.
 1.62.20.1 11-Jul-2007  mjf Sync with head.
 1.62.18.1 09-Jun-2007  ad Sync with head.
 1.62.12.2 17-Mar-2012  bouyer Pull up following revision(s) via patch (requested by nakayama in ticket #1443):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.62.12.1 05-Jun-2007  bouyer branches: 1.62.12.1.4;
Pull up following revision(s) (requested by martin in ticket #700):
sys/arch/sparc64/conf/kern32.ldscript: revision 1.8
sys/arch/sparc64/conf/kern.ldscript: revision 1.9
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.63
instead of specifying the start of the data section in the makefile,
just round it up to the next 4MB boundary in the ldscript.
this prevents parts of the kernel-image range from being left unmapped.
fixes PR 36388.
 1.62.12.1.4.1 17-Mar-2012  bouyer Pull up following revision(s) via patch (requested by nakayama in ticket #1443):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.63.10.2 23-Mar-2008  matt sync with HEAD
 1.63.10.1 06-Nov-2007  matt sync with HEAD
 1.64.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.66.16.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.66.16.1 19-Oct-2008  haad Sync with HEAD.
 1.66.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.66.10.2 11-Aug-2010  yamt sync with head.
 1.66.10.1 04-May-2009  yamt sync with head.
 1.66.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.66.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.67.10.1 21-Apr-2010  matt sync to netbsd-5
 1.67.8.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by nakayama in ticket #1736):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.67.4.2 17-Mar-2012  bouyer Pull up following revision(s) (requested by nakayama in ticket #1736):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.67.4.1 07-Aug-2009  snj branches: 1.67.4.1.2;
Pull up following revision(s) (requested by sborrill in ticket #905):
sys/arch/alpha/conf/Makefile.alpha: revision 1.81
sys/arch/amd64/conf/Makefile.amd64: revision 1.26
sys/arch/i386/conf/Makefile.i386: revision 1.162
sys/arch/macppc/conf/Makefile.macppc: revision 1.31
sys/arch/mips/conf/Makefile.mips: revision 1.52
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.68
sys/arch/xen/conf/Makefile.xen: revision 1.28
Clean-up makefile stub used to include in the build the binary HAL object
 1.67.4.1.2.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by nakayama in ticket #1736):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.67.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.68.6.2 05-Mar-2011  rmind sync with head
 1.68.6.1 30-May-2010  rmind sync with head
 1.68.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.69.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.70.12.1 05-Mar-2012  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #85):
sys/arch/sparc64/sparc64/locore.s: revision 1.340
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
sys/arch/sparc64/conf/files.sparc64: revision 1.138

Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
 1.70.10.3 06-Mar-2012  mrg sync to -current
 1.70.10.2 06-Mar-2012  mrg sync to -current
 1.70.10.1 04-Mar-2012  mrg sync to latest -current.
 1.70.6.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.70.6.1 17-Apr-2012  yamt sync with head
 1.71.2.3 03-Dec-2017  jdolecek update from HEAD
 1.71.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.71.2.1 23-Jun-2013  tls resync from head
 1.73.6.1 18-May-2014  rmind sync with head
 1.75.2.3 22-Apr-2016  skrll Sync with HEAD
 1.75.2.2 19-Mar-2016  skrll Sync with HEAD
 1.75.2.1 22-Sep-2015  skrll Sync with HEAD
 1.84.4.1 10-Jun-2019  christos Sync with HEAD
 1.84.2.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.61 20-Dec-2023  andvar Remove NONPLUS(64) kernel configs, which are not part of autobuild configs,
unmaintained and fail to build.

Approved by eeh (who committed them originally) by email and martin.
 1.60 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.59 25-May-2016  nakayama branches: 1.59.16; 1.59.18;
tabify, fix indent and remove trailing whitespace.
 1.58 30-Jun-2006  tsutsui branches: 1.58.102; 1.58.106; 1.58.108; 1.58.118; 1.58.126;
Make GENERIC config really generic and change GENERIC32 config for 32 bit
compat kernel to include the GENERIC and use "no" keywords of config(1).
Also merge std.sparc64-64 into std.sparc64 and prepare std.sparc64-32
which uses "no" keywords for 32 bit kernels. OK'ed by mrg.
 1.57 05-Feb-2006  cube branches: 1.57.2; 1.57.10;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.56 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.55 07-Dec-2005  tsutsui branches: 1.55.2; 1.55.4; 1.55.6;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.54 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.53 19-Aug-2005  christos 64 bit inode changes.
 1.52 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.51 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.50 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.49 15-Jun-2005  tron branches: 1.49.2;
Remove commented out "upa" attachments because NetBSD doesn't have a
driver for that anyway. Approved by Martin Husemann.
 1.48 25-Feb-2005  martin branches: 1.48.2;
Nuke options RASTERCONSOLE for sparc64
 1.47 25-Feb-2005  simonb 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.46 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.45 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.44 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.43 10-Nov-2004  christos branches: 1.43.4; 1.43.6;
Add COMPAT_BSDPTY to the rest of the config files.
 1.42 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.41 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.40 20-Jun-2003  nakayama branches: 1.40.2; 1.40.4;
s/options\t/options \t/
 1.39 26-May-2003  martin Remove commented out and nowadays incorrect KGDB declarations.
 1.38 10-Apr-2003  christos Bye Bye UCONSOLE
 1.37 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.36 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.35 25-Apr-2002  atatat branches: 1.35.2; 1.35.4;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.34 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.33 20-Mar-2002  eeh DDB_ONPANIC now needs a number.
 1.32 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.31 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.30 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.29 24-Oct-2001  thorpej branches: 1.29.2;
Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.28 23-Jul-2001  eeh branches: 1.28.4;
Update this.
 1.27 08-Jul-2001  abs branches: 1.27.2;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.26 02-Mar-2001  mrg sync with GENERIC32.
 1.25 11-Feb-2001  eeh Add COMPAT_SVR4_32.
 1.24 09-Nov-2000  eeh Enable clean up keyboard attach and make formatting prettier.
 1.23 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.22 27-Jul-2000  mrg remove COMPAT_AOUT option.
 1.21 18-Jul-2000  mrg s/auxreg/auxio/
 1.20 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.19 20-Nov-1999  eeh branches: 1.19.4;
Add softdep option.
 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 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.16 18-Jul-1999  eeh Switch over to NetBSD/sparc ELF for 32-bit userland.
 1.15 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.14 05-Jun-1999  eeh Fix things up so they compile again.
 1.13 23-May-1999  eeh Start putting in hooks for non-zs console devices.
 1.12 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.11 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.10 27-Mar-1999  eeh branches: 1.10.2; 1.10.4;
We don't have a default binary format: EXEC_AOUT is used for NetBSD/sparc pre 1.4,
EXEC_ELF64 is used for NetBSD/sparc64, and EXEC_ELF32 is used for NetBSD/sparc_elf.

We really need a way to turn these on and off depending on whether we're building
a 32-bit or 64-bit kernel...
 1.9 23-Jan-1999  eeh Synchronize config files.
 1.8 06-Sep-1998  eeh 32-bit fixup.
 1.7 27-Aug-1998  mrg remove sparc64 "options BUS_DMA" -- it is now standard
 1.6 26-Aug-1998  mrg - use UVM by default.
- clean up the Makefile a bit to be less solaris-centric :)
- add support for compat_sparc32 (32bit compat module for NetBSD/sparc). this
isn't yet fully tested but it mostly written and compiles if not totally
links yet.
 1.5 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.4 28-Jul-1998  eeh branches: 1.4.2;
Apparently we need to specify both slot and offset for all SBUS devices.
This is really annoying....
 1.3 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.2 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.2.2 09-Aug-1998  eeh General pmap and debug cleanup. Added PMAP_NEW support, but it doesn't work too well yet.
 1.4.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.10.4.2 02-Aug-1999  thorpej Update from trunk.
 1.10.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.1 05-Jul-2000  he Pull up revision 1.20 (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.18.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.18.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.18.2.2 22-Nov-2000  bouyer Sync with HEAD.
 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.2 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.19.4.1 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.27.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.27.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.27.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.27.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.27.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.1 03-Aug-2001  lukem update to -current
 1.28.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.29.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.29.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.29.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.29.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.29.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.29.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.29.2.1 24-Oct-2001  nathanw file NONPLUS was added on branch nathanw_sa on 2002-01-08 00:27:57 +0000
 1.35.4.1 01-Aug-2002  lukem Pull up revision 1.36 (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.35.2.1 15-Jul-2002  gehenna catch up with -current.
 1.40.4.1 15-Jul-2004  he Pull up revision 1.41 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.40.2.9 11-Dec-2005  christos Sync with head.
 1.40.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.40.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.40.2.6 15-Feb-2005  skrll Sync with HEAD.
 1.40.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.40.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.40.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.40.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.40.2.1 03-Aug-2004  skrll Sync with HEAD
 1.43.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.43.6.1 12-Feb-2005  yamt sync with head.
 1.43.4.1 29-Apr-2005  kent sync with -current
 1.48.2.2 18-Jul-2005  riz Pull up revision 1.50 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.48.2.1 18-Jun-2005  riz Pull up revision 1.49 (requested by tron in ticket #457):
Remove commented out "upa" attachments because NetBSD doesn't have a
driver for that anyway. Approved by Martin Husemann.
 1.49.2.2 30-Dec-2006  yamt sync with head.
 1.49.2.1 21-Jun-2006  yamt sync with head.
 1.55.6.1 22-Apr-2006  simonb Sync with head.
 1.55.4.1 09-Sep-2006  rpaulo sync with head
 1.55.2.1 18-Feb-2006  yamt sync with head.
 1.57.10.1 13-Jul-2006  gdamore Merge from HEAD.
 1.57.2.1 11-Aug-2006  yamt sync with head
 1.58.126.1 29-May-2016  skrll Sync with HEAD
 1.58.118.1 07-Jun-2018  martin Fix fallout from ticket #1500: COMPAT_SVR4* has been disabled, do not
disable it here again.
 1.58.108.1 07-Jun-2018  martin Fix fallout from ticket #1500: COMPAT_SVR4* has been disabled, do not
disable it here again.
 1.58.106.1 03-Dec-2017  jdolecek update from HEAD
 1.58.102.1 07-Jun-2018  martin Fix fallout from ticket #1500: COMPAT_SVR4* has been disabled, do not
disable it here again.
 1.59.18.1 10-Jun-2019  christos Sync with HEAD
 1.59.16.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.60 20-Dec-2023  andvar Remove NONPLUS(64) kernel configs, which are not part of autobuild configs,
unmaintained and fail to build.

Approved by eeh (who committed them originally) by email and martin.
 1.59 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.58 19-Jan-2020  thorpej Remove the strip(4) - Starmode Radio IP - pseudo-device driver. It is
long since obsolete.
 1.57 13-Apr-2019  isaki branches: 1.57.6;
Add drvctl to kernel which has audio device.
audiocfg(1) requires drvctl(4).
 1.56 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.55 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.54 05-Feb-2018  maxv branches: 1.54.2; 1.54.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.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 29-Jul-2017  maxv Remove TCP_COMPAT_42 from the config files. Pass 3.
 1.50 13-Dec-2016  christos branches: 1.50.8;
wildcard speaker attachments, now that we can handle many of them.
 1.49 10-Dec-2016  christos remove VAUDIOSPEAKER for now, will be done differently.
 1.48 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.47 25-May-2016  nakayama branches: 1.47.2;
tabify, fix indent and remove trailing whitespace.
 1.46 26-Sep-2015  maxv Remove KMEMSTATS. Normally it's ok now.
 1.45 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.44 16-Nov-2014  manu branches: 1.44.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.43 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.42 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.41 24-Mar-2014  szptvlfn branches: 1.41.4;
fix manual section numbering of sysctl.
thanks wiz@
 1.40 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.39 05-Jun-2013  christos branches: 1.39.2;
remove obsolete networking options
 1.38 27-Apr-2013  christos remove confusing numeric locators where they are unused.
 1.37 02-Mar-2013  christos Under FAST_IPSEC, IPSEC_ESP is mandatory; GC it.
 1.36 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.35 11-Mar-2012  nakayama branches: 1.35.2;
Remove stray comments for LKM.
 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 23-Nov-2010  hannken branches: 1.32.2; 1.32.4;
Remove unused count from pseudo-device md.
 1.31 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.30 05-Dec-2009  pooka branches: 1.30.2; 1.30.4;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.29 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.28 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.27 24-Nov-2008  ad branches: 1.27.4;
Remove softdep, pass 1. We are focused on improving journalling.

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

Proposed on tech-kern@.
 1.25 30-May-2008  tsutsui branches: 1.25.4; 1.25.6;
Add options COMPAT_40 to files which have options COMPAT_30.
 1.24 27-Sep-2006  manu branches: 1.24.52; 1.24.54; 1.24.56; 1.24.58;
- 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.23 26-Aug-2006  christos branches: 1.23.2; 1.23.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.22 30-Jun-2006  tsutsui Make GENERIC config really generic and change GENERIC32 config for 32 bit
compat kernel to include the GENERIC and use "no" keywords of config(1).
Also merge std.sparc64-64 into std.sparc64 and prepare std.sparc64-32
which uses "no" keywords for 32 bit kernels. OK'ed by mrg.
 1.21 20-Nov-2001  lukem branches: 1.21.32; 1.21.46; 1.21.50; 1.21.58;
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.20 25-Oct-2001  mrg branches: 1.20.2;
lets play catch up with thorpej.rototiller
 1.19 24-Oct-2001  thorpej Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.18 11-Feb-2001  eeh branches: 1.18.4; 1.18.6;
Add COMPAT_SVR4_32.
 1.17 02-Aug-2000  eeh Include NONPLUS and just set the extras we need for 64-bit kernels.
 1.16 27-Jul-2000  mrg remove COMPAT_AOUT option.
 1.15 18-Jul-2000  mrg s/auxreg/auxio/
 1.14 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.13 19-Jun-2000  eeh branches: 1.13.2;
Have separate data and text segments, make text read-only.
 1.12 20-Nov-1999  eeh branches: 1.12.2;
Add softdep option.
 1.11 12-Sep-1999  chs branches: 1.11.2; 1.11.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.10 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.9 18-Jul-1999  eeh Switch to NetBSD/sparc ELF for 32-bit userland.
 1.8 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.7 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.6 27-Mar-1999  eeh branches: 1.6.2; 1.6.4;
We don't have a default binary format: EXEC_AOUT is used for NetBSD/sparc pre 1.4,
EXEC_ELF64 is used for NetBSD/sparc64, and EXEC_ELF32 is used for NetBSD/sparc_elf.

We really need a way to turn these on and off depending on whether we're building
a 32-bit or 64-bit kernel...
 1.5 26-Mar-1999  eeh COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.4 23-Jan-1999  eeh Sync 32-bit and 64-bit kernel config files.
 1.3 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.2 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.1 06-Sep-1998  eeh May as well check in my 64-bit kernel config file for the moment.
 1.6.4.2 02-Aug-1999  thorpej Update from trunk.
 1.6.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.2.1 05-Jul-2000  he Pull up revision 1.14 (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.11.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 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.12.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.2.2 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.13.2.1 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.18.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.18.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.20.2.1 25-Oct-2001  nathanw file NONPLUS64 was added on branch nathanw_sa on 2002-01-08 00:27:58 +0000
 1.21.58.1 13-Jul-2006  gdamore Merge from HEAD.
 1.21.50.2 03-Sep-2006  yamt sync with head.
 1.21.50.1 11-Aug-2006  yamt sync with head
 1.21.46.1 09-Sep-2006  rpaulo sync with head
 1.21.32.1 30-Dec-2006  yamt sync with head.
 1.23.4.1 22-Oct-2006  yamt sync with head
 1.23.2.1 18-Nov-2006  ad Sync with head.
 1.24.58.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.56.3 11-Aug-2010  yamt sync with head.
 1.24.56.2 11-Mar-2010  yamt sync with head
 1.24.56.1 04-May-2009  yamt sync with head.
 1.24.54.1 04-Jun-2008  yamt sync with head
 1.24.52.2 17-Jan-2009  mjf Sync with HEAD.
 1.24.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.25.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.25.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.27.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.30.4.3 21-Apr-2011  rmind sync with head
 1.30.4.2 05-Mar-2011  rmind sync with head
 1.30.4.1 30-May-2010  rmind sync with head
 1.30.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.32.4.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.32.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.33.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.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.1 05-Apr-2012  mrg sync to latest -current.
 1.35.2.3 03-Dec-2017  jdolecek update from HEAD
 1.35.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.2.1 23-Jun-2013  tls resync from head
 1.39.2.2 18-May-2014  rmind sync with head
 1.39.2.1 28-Aug-2013  rmind sync with head
 1.41.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.41.4.2 18-Nov-2014  snj branches: 1.41.4.2.2; 1.41.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.41.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.41.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.41.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.44.2.5 28-Aug-2017  skrll Sync with HEAD
 1.44.2.4 05-Feb-2017  skrll Sync with HEAD
 1.44.2.3 29-May-2016  skrll Sync with HEAD
 1.44.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.44.2.1 22-Sep-2015  skrll Sync with HEAD
 1.47.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.50.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.54.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.54.4.1 10-Jun-2019  christos Sync with HEAD
 1.54.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.54.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.57.6.1 25-Jan-2020  ad Sync with head.
 1.22 05-Feb-2006  mrg these configs have not been used for years. (in reality, the machine
splode is now more like the POWEROFSEVEN config.)
 1.21 25-Oct-2001  mrg branches: 1.21.2; 1.21.34; 1.21.46; 1.21.48; 1.21.50;
lets play catch up with thorpej.rototiller
 1.20 24-Oct-2001  thorpej Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.19 02-Sep-2001  mrg branches: 1.19.4;
place the main chunk of POWEROFSEVEN's config into the .inc file, and have
the 32 and 64 files define MACHINE_ARCH, CC, LD and AS appropriately to build
a 32 or 64 bit kernel, respectively. this allows either to be built on a
system that can generate 32 or 64 bit code.
 1.18 25-Aug-2001  mrg turn off compat & some exec options
 1.17 04-Mar-2001  mrg branches: 1.17.4;
sync with GENERIC; add COMPAT_SVR4_32
 1.16 27-Jul-2000  mrg include the 32-bit kernel, not myself
 1.15 27-Jul-2000  mrg do the 32 bit / 64 bit name swap, as per GENERIC.
 1.14 25-Jul-2000  mrg add disabled LOCKDEBUG; re-enable all the phy drivers
 1.13 18-Jul-2000  mrg s/auxreg/auxio/
 1.12 13-Jul-2000  mrg bump some system values.
 1.11 07-Jul-2000  mrg options BUFCACHE=20, plus a 64 bit config.
 1.10 02-Jul-2000  mrg update to reality:
- TRAPWIN is defined in locore.s
- don't config netbsd_wd0
- enable MSDOSFS and FFS_IE
- enable INET6 & IPSEC*
- enable ipfilter
- comment sbus & zs at sbus
- enable scsi devices seeing we have scsi bus support
- hardwire the onboard hme as 'hme0'
- disable audiocs for now
- disable rnd for now
 1.9 18-Jun-2000  mrg branches: 1.9.2;
update to reality
 1.8 05-Apr-2000  mrg branches: 1.8.2;
enable auxio at ebus.
 1.7 05-Apr-2000  mrg add "hme at pci" support. also, add "nsphy at mii" and other mii stuff
 1.6 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.5 12-Sep-1999  chs branches: 1.5.2;
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.4 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.3 06-Jun-1999  mrg branches: 1.3.2;
note that this is for an u5/u10 (from hubert)
 1.2 05-Jun-1999  mrg lpt at ebus. fixed (commented) audiocs attachments.
 1.1 04-Jun-1999  mrg Ultra5/10 configuration.
 1.3.2.2 02-Aug-1999  thorpej Update from trunk.
 1.3.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.2 07-Aug-2000  mrg pull up config file changes (approved by thorpej):

rename the POWEROFSEVEN & EVERGLADES kernels inline with the GENERIC/GENERIC32
naming.
 1.9.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.17.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.19.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.21.50.1 22-Apr-2006  simonb Sync with head.
 1.21.48.1 09-Sep-2006  rpaulo sync with head
 1.21.46.1 18-Feb-2006  yamt sync with head.
 1.21.34.1 21-Jun-2006  yamt sync with head.
 1.21.2.2 25-Oct-2001  mrg lets play catch up with thorpej.rototiller
 1.21.2.1 25-Oct-2001  mrg file POWEROFSEVEN was added on branch nathanw_sa on 2001-10-25 13:28:22 +0000
 1.43 05-Feb-2006  mrg these configs have not been used for years. (in reality, the machine
splode is now more like the POWEROFSEVEN config.)
 1.42 05-Feb-2006  cube Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.41 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.40 10-Dec-2005  tsutsui branches: 1.40.2; 1.40.4; 1.40.6;
Adjust comments for options FFS_NO_SNAPSHOT.
 1.39 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.38 19-Aug-2005  christos 64 bit inode changes.
 1.37 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.36 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.35 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.34 15-Jun-2005  tron branches: 1.34.2;
Remove commented out "upa" attachments because NetBSD doesn't have a
driver for that anyway. Approved by Martin Husemann.
 1.33 31-May-2005  tron Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.32 25-Feb-2005  martin branches: 1.32.2;
Nuke options RASTERCONSOLE for sparc64
 1.31 25-Feb-2005  simonb 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 24-Nov-2004  bouyer branches: 1.28.4; 1.28.6;
pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) serie of
controllers. Tested with a PDC20375 (2 SATA, one PATA) controller on sparc64.
Added to all kernel config file which had pdcide(4).
 1.27 10-Nov-2004  christos 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 14-Dec-2003  thorpej branches: 1.24.2;
Split the Intel i31244 SATA controller ("Artisea") driver out of piixide
into its own driver (artsata).
 1.23 13-Dec-2003  thorpej Split out the Silicon Image SATALink support into its own driver,
"satalink".
 1.22 18-Oct-2003  lukem Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.21 08-Oct-2003  bouyer Add new per-chip pciide drivers.
 1.20 08-Oct-2003  bouyer Add atabus.
 1.19 20-Jun-2003  nakayama branches: 1.19.2;
s/options\t/options \t/
 1.18 26-May-2003  martin Remove commented out and nowadays incorrect KGDB declarations.
 1.17 10-Apr-2003  christos Bye Bye UCONSOLE
 1.16 01-Jan-2003  mrg enable sab & sabtty
 1.15 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.14 20-Jul-2002  mrg create a "sparc" symlink as well. sync kernels.
 1.13 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.12 25-Apr-2002  atatat branches: 1.12.2; 1.12.4;
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.11 17-Apr-2002  mycroft Remove TLP_MATCH_* options.
 1.10 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.9 25-Mar-2002  mrg remove vnd. use -mcpu=ultrasparc.
 1.8 10-Feb-2002  wiz Update description for icsphy.
 1.7 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.6 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.5 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.4 24-Oct-2001  thorpej branches: 1.4.2;
Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.3 22-Oct-2001  mrg branches: 1.3.2;
sync with reality:
options BLINK
options AUDIO_DEBUG
audiocs at ebus
audio at audiocs
 1.2 22-Sep-2001  mrg update to reality: remove a bunch of stuff.
 1.1 02-Sep-2001  mrg branches: 1.1.2; 1.1.4;
place the main chunk of POWEROFSEVEN's config into the .inc file, and have
the 32 and 64 files define MACHINE_ARCH, CC, LD and AS appropriately to build
a 32 or 64 bit kernel, respectively. this allows either to be built on a
system that can generate 32 or 64 bit code.
 1.1.4.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.1.4.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.5 16-Mar-2002  jdolecek Catch up with -current.
 1.1.4.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.1 02-Sep-2001  thorpej file POWEROFSEVEN.inc was added on branch kqueue on 2001-09-13 01:14:39 +0000
 1.1.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.4.2.9 03-Jan-2003  thorpej Sync with HEAD.
 1.4.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.7 01-Aug-2002  nathanw Catch up to -current.
 1.4.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.4.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.4.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.2.1 24-Oct-2001  nathanw file POWEROFSEVEN.inc was added on branch nathanw_sa on 2002-01-08 00:27:58 +0000
 1.12.4.1 01-Aug-2002  lukem Pull up revision 1.13 (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.12.2.2 31-Aug-2002  gehenna catch up with -current.
 1.12.2.1 15-Jul-2002  gehenna catch up with -current.
 1.19.2.9 11-Dec-2005  christos Sync with head.
 1.19.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.19.2.6 15-Feb-2005  skrll Sync with HEAD.
 1.19.2.5 29-Nov-2004  skrll Sync with HEAD.
 1.19.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.19.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.24.2.1 15-Jul-2004  he branches: 1.24.2.1.2;
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.24.2.1.2.1 02-Apr-2005  he Pull up revision 1.28 (requested by bouyer in ticket #1019):
Add pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) series of
controllers.
 1.28.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.6.1 12-Feb-2005  yamt sync with head.
 1.28.4.1 29-Apr-2005  kent sync with -current
 1.32.2.3 18-Jul-2005  riz Pull up revision 1.35 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.32.2.2 18-Jun-2005  riz Pull up revision 1.34 (requested by tron in ticket #457):
Remove commented out "upa" attachments because NetBSD doesn't have a
driver for that anyway. Approved by Martin Husemann.
 1.32.2.1 01-Jun-2005  riz Pull up revision 1.33 (requested by tron in ticket #362):
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.34.2.1 21-Jun-2006  yamt sync with head.
 1.40.6.1 22-Apr-2006  simonb Sync with head.
 1.40.4.1 09-Sep-2006  rpaulo sync with head
 1.40.2.1 18-Feb-2006  yamt sync with head.
 1.14 01-Jan-2003  mrg this file is really no longer used
 1.13 01-Jan-2003  mrg this is no longer used.
 1.12 24-Oct-2001  thorpej branches: 1.12.2;
Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.11 02-Sep-2001  mrg branches: 1.11.4;
place the main chunk of POWEROFSEVEN's config into the .inc file, and have
the 32 and 64 files define MACHINE_ARCH, CC, LD and AS appropriately to build
a 32 or 64 bit kernel, respectively. this allows either to be built on a
system that can generate 32 or 64 bit code.
 1.10 25-Aug-2001  mrg turn off compat & some exec options
 1.9 08-Jul-2001  abs branches: 1.9.2;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.8 02-Mar-2001  mrg sync with GENERIC32.
 1.7 05-Feb-2001  mrg turn off UVMHIST. turn on LKM. makeoptions DEBUG=-g
 1.6 02-Feb-2001  mrg enable the kbd/ms. enable some compat options for compat_sunos
 1.5 27-Nov-2000  soren Removed increased BUFCACHE/BUFPAGES.
 1.4 24-Sep-2000  jdolecek branches: 1.4.2;
don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.3 20-Aug-2000  mrg add SOFTDEP
 1.2 31-Jul-2000  mrg branches: 1.2.2;
sync with GENERIC32; enable rnd
 1.1 27-Jul-2000  mrg do the 32 bit / 64 bit name swap, as per GENERIC.
 1.2.2.3 26-Aug-2000  mrg pull up 1.3. approved by thorpej:
>add SOFTDEP
 1.2.2.2 07-Aug-2000  mrg pull up config file changes (approved by thorpej):

rename the POWEROFSEVEN & EVERGLADES kernels inline with the GENERIC/GENERIC32
naming.
 1.2.2.1 31-Jul-2000  mrg file POWEROFSEVEN32 was added on branch netbsd-1-5 on 2000-08-07 02:31:59 +0000
 1.4.2.5 12-Mar-2001  bouyer Sync with HEAD.
 1.4.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.4.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.1 24-Sep-2000  bouyer file POWEROFSEVEN32 was added on branch thorpej_scsipi on 2000-11-20 20:26:41 +0000
 1.9.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.11.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.12.2.2 03-Jan-2003  thorpej Sync with HEAD.
 1.12.2.1 24-Oct-2001  thorpej file POWEROFSEVEN32 was added on branch nathanw_sa on 2003-01-03 16:57:12 +0000
 1.2 27-Jul-2000  mrg do the 32 bit / 64 bit name swap, as per GENERIC.
 1.1 07-Jul-2000  mrg branches: 1.1.2;
options BUFCACHE=20, plus a 64 bit config.
 1.1.2.3 07-Aug-2000  mrg pull up config file changes (approved by thorpej):

rename the POWEROFSEVEN & EVERGLADES kernels inline with the GENERIC/GENERIC32
naming.
 1.1.2.2 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.1.2.1 07-Jul-2000  mrg file POWEROFSEVEN64 was added on branch netbsd-1-5 on 2000-07-18 16:23:17 +0000
 1.8 13-Mar-2010  mrg convert sparc64 to MULTIPROCESSOR kernel by default, and introduce
s/MP/UP/ kernels were otherwise in place.

in my testing on a U60, i couldn't really notice any different in
speed, but we need testing on a U1/U5/U10 systems to be sure that
GENERIC.UP isn't necessary.

for sparc64, this is some what required as USIIIi systems have the
memory controller on the CPU, and unless the CPU is spunup, a UP
kernel will not function on these systems. (we obviously need to
join the NUMA-for-netbsd camp now, too! :-)


this should enable the installer to function on all systems that we
support, but also give the option for people to install GENERIC.UP
on their single-cpu systems if they choose.


XXX: i haven't actually tested sysinst with this, but i have built
both sparc and sparc64 release iso's successfully with this change
(sans having to comment out kern_ctf.c.)
 1.7 28-Feb-2010  martin branches: 1.7.2;
Remove the envctrl driver, it is superseeded by the more general pcfiic @
ebus. Add the SB1000/SB2000 fan controll driver (tda). From OpenBSD.
Move config files over to direct configuration of i2c devices.
 1.6 13-Feb-2010  mrg remove all the devices now present in GENERIC.
 1.5 06-Feb-2010  mrg branches: 1.5.2;
- properly map the schizo interrupt registers, so we can use the normal
virtual mappings to access them.
- with the above fxied, kill SCHIZO_BUS_SPACE_BROKEN, and introduce
an options CHEETAH for now, that disables the SPITFIRE code in locore.
- merge schizo_init() into schizo_attach() and clean up the softc a bit.


with this we are only one more step away from GENERIC booting on USIII
machines.
 1.4 28-Jan-2010  mrg enable LOCKDEBUG
enable bge @ pci
enable ieee1394
 1.3 12-Jan-2010  martin Import support for upa64s device (/upa on SB1000/2000) from OpenBSD.
Attach ffb both at mainbus and at upa.
 1.2 03-Dec-2009  mrg base this on GENERIC.MP. seems just as stable.
turn on esiop/siop now that their interrupts match.
turn off admtemp, since we get a false match.
XXX admtemp_match needs help.
 1.1 28-Nov-2009  mrg add the kernel config i've been mostly using for USIII/schizo support
 1.5.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.7.2.3 11-Aug-2010  yamt sync with head.
 1.7.2.2 11-Mar-2010  yamt sync with head
 1.7.2.1 28-Feb-2010  yamt file SCHIZO was added on branch yamt-nfs-mp on 2010-03-11 15:02:59 +0000
 1.44 05-Feb-2006  mrg these configs have not been used for years. (in reality, the machine
splode is now more like the POWEROFSEVEN config.)
 1.43 05-Feb-2006  cube Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.42 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.41 07-Dec-2005  tsutsui branches: 1.41.2; 1.41.4; 1.41.6;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.40 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.39 19-Aug-2005  christos 64 bit inode changes.
 1.38 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.37 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.36 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.35 15-Jun-2005  tron branches: 1.35.2;
Remove commented out "upa" attachments because NetBSD doesn't have a
driver for that anyway. Approved by Martin Husemann.
 1.34 31-May-2005  tron Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.33 25-Feb-2005  martin branches: 1.33.2;
Nuke options RASTERCONSOLE for sparc64
 1.32 25-Feb-2005  simonb 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.31 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.30 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.29 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.28 17-Jan-2005  cube branches: 1.28.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.27 24-Nov-2004  bouyer branches: 1.27.4;
pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) serie of
controllers. Tested with a PDC20375 (2 SATA, one PATA) controller on sparc64.
Added to all kernel config file which had pdcide(4).
 1.26 10-Nov-2004  christos Add COMPAT_BSDPTY to the rest of the config files.
 1.25 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.24 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.23 14-Dec-2003  thorpej branches: 1.23.2;
Split the Intel i31244 SATA controller ("Artisea") driver out of piixide
into its own driver (artsata).
 1.22 13-Dec-2003  thorpej Split out the Silicon Image SATALink support into its own driver,
"satalink".
 1.21 18-Oct-2003  lukem Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.20 08-Oct-2003  bouyer Add new per-chip pciide drivers.
 1.19 08-Oct-2003  bouyer Add atabus.
 1.18 20-Jun-2003  nakayama branches: 1.18.2;
s/options\t/options \t/
 1.17 26-May-2003  martin Remove commented out and nowadays incorrect KGDB declarations.
 1.16 10-Apr-2003  christos Bye Bye UCONSOLE
 1.15 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.14 20-Jul-2002  mrg create a "sparc" symlink as well. sync kernels.
 1.13 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.12 25-Apr-2002  atatat branches: 1.12.2; 1.12.4;
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.11 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.10 10-Feb-2002  wiz Update description for icsphy.
 1.9 10-Feb-2002  mrg give splode 8 raid devices
 1.8 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.7 22-Jan-2002  mrg turn on BLINK & bridge
 1.6 19-Jan-2002  mrg update to reality, even if it still does not quite work.
 1.5 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.4 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.3 24-Oct-2001  thorpej branches: 1.3.2;
Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.2 22-Sep-2001  mrg branches: 1.2.2;
sync.
 1.1 14-Aug-2001  mrg branches: 1.1.2; 1.1.4;
but this machine is now an ultra1.
 1.1.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.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.1.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.1.2.1 14-Aug-2001  thorpej file SPLODE was added on branch kqueue on 2001-08-25 06:15:54 +0000
 1.2.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.3.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.3.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.3.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.2.1 24-Oct-2001  nathanw file SPLODE was added on branch nathanw_sa on 2002-01-08 00:27:58 +0000
 1.12.4.1 01-Aug-2002  lukem Pull up revision 1.13 (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.12.2.2 31-Aug-2002  gehenna catch up with -current.
 1.12.2.1 15-Jul-2002  gehenna catch up with -current.
 1.18.2.11 11-Dec-2005  christos Sync with head.
 1.18.2.10 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.9 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.2.8 15-Feb-2005  skrll Sync with HEAD.
 1.18.2.7 04-Feb-2005  skrll Sync with HEAD.
 1.18.2.6 24-Jan-2005  skrll Sync with HEAD.
 1.18.2.5 29-Nov-2004  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.23.2.1 15-Jul-2004  he branches: 1.23.2.1.2;
Pull up revision 1.24 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.23.2.1.2.1 02-Apr-2005  he Pull up revision 1.27 (requested by bouyer in ticket #1019):
Add pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) series of
controllers.
 1.27.4.1 29-Apr-2005  kent sync with -current
 1.28.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.2.1 12-Feb-2005  yamt sync with head.
 1.33.2.3 18-Jul-2005  riz Pull up revision 1.36 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.33.2.2 18-Jun-2005  riz Pull up revision 1.35 (requested by tron in ticket #457):
Remove commented out "upa" attachments because NetBSD doesn't have a
driver for that anyway. Approved by Martin Husemann.
 1.33.2.1 01-Jun-2005  riz Pull up revision 1.34 (requested by tron in ticket #362):
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.35.2.1 21-Jun-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.41.2.1 18-Feb-2006  yamt sync with head.
 1.168 04-Oct-2025  thorpej Don't use the common OpenFirmware PCI-device-to-devhandle mapping
routine. We've gone through the trouble of encoding the PROM node
into the pcitag_t, and using that ensures we're consistent with
any PROM data quirks.
 1.167 01-Sep-2025  thorpej Put the pcfiic driver declaration in the global location, and adapt
the sparc64 instance to be a proper separate attachment.
 1.166 12-May-2021  thorpej - Define a device call for PCI bus instances to fetch a direct child's
device handle given the device's device/function #s (extracted from
a pcitag_t). Use it to associate the handle with the child device
at config_found() time.
- Implement this device call for ACPI and OpenFirmware.
- Enable the OpenFirmware variant for evbarm FDT, macppc, ofppc, sparc64.
- Obsolete acpi_device_register(); it is no longer needed.
- Obsolete setting the OpenFirmware handle in PCI devices in the
sparc64 device_register(); it is no longer needed.
 1.165 25-Apr-2021  thorpej branches: 1.165.2; 1.165.4;
PCI busses do not attach to "ebus", therefore there is no need for
it to carry the "pcibus" interface attribute.

Fixes kern/56124.
 1.164 04-Mar-2021  palle sun4v: add vnet driver from openbsd - compiles but probably does not work yet - still WIP
 1.163 21-Oct-2020  christos branches: 1.163.2;
make process_machdep.c included always since it provides register i/o used by
sys_process_getlwpstatus.c which is always included.
 1.162 20-Oct-2020  christos harmonize process_machdep.c inclusion.
 1.161 16-Oct-2020  jdc Move OFW patching routines into their own file.
 1.160 11-Oct-2020  jdc Add a static EDID entry for the Mesostation-999.
Use the same logic as macppc for adding the entry.
 1.159 11-May-2020  jdc Add an ebus frontend for the Winbond W83l518D SD card reader as found on
Tadpole SPARCLE latops.
 1.158 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.157 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.156 20-Oct-2018  macallan support for jbus-i2c found in US-IIIi machines
this needs help from schizo to access its registers, which is suboptimal and
should go away. So, for now this is for documentation purposes only.
 1.155 13-Oct-2018  macallan config and attachment goop for tadpmu
 1.154 19-Dec-2017  nakayama branches: 1.154.2; 1.154.4;
files.ofw is now mandatory, so use its dependency.
 1.153 06-Jul-2017  martin Remove unused "power @ ebus" device, we use the firmware to handle power/
reboot.
 1.152 19-Aug-2016  palle sun4v: vdsk and ldc drivers - from OpenBSD, but heavily adapted to NetBSD scsipi - access to a virtual disk served from a ldom primary domain now works
 1.151 22-Jun-2016  palle sun4v: add cbus driver - from OpenBSD
 1.150 17-Jun-2016  palle sun4v: vbus and vrtc drivers - from OpenBSD
 1.149 06-Oct-2015  martin Split auxio at ebus and auxio at sbus properly, so we can build kernels
without sbus support.
 1.148 15-Feb-2015  nakayama Fix up sysmon_* dependencies.
 1.147 12-Feb-2015  palle sun4v: vpci driver - initial (and incomplete) version of virtual PCIe host bridge driver for sun4v systems. Based on the NetBSD pyro driver and OpenBSD vpci driver. Future work will include integrating code from the OpenBSD vpci driver.
 1.146 10-Jan-2015  palle sun4v: add hypervisor machine description (mdesc) functions - from OpenBSD
 1.145 01-Feb-2014  nakayama branches: 1.145.6;
Make sljit usable on sparc64 32-bit kernels.
 1.144 28-Dec-2013  nakayama Add SUN4V to opt_sparc_arch.h.
 1.143 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.142 27-Aug-2013  macallan psycho needs-flag now
while there, ffb doesn't need rasops8
 1.141 17-Mar-2013  christos branches: 1.141.6;
no more duplicate copy of the memcpy code.
 1.140 14-Mar-2013  nakayama Use elf32 version module object relocator on sparc64 32-bit kernel.
 1.139 13-Oct-2012  jdc Add pckbc at ebus.
 1.138 03-Mar-2012  nakayama branches: 1.138.2;
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.137 18-Feb-2012  christos Move the ddb registers and empty command table into a separate file, like
other archs do for the benefit of crash.
 1.136 04-Oct-2011  nakayama branches: 1.136.2; 1.136.6; 1.136.8;
Make ffb(4) buildable without iic(4) driver.
 1.135 01-Aug-2011  mrg fix the zx@fhc attachment.
 1.134 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.133 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.132 06-Jun-2011  mrg sort
 1.131 06-Jun-2011  mrg re-implement blast_dcache() and blast_icache() via function pointers so that
we can set these to functions that simply return on sun4us/sun4v systems.

also include some work-in-progress #if 0'ed code to do the same for the
dcache_flush*() functions.


(some of these could probably move into the cpuinfo except that sparc64
systems don't really ever work with mismatches AFAICT.)
 1.130 09-Apr-2011  jdc branches: 1.130.2;
Add EDID and video mode setting support to FFB.

Add definitions for registers related to video modes, and to DDC. Rename
other registers to be more descriptive.
Add i2c bus routines to read the EDID data via DDC.
Add routines to calculate, and to set, the video mode.

Note, that interlaced and stereo video modes are not supported.

Thanks to Michael Lorenz and Jared McNeill for advice and encouragement,
and to Martin Husemann for testing.
 1.129 20-Mar-2011  mrg add pci@pryo@mainbus and ebus@mainbus support.
 1.128 21-Sep-2010  macallan branches: 1.128.2;
defflag some flags for the ffb driver
 1.127 06-Mar-2010  mrg branches: 1.127.2;
move the memcpy/memset implementations out into their own file, with the
block copy versions as well. move some of the definitions in locore.s
into a new locore.h.

locore.s is almost 2000 lines shorter with this change.
 1.126 02-Mar-2010  nakayama Make kernel buildable without device ecadc.
 1.125 28-Feb-2010  martin Remove the envctrl driver, it is superseeded by the more general pcfiic @
ebus. Add the SB1000/SB2000 fan controll driver (tda). From OpenBSD.
Move config files over to direct configuration of i2c devices.
 1.124 22-Feb-2010  mrg move {dump,print}_[id]tlb() into a separate file.
 1.123 12-Jan-2010  martin branches: 1.123.2;
Import support for upa64s device (/upa on SB1000/2000) from OpenBSD.
Attach ffb both at mainbus and at upa.
 1.122 29-Dec-2009  macallan add gfb at mainbus
 1.121 02-Oct-2009  nakayama Port lom(4) driver for LOMlite lights out management hardware monitor
and watchdog timer from OpenBSD.

It supports the LOMlite found on Sun Netra t1 and the LOMlite2 found
on Sun Netra T1/X1 and Sun Fire V100/V120.
 1.120 10-Dec-2008  mrg checkpoint my work-in-progress port of this driver.
it boots some way but will crash attaching rtc0.

known TODO items:
- figure out why BUS_SPACE_MAP_LINEAR mappings generate data errors
(cause of the rtc issue)
- several interrupt issues
 1.119 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.118 20-Feb-2008  drochner branches: 1.118.6; 1.118.10; 1.118.16; 1.118.18; 1.118.20; 1.118.22; 1.118.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.117 03-Feb-2008  martin Adjust assembler in_cksum code to new signature and re-enable it.
 1.116 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.115 06-Jan-2008  ad Add MODULAR option. Include kernel linker stuff if MODULAR.
 1.114 19-Nov-2007  macallan branches: 1.114.6;
pull in ofw_subr.c for some convenience OpenFirmware routines
 1.113 17-Oct-2007  garbled branches: 1.113.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.112 13-Aug-2007  macallan branches: 1.112.2; 1.112.6;
envctrl needs to pull in i2cbus
 1.111 07-Jul-2007  tsutsui branches: 1.111.4; 1.111.8;
Remove leftover netns stuff.
 1.110 14-Apr-2007  tnn branches: 1.110.2;
Add envctrl(4): Sun Ultra Enterprise 450 environmental monitoring driver.
Also add accompanying i2c controller driver, pcf8584.
Both written by me. Some cosmetic improvements from Iain Hibbert.
ok <martin>
 1.109 10-Apr-2007  macallan include files.wsfb
 1.108 09-Feb-2007  ad branches: 1.108.2; 1.108.6; 1.108.8;
Merge newlock2 to head.
 1.107 09-Nov-2006  tsutsui branches: 1.107.2; 1.107.8;
More cleanup of sparc64 clock stuff:
- split mkclock attachment from sparc64/clock.c into dev/mkclock.c
(now clock.s only contains clock interrupt and timecounter stuff)
- rename match/attach functions of rtc at ebus to match the device name
- update some comments around clock devices in GENERIC

No objection on port-sparc64 for a month.
 1.106 10-Oct-2006  tsutsui Remove eeprom and clock at mainbus stuff.
They are available only on sun4 or sun4c.
 1.105 09-Oct-2006  mrg avoid bringing in mc146818 routines for kernels that do not have the
'rtc'-style clock linked in. put the rtc code in it's own file and
only link it in if it is actually configured. fixes PR#23342.
 1.104 06-Oct-2006  jnemeth Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.103 14-Sep-2006  martin branches: 1.103.2;
Vcons-ify the ffb driver, from macallan.
Also adds some redrawing when entering DDB.
 1.102 10-Sep-2006  plunky add bluetooth support to sparc64, built by default in GENERIC
 1.101 10-Jul-2006  gdamore branches: 1.101.4;
New psm driver for use on Ultrabook IIi. Right now it supports the power
button and lid switch. I will add environmentals (battery, etc.) later.
 1.100 07-Jun-2006  kardel branches: 1.100.2;
convert to timecounters (from branch simonb-timecounters)
 1.99 04-Apr-2006  gdamore branches: 1.99.2;
Convert existing ath users to new Makefile, except for amd64, which needs
the rules due to needing to conditionally postprocess the HAL object file.

Macppc needs a a non-ELF HAL (EABI) object, so take care of that by default
in the atheros include file.
 1.98 02-Mar-2006  martin branches: 1.98.2; 1.98.4; 1.98.6;
Add glue to make ath* usable on sparc64.
 1.97 11-Dec-2005  christos branches: 1.97.4; 1.97.6;
merge ktrace-lwp.
 1.96 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.95 14-Sep-2004  jdolecek branches: 1.95.12;
do not include "compat/aout/files.aout", COMPAT_AOUT is soon to be removed
 1.94 13-Sep-2004  drochner nothing attaches to a "sabtty", so there is no need for an
interface attribute
 1.93 22-Mar-2004  martin Realy disable optimization for 32bit kernels when compiling uvm_bio.c.
 1.92 21-Mar-2004  pk Reach over to the sparc openfirm & openprom implementation.
 1.91 21-Mar-2004  pk Add sparc/sparc/promlib.c.
 1.90 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.89 10-Feb-2004  jdolecek whitespace police
 1.88 20-Jan-2004  jdolecek cleanup old lpt(4) attachment, and glue ppbus in so that they can coexist:
* lpt device is defined in MI place (dev/ppbus/files.ppbus), dev/ic/lpt.c
is included there too; dev/ic/lpt.c is not included if ppbus is
configured or if there is alternative platform lpt (like for pc532)
* g/c MD lpt definitions and custom puc/upc attachments,
glue moved to conf/files and dev/pci/files.pci respectively; remove
device lpt definition from dev/isa/files.isa
* add ppbus parport attribute, atppc device attachments, adjust plip and lpt
glue
 1.87 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.86 02-Nov-2003  he Make the clock device aldo depend on mc146818, to make kernels without
the 'rtc at ebus' driver configured (e.g. for sbus machines) link.
 1.85 01-Nov-2003  tsutsui - Adapt to MI mk48txx(4) changes.
- Switch rtc (M5819) routines to use MI mc146818(4) driver.

Tested on Ultra5 (mkclock_ebus), but mkclock_sbus and rtc_ebus are not tested.

XXX This file should be split into each device and each bus attachment,
XXX and moved into sys/arch/sparc64/dev or sys/dev/sun.
 1.84 31-Oct-2003  petrov Don't attach zs at mainbus.
 1.83 26-Oct-2003  christos Add compat_16_machdep.c
 1.82 19-Sep-2003  martin Remove workarounds for bugs in the old compiler.
 1.81 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.80 17-Jul-2003  petrov Driver for CP1500/1400 watchdog timer.
 1.79 16-Jun-2003  heas branches: 1.79.2;
Define option BLINK in option file opt_auxio.h and include it in auxio.c.
approved by martin@
 1.78 23-May-2003  petrov ffb added.
 1.77 18-May-2003  martin Remove reference to non-existing file
 1.76 21-Apr-2003  martin Connect the front panel power button on psycho based machines to sysmon's
/dev/power.

XXX - due to the way interrupt handling is structured we have no easy
way to defer clearing the button interrupt until the sysmon callback
has happened and the event is dispatched. We clear it imediately on
return from the interrupt handler. This means we get an interrupt storm
until the button is released, and then start to handle it.
This needs to be fixed! (But with the default application for the power
button does not make a user visible difference.)
 1.75 22-Mar-2003  nakayama PCI-CardBus bridge support for sparc64:
- add CardBus and PCMCIA devices configrations.
- add workaround for internal compiler error on dev/ic/elink3.c.
 1.74 05-Feb-2003  nakayama Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.

This should fix PR port-sparc64/18452.
(approved by martin)
 1.73 06-Jan-2003  wiz compatibility, not compatiblity.
 1.72 08-Dec-2002  martin Follow the sparc port and use the MI versions of setrunqueue and
remrunqueue.
 1.71 27-Oct-2002  martin Oops, forgot to commit this: include files.wscons instead of files.rcons.
 1.70 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.69 15-Oct-2002  thorpej The zstty device must have an interface attribute in order for
children to attach; it is not sufficient to have an interface
atttribute which only happens to have the same name.

Fix the same mistake with the sabtty declaration.
 1.68 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.67 29-Sep-2002  chs remove some vestigial FPU and cache code that's not need on ultrasparcs.
misc tidiness.
 1.66 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.65 16-Aug-2002  petrov Enable sab.
 1.64 16-May-2002  thorpej branches: 1.64.2; 1.64.4;
* 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.63 06-May-2002  eeh Add a flag for ofpci to let psycho chose between pci and ofpci.
 1.62 06-May-2002  eeh Add ofpci and ofppb.
 1.61 05-May-2002  martin Add PCMCIA support (for nell at sbus and pci cardbus bridges)
 1.60 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.59 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.58 21-Jan-2002  jdolecek branches: 1.58.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.57 04-Dec-2001  lukem s/defopt/defflag/
 1.56 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.55 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.54 20-Nov-2001  lukem whitespace cleanup
 1.53 25-Oct-2001  eeh branches: 1.53.2;
Fix bugs in previous.
 1.52 25-Oct-2001  eeh _LP64 -> EXEC_ELF64
 1.51 02-Sep-2001  eeh branches: 1.51.4;
Get rid of all simba references.
 1.50 10-Aug-2001  eeh Use the new in4_cksum.
 1.49 08-Aug-2001  eeh Use the new version of in_cksum.
 1.48 08-Jun-2001  simonb branches: 1.48.2;
For ports that wire up pciide in compatibility mode, have
them define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
in pci_machdep.h and pciide_map_compat_intr() only calls
pciide_machdep_compat_intr_establish() if that preprocessor
define exists.

Ports that don't need to do this no longer need to supply a
dummy function.
 1.47 06-Jun-2001  mrg extract the netbsd32, sunos, 32 bit svr4 and 64 bit svr4 sigcode out into
separate files, so that compat lkms can link with them as well.
 1.46 13-Apr-2001  matt Include USB and 1394 support (sun models now have them).
 1.45 11-Feb-2001  eeh branches: 1.45.2;
Add support for COMPAT_SVR4_32.
 1.44 05-Feb-2001  mrg use sunos32_machdep.c on 64 bit kernels.
 1.43 02-Feb-2001  mrg include compat/sunos32/sunos32.files
 1.42 17-Jan-2001  fvdl 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.41 10-Nov-2000  eeh Clean up config and fix things so kbd.h is generated even w/no keyboard.
 1.40 09-Nov-2000  eeh Switch to sunkbd for both com and zstty.
 1.39 08-Nov-2000  ad Pull in dev/i2o/files.i2o.
 1.38 21-Sep-2000  eeh Add support for the `com' driver and Sun Keyboard/Mouse line disciplines.
 1.37 23-Aug-2000  pk Use common fb.c from sys/dev/sun.
 1.36 22-Aug-2000  pk These devices will never be found on sun4u machines.
 1.35 22-Aug-2000  pk Pull in sys/dev/sun/files.sun.
Remove driver declarations that are now in /sys/dev/{sbus,sun}
 1.34 26-Jul-2000  pk Use the mk48txx driver for time-of-day clock access.
 1.33 18-Jun-2000  mrg branches: 1.33.2;
duplicate "file" should only include "compile-with"
 1.32 18-Jun-2000  mrg use arch/sparc/fpu
 1.31 09-Jun-2000  eeh Separate COPTS from CFLAGS to fix problems w/unoptimized files, and add
lfs_loop.c to the list that breaks optimization.
 1.30 08-Jun-2000  eeh Override optimization for files that break gcc.
 1.29 19-May-2000  eeh branches: 1.29.2;
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.28 22-Apr-2000  mrg whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.27 15-Apr-2000  mrg - auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.26 05-Apr-2000  mrg attach auxio at ebus
 1.25 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.24 14-Feb-2000  thorpej Allow arch-specific code to specify in4_cksum() like it can specify
in_cksum().
 1.23 07-Jun-1999  thorpej branches: 1.23.2;
Only declare block major numbers for devices which can be the root device.
 1.22 05-Jun-1999  eeh Add support for AOUT_COMPAT which we'll need when the sparc port cuts to ELF.
 1.21 05-Jun-1999  mrg fix lpt definition. add audiocs at ebus. oops, comment broken/incomplete devices.
 1.20 05-Jun-1999  mrg use common IOMMU code for sbus and psycho (remove old iommu
device declaration, we don't want it). pull in psycho, pci,
ata and pciide code. clock, eeprom and power attach at sbus
*and* ebus now (clock as `eeprom' works). add `lpt at ebus',
wd major number, and other misc. commented devices.
 1.19 23-May-1999  eeh Start putting in hooks for non-zs console devices.
 1.18 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.17 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.16 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.15 25-Mar-1999  mrg branches: 1.15.4;
move sparc32 MD bits here.
 1.14 12-Feb-1999  mrg include dev/mii/files.mii
 1.13 17-Sep-1998  thorpej Make the signal code look a bit more like the 32-bit SPARC port's.
 1.12 05-Sep-1998  pk Define a few major devices.
Remove `dma' and `esp' definitions.
 1.11 05-Sep-1998  pk Remove unused devices.
 1.10 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.9 27-Aug-1998  mrg oops, remove old isp attachment here..
 1.8 26-Aug-1998  mrg - use UVM by default.
- clean up the Makefile a bit to be less solaris-centric :)
- add support for compat_sparc32 (32bit compat module for NetBSD/sparc). this
isn't yet fully tested but it mostly written and compiles if not totally
links yet.
 1.7 28-Jul-1998  eeh Fixup problems caused by sys/dev/sbus addition.
 1.6 27-Jul-1998  pk Use <dev/sbus/files.sbus>
 1.5 27-Jul-1998  mrg move to sys/dev/sbus for lebuffer driver (old path never existed anyway)
 1.4 21-Jul-1998  drochner adapt to LANCE driver split
 1.3 15-Jul-1998  thorpej Remove the raw HYPERchannel kludge.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.15.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.23.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.23.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.23.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.23.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.23.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.29.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.33.2.1 25-Oct-2001  he Apply patch (requested by ad):
Add Mylex DACC960, CAC-EISA, and I2O block/SCSI drivers.
 1.45.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.48.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.48.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.48.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.48.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.48.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.48.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.48.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.48.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.51.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.53.2.11 07-Jan-2003  thorpej Sync with HEAD.
 1.53.2.10 11-Dec-2002  thorpej Sync with HEAD.
 1.53.2.9 11-Nov-2002  nathanw Catch up to -current
 1.53.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.53.2.7 17-Sep-2002  nathanw Catch up to -current.
 1.53.2.6 27-Aug-2002  nathanw Catch up to -current.
 1.53.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.53.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.53.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.53.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.53.2.1 25-Oct-2001  nathanw file files.sparc64 was added on branch nathanw_sa on 2002-01-08 00:27:58 +0000
 1.58.4.1 19-Mar-2002  thorpej First draft of mutex and rwlock implementation for sparc64.
 1.64.4.1 24-Jun-2003  grant Pull up revision 1.74 (requested by nakayama in ticket #1329):

Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.
 1.64.2.4 31-Aug-2002  gehenna catch up with -current.
 1.64.2.3 17-May-2002  gehenna Remove old block majors list.
 1.64.2.2 16-May-2002  gehenna Include the list of block/character major numbers.
 1.64.2.1 16-May-2002  gehenna file files.sparc64 was added on branch gehenna-devsw on 2002-05-16 13:32:50 +0000
 1.79.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.95.12.8 27-Feb-2008  yamt sync with head.
 1.95.12.7 04-Feb-2008  yamt sync with head.
 1.95.12.6 21-Jan-2008  yamt sync with head
 1.95.12.5 07-Dec-2007  yamt sync with head
 1.95.12.4 03-Sep-2007  yamt sync with head.
 1.95.12.3 26-Feb-2007  yamt sync with head.
 1.95.12.2 30-Dec-2006  yamt sync with head.
 1.95.12.1 21-Jun-2006  yamt sync with head.
 1.97.6.2 02-Jun-2006  kardel - support timecounters
 1.97.6.1 22-Apr-2006  simonb Sync with head.
 1.97.4.1 09-Sep-2006  rpaulo sync with head
 1.98.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.98.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.98.2.4 14-Sep-2006  yamt sync with head.
 1.98.2.3 11-Aug-2006  yamt sync with head
 1.98.2.2 26-Jun-2006  yamt sync with head.
 1.98.2.1 11-Apr-2006  yamt sync with head
 1.99.2.1 19-Jun-2006  chap Sync with head.
 1.100.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.101.4.2 29-Dec-2006  ad Checkpoint work in progress.
 1.101.4.1 18-Nov-2006  ad Sync with head.
 1.103.2.2 10-Dec-2006  yamt sync with head.
 1.103.2.1 22-Oct-2006  yamt sync with head
 1.107.8.1 17-Mar-2012  bouyer Pull up following revision(s) via patch (requested by nakayama in ticket #1443):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.107.2.1 17-Mar-2012  bouyer Pull up following revision(s) via patch (requested by nakayama in ticket #1443):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.108.8.1 11-Jul-2007  mjf Sync with head.
 1.108.6.5 03-Dec-2007  ad Sync with HEAD.
 1.108.6.4 20-Aug-2007  ad Sync with HEAD.
 1.108.6.3 15-Jul-2007  ad Sync with head.
 1.108.6.2 27-May-2007  ad Sync with head.
 1.108.6.1 10-Apr-2007  ad Sync with head.
 1.108.2.1 15-Apr-2007  yamt sync with head.
 1.110.2.1 03-Oct-2007  garbled Sync with HEAD
 1.111.8.2 21-Nov-2007  joerg Sync with HEAD.
 1.111.8.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.111.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.112.6.1 21-Nov-2007  bouyer Sync with HEAD
 1.112.2.3 23-Mar-2008  matt sync with HEAD
 1.112.2.2 09-Jan-2008  matt sync with HEAD
 1.112.2.1 06-Nov-2007  matt sync with HEAD
 1.113.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.113.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.114.6.1 08-Jan-2008  bouyer Sync with HEAD
 1.118.24.1 21-Apr-2010  matt sync to netbsd-5
 1.118.22.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by nakayama in ticket #1736):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.118.20.2 17-Mar-2012  bouyer Pull up following revision(s) (requested by nakayama in ticket #1736):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.118.20.1 16-Oct-2009  sborrill branches: 1.118.20.1.2;
Pull up the following revisions(s) (requested by nakayama in ticket #1064):
distrib/sets/lists/man/mi: revision 1.1161
share/man/man4/man4.sparc64/Makefile: revision 1.5
share/man/man4/man4.sparc64/lom.4: revision 1.1-1.2
sys/arch/sparc64/conf/GENERIC: revision 1.111
sys/arch/sparc64/conf/files.sparc64: revision 1.121
sys/arch/sparc64/dev/lom.c: revision 1.1
sys/dev/DEVNAMES: revision 1.252

Add a driver for LOMlite lights out management hardware monitor and watchdog
timer.
 1.118.20.1.2.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by nakayama in ticket #1736):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.118.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.118.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.118.10.3 09-Oct-2010  yamt sync with head
 1.118.10.2 11-Mar-2010  yamt sync with head
 1.118.10.1 04-May-2009  yamt sync with head.
 1.118.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.123.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.123.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.127.2.4 12-Jun-2011  rmind sync with head
 1.127.2.3 21-Apr-2011  rmind sync with head
 1.127.2.2 05-Mar-2011  rmind sync with head
 1.127.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.128.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.130.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.136.8.1 05-Mar-2012  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #85):
sys/arch/sparc64/sparc64/locore.s: revision 1.340
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
sys/arch/sparc64/conf/files.sparc64: revision 1.138

Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
 1.136.6.4 06-Mar-2012  mrg sync to -current
 1.136.6.3 06-Mar-2012  mrg sync to -current
 1.136.6.2 04-Mar-2012  mrg sync to latest -current.
 1.136.6.1 24-Feb-2012  mrg sync to -current.
 1.136.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.136.2.2 30-Oct-2012  yamt sync with head
 1.136.2.1 17-Apr-2012  yamt sync with head
 1.138.2.4 03-Dec-2017  jdolecek update from HEAD
 1.138.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.138.2.2 23-Jun-2013  tls resync from head
 1.138.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.141.6.2 18-May-2014  rmind sync with head
 1.141.6.1 28-Aug-2013  rmind sync with head
 1.145.6.5 28-Aug-2017  skrll Sync with HEAD
 1.145.6.4 05-Oct-2016  skrll Sync with HEAD
 1.145.6.3 09-Jul-2016  skrll Sync with HEAD
 1.145.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.145.6.1 06-Apr-2015  skrll Sync with HEAD
 1.154.4.1 10-Jun-2019  christos Sync with HEAD
 1.154.2.4 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.154.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.154.2.2 20-Oct-2018  pgoyette Sync with head
 1.154.2.1 30-Sep-2018  pgoyette Split sparc64/netbsd32_machdep.c into pieces specific to versions _13
and _16

XXX Somehow this has broken compat_sunos - must investigate further
 1.163.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.165.4.1 31-May-2021  cjep sync with head
 1.165.2.1 13-May-2021  thorpej Sync with HEAD.
 1.18 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.17 25-Aug-2015  uebayasi Don't expand unwanted symbols by cpp(1).
 1.16 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.15 22-Aug-2015  uebayasi .rel/.rela should not be generated in kernels.
 1.14 22-Aug-2015  uebayasi .init/.fini/.ctors/.dtors should be irrelevant to kernels.
 1.13 21-Aug-2015  uebayasi I bet setting search-directory for ld.so is useless in any kernel.
 1.12 20-Aug-2015  uebayasi Indent with 2 spaces.
 1.11 01-Jun-2010  mjf branches: 1.11.18; 1.11.36;
Add __cacheline_aligned and __read_mostly annotations.

These annotations help to mitigate false sharing on multiprocessor
systems.

Variables annotated with __cacheline_aligned are placed into the
.data.cacheline_aligned section in the kernel. Each item in this
section is aligned on a cachline boundary - this avoids false
sharing. Highly contended global locks are a good candidate for
__cacheline_aligned annotation.

Variables annotated with __read_mostly are packed together tightly
into a .data.read_mostly section in the kernel. The idea here is that
we can pack infrequently modified data items into a cacheline and
avoid having to purge the cache, which would happen if read mostly
data and write mostly data shared a cachline. Initialisation variables
are a prime candiate for __read_mostly annotations.
 1.10 17-Oct-2007  garbled branches: 1.10.20; 1.10.40; 1.10.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.9 04-Jun-2007  chs branches: 1.9.10;
instead of specifying the start of the data section in the makefile,
just round it up to the next 4MB boundary in the ldscript.
this prevents parts of the kernel-image range from being left unmapped.
fixes PR 36388.
 1.8 05-Dec-2006  martin branches: 1.8.6; 1.8.8; 1.8.14;
Enable the .note.netbsd section
 1.7 11-Dec-2005  christos branches: 1.7.20; 1.7.22; 1.7.24; 1.7.26;
merge ktrace-lwp.
 1.6 24-May-2004  martin branches: 1.6.12;
Back to SIZEOF_HEADERS.
 1.5 23-May-2004  martin Use 1024 instead of SIZEOF_HEADERS for now.
 1.4 16-May-2002  thorpej branches: 1.4.2; 1.4.10;
* 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.3 06-May-2002  eeh Provide pci_cd if needed.
 1.2 04-Mar-2001  mrg branches: 1.2.4; 1.2.6; 1.2.10;
move etext after rodata, like kern32.ldscript and sparc's kern.ldscript.
 1.1 28-Feb-2001  mrg add and user a linker script.
 1.2.10.1 20-Jun-2002  nathanw Catch up to -current.
 1.2.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.1 04-Mar-2001  bouyer file kern.ldscript was added on branch thorpej_scsipi on 2001-03-12 13:29:28 +0000
 1.4.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.10.1 03-Aug-2004  skrll Sync with HEAD
 1.4.2.2 16-May-2002  thorpej * 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.4.2.1 16-May-2002  thorpej file kern.ldscript was added on branch gehenna-devsw on 2002-05-16 01:01:42 +0000
 1.6.12.2 03-Sep-2007  yamt sync with head.
 1.6.12.1 30-Dec-2006  yamt sync with head.
 1.7.26.2 08-Nov-2007  skrll Keep the NetBSD note section.
 1.7.26.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.7.24.2 16-Sep-2008  bouyer Sync with the following revisions (requested by skrll in ticket #1196):
gnu/dist/gdb removed
gnu/usr.bin/gdb53 removed
distrib/cats/instkernel/Makefile 1.14.6.1
gnu/dist/gdb6/bfd/config.bfd 1.3.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.c 1.1.1.2.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/Makefile.in 1.2.2.1.2.2
gnu/dist/gdb6/gdb/alpha-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alpha-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/alphabsd-nat.h 1.1.2.1
gnu/dist/gdb6/gdb/alphabsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphanbsd-nat.c 1.1.2.1
gnu/dist/gdb6/gdb/alphanbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64nbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/amd64nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/arm-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/armbsd-tdep.c 1.1.2.1
gnu/dist/gdb6/gdb/armnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/armnbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure.ac 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/m68kbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/mipsnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/nbsd-thread.c 1.1.2.3
gnu/dist/gdb6/gdb/ppcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/ppcnbsd-tdep.c 1.3.6.1
gnu/dist/gdb6/gdb/sh-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/shnbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/shnbsd-tdep.c 1.1.1.2.6.4
gnu/dist/gdb6/gdb/shnbsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc64nbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/sparcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/tramp-frame.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/vaxbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/config/alpha/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/arm/nbsd.mt 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/arm/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/i386/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/m68k/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/mips/nbsd.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/powerpc/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/sh/nbsd.mh 1.1.1.1.6.2
gnu/dist/gdb6/gdb/config/sh/tm-nbsd.h 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/vax/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/opcodes/configure 1.1.1.2.6.1
gnu/dist/gdb6/opcodes/configure.in 1.1.1.2.6.1
gnu/usr.bin/Makefile 1.126.4.1
gnu/usr.bin/gdb6/arch/alpha/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/alpha/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/init.c 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/nm.h 1.2.6.1
gnu/usr.bin/gdb6/arch/arm/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/arm/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/defs.mk 1.1.6.3
gnu/usr.bin/gdb6/arch/armeb/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/i386/defs.mk 1.4.4.1
gnu/usr.bin/gdb6/arch/i386/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68k/defs.mk 1.1.4.1
gnu/usr.bin/gdb6/arch/m68k/init.c 1.1.4.1
gnu/usr.bin/gdb6/arch/mipseb/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/mipseb/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/mipseb/init.c 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/config.h 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/defs.mk 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/init.c 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/tm.h 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/version.c 1.2.6.2
gnu/usr.bin/gdb6/arch/powerpc/defs.mk 1.3.6.1
gnu/usr.bin/gdb6/arch/powerpc/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/sh3eb/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3eb/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3eb/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3eb/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3el/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3el/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3el/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sparc/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/sparc64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc64/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/x86_64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/x86_64/init.c 1.1.6.1
gnu/usr.bin/gdb6/bfd/arch/armeb/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/vax/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/gdb/Makefile 1.5.2.1.2.2
gnu/usr.bin/gdb6/gdbtui/Makefile 1.2.6.1
gnu/usr.bin/gdb6/libiberty/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/sim/arch/mipseb/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/defs.mk 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/defs.mk 1.1.2.1
lib/libkvm/kvm_sparc64.c 1.10.18.2
lib/libpthread/pthread.c 1.48.6.4
lib/libpthread/pthread_barrier.c 1.6.18.1
lib/libpthread/pthread_cond.c 1.18.12.2
lib/libpthread/pthread_debug.h 1.8.18.1
lib/libpthread/pthread_int.h 1.34.4.5
lib/libpthread/pthread_lock.c 1.14.6.1
lib/libpthread/pthread_mutex.c 1.22.4.2
lib/libpthread/pthread_run.c 1.18.12.4
lib/libpthread/pthread_rwlock.c 1.13.6.2
lib/libpthread/pthread_sa.c 1.37.6.5
lib/libpthread/pthread_sig.c 1.47.4.8
lib/libpthread/pthread_sleep.c 1.7.6.2
lib/libpthread/sem.c 1.9.6.2
lib/libpthread/arch/sh3/pthread_md.h 1.3.6.1
regress/lib/libpthread/resolv/Makefile 1.1.12.1
regress/lib/libpthread/sigrunning/Makefile 1.1.2.1
regress/lib/libpthread/sigrunning/sigrunning.c 1.1.2.1
share/mk/bsd.own.mk 1.489.4.3
sys/arch/amd64/amd64/locore.S 1.18.14.1
sys/arch/amd64/amd64/machdep.c 1.44.2.3.2.1
sys/arch/amd64/conf/kern.ldscript 1.1.70.1
sys/arch/cats/conf/Makefile.cats.inc 1.17.30.1
sys/arch/shark/conf/Makefile.shark.inc 1.6.30.1
sys/arch/sparc64/conf/kern.ldscript 1.7.26.2
sys/arch/sparc64/conf/kern32.ldscript 1.6.26.2
sys/arch/sparc64/include/kcore.h 1.4.92.2
sys/arch/sparc64/sparc64/locore.s 1.232.4.4
sys/arch/sparc64/sparc64/machdep.c 1.193.4.3
sys/arch/sparc64/sparc64/pmap.c 1.184.2.1.2.4
sys/conf/newvers.sh 1.42.26.2
sys/kern/kern_sa.c 1.87.4.11
sys/kern/kern_synch.c 1.173.4.2
sys/sys/savar.h 1.20.10.2
tools/gdb/Makefile 1.9.4.1
tools/gdb/mknative-gdb 1.1.6.1

pullup the wrstuden-fixsa CVS branch to netbsd-4:
toolchain/35540 - GDB 6 support for pthreads.
port-sparc64/37534 - ktrace firefox gives
kernel trap 30: data access expection
GDB changes:
- delete gdb53
- enable gdb6 on all architectures
- add support for amd64 crash dumps
- add support for sparc64 crash dumps
- add support for /proc pid to executable filename for all archs
- enable thread support for all architectures
- add a note section to kernels to all platforms
- support detection/unwinding of signals for most architectures.
- Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT on sh3.
- Apply fix from binutils-current so that sparc gdb can be cross built
on a 64bit host.
SA/pthread changes:
Pre-allocate memory needed for event delivery. Eliminates dropped
interrupts under load.
Deliver intra-process signals to running threads
Eliminate some deadlock scenarios
Fix intra-process signal delivery when delivering to a thread waiting
for signals. Makes afs work again!
 1.7.24.1 05-Jun-2007  bouyer Pull up following revision(s) (requested by martin in ticket #700):
sys/arch/sparc64/conf/kern32.ldscript: revision 1.8
sys/arch/sparc64/conf/kern.ldscript: revision 1.9
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.63
instead of specifying the start of the data section in the makefile,
just round it up to the next 4MB boundary in the ldscript.
this prevents parts of the kernel-image range from being left unmapped.
fixes PR 36388.
 1.7.22.1 10-Dec-2006  yamt sync with head.
 1.7.20.1 12-Jan-2007  ad Sync with head.
 1.8.14.1 26-Jun-2007  garbled Sync with HEAD.
 1.8.8.1 11-Jul-2007  mjf Sync with head.
 1.8.6.1 09-Jun-2007  ad Sync with head.
 1.9.10.1 06-Nov-2007  matt sync with HEAD
 1.10.42.1 03-Jul-2010  rmind sync with head
 1.10.40.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.10.20.1 11-Aug-2010  yamt sync with head.
 1.11.36.1 22-Sep-2015  skrll Sync with HEAD
 1.11.18.1 03-Dec-2017  jdolecek update from HEAD
 1.18 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.17 25-Mar-2016  nakayama Fix probably a typo.
 1.16 25-Aug-2015  uebayasi Don't expand unwanted symbols by cpp(1).
 1.15 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.14 22-Aug-2015  uebayasi .rel/.rela should not be generated in kernels.
 1.13 22-Aug-2015  uebayasi .init/.fini/.ctors/.dtors should be irrelevant to kernels.
 1.12 21-Aug-2015  uebayasi I bet setting search-directory for ld.so is useless in any kernel.
 1.11 20-Aug-2015  uebayasi Indent with 2 spaces.
 1.10 01-Jun-2010  mjf branches: 1.10.18; 1.10.36;
Add __cacheline_aligned and __read_mostly annotations.

These annotations help to mitigate false sharing on multiprocessor
systems.

Variables annotated with __cacheline_aligned are placed into the
.data.cacheline_aligned section in the kernel. Each item in this
section is aligned on a cachline boundary - this avoids false
sharing. Highly contended global locks are a good candidate for
__cacheline_aligned annotation.

Variables annotated with __read_mostly are packed together tightly
into a .data.read_mostly section in the kernel. The idea here is that
we can pack infrequently modified data items into a cacheline and
avoid having to purge the cache, which would happen if read mostly
data and write mostly data shared a cachline. Initialisation variables
are a prime candiate for __read_mostly annotations.
 1.9 17-Oct-2007  garbled branches: 1.9.20; 1.9.40; 1.9.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.8 04-Jun-2007  chs branches: 1.8.10;
instead of specifying the start of the data section in the makefile,
just round it up to the next 4MB boundary in the ldscript.
this prevents parts of the kernel-image range from being left unmapped.
fixes PR 36388.
 1.7 05-Dec-2006  martin branches: 1.7.6; 1.7.8; 1.7.14;
Enable the .note.netbsd section
 1.6 11-Dec-2005  christos branches: 1.6.20; 1.6.22; 1.6.24; 1.6.26;
merge ktrace-lwp.
 1.5 24-May-2004  martin branches: 1.5.12;
Back to SIZEOF_HEADERS.
 1.4 23-May-2004  martin Use 1024 instead of SIZEOF_HEADERS for now.
 1.3 16-May-2002  thorpej branches: 1.3.2; 1.3.10;
* 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.2 06-May-2002  eeh Provide pci_cd if needed.
 1.1 04-Mar-2001  mrg branches: 1.1.4; 1.1.6; 1.1.10;
deal with 32 bit kernels.
 1.1.10.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.1.4.1 04-Mar-2001  bouyer file kern32.ldscript was added on branch thorpej_scsipi on 2001-03-12 13:29:28 +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.3.2.2 16-May-2002  thorpej * 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.3.2.1 16-May-2002  thorpej file kern32.ldscript was added on branch gehenna-devsw on 2002-05-16 01:01:42 +0000
 1.5.12.2 03-Sep-2007  yamt sync with head.
 1.5.12.1 30-Dec-2006  yamt sync with head.
 1.6.26.2 08-Nov-2007  skrll Keep the NetBSD note section.
 1.6.26.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.6.24.2 16-Sep-2008  bouyer Sync with the following revisions (requested by skrll in ticket #1196):
gnu/dist/gdb removed
gnu/usr.bin/gdb53 removed
distrib/cats/instkernel/Makefile 1.14.6.1
gnu/dist/gdb6/bfd/config.bfd 1.3.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.c 1.1.1.2.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/Makefile.in 1.2.2.1.2.2
gnu/dist/gdb6/gdb/alpha-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alpha-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/alphabsd-nat.h 1.1.2.1
gnu/dist/gdb6/gdb/alphabsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphanbsd-nat.c 1.1.2.1
gnu/dist/gdb6/gdb/alphanbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64nbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/amd64nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/arm-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/armbsd-tdep.c 1.1.2.1
gnu/dist/gdb6/gdb/armnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/armnbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure.ac 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/m68kbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/mipsnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/nbsd-thread.c 1.1.2.3
gnu/dist/gdb6/gdb/ppcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/ppcnbsd-tdep.c 1.3.6.1
gnu/dist/gdb6/gdb/sh-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/shnbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/shnbsd-tdep.c 1.1.1.2.6.4
gnu/dist/gdb6/gdb/shnbsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc64nbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/sparcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/tramp-frame.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/vaxbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/config/alpha/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/arm/nbsd.mt 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/arm/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/i386/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/m68k/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/mips/nbsd.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/powerpc/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/sh/nbsd.mh 1.1.1.1.6.2
gnu/dist/gdb6/gdb/config/sh/tm-nbsd.h 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/vax/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/opcodes/configure 1.1.1.2.6.1
gnu/dist/gdb6/opcodes/configure.in 1.1.1.2.6.1
gnu/usr.bin/Makefile 1.126.4.1
gnu/usr.bin/gdb6/arch/alpha/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/alpha/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/init.c 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/nm.h 1.2.6.1
gnu/usr.bin/gdb6/arch/arm/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/arm/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/defs.mk 1.1.6.3
gnu/usr.bin/gdb6/arch/armeb/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/i386/defs.mk 1.4.4.1
gnu/usr.bin/gdb6/arch/i386/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68k/defs.mk 1.1.4.1
gnu/usr.bin/gdb6/arch/m68k/init.c 1.1.4.1
gnu/usr.bin/gdb6/arch/mipseb/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/mipseb/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/mipseb/init.c 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/config.h 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/defs.mk 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/init.c 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/tm.h 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/version.c 1.2.6.2
gnu/usr.bin/gdb6/arch/powerpc/defs.mk 1.3.6.1
gnu/usr.bin/gdb6/arch/powerpc/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/sh3eb/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3eb/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3eb/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3eb/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3el/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3el/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3el/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sparc/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/sparc64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc64/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/x86_64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/x86_64/init.c 1.1.6.1
gnu/usr.bin/gdb6/bfd/arch/armeb/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/vax/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/gdb/Makefile 1.5.2.1.2.2
gnu/usr.bin/gdb6/gdbtui/Makefile 1.2.6.1
gnu/usr.bin/gdb6/libiberty/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/sim/arch/mipseb/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/defs.mk 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/defs.mk 1.1.2.1
lib/libkvm/kvm_sparc64.c 1.10.18.2
lib/libpthread/pthread.c 1.48.6.4
lib/libpthread/pthread_barrier.c 1.6.18.1
lib/libpthread/pthread_cond.c 1.18.12.2
lib/libpthread/pthread_debug.h 1.8.18.1
lib/libpthread/pthread_int.h 1.34.4.5
lib/libpthread/pthread_lock.c 1.14.6.1
lib/libpthread/pthread_mutex.c 1.22.4.2
lib/libpthread/pthread_run.c 1.18.12.4
lib/libpthread/pthread_rwlock.c 1.13.6.2
lib/libpthread/pthread_sa.c 1.37.6.5
lib/libpthread/pthread_sig.c 1.47.4.8
lib/libpthread/pthread_sleep.c 1.7.6.2
lib/libpthread/sem.c 1.9.6.2
lib/libpthread/arch/sh3/pthread_md.h 1.3.6.1
regress/lib/libpthread/resolv/Makefile 1.1.12.1
regress/lib/libpthread/sigrunning/Makefile 1.1.2.1
regress/lib/libpthread/sigrunning/sigrunning.c 1.1.2.1
share/mk/bsd.own.mk 1.489.4.3
sys/arch/amd64/amd64/locore.S 1.18.14.1
sys/arch/amd64/amd64/machdep.c 1.44.2.3.2.1
sys/arch/amd64/conf/kern.ldscript 1.1.70.1
sys/arch/cats/conf/Makefile.cats.inc 1.17.30.1
sys/arch/shark/conf/Makefile.shark.inc 1.6.30.1
sys/arch/sparc64/conf/kern.ldscript 1.7.26.2
sys/arch/sparc64/conf/kern32.ldscript 1.6.26.2
sys/arch/sparc64/include/kcore.h 1.4.92.2
sys/arch/sparc64/sparc64/locore.s 1.232.4.4
sys/arch/sparc64/sparc64/machdep.c 1.193.4.3
sys/arch/sparc64/sparc64/pmap.c 1.184.2.1.2.4
sys/conf/newvers.sh 1.42.26.2
sys/kern/kern_sa.c 1.87.4.11
sys/kern/kern_synch.c 1.173.4.2
sys/sys/savar.h 1.20.10.2
tools/gdb/Makefile 1.9.4.1
tools/gdb/mknative-gdb 1.1.6.1

pullup the wrstuden-fixsa CVS branch to netbsd-4:
toolchain/35540 - GDB 6 support for pthreads.
port-sparc64/37534 - ktrace firefox gives
kernel trap 30: data access expection
GDB changes:
- delete gdb53
- enable gdb6 on all architectures
- add support for amd64 crash dumps
- add support for sparc64 crash dumps
- add support for /proc pid to executable filename for all archs
- enable thread support for all architectures
- add a note section to kernels to all platforms
- support detection/unwinding of signals for most architectures.
- Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT on sh3.
- Apply fix from binutils-current so that sparc gdb can be cross built
on a 64bit host.
SA/pthread changes:
Pre-allocate memory needed for event delivery. Eliminates dropped
interrupts under load.
Deliver intra-process signals to running threads
Eliminate some deadlock scenarios
Fix intra-process signal delivery when delivering to a thread waiting
for signals. Makes afs work again!
 1.6.24.1 05-Jun-2007  bouyer Pull up following revision(s) (requested by martin in ticket #700):
sys/arch/sparc64/conf/kern32.ldscript: revision 1.8
sys/arch/sparc64/conf/kern.ldscript: revision 1.9
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.63
instead of specifying the start of the data section in the makefile,
just round it up to the next 4MB boundary in the ldscript.
this prevents parts of the kernel-image range from being left unmapped.
fixes PR 36388.
 1.6.22.1 10-Dec-2006  yamt sync with head.
 1.6.20.1 12-Jan-2007  ad Sync with head.
 1.7.14.1 26-Jun-2007  garbled Sync with HEAD.
 1.7.8.1 11-Jul-2007  mjf Sync with head.
 1.7.6.1 09-Jun-2007  ad Sync with head.
 1.8.10.1 06-Nov-2007  matt sync with HEAD
 1.9.42.1 03-Jul-2010  rmind sync with head
 1.9.40.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.20.1 11-Aug-2010  yamt sync with head.
 1.10.36.2 22-Apr-2016  skrll Sync with HEAD
 1.10.36.1 22-Sep-2015  skrll Sync with HEAD
 1.10.18.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 29-Jun-2021  nia Remove uscanner(4) driver

This exists for compatibility with a Linux interface which was apparently
deprecated in Linux 2.6. There are various mailing list threads going
back to 2004 where the usefulness of this driver is discussed, but
the conclusion is that scanner software has all moved to using ugen(4)
instead, and enabling this driver will not help you scan things.
 1.39 04-Apr-2020  jdolecek branches: 1.39.8;
mark nsmb major obsolete
 1.38 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.37 28-Jan-2019  dholland branches: 1.37.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.36 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.35 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.34 26-Mar-2017  martin branches: 1.34.12; 1.34.14;
Assign majors for ld(4)
 1.33 23-Apr-2015  pgoyette branches: 1.33.2; 1.33.4;
Update device dependency information - the sysmon major device now depends on the sysmon module itself, not on the individual components.
 1.32 30-Jun-2011  wiz branches: 1.32.12; 1.32.30;
dependant -> dependent
 1.31 06-Mar-2010  plunky use a MI major number for uhso(4) driver
(requested by mrg)
 1.30 06-Mar-2010  plunky add major device for usho(4) driver
 1.29 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.28 31-Dec-2007  ad branches: 1.28.6; 1.28.10; 1.28.16; 1.28.18;
Remove systrace. Ok core@.
 1.27 24-Nov-2006  wiz branches: 1.27.28; 1.27.34; 1.27.42;
s/independant/independent/, from Zafer.
 1.26 11-Dec-2005  christos branches: 1.26.16; 1.26.20; 1.26.22;
merge ktrace-lwp.
 1.25 17-Sep-2005  yamt make VMSWAP optional again.
 1.24 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.23 30-Jul-2005  yamt defflag VMSWAP.
 1.22 13-Jul-2005  kiyohara obsolete fwiso.
 1.21 03-Jun-2005  blymn branches: 1.21.2;
Removed verified exec major, now a MI one.
 1.20 13-Sep-2004  drochner branches: 1.20.10;
add "joy"
 1.19 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.18 10-Dec-2003  jmc Change reference at bottom from sys/dev/majors to sys/conf/majors to match
reality
 1.17 07-Dec-2003  christos add altq
 1.16 10-Oct-2003  jdolecek reassing majors for crypto and pf to use the newly defined MI major
range
 1.15 10-Oct-2003  jdolecek update the comment - the space for machine-dependant majors
is reduced to 0-143
follows discussion on tech-kern
 1.14 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.13 22-Aug-2003  itojun create /dev/crypto
 1.12 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.11 08-Aug-2003  rafal Add major 85 for radio(4).
 1.10 27-Jul-2003  itojun reserve cdev major # for PF. ok'ed by technical-exec
 1.9 25-Apr-2003  ragge branches: 1.9.2;
Add ksyms device major.
 1.8 20-Apr-2003  martin Add sysmon device.
 1.7 20-Feb-2003  martin Add a few new devices.
 1.6 24-Nov-2002  martin Assign a major number for "lpt* at ebus?".
 1.5 16-Oct-2002  petrov Add wscons devices, sync with sparc.
 1.4 04-Oct-2002  elric branches: 1.4.2;
assign majors for raw and cooked cgd's.
 1.3 28-Sep-2002  martin Add entries for various USB character devices.
From Takeshi Nakayama in PR 18450.
 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.sparc64 was initially added on branch gehenna-devsw.
 1.1.2.5 31-Aug-2002  gehenna rename device switch prefix for sabtty.
 1.1.2.4 31-Aug-2002  gehenna catch up with -current.
 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.sparc64 was added on branch nathanw_sa on 2002-09-17 21:17:54 +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.sparc64 was added on branch kqueue on 2002-10-10 18:36:31 +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.20.10.1 10-Jun-2005  tron Pull up revision 1.21 (requested by elad in ticket #389):
Removed verified exec major, now a MI one.
 1.21.2.3 21-Jan-2008  yamt sync with head
 1.21.2.2 30-Dec-2006  yamt sync with head.
 1.21.2.1 21-Jun-2006  yamt sync with head.
 1.26.22.1 10-Dec-2006  yamt sync with head.
 1.26.20.1 12-Jan-2007  ad Sync with head.
 1.26.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.27.42.1 02-Jan-2008  bouyer Sync with HEAD
 1.27.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.27.28.1 09-Jan-2008  matt sync with HEAD
 1.28.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.28.10.1 04-May-2009  yamt sync with head.
 1.28.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.32.30.2 28-Aug-2017  skrll Sync with HEAD
 1.32.30.1 06-Jun-2015  skrll Sync with HEAD
 1.32.12.1 03-Dec-2017  jdolecek update from HEAD
 1.33.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.33.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.34.14.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.34.14.1 10-Jun-2019  christos Sync with HEAD
 1.34.12.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.34.12.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.37.6.1 29-Feb-2020  ad Sync with head.
 1.39.8.1 01-Aug-2021  thorpej Sync with HEAD.
 1.19 07-May-2015  mrg bump CHILD_MAX and OPEN_MAX defaults on several platforms, both to 1024.
 1.18 11-Dec-2008  alc branches: 1.18.24; 1.18.40; 1.18.42;
Import config(9) file and register HAL's files in the build machinery.
 1.17 03-Feb-2008  martin branches: 1.17.6; 1.17.10; 1.17.16; 1.17.18; 1.17.20; 1.17.26;
Adjust assembler in_cksum code to new signature and re-enable it.
 1.16 09-Oct-2006  tsutsui branches: 1.16.28; 1.16.34;
Update comment for recent reorganization of 64bit/32bit kernel configurations.
 1.15 30-Jun-2006  tsutsui branches: 1.15.4; 1.15.6;
Make GENERIC config really generic and change GENERIC32 config for 32 bit
compat kernel to include the GENERIC and use "no" keywords of config(1).
Also merge std.sparc64-64 into std.sparc64 and prepare std.sparc64-32
which uses "no" keywords for 32 bit kernels. OK'ed by mrg.
 1.14 05-Apr-2006  gdamore branches: 1.14.4;
Rename AH_DEBUG, AH_ASSERT, and AH_DEBUG_ALQ to ATH_XXX.
Use the opt_ah.h for the provided HAL to get options like AH_REGOPS_FUNC.
Add AH_REGOPS_FUNC to a few opt_ah.h that don't have it in this version
of the HAL but need it. (The next version from Sam should have this fixed
in it. If it doesn't, then we'll have to take care at import time.)

Ultimately, this should make future imports even easier, and individual ports
should not have to worry about whether AH_REGOPS_FUNC is properly defined or
not, since the opt_ah.h will just take care of it automatically.

Ok'd by dyoung@.
 1.13 02-Mar-2006  martin branches: 1.13.2; 1.13.4; 1.13.6;
Add glue to make ath* usable on sparc64.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6;
merge ktrace-lwp.
 1.11 17-Sep-2005  yamt include "conf/std".
 1.10 24-Oct-2001  thorpej branches: 1.10.2; 1.10.18; 1.10.34;
Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.9 23-Oct-2001  thorpej branches: 1.9.2;
No need to explictly set MACHINE any more; config(8) does it.
 1.8 22-Jun-2000  fvdl branches: 1.8.4;
Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.7 19-Jun-2000  eeh branches: 1.7.2;
Have separate data and text segments, make text read-only.
 1.6 15-Nov-1999  fvdl branches: 1.6.2;
Add

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

to all std.* files, so that soft dependencies can be activated using
"options SOFTDEP".
 1.5 23-May-1999  mrg branches: 1.5.2; 1.5.8;
UVM is not an option these days.
 1.4 27-Mar-1999  eeh branches: 1.4.4;
We don't have a default binary format: EXEC_AOUT is used for NetBSD/sparc pre 1.4,
EXEC_ELF64 is used for NetBSD/sparc64, and EXEC_ELF32 is used for NetBSD/sparc_elf.

We really need a way to turn these on and off depending on whether we're building
a 32-bit or 64-bit kernel...
 1.3 24-Mar-1999  mrg clean up kernel/config files files for machVM lossage.
 1.2 26-Aug-1998  mrg - use UVM by default.
- clean up the Makefile a bit to be less solaris-centric :)
- add support for compat_sparc32 (32bit compat module for NetBSD/sparc). this
isn't yet fully tested but it mostly written and compiles if not totally
links yet.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.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.8.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.10.34.3 04-Feb-2008  yamt sync with head.
 1.10.34.2 30-Dec-2006  yamt sync with head.
 1.10.34.1 21-Jun-2006  yamt sync with head.
 1.10.18.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.2 24-Oct-2001  thorpej Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.10.2.1 24-Oct-2001  thorpej file std.sparc64 was added on branch nathanw_sa on 2001-10-24 18:49:41 +0000
 1.12.6.1 22-Apr-2006  simonb Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.13.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.13.2.2 11-Aug-2006  yamt sync with head
 1.13.2.1 11-Apr-2006  yamt sync with head
 1.14.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.15.6.1 22-Oct-2006  yamt sync with head
 1.15.4.1 18-Nov-2006  ad Sync with head.
 1.16.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.16.28.1 23-Mar-2008  matt sync with HEAD
 1.17.26.1 21-Apr-2010  matt sync to netbsd-5
 1.17.20.1 07-Aug-2009  snj Apply patch (requested by jmcneill in ticket 775):
Update to the open source atheros HAL.
 1.17.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.17.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.17.10.1 04-May-2009  yamt sync with head.
 1.17.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.18.42.1 06-Jun-2015  skrll Sync with HEAD
 1.18.40.1 09-May-2015  snj Pull up following revision(s) (requested by mrg in ticket #741):
sys/arch/aarch64/conf/std.aarch64: revision 1.2
sys/arch/amd64/conf/std.amd64: revision 1.10
sys/arch/evbarm/conf/std.evbarm: revision 1.4
sys/arch/evbarm64/conf/std.evbarm64: revision 1.2
sys/arch/i386/conf/std.i386: revision 1.34
sys/arch/sparc64/conf/std.sparc64: revision 1.19
bump CHILD_MAX and OPEN_MAX defaults on several platforms, both to 1024.
 1.18.24.1 03-Dec-2017  jdolecek update from HEAD
 1.5 09-May-2015  mrg revert previous.
 1.4 07-May-2015  mrg bump CHILD_MAX and OPEN_MAX defaults on several platforms, both to 1024.
 1.3 11-Dec-2008  nakayama branches: 1.3.42;
Revert previous.

This file is included after std.sparc64, so no need to include Atheros HAL
options in this file.
 1.2 11-Dec-2008  alc Import config(9) file and register HAL's files in the build machinery.
 1.1 30-Jun-2006  tsutsui branches: 1.1.2; 1.1.6; 1.1.10; 1.1.16; 1.1.76; 1.1.78; 1.1.80; 1.1.86;
Make GENERIC config really generic and change GENERIC32 config for 32 bit
compat kernel to include the GENERIC and use "no" keywords of config(1).
Also merge std.sparc64-64 into std.sparc64 and prepare std.sparc64-32
which uses "no" keywords for 32 bit kernels. OK'ed by mrg.
 1.1.86.1 21-Apr-2010  matt sync to netbsd-5
 1.1.80.2 07-Aug-2009  snj Pull up following revision(s) (requested by nakayama in ticket #906):
sys/arch/sparc64/conf/std.sparc64-32: revision 1.3
Revert previous.
This file is included after std.sparc64, so no need to include Atheros HAL
options in this file.
 1.1.80.1 07-Aug-2009  snj Apply patch (requested by jmcneill in ticket 775):
Update to the open source atheros HAL.
 1.1.78.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.76.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.16.2 30-Dec-2006  yamt sync with head.
 1.1.16.1 30-Jun-2006  yamt file std.sparc64-32 was added on branch yamt-lazymbuf on 2006-12-30 20:47:02 +0000
 1.1.10.2 09-Sep-2006  rpaulo sync with head
 1.1.10.1 30-Jun-2006  rpaulo file std.sparc64-32 was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:43:36 +0000
 1.1.6.2 11-Aug-2006  yamt sync with head
 1.1.6.1 30-Jun-2006  yamt file std.sparc64-32 was added on branch yamt-pdpolicy on 2006-08-11 15:43:00 +0000
 1.1.2.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.2.1 30-Jun-2006  gdamore file std.sparc64-32 was added on branch gdamore-uart on 2006-07-13 17:49:04 +0000
 1.3.42.1 06-Jun-2015  skrll Sync with HEAD
 1.2 30-Jun-2006  tsutsui Make GENERIC config really generic and change GENERIC32 config for 32 bit
compat kernel to include the GENERIC and use "no" keywords of config(1).
Also merge std.sparc64-64 into std.sparc64 and prepare std.sparc64-32
which uses "no" keywords for 32 bit kernels. OK'ed by mrg.
 1.1 24-Oct-2001  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.38; 1.1.52; 1.1.56; 1.1.64;
Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.1.64.1 13-Jul-2006  gdamore Merge from HEAD.
 1.1.56.1 11-Aug-2006  yamt sync with head
 1.1.52.1 09-Sep-2006  rpaulo sync with head
 1.1.38.1 30-Dec-2006  yamt sync with head.
 1.1.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.1 24-Oct-2001  thorpej file std.sparc64-64 was added on branch kqueue on 2002-01-10 19:49:13 +0000
 1.1.4.2 24-Oct-2001  thorpej Clean up the 32-bit vs. 64-bit kernel configuration stuff:
- Put all options necessary to build a 64-bit kernel into std.sparc64-64,
which can be included after std.sparc64.
- Change the logic used to enable 64-bit kernels. The kernel Makefile now
uses an LP64 make variable, and explicitly sets compiler flags and linker
scripts to generate 32-bit or 64-bit kernels.
 1.1.4.1 24-Oct-2001  thorpej file std.sparc64-64 was added on branch nathanw_sa on 2001-10-24 18:49:41 +0000
 1.1.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.2.1 24-Oct-2001  thorpej file std.sparc64-64 was added on branch thorpej-mips-cache on 2001-11-12 21:17:35 +0000
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.27 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.26 14-Oct-2016  mlelstv the mutex is also used for fdc attachment, so initialize it also
for a kernel without BLINK option.
 1.25 06-Oct-2015  martin branches: 1.25.2;
Split auxio at ebus and auxio at sbus properly, so we can build kernels
without sbus support.
 1.24 24-Aug-2015  mrg convert auxio(4) to use a mutex for exclusion (this existing code didn't
really work for MP systems, anyway -- it only went to splhigh.)

various cleanups:
- remove unused AUXIO_SBUS
- make most functions static
- introduce auxio_{read,write}_led() frontends
- avoid a potential NULL deref in auxio_fd_control()

the text is 32 bytes smaller.
 1.23 11-Jul-2015  kamil Improve spelling: regsiter -> register

This change is non-functional.

Approved by <riastradh>, <pgoyette>
 1.22 02-Jun-2011  christos branches: 1.22.12; 1.22.30;
split auxio, ebus, psycho, sab.
 1.21 12-Mar-2011  nakayama branches: 1.21.2;
Remove implicit include <dev/sbus/sbusvar.h> from autoconf.h, and
add it explicitly in files depending on it.
 1.20 13-Jun-2008  cegger branches: 1.20.18; 1.20.24;
use device_lookup_private to get softc
 1.19 29-May-2008  mrg branches: 1.19.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 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 09-Jul-2007  ad branches: 1.17.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.16 06-Oct-2006  jnemeth branches: 1.16.8; 1.16.10; 1.16.16;
Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.15 13-Feb-2006  cdi branches: 1.15.14; 1.15.16;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.14 11-Dec-2005  christos branches: 1.14.2; 1.14.4; 1.14.6;
merge ktrace-lwp.
 1.13 14-Oct-2004  bouyer branches: 1.13.12;
In auxio_blink(), only toggle the AUXIO_LED_LED bit, don't clear the others.
It looks like bit 3 control the on-board le's link test, clearing it breaks
the interface (no link detected on the remote end). bit 3 is defined as
AUXIO4M_LTE (link-test enable) for sun4m systems (maybe all the AUXIO4M_*
bits are valid on the Ultra/1 too ?).
Tested on Ultra/1 and Ultra/5, approved by Martin Husemann and Matthew Green.
Should fix port-sparc64/25039 by Lubomir Sedlacik.
 1.12 29-Sep-2004  mrg allow the LED blinker to be disabled via do_blink.
 1.11 15-Jul-2003  lukem branches: 1.11.4;
__KERNEL_RCSID()
 1.10 16-Jun-2003  heas branches: 1.10.2;
Define option BLINK in option file opt_auxio.h and include it in auxio.c.
approved by martin@
 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 21-Mar-2002  eeh Add missing brace.
 1.5 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.4 16-Mar-2002  mrg convert to using <dev/ebus/ebusvar.h> and it's struct member names.
 1.3 23-Oct-2001  pooka branches: 1.3.4;
declare variable used only with BLINK inside #ifdef BLINK to avoid
unused variable warning
 1.2 22-Oct-2001  mrg implement `options BLINK' for sparc64 for ebus & sbus. tested on a U2
(sbus) and a U5 (ebus).
 1.1 15-Apr-2000  mrg branches: 1.1.6; 1.1.10;
- auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.1.10.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 15-Apr-2000  bouyer file auxio.c was added on branch thorpej_scsipi on 2000-11-20 20:26:41 +0000
 1.3.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.3.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.4.1 23-Oct-2001  nathanw file auxio.c was added on branch nathanw_sa on 2002-04-01 07:42:59 +0000
 1.10.2.4 19-Oct-2004  skrll 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.4.1 16-Jan-2005  he Pull up revision 1.13 (requested by bouyer in ticket #924):
In auxio_blink(), only toggle the AUXIO_LED_LED bit, don't
clear the others. It looks like bit 3 control the on-board
le's link test, clearing it breaks the interface (no link
detected on the remote end). Bit 3 is defined as AUXIO4M_LTE
(link-test enable) for sun4m systems (maybe all the AUXIO4M_*
bits are valid on the Ultra/1 too?).
Tested on Ultra/1 and Ultra/5. Fixes PR#25039.
 1.13.12.3 03-Sep-2007  yamt sync with head.
 1.13.12.2 30-Dec-2006  yamt sync with head.
 1.13.12.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.15.16.1 22-Oct-2006  yamt sync with head
 1.15.14.1 18-Nov-2006  ad Sync with head.
 1.16.16.1 03-Oct-2007  garbled Sync with HEAD
 1.16.10.1 11-Jul-2007  mjf Sync with head.
 1.16.8.1 15-Jul-2007  ad Sync with head.
 1.17.10.1 06-Nov-2007  matt sync with HEAD
 1.18.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.20.1 04-May-2009  yamt sync with head.
 1.18.18.2 17-Jun-2008  yamt sync with head.
 1.18.18.1 04-Jun-2008  yamt sync with head
 1.18.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.18.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.2.1 18-Jun-2008  simonb Sync with head.
 1.20.24.1 06-Jun-2011  jruoho Sync with HEAD.
 1.20.18.2 12-Jun-2011  rmind sync with head
 1.20.18.1 21-Apr-2011  rmind sync with head
 1.21.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.22.30.3 05-Dec-2016  skrll Sync with HEAD
 1.22.30.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.22.30.1 22-Sep-2015  skrll Sync with HEAD
 1.22.12.1 03-Dec-2017  jdolecek update from HEAD
 1.25.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.7 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.6 06-Oct-2015  martin branches: 1.6.2; 1.6.18;
Split auxio at ebus and auxio at sbus properly, so we can build kernels
without sbus support.
 1.5 15-Apr-2000  mrg - auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.4 13-Apr-2000  mrg store all the physical address bits.
 1.3 08-Apr-2000  mrg actually, i wrote these in 2000
 1.2 05-Apr-2000  mrg correct a message
 1.1 05-Apr-2000  mrg driver for the PCI/ebus AUXIO registers.
 1.6.18.2 03-Dec-2017  jdolecek update from HEAD
 1.6.18.1 06-Oct-2015  jdolecek file auxio_ebus.c was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.6.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.6.2.1 06-Oct-2015  skrll file auxio_ebus.c was added on branch nick-nhusb on 2015-12-27 12:09:43 +0000
 1.2 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.1 06-Oct-2015  martin branches: 1.1.2; 1.1.18;
Split auxio at ebus and auxio at sbus properly, so we can build kernels
without sbus support.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 06-Oct-2015  jdolecek file auxio_sbus.c was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.1.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.1 06-Oct-2015  skrll file auxio_sbus.c was added on branch nick-nhusb on 2015-12-27 12:09:43 +0000
 1.8 11-Jul-2015  kamil Improve spelling: regsiter -> register

This change is non-functional.

Approved by <riastradh>, <pgoyette>
 1.7 29-May-2008  mrg branches: 1.7.42; 1.7.62;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.6 27-Mar-2007  jnemeth branches: 1.6.34; 1.6.36; 1.6.38; 1.6.40;
move definition of FTC_FLIP to auxioreg.h to mirror sparc
 1.5 06-Oct-2006  jnemeth branches: 1.5.4; 1.5.8; 1.5.10; 1.5.12;
Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.4 22-Oct-2001  mrg branches: 1.4.4; 1.4.36; 1.4.66; 1.4.68;
implement `options BLINK' for sparc64 for ebus & sbus. tested on a U2
(sbus) and a U5 (ebus).
 1.3 15-Apr-2000  mrg branches: 1.3.6; 1.3.10;
- auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.2 08-Apr-2000  mrg actually, i wrote these in 2000
 1.1 05-Apr-2000  mrg driver for the PCI/ebus AUXIO registers.
 1.3.10.1 10-Jan-2002  thorpej Sync kqueue branch 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 15-Apr-2000  bouyer file auxioreg.h was added on branch thorpej_scsipi on 2000-11-20 20:26:41 +0000
 1.4.68.1 22-Oct-2006  yamt sync with head
 1.4.66.1 18-Nov-2006  ad Sync with head.
 1.4.36.2 03-Sep-2007  yamt sync with head.
 1.4.36.1 30-Dec-2006  yamt sync with head.
 1.4.4.2 22-Oct-2001  mrg implement `options BLINK' for sparc64 for ebus & sbus. tested on a U2
(sbus) and a U5 (ebus).
 1.4.4.1 22-Oct-2001  mrg file auxioreg.h was added on branch nathanw_sa on 2001-10-22 07:31:42 +0000
 1.5.12.1 29-Mar-2007  reinoud Pullup to -current
 1.5.10.1 11-Jul-2007  mjf Sync with head.
 1.5.8.1 10-Apr-2007  ad Sync with head.
 1.5.4.1 15-Apr-2007  yamt sync with head.
 1.6.40.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.38.1 04-May-2009  yamt sync with head.
 1.6.36.1 04-Jun-2008  yamt sync with head
 1.6.34.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.62.1 22-Sep-2015  skrll Sync with HEAD
 1.7.42.1 03-Dec-2017  jdolecek update from HEAD
 1.8 06-Oct-2015  martin Split auxio at ebus and auxio at sbus properly, so we can build kernels
without sbus support.
 1.7 29-May-2008  mrg branches: 1.7.42; 1.7.62;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.6 06-Oct-2006  jnemeth branches: 1.6.52; 1.6.54; 1.6.56; 1.6.58;
Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.5 22-Oct-2001  mrg branches: 1.5.22; 1.5.40; 1.5.42;
implement `options BLINK' for sparc64 for ebus & sbus. tested on a U2
(sbus) and a U5 (ebus).
 1.4 15-Apr-2000  mrg branches: 1.4.6; 1.4.10;
- auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.3 13-Apr-2000  mrg store all the physical address bits.
 1.2 08-Apr-2000  mrg actually, i wrote these in 2000
 1.1 05-Apr-2000  mrg driver for the PCI/ebus AUXIO registers.
 1.4.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.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.4.6.1 15-Apr-2000  bouyer file auxiovar.h was added on branch thorpej_scsipi on 2000-11-20 20:26:42 +0000
 1.5.42.1 22-Oct-2006  yamt sync with head
 1.5.40.1 18-Nov-2006  ad Sync with head.
 1.5.22.1 30-Dec-2006  yamt sync with head.
 1.6.58.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.56.1 04-May-2009  yamt sync with head.
 1.6.54.1 04-Jun-2008  yamt sync with head
 1.6.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.62.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.7.42.1 03-Dec-2017  jdolecek update from HEAD
 1.6 23-Aug-2000  pk Brooktree DAC support now lives in sys/dev/sun.
 1.5 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 24-Mar-1999  mrg branches: 1.4.8; 1.4.18;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.3 11-Sep-1998  eeh Don't use fuword()/suword() -- can't count on their size.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.4.18.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.4.8.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 23-Aug-2000  pk Brooktree DAC support now lives in sys/dev/sun.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 23-Aug-2000  pk Brooktree DAC support now lives in sys/dev/sun.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.11 23-Aug-2000  pk These drivers are now in sys/dev/sun
 1.10 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.9 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.8 07-Jun-1999  eeh branches: 1.8.2; 1.8.12;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.7 05-Jun-1999  mrg catch up with probe[gs]et() changes.
 1.6 23-May-1999  eeh Start putting in hooks for non-zs console devices.
 1.5 05-Sep-1998  eeh branches: 1.5.8;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 05-Sep-1998  pk #include <dev/sbus/sbusvar.h>
 1.3 26-Aug-1998  mrg fix missed sparc -> sparc64
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.5.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.8.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 23-Aug-2000  pk These drivers are now in sys/dev/sun
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.8 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.7 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.6 10-May-2021  thorpej branches: 1.6.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.5 24-Apr-2021  thorpej branches: 1.5.2; 1.5.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.4 04-Jan-2021  thorpej branches: 1.4.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.3 10-Nov-2019  chs branches: 1.3.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.2 18-Jul-2016  palle branches: 1.2.14; 1.2.18;
sun4v: reset cbus debug back to zero
 1.1 22-Jun-2016  palle branches: 1.1.2; 1.1.4;
sun4v: add cbus driver - from OpenBSD
 1.1.4.1 26-Jul-2016  pgoyette Sync with HEAD
 1.1.2.3 05-Oct-2016  skrll Sync with HEAD
 1.1.2.2 09-Jul-2016  skrll Sync with HEAD
 1.1.2.1 22-Jun-2016  skrll file cbus.c was added on branch nick-nhusb on 2016-07-09 20:24:57 +0000
 1.2.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.14.2 03-Dec-2017  jdolecek update from HEAD
 1.2.14.1 18-Jul-2016  jdolecek file cbus.c was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.3.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.4.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.5.4.1 31-May-2021  cjep sync with head
 1.5.2.1 13-May-2021  thorpej Sync with HEAD.
 1.6.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.1 22-Jun-2016  palle branches: 1.1.2; 1.1.18;
sun4v: add cbus driver - from OpenBSD
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 22-Jun-2016  jdolecek file cbusvar.h was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.1.2.2 09-Jul-2016  skrll Sync with HEAD
 1.1.2.1 22-Jun-2016  skrll file cbusvar.h was added on branch nick-nhusb on 2016-07-09 20:24:57 +0000
 1.9 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.8 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.7 10-May-2021  thorpej branches: 1.7.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.6 24-Apr-2021  thorpej branches: 1.6.2; 1.6.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.5 04-Jan-2021  thorpej branches: 1.5.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.4 10-Nov-2019  chs branches: 1.4.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.3 18-Mar-2012  mrg branches: 1.3.40;
add missing __KERNEL_RCSID().
 1.2 01-Aug-2011  mrg branches: 1.2.2; 1.2.6;
use device_private(). thanks to jmcneill for pointing this out.
 1.1 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.2.6.1 05-Apr-2012  mrg sync to latest -current.
 1.2.2.1 17-Apr-2012  yamt sync with head
 1.3.40.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.5.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.6.4.1 31-May-2021  cjep sync with head
 1.6.2.1 13-May-2021  thorpej Sync with HEAD.
 1.7.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.1 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.7 22-Aug-2000  pk These devices will never be found on sun4u machines.
 1.6 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 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.4 05-Jun-1999  eeh branches: 1.4.2; 1.4.12;
Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.3 19-Nov-1998  mrg branches: 1.3.6;
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.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.3.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.4.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.8 22-Aug-2000  pk These devices will never be found on sun4u machines.
 1.7 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 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.5 05-Jun-1999  eeh branches: 1.5.2; 1.5.12;
Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.4 05-Jun-1999  mrg catch up with probe[gs]et() changes.
 1.3 19-Nov-1998  mrg branches: 1.3.6;
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.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.3.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.5.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.7 22-Aug-2000  pk These devices will never be found on sun4u machines.
 1.6 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 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.4 23-May-1999  eeh branches: 1.4.2; 1.4.12;
Start putting in hooks for non-zs console devices.
 1.3 19-Nov-1998  mrg branches: 1.3.6;
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.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.3.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.4.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 22-Aug-2000  pk These devices will never be found on sun4u machines.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 22-Aug-2000  pk These devices will never be found on sun4u machines.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.8 23-Jul-2001  eeh Get rid of a bunch of obsolete files.
 1.7 26-Aug-2000  eeh branches: 1.7.4;
Make 64-bit clean.
 1.6 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 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.4 24-Mar-1999  mrg branches: 1.4.8; 1.4.18;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.3 05-Sep-1998  pk #include <dev/sbus/sbusvar.h>
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.3 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.1.1.1.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.4.18.2 09-Sep-2000  eeh Pullup of 1.2 and 1.7 (approved by thorpej):

revision 1.7
date: 2000/08/26 16:02:06; author: eeh; state: Exp; lines: +5 -5
Make 64-bit clean.

revision 1.2
date: 2000/08/26 16:02:06; author: eeh; state: Exp; lines: +2 -2
Make 64-bit clean.
 1.4.18.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 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.7.4.1 03-Aug-2001  lukem update to -current
 1.5 23-Jul-2001  eeh Get rid of a bunch of obsolete files.
 1.4 29-Jun-2000  mrg branches: 1.4.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 25-Mar-1999  mrg branches: 1.3.8;
remove opt_uvm.h
 1.2 05-Sep-1998  pk #include <dev/sbus/sbusvar.h>
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.4.1 03-Aug-2001  lukem update to -current
 1.7 23-Jul-2001  eeh Get rid of a bunch of obsolete files.
 1.6 29-Jun-2000  mrg branches: 1.6.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 14-Apr-2000  mrg add some casts to (u_long) to shut up gcc. cleanup unused variables
 1.4 23-May-1999  eeh branches: 1.4.2;
Start putting in hooks for non-zs console devices.
 1.3 05-Sep-1998  pk branches: 1.3.8;
#include <dev/sbus/sbusvar.h>
 1.2 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.8.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.6.4.1 03-Aug-2001  lukem update to -current
 1.3 23-Jul-2001  eeh Get rid of a bunch of obsolete files.
 1.2 26-Aug-2000  eeh branches: 1.2.4;
Make 64-bit clean.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.24;
Import of sparc64.
 1.1.1.1.24.1 09-Sep-2000  eeh Pullup of 1.2 and 1.7 (approved by thorpej):

revision 1.7
date: 2000/08/26 16:02:06; author: eeh; state: Exp; lines: +5 -5
Make 64-bit clean.

revision 1.2
date: 2000/08/26 16:02:06; author: eeh; state: Exp; lines: +2 -2
Make 64-bit clean.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 03-Aug-2001  lukem update to -current
 1.2 23-Jul-2001  eeh Get rid of a bunch of obsolete files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28;
Import of sparc64.
 1.1.1.1.28.1 03-Aug-2001  lukem update to -current
 1.10 23-Aug-2000  pk These drivers are now in sys/dev/sun
 1.9 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.8 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.7 05-Jun-1999  eeh branches: 1.7.2; 1.7.12;
Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.6 05-Jun-1999  mrg catch up with probe[gs]et() changes.
 1.5 23-May-1999  eeh Start putting in hooks for non-zs console devices.
 1.4 19-Nov-1998  mrg branches: 1.4.6;
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.3 05-Sep-1998  pk #include <dev/sbus/sbusvar.h>
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.4.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.7.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 23-Aug-2000  pk These drivers are now in sys/dev/sun
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.7 22-Aug-2000  pk These devices will never be found on sun4u machines.
 1.6 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 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.4 05-Jun-1999  eeh branches: 1.4.2; 1.4.12;
Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.3 05-Jun-1999  mrg catch up with probe[gs]et() changes.
 1.2 13-Aug-1998  eeh branches: 1.2.8;
Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.4.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.36 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.35 24-Apr-2021  thorpej branches: 1.35.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.34 08-Dec-2018  thorpej branches: 1.34.14;
Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.33 01-Jul-2011  dyoung branches: 1.33.52; 1.33.54;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.32 02-Jun-2011  mrg also look for "FJSV,su" as found on PRIMEPOWER machines.
while here, copy some code from openbsd that should allow this to work
on the Fujitsu SPARC Enterprise Mx000 systems.
 1.31 15-Mar-2011  mrg branches: 1.31.2;
also attach for su16552 compatible devices.
 1.30 03-Jan-2010  jdc branches: 1.30.4; 1.30.6;
Match "rsc-console" and set its baud rate to 115200.
Makes the 501-5856 (RSC2) card usuable as console on a Fire 280R.
 1.29 14-Nov-2009  nakayama comcons in dev/ic/com.c is now declared as static, so don't peek it
directly but use it via cn_tab.

Tested on my Netra X1.
 1.28 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.27 14-Mar-2008  cube branches: 1.27.2; 1.27.4; 1.27.6;
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.26 13-Jul-2006  gdamore branches: 1.26.34; 1.26.54; 1.26.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.25 28-Mar-2006  thorpej branches: 1.25.4;
Use device_unit().
 1.24 11-Feb-2006  cdi branches: 1.24.2; 1.24.4; 1.24.6;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.23 11-Dec-2005  christos branches: 1.23.2; 1.23.4; 1.23.6;
merge ktrace-lwp.
 1.22 31-May-2005  christos branches: 1.22.2;
- sprinkle const
- avoid variable shadow
 1.21 21-Mar-2004  pk Use the promlib I/O routines.
 1.20 15-Jul-2003  lukem __KERNEL_RCSID()
 1.19 14-Jun-2003  thorpej branches: 1.19.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.18 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.17 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.16 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 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.13 18-Jul-2002  wiz Spell 'should' correctly.
 1.12 20-Mar-2002  eeh branches: 1.12.4;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.11 16-Mar-2002  mrg convert to using <dev/ebus/ebusvar.h> and it's struct member names.
 1.10 15-Mar-2002  eeh Get PCI working with the new bus_space*.
 1.9 01-Mar-2002  martin Rename EBUS_PADDR_FROM_REG uses to EBUS_ADDR_FROM_REG.
 1.8 22-Oct-2001  mrg branches: 1.8.4;
use <dev/ebus/ebusreg.h>
 1.7 02-Oct-2001  eeh Handle the situation where console input and console output go to different
devices. (N.B. The com driver does not handle different instances as input
and output devices, so this only works for two different drivers.)
 1.6 24-Jul-2001  eeh branches: 1.6.2;
Use OF_getprop instead of getprop.
 1.5 19-Jul-2001  eeh Also attach apropriate devices named "serial".
 1.4 20-Dec-2000  mrg branches: 1.4.4;
com_attach_subr() prints the newline for us.
 1.3 03-Dec-2000  fvdl Make softintr_establish prototype match other ports, avoiding compile
warnings.
 1.2 08-Nov-2000  eeh branches: 1.2.2;
Remove debug printfs.
 1.1 21-Sep-2000  eeh Guts of the Sun Keyboard/Mouse line disciplines.
N.B. They don't recognize L1-A yet.
 1.2.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.4 08-Dec-2000  bouyer Sync with HEAD.
 1.2.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 08-Nov-2000  bouyer file com_ebus.c was added on branch thorpej_scsipi on 2000-11-20 20:26:42 +0000
 1.4.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.4.4.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.4.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.4.1 03-Aug-2001  lukem update to -current
 1.6.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.8.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.8.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.8.4.4 17-Sep-2002  nathanw Catch up to -current.
 1.8.4.3 01-Aug-2002  nathanw Catch up to -current.
 1.8.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.4.1 22-Oct-2001  nathanw file com_ebus.c was added on branch nathanw_sa on 2002-04-01 07:43:00 +0000
 1.12.4.2 21-Jul-2002  gehenna catch up with -current.
 1.12.4.1 19-May-2002  gehenna Replace the access to devsw table and the hard-coded majors with devsw API.
 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.3 17-Mar-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.23.6.1 22-Apr-2006  simonb Sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.23.2.1 18-Feb-2006  yamt sync with head.
 1.24.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.24.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.24.2.2 11-Aug-2006  yamt sync with head
 1.24.2.1 01-Apr-2006  yamt sync with head.
 1.25.4.1 15-Jun-2006  gdamore Adapt to new com framework.
 1.26.58.2 02-Jun-2008  mjf Sync with HEAD.
 1.26.58.1 03-Apr-2008  mjf Sync with HEAD.
 1.26.54.1 24-Mar-2008  keiichi sync with head.
 1.26.34.1 23-Mar-2008  matt sync with HEAD
 1.27.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.27.4.2 11-Mar-2010  yamt sync with head
 1.27.4.1 04-May-2009  yamt sync with head.
 1.27.2.1 04-Jun-2008  yamt sync with head
 1.30.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.4.2 12-Jun-2011  rmind sync with head
 1.30.4.1 21-Apr-2011  rmind sync with head
 1.31.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.33.54.1 10-Jun-2019  christos Sync with HEAD
 1.33.52.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.34.14.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.35.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 19-May-2000  mrg this file has not been used for a long time.
 1.3 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.2 05-Aug-1999  thorpej branches: 1.2.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.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.9 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.8 16-Oct-2006  martin branches: 1.8.78; 1.8.84; 1.8.88;
Remove obsolete kgdb prototypes.
 1.7 13-Feb-2006  cdi branches: 1.7.14; 1.7.16;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.6 11-Dec-2005  christos branches: 1.6.2; 1.6.4; 1.6.6;
merge ktrace-lwp.
 1.5 21-Mar-2004  pk branches: 1.5.16;
`stdin' and `stdout' are obsolete.
 1.4 19-Mar-2004  pk Sync with sparc: rename
stdinnode => prom_stdin_node,
fbnode => prom_stdout_node.
 1.3 19-May-2000  eeh branches: 1.3.28;
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.2 15-Feb-1999  hubertf branches: 1.2.8;
RCS ID police
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.2 30-Dec-2006  yamt 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.6.2.1 18-Feb-2006  yamt sync with head.
 1.7.16.1 22-Oct-2006  yamt sync with head
 1.7.14.1 18-Nov-2006  ad Sync with head.
 1.8.88.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8.84.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8.78.1 12-Jun-2011  rmind sync with head
 1.28 02-Mar-2015  nakayama prom_printf converts "\n" to "\r\n" internally, so omit "\r".
 1.27 12-Sep-2013  martin branches: 1.27.6;
Remove an unused variable, avoid unused variable warning.
 1.26 31-Jul-2012  martin branches: 1.26.2; 1.26.4;
Set up cn_tab in bootstrap() instead of initializing it statically.
Fixes -Wno-common fallout, idea from tsutsui.
 1.25 18-Mar-2009  cegger branches: 1.25.12;
Ansify function definitions w/o arguments. Generated with sed.
 1.24 17-Oct-2007  garbled branches: 1.24.20; 1.24.28; 1.24.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.23 01-Oct-2007  martin printf -> DPRINTF
 1.22 15-Oct-2006  martin branches: 1.22.8; 1.22.16; 1.22.26; 1.22.28; 1.22.30;
Initialize struct consdev in C99 style
 1.21 13-Feb-2006  cdi branches: 1.21.14; 1.21.16;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.20 17-Dec-2005  jdc branches: 1.20.2; 1.20.4; 1.20.6;
Check the PROM stdin path for the string "/usb@0". If we find a match, call
ukbd_cnattach(), so that the USB keyboard will become the console keyboard.
Makes the keyboard work on a Blade 100.
 1.19 11-Dec-2005  christos merge ktrace-lwp.
 1.18 31-May-2005  christos branches: 1.18.2;
- sprinkle const
- avoid variable shadow
 1.17 21-Mar-2004  pk branches: 1.17.14;
Use the promlib I/O routines.
 1.16 19-Mar-2004  petrov More on fbnode to prom_stdout_node rename.
 1.15 19-Mar-2004  pk Sync with sparc: rename
stdinnode => prom_stdin_node,
fbnode => prom_stdout_node.
 1.14 21-Oct-2003  petrov don't initialize an int with NULL.
 1.13 15-Jul-2003  lukem __KERNEL_RCSID()
 1.12 06-Sep-2002  gehenna branches: 1.12.6;
Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.11 31-Aug-2001  eeh branches: 1.11.6; 1.11.14;
instance-to-path works on instances not nodes.
 1.10 28-Aug-2001  eeh Fix incorrect parentheses.
 1.9 20-Oct-2000  mrg branches: 1.9.4;
#include <machine/sparc64.h> for prom_printf() prototype.
 1.8 28-Sep-2000  eeh Use prom_printf() for debugging instead of printf() since the console may
not be functional.
 1.7 10-Jul-2000  eeh Break into debugger by typing `+++++',
 1.6 24-Jun-2000  eeh Get rid of vaddrs.h.
 1.5 19-May-2000  eeh branches: 1.5.4;
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.4 19-Apr-2000  pk Have prom_cngetc() wait until input has been typed.
 1.3 13-Apr-2000  mrg this does not need auxreg.h
 1.2 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.1 23-May-1999  eeh branches: 1.1.2; 1.1.4;
Separate out the generic console handling from zs.c
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.9.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.9.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.11.14.1 19-May-2002  gehenna Replace the access to devsw table and the hard-coded majors with devsw API.
 1.11.6.2 17-Sep-2002  nathanw Catch up to -current.
 1.11.6.1 31-Aug-2001  nathanw file consinit.c was added on branch nathanw_sa on 2002-09-17 21:17:55 +0000
 1.12.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.17.14.1 01-Jan-2006  riz Pull up following revision(s) (requested by jdc in ticket #1076):
sys/arch/sparc64/dev/consinit.c: revision 1.20
Check the PROM stdin path for the string "/usb@0". If we find a match, call
ukbd_cnattach(), so that the USB keyboard will become the console keyboard.
Makes the keyboard work on a Blade 100.
 1.18.2.3 27-Oct-2007  yamt sync with head.
 1.18.2.2 30-Dec-2006  yamt sync with head.
 1.18.2.1 21-Jun-2006  yamt sync with head.
 1.20.6.1 22-Apr-2006  simonb Sync with head.
 1.20.4.1 09-Sep-2006  rpaulo sync with head
 1.20.2.1 18-Feb-2006  yamt sync with head.
 1.21.16.1 22-Oct-2006  yamt sync with head
 1.21.14.1 18-Nov-2006  ad Sync with head.
 1.22.30.1 06-Oct-2007  yamt sync with head.
 1.22.28.1 06-Nov-2007  matt sync with HEAD
 1.22.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.22.16.1 03-Oct-2007  garbled Sync with HEAD
 1.22.8.1 09-Oct-2007  ad Sync with head.
 1.24.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.24.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.24.20.1 04-May-2009  yamt sync with head.
 1.25.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.25.12.1 30-Oct-2012  yamt sync with head
 1.26.4.1 18-May-2014  rmind sync with head
 1.26.2.2 03-Dec-2017  jdolecek update from HEAD
 1.26.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.6.1 06-Apr-2015  skrll Sync with HEAD
 1.9 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.8 01-Mar-2002  martin Rename EBUS_PADDR_FROM_REG uses to EBUS_ADDR_FROM_REG.
 1.7 22-Oct-2001  mrg branches: 1.7.4;
use <dev/ebus/ebusreg.h>
 1.6 09-Jul-2000  pk branches: 1.6.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.5 18-Jun-2000  mrg branches: 1.5.2;
add a (u_long) cast for quietness
 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 15-Apr-2000  mrg branches: 1.3.2;
- auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.2 05-Apr-2000  mrg add a couple of comments.
 1.1 07-Jun-1999  mrg branches: 1.1.2; 1.1.4;
add ebus attachment for cs4231. this does not work as it requires ebus DMA and will panic if enabled. but it should otherwise be mostly complete.
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.2 21-Jun-1999  thorpej Sync w/ -current.
 1.1.2.1 07-Jun-1999  thorpej file cs4231_ebus.c was added on branch chs-ubc2 on 1999-06-21 01:02:30 +0000
 1.3.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.6.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -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 22-Oct-2001  nathanw file cs4231_ebus.c was added on branch nathanw_sa on 2002-04-01 07:43:00 +0000
 1.6 05-Sep-1998  pk These are replaced by drivers in <sys/dev/sbus>.
 1.5 05-Sep-1998  pk #include <dev/sbus/sbusvar.h>
 1.4 27-Aug-1998  mrg remove sparc64 "options BUS_DMA" -- it is now standard
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2.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.2 05-Sep-1998  pk These are replaced by drivers in <sys/dev/sbus>.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 05-Sep-1998  pk These are replaced by drivers in <sys/dev/sbus>.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.69 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.68 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.67 10-May-2021  thorpej branches: 1.67.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.66 24-Apr-2021  thorpej branches: 1.66.2; 1.66.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.65 04-Jan-2021  thorpej branches: 1.65.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.64 10-Nov-2019  chs branches: 1.64.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.63 18-Jan-2018  mrg branches: 1.63.4;
merge the ebus@pci attach output to be like most PCI drivers:

ebus0 at pci1 dev 1 function 0
ebus0: Sun Microsystems PCIO Ebus2, revision 0x01

becomes:

ebus0 at pci1 dev 1 function 0: Sun Microsystems PCIO Ebus2, revision 0x01
 1.62 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.61 19-Sep-2012  jdc Match the Altera ebus bridge, as found on the Tadpole SPARCle.
 1.60 30-Jan-2012  mrg branches: 1.60.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.59 20-Jul-2011  macallan branches: 1.59.2; 1.59.6;
add per ivec event counters
 1.58 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.57 02-Jun-2011  christos split auxio, ebus, psycho, sab.
 1.56 18-Mar-2011  mrg branches: 1.56.2;
re-add local ebusvar.h, and use it to share between ebus.c and ebus_mainbus.c
 1.55 11-Mar-2011  nakayama Remove unnecessary headers.
 1.54 11-Mar-2010  mrg branches: 1.54.2; 1.54.4;
various aprint_* fixes.
 1.53 13-Oct-2008  nakayama branches: 1.53.14;
Remove unnecessary includes.
 1.52 29-May-2008  mrg branches: 1.52.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.51 05-Apr-2008  cegger branches: 1.51.2; 1.51.4; 1.51.6;
use aprint_*_dev and device_xname
OK martin
 1.50 13-Feb-2006  cdi branches: 1.50.68;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.49 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.48 11-Dec-2005  christos branches: 1.48.2; 1.48.4; 1.48.6;
merge ktrace-lwp.
 1.47 31-May-2005  christos branches: 1.47.2;
- sprinkle const
- avoid variable shadow
 1.46 24-Apr-2004  kleink Update for new pci_devinfo(9) signature.
 1.45 21-Mar-2004  pk Use prom_getpropstring().
 1.44 21-Mar-2004  martin Make sure prom_getprop is called with the size pointed to by nitem
initialized. (Some of these are more paranoia, but two were actual bugs.)
Print error codes in some panic messages.
 1.43 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.42 09-Nov-2003  martin Nuke bcopy/bzero.
 1.41 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.40 15-Jul-2003  lukem __KERNEL_RCSID()
 1.39 17-May-2003  nakayama branches: 1.39.2;
Avoid strict-alias warnings in gcc 3.3.
 1.38 03-May-2003  wiz DMA, not dma nor Dma.
 1.37 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.36 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.35 10-Dec-2002  pk bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.34 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.33 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.32 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.31 16-Mar-2002  mrg convert to using <dev/ebus/ebusvar.h> and it's struct member names.
 1.30 15-Mar-2002  eeh Get PCI working with the new bus_space*.
 1.29 22-Oct-2001  mrg branches: 1.29.4;
clean up ebus:
- kill dead dma code
- remove icky self->dv_parent casts

audiocs @ ebus doesn't crash anymore, but it doesn't appear to work
yet either...
 1.28 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.27 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.26 10-Sep-2001  eeh Get rid of spurious OF_getprop().
 1.25 10-Sep-2001  eeh Sun Blade 100 support (and some psycho fixes from Jason Wright).
 1.24 25-Jul-2001  eeh branches: 1.24.2;
Don't match ebus nodes not called "ebus" like the ones on hme cards.
 1.23 20-Jul-2001  eeh PCI overhaul.
 1.22 04-Jun-2001  mrg branches: 1.22.2;
fix lint exposed by GCC 3.0 20010604 (prerelease).
 1.21 18-May-2001  mrg correct some comments. <80 char debug statements.
 1.20 18-May-2001  mrg do not force ebus interrupts to have bit 0x20 set.
 1.19 08-Jan-2001  pk branches: 1.19.2;
ebus_find_node(): plug memory leak; make debug output meaningfuller.
 1.18 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.17 27-Jul-2000  mrg ebus sc_is is a pointer now, already.
 1.16 12-Jul-2000  pk If there is no "interrupt-map" property on the ebus node, assume the
child "interrupt" properties are already in a format suitable for
the parent bus.
 1.15 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.14 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 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.12 24-Jun-2000  eeh Enable interrupts.
 1.11 12-Jun-2000  eeh branches: 1.11.2;
ebus_ca needs to specify enough memory to hold an ebus_softc, not a struct device.
 1.10 08-Jun-2000  mrg ensure an ebus really does exist in ebus_match; fixes spurious attachments with the ebus on a hme pci card.
 1.9 17-May-2000  mrg branches: 1.9.2;
expand a comment slightly.
 1.8 22-Apr-2000  mrg whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.7 15-Apr-2000  mrg - auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.6 13-Apr-2000  mrg avoid a potential memory leak.
 1.5 08-Apr-2000  mrg - store the ebus's parent so we can find the IOMMU
- use generic iommu routines in the ebus code (uses the above)
- add some more comments.
 1.4 05-Apr-2000  mrg be slightly more verbose when attaching ebus devices.
 1.3 05-Jun-1999  mrg branches: 1.3.2; 1.3.4;
find ebus device INO values via the "interrupt-map" and "interrupt-map-mask" properties.
 1.2 04-Jun-1999  mrg avoid uninitalised pointers.
 1.1 04-Jun-1999  mrg support for the UltraSPARC `Extension Bus' found on the PCI machines.
the bus space/dma code is cloned from the PCI code to do the same thing
which itself was cloned from the sbus bus space/dma code. the bus dma
code is non-functional at this point.
 1.3.4.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.3.4.2 08-Dec-2000  bouyer Sync with HEAD.
 1.3.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.3.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.11.2.2 15-May-2001  he Pull up revision 1.17 (requested by martin):
Fix a bug: ``sc'' is a pointer, so use it correctly.
 1.11.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.19.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.22.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.22.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.22.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.22.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.22.2.1 03-Aug-2001  lukem update to -current
 1.24.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.29.4.5 03-Jan-2003  thorpej Sync with HEAD.
 1.29.4.4 11-Dec-2002  thorpej Sync with HEAD.
 1.29.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.29.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.29.4.1 22-Oct-2001  nathanw file ebus.c was added on branch nathanw_sa on 2002-04-01 07:43:00 +0000
 1.39.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.47.2.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.50.68.2 17-Jan-2009  mjf Sync with HEAD.
 1.50.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.51.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.51.4.2 11-Aug-2010  yamt sync with head.
 1.51.4.1 04-May-2009  yamt sync with head.
 1.51.2.1 04-Jun-2008  yamt sync with head
 1.52.4.1 19-Oct-2008  haad Sync with HEAD.
 1.53.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.54.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.54.2.2 12-Jun-2011  rmind sync with head
 1.54.2.1 21-Apr-2011  rmind sync with head
 1.56.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.59.6.1 18-Feb-2012  mrg merge to -current.
 1.59.2.2 30-Oct-2012  yamt sync with head
 1.59.2.1 17-Apr-2012  yamt sync with head
 1.60.6.2 03-Dec-2017  jdolecek update from HEAD
 1.60.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.63.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.64.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.65.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.66.4.1 31-May-2021  cjep sync with head
 1.66.2.1 13-May-2021  thorpej Sync with HEAD.
 1.67.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.9 22-Apr-2000  mrg whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.8 10-Apr-2000  mrg UltraSPARC IIi CPU has bits 6-10 of the INO hardwired to 1. when we
install an interrupt handler, make sure we set these bits to 1. now,
interrupt_vector in locore can find our registered interrupt handlers
and at least try to setup a call to them.
 1.7 08-Apr-2000  mrg - store the ebus's parent so we can find the IOMMU
- use generic iommu routines in the ebus code (uses the above)
- add some more comments.
 1.6 05-Apr-2000  mrg include opt_ddb.h
 1.5 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.4 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.3 08-Jul-1999  thorpej branches: 1.3.2; 1.3.4; 1.3.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.2 07-Jun-1999  eeh branches: 1.2.2;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.1 04-Jun-1999  mrg support for the UltraSPARC `Extension Bus' found on the PCI machines.
the bus space/dma code is cloned from the PCI code to do the same thing
which itself was cloned from the sbus bus space/dma code. the bus dma
code is non-functional at this point.
 1.2.2.3 02-Aug-1999  thorpej Update from trunk.
 1.2.2.2 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 07-Jun-1999  thorpej file ebus_bus.c was added on branch chs-ubc2 on 1999-06-21 01:02:30 +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 Remove files that are no longer on the trunck
 1.23 24-May-2022  andvar fix various typos in comment, documentation and log messages.
 1.22 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.21 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.20 10-May-2021  thorpej branches: 1.20.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.19 24-Apr-2021  thorpej branches: 1.19.2; 1.19.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.18 04-Jan-2021  thorpej branches: 1.18.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.17 10-Nov-2019  chs branches: 1.17.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.16 13-May-2016  nakayama branches: 1.16.18;
Use newly introduced intrhand_alloc().
 1.15 04-Nov-2014  palle branches: 1.15.2;
sun4v: Removed a bunch of ifdef SUN4V since the CPU_ISSUN4V already has the necessary logic. Noticed by mrg@
 1.14 27-Aug-2014  palle Use device_lookup() to locate device instances
 1.13 24-Aug-2014  palle Generalize the code to allow for arbitrary interrupt wirings - with this change the serial console is usable on Sun Fire V445 systems - from OpenBSD - ok mrg@ martin@
 1.12 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.11 12-Sep-2013  martin #if 0 a variable just like their only use
 1.10 27-Oct-2012  chs branches: 1.10.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.9 18-Mar-2012  mrg branches: 1.9.2;
add missing __KERNEL_RCSID().
 1.8 14-Aug-2011  mrg branches: 1.8.2; 1.8.6;
initialise ih_ivec.
 1.7 12-Aug-2011  mrg - make a bunch of functions static
- set nmapmask to 1 before prom_getprop(), so we don't trigger an ENOMEM
- initialise ih_pending
 1.6 12-Aug-2011  mrg use device_private() to find the matching pyro leaf, now that pyro
has been device_t-ified.
 1.5 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.4 02-Jun-2011  christos branches: 1.4.2;
split auxio, ebus, psycho, sab.
 1.3 16-Mar-2011  mrg branches: 1.3.2; 1.3.4;
minor clean up.
 1.2 15-Mar-2011  mrg initial port of these drivers to netbsd. both pyro(4) and ebus(4) at
mainbus depend upon other as-yet uncommited changes.
 1.1 15-Mar-2011  mrg branches: 1.1.1;
Initial revision
 1.1.1.1 15-Mar-2011  mrg import the openbsd pyro and ebus_mainbus drivers for base reference.
 1.3.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3.2.3 12-Jun-2011  rmind sync with head
 1.3.2.2 21-Apr-2011  rmind sync with head
 1.3.2.1 16-Mar-2011  rmind file ebus_mainbus.c was added on branch rmind-uvmplock on 2011-04-21 01:41:26 +0000
 1.4.2.2 06-Jun-2011  jruoho Sync with HEAD.
 1.4.2.1 02-Jun-2011  jruoho file ebus_mainbus.c was added on branch jruoho-x86intr on 2011-06-06 09:06:49 +0000
 1.8.6.1 05-Apr-2012  mrg sync to latest -current.
 1.8.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.8.2.2 30-Oct-2012  yamt sync with head
 1.8.2.1 17-Apr-2012  yamt sync with head
 1.9.2.3 03-Dec-2017  jdolecek update from HEAD
 1.9.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.10.2.1 18-May-2014  rmind sync with head
 1.15.2.1 29-May-2016  skrll Sync with HEAD
 1.16.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.17.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.18.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.19.4.1 31-May-2021  cjep sync with head
 1.19.2.1 13-May-2021  thorpej Sync with HEAD.
 1.20.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 22-Oct-2001  mrg this has moved to dev/ebus
 1.1 04-Jun-1999  mrg branches: 1.1.2; 1.1.18;
support for the UltraSPARC `Extension Bus' found on the PCI machines.
the bus space/dma code is cloned from the PCI code to do the same thing
which itself was cloned from the sbus bus space/dma code. the bus dma
code is non-functional at this point.
 1.1.18.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12 24-Aug-2014  palle Generalize the code to allow for arbitrary interrupt wirings - with this change the serial console is usable on Sun Fire V445 systems - from OpenBSD - ok mrg@ martin@
 1.11 01-Jul-2011  dyoung branches: 1.11.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 02-Jun-2011  christos split auxio, ebus, psycho, sab.
 1.9 18-Mar-2011  mrg branches: 1.9.2;
re-add local ebusvar.h, and use it to share between ebus.c and ebus_mainbus.c
 1.8 16-Mar-2002  mrg branches: 1.8.86; 1.8.92;
this file is no longer used.
 1.7 14-Mar-2002  eeh bus_space_map2 no longer exists.
 1.6 22-Oct-2001  mrg branches: 1.6.4;
clean up ebus:
- kill dead dma code
- remove icky self->dv_parent casts

audiocs @ ebus doesn't crash anymore, but it doesn't appear to work
yet either...
 1.5 20-Jul-2001  eeh PCI overhaul.
 1.4 15-Apr-2000  mrg branches: 1.4.8;
- auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.3 08-Apr-2000  mrg - store the ebus's parent so we can find the IOMMU
- use generic iommu routines in the ebus code (uses the above)
- add some more comments.
 1.2 05-Jun-1999  mrg branches: 1.2.2; 1.2.4;
find ebus device INO values via the "interrupt-map" and "interrupt-map-mask" properties.
 1.1 04-Jun-1999  mrg support for the UltraSPARC `Extension Bus' found on the PCI machines.
the bus space/dma code is cloned from the PCI code to do the same thing
which itself was cloned from the sbus bus space/dma code. the bus dma
code is non-functional at this point.
 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.4.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.8.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.8.1 03-Aug-2001  lukem update to -current
 1.6.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.4.1 22-Oct-2001  nathanw file ebusvar.h was added on branch nathanw_sa on 2002-04-01 07:43:01 +0000
 1.8.92.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8.86.2 12-Jun-2011  rmind sync with head
 1.8.86.1 21-Apr-2011  rmind sync with head
 1.9.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.11.12.1 03-Dec-2017  jdolecek update from HEAD
 1.12 28-Feb-2010  martin Remove the envctrl driver, it is superseeded by the more general pcfiic @
ebus. Add the SB1000/SB2000 fan controll driver (tda). From OpenBSD.
Move config files over to direct configuration of i2c devices.
 1.11 28-Apr-2008  martin branches: 1.11.14; 1.11.20;
Remove clause 3 and 4 from TNF licenses
 1.10 26-Mar-2008  xtraeme branches: 1.10.2; 1.10.4;
sme_cookie is not needed when SME_DISABLE_REFRESH is set.
 1.9 26-Mar-2008  tnn Split device_t/softc for envctrl(4).
 1.8 16-Nov-2007  xtraeme branches: 1.8.14;
Extend the envsys2 API (one more time, sorry) as defined in:

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

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

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

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

Update all users and documentation to reflect these changes.
 1.7 17-Oct-2007  garbled branches: 1.7.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.6 16-Jul-2007  xtraeme branches: 1.6.8; 1.6.10; 1.6.12; 1.6.16;
Disable monitoring in the Integer sensors, they are just informative
and shouldn't need it anyway.
 1.5 09-Jul-2007  ad branches: 1.5.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.4 01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

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

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.3 02-May-2007  tnn branches: 1.3.2;
Define microvoltage scale factor which was previously a magic constant.
 1.2 15-Apr-2007  tnn branches: 1.2.2; 1.2.4;
Correct envsys ranges. From njoly@
 1.1 14-Apr-2007  tnn Add envctrl(4): Sun Ultra Enterprise 450 environmental monitoring driver.
Also add accompanying i2c controller driver, pcf8584.
Both written by me. Some cosmetic improvements from Iain Hibbert.
ok <martin>
 1.2.4.2 03-Oct-2007  garbled Sync with HEAD
 1.2.4.1 22-May-2007  matt Update to HEAD.
 1.2.2.3 07-May-2007  yamt sync with head.
 1.2.2.2 15-Apr-2007  yamt sync with head.
 1.2.2.1 15-Apr-2007  yamt file envctrl.c was added on branch yamt-idlelwp on 2007-04-15 16:03:08 +0000
 1.3.2.5 03-Dec-2007  ad Sync with HEAD.
 1.3.2.4 20-Aug-2007  ad Sync with HEAD.
 1.3.2.3 15-Jul-2007  ad Sync with head.
 1.3.2.2 09-Jun-2007  ad Sync with head.
 1.3.2.1 02-May-2007  ad file envctrl.c was added on branch vmlocking on 2007-06-09 21:37:03 +0000
 1.5.2.2 11-Jul-2007  mjf Sync with head.
 1.5.2.1 09-Jul-2007  mjf file envctrl.c was added on branch mjf-ufs-trans on 2007-07-11 20:02:33 +0000
 1.6.16.1 18-Nov-2007  bouyer Sync with HEAD
 1.6.12.3 07-Dec-2007  yamt sync with head
 1.6.12.2 03-Sep-2007  yamt sync with head.
 1.6.12.1 16-Jul-2007  yamt file envctrl.c was added on branch yamt-lazymbuf on 2007-09-03 14:30:13 +0000
 1.6.10.2 09-Jan-2008  matt sync with HEAD
 1.6.10.1 06-Nov-2007  matt sync with HEAD
 1.6.8.1 21-Nov-2007  joerg Sync with HEAD.
 1.7.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.8.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.8.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.10.4.2 11-Mar-2010  yamt sync with head
 1.10.4.1 16-May-2008  yamt sync with head.
 1.10.2.1 18-May-2008  yamt sync with head.
 1.11.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.11.14.1 24-Oct-2010  jym Sync with HEAD
 1.6 28-Feb-2010  martin Remove the envctrl driver, it is superseeded by the more general pcfiic @
ebus. Add the SB1000/SB2000 fan controll driver (tda). From OpenBSD.
Move config files over to direct configuration of i2c devices.
 1.5 28-Apr-2008  martin branches: 1.5.14; 1.5.20;
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 02-May-2007  tnn branches: 1.3.2; 1.3.4; 1.3.14; 1.3.16;
Define microvoltage scale factor which was previously a magic constant.
 1.2 18-Apr-2007  tnn branches: 1.2.2;
We can't support them in a clean way, but still note the bus addresses
of the disk failure LEDs.
 1.1 14-Apr-2007  tnn branches: 1.1.2;
Add envctrl(4): Sun Ultra Enterprise 450 environmental monitoring driver.
Also add accompanying i2c controller driver, pcf8584.
Both written by me. Some cosmetic improvements from Iain Hibbert.
ok <martin>
 1.1.2.3 07-May-2007  yamt sync with head.
 1.1.2.2 15-Apr-2007  yamt sync with head.
 1.1.2.1 14-Apr-2007  yamt file envctrlreg.h was added on branch yamt-idlelwp on 2007-04-15 16:03:08 +0000
 1.2.2.1 22-May-2007  matt Update to HEAD.
 1.3.16.2 03-Sep-2007  yamt sync with head.
 1.3.16.1 02-May-2007  yamt file envctrlreg.h was added on branch yamt-lazymbuf on 2007-09-03 14:30:14 +0000
 1.3.14.1 06-Nov-2007  matt sync with HEAD
 1.3.4.2 11-Jul-2007  mjf Sync with head.
 1.3.4.1 02-May-2007  mjf file envctrlreg.h was added on branch mjf-ufs-trans on 2007-07-11 20:02:34 +0000
 1.3.2.2 09-Jun-2007  ad Sync with head.
 1.3.2.1 02-May-2007  ad file envctrlreg.h was added on branch vmlocking on 2007-06-09 21:37:03 +0000
 1.4.20.2 11-Mar-2010  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.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.5.14.1 24-Oct-2010  jym Sync with HEAD
 1.7 05-Sep-1998  pk These are replaced by drivers in <sys/dev/sbus>.
 1.6 05-Sep-1998  pk #include <dev/sbus/sbusvar.h>
 1.5 15-Aug-1998  mycroft Minor edit.
 1.4 15-Aug-1998  mycroft Assign copyright to TNF.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2 05-Sep-1998  pk These are replaced by drivers in <sys/dev/sbus>.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 05-Sep-1998  pk These are replaced by drivers in <sys/dev/sbus>.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 25-Jun-2001  eeh Remove unused file.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 25-Jun-2001  eeh Remove another unused file.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.22 07-Oct-2002  martin Remove unused file, superseeded by syssrc/dev/sun/fb.c.
 1.21 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.20 26-Sep-2001  eeh branches: 1.20.4; 1.20.12;
getprop* -> PROM_getprop*
 1.19 19-Sep-2001  thorpej machine/fbio.h -> dev/sun/fbio.h
 1.18 23-Aug-2000  pk branches: 1.18.2; 1.18.4;
remove pfourreg.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 26-Aug-1999  thorpej branches: 1.16.2; 1.16.12;
Suns use black-on-white as the default rcons colors.
 1.15 23-May-1999  ad - Setting initial position of cursor is up to caller.
- Set cursor position properly for SPARC. From Juergen Hannken-Illjes.
 1.14 23-May-1999  eeh Start putting in hooks for non-zs console devices.
 1.13 19-May-1999  ad SPARC console is black on white, and is centered by default.
 1.12 19-May-1999  ad Add arg to rcons_init() that when set causes screen to be cleared.
 1.11 19-May-1999  ad Insert missing code that defines screen metrics for rcons. This fixes the
more blatant rcons brokenness (ie no panics).
 1.10 18-May-1999  ad Sync with last two changes made to sys/arch/sparc/dev/fb.c (don't clear
screen, typo).
 1.9 16-May-1999  ad Fix typo on my behalf. From Juergen Hannken-Illjes.
 1.8 15-May-1999  ad Panic if rasops_init() fails us (should never be the case).
 1.7 15-May-1999  ad Make sure rasops_info descriptor is zeroed out before initializing.
 1.6 26-Apr-1999  ad Update configuration to match `rasops' fixes and config glue.
 1.5 13-Apr-1999  ad Leave font selection to 'rasops' until 'rasops1' has been completed and can
handle non {8,16} pixel wide fonts.
 1.4 13-Apr-1999  ad Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.3 02-Sep-1998  eeh branches: 1.3.8;
Periodic update: now starts probing devices.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.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.3.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.16.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.16.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.18.4.3 11-Oct-2002  jdolecek follow rev. 1.22, and g/c this file
 1.18.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.18.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.2.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.18.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.20.12.1 17-May-2002  gehenna Add device switch.
 1.20.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.20.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.20.4.1 26-Sep-2001  nathanw file fb.c was added on branch nathanw_sa on 2002-09-17 21:17:56 +0000
 1.20 22-Oct-2001  mrg kill a dead driver. the floppy driver will be shared with sparc anyway...
 1.19 08-Jul-2001  wiz branches: 1.19.2; 1.19.4;
Correct various misspellings of 'transfer' and inflected forms.
 1.18 24-Aug-2000  nathanw 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.17 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.16 16-May-2000  thorpej branches: 1.16.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.15 15-Apr-2000  mrg - auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.14 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.13 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.12 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.11 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.10 21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.9 14-Jan-2000  pk Remove old-style boot device recognition.
 1.8 07-Jun-1999  eeh branches: 1.8.2; 1.8.8;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.7 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.6 05-Jun-1999  mrg catch up with probe[gs]et() changes.
 1.5 08-Feb-1999  bouyer branches: 1.5.4;
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.4 07-Feb-1999  jonathan defopt MEMORY_DISK_{HOOKS,SERVER,IS_ROOT}.
 1.3 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.2 04-Jul-1998  jonathan defopt DDB.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.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.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.16.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.19.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.19.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.52 02-Sep-2023  jdc sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines
Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)
Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c
Add "socal" and "SUNW,bpp" to the interrupt map.
 1.51 07-Aug-2021  thorpej branches: 1.51.6;
Merge thorpej-cfargs2.
 1.50 24-Apr-2021  thorpej branches: 1.50.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.49 04-Jan-2021  thorpej branches: 1.49.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.48 10-Nov-2019  chs branches: 1.48.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.47 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.46 05-Feb-2019  mrg add or avoid fallthru comments.
 1.45 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.44 26-Apr-2015  mlelstv branches: 1.44.16; 1.44.18;
Use C99-style initializers for struct dkdriver.
 1.43 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.42 19-Aug-2014  jnemeth branches: 1.42.2;
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.
 1.41 25-Jul-2014  dholland branches: 1.41.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.40 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.39 16-Mar-2014  dholland branches: 1.39.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.38 30-May-2013  martin branches: 1.38.2;
Make it compile again
 1.37 29-May-2013  christos phase 1 of disk geometry cleanup:
- centralize the geometry -> plist code so that we don't have
n useless copies of it.
 1.36 08-Aug-2011  jakllsch branches: 1.36.2; 1.36.8; 1.36.12; 1.36.14; 1.36.22;
inline -> static inline
For successful gcc 4.5 builds.
 1.35 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.34 12-Mar-2011  nakayama branches: 1.34.2;
Remove implicit include <dev/sbus/sbusvar.h> from autoconf.h, and
add it explicitly in files depending on it.
 1.33 24-Feb-2010  dyoung branches: 1.33.2; 1.33.4;
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.32 08-Jan-2010  dyoung branches: 1.32.2;
Expand PMF_FN_* macros.
 1.31 15-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().
 1.30 18-Mar-2009  cegger bzero -> memset
 1.29 13-Jan-2009  yamt branches: 1.29.2;
g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.28 17-Dec-2008  cegger kill MALLOC and FREE macros.
 1.27 17-Dec-2008  cegger make this compile
 1.26 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.25 20-Jun-2008  jnemeth branches: 1.25.4;
KNF: space after comma -- be consistent!
 1.24 18-Jun-2008  dogcow add a missing close-parenthesis. (HI CEGGER!)
 1.23 13-Jun-2008  cegger use device_lookup_private to get softc
 1.22 28-Apr-2008  martin branches: 1.22.2; 1.22.4;
Remove clause 3 and 4 from TNF licenses
 1.21 05-Apr-2008  cegger branches: 1.21.2; 1.21.4;
use aprint_*_dev and device_xname
OK martin
 1.20 02-Jan-2008  ad branches: 1.20.6;
Merge vmlocking2 to head.
 1.19 28-Nov-2007  jnemeth branches: 1.19.2; 1.19.6;
don't include sys/intr.h twice, why aren't the includes sorted?
 1.18 28-Nov-2007  ad Use the softint API.
 1.17 28-Nov-2007  jnemeth Sync with src/sys/sparc/dev/fd.c change to use softint(9) API.

XXX Please keep these two in sync as this one is a drop-in replacement
for the sparc version and the idea is to have both sparc and sparc64
use the same file one day.
 1.16 17-Oct-2007  garbled branches: 1.16.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.15 08-Oct-2007  ad Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
 1.14 29-Jul-2007  ad branches: 1.14.4; 1.14.6; 1.14.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.13 09-Jul-2007  ad branches: 1.13.2; 1.13.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.12 27-Mar-2007  jnemeth branches: 1.12.4;
fix a couple of syntax issues in sparc code from Tobias Nygren
 1.11 27-Mar-2007  jnemeth move definition of FTC_FLIP to auxioreg.h to mirror sparc
 1.10 25-Mar-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.
 1.9 09-Mar-2007  jnemeth branches: 1.9.2; 1.9.4; 1.9.6;
Correct gap2 length from ISA driver.

XXX The machine no longer becomes unusable when formatting, but it still
doesn't format properly.
 1.8 06-Mar-2007  dogcow more caddr_t fallout.
 1.7 04-Mar-2007  christos fix fallout from caddr_t changes.
 1.6 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 02-Mar-2007  jnemeth Deallocate resources where possible when we fail to attach.

XXX Somebody needs to write bus_intr_disestablish().
 1.4 02-Mar-2007  jnemeth add support for drvctl properties
 1.3 02-Mar-2007  jnemeth merge remaining differences from sparc driver in
 1.2 15-Feb-2007  reinoud branches: 1.2.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.1 06-Oct-2006  jnemeth branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10;
Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.1.10.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.1.8.7 21-Jan-2008  yamt sync with head
 1.1.8.6 07-Dec-2007  yamt sync with head
 1.1.8.5 27-Oct-2007  yamt sync with head.
 1.1.8.4 03-Sep-2007  yamt sync with head.
 1.1.8.3 26-Feb-2007  yamt sync with head.
 1.1.8.2 30-Dec-2006  yamt sync with head.
 1.1.8.1 06-Oct-2006  yamt file fdc.c was added on branch yamt-lazymbuf on 2006-12-30 20:47:02 +0000
 1.1.6.1 20-May-2007  jdc APull up revisions 1.9-1.10 (requested by jnemeth in ticket #647)

Correct gap2 length from ISA driver.

XXX The machine no longer becomes unusable when formatting, but it still
doesn't format properly.

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.
 1.1.4.2 18-Nov-2006  ad Sync with head.
 1.1.4.1 06-Oct-2006  ad file fdc.c was added on branch newlock2 on 2006-11-18 21:29:32 +0000
 1.1.2.2 22-Oct-2006  yamt sync with head
 1.1.2.1 06-Oct-2006  yamt file fdc.c was added on branch yamt-splraiseipl on 2006-10-22 06:05:11 +0000
 1.2.2.2 15-Apr-2007  yamt sync with head.
 1.2.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.6.1 29-Mar-2007  reinoud Pullup to -current
 1.9.4.1 11-Jul-2007  mjf Sync with head.
 1.9.2.5 03-Dec-2007  ad Sync with HEAD.
 1.9.2.4 20-Aug-2007  ad - Alter disk attach/detach to fix a panic when closing a vnd device.
- Sync with HEAD.
 1.9.2.3 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.9.2.2 01-Jul-2007  ad Adapt to callout API change.
 1.9.2.1 10-Apr-2007  ad Sync with head.
 1.12.4.2 16-Oct-2007  garbled Sync with HEAD
 1.12.4.1 03-Oct-2007  garbled Sync with HEAD
 1.13.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.13.2.1 07-Aug-2007  matt Sync with HEAD.
 1.14.8.1 14-Oct-2007  yamt sync with head.
 1.14.6.2 09-Jan-2008  matt sync with HEAD
 1.14.6.1 06-Nov-2007  matt sync with HEAD
 1.14.4.2 03-Dec-2007  joerg Sync with HEAD.
 1.14.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.16.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.16.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.19.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.2.2 31-Dec-2007  ad Catch up with buffer cache changes.
 1.19.2.1 10-Dec-2007  ad Make it compile.
 1.20.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.20.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.20.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.4.4 11-Mar-2010  yamt sync with head
 1.21.4.3 16-May-2009  yamt sync with head
 1.21.4.2 04-May-2009  yamt sync with head.
 1.21.4.1 16-May-2008  yamt sync with head.
 1.21.2.2 17-Jun-2008  yamt sync with head.
 1.21.2.1 18-May-2008  yamt sync with head.
 1.22.4.2 27-Jun-2008  simonb Sync with head.
 1.22.4.1 18-Jun-2008  simonb Sync with head.
 1.22.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.25.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.25.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.29.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.32.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.33.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.33.2.2 12-Jun-2011  rmind sync with head
 1.33.2.1 21-Apr-2011  rmind sync with head
 1.34.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.36.22.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.36.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.36.12.3 03-Dec-2017  jdolecek update from HEAD
 1.36.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.12.1 23-Jun-2013  tls resync from head
 1.36.8.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.36.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.38.2.1 18-May-2014  rmind sync with head
 1.39.2.1 10-Aug-2014  tls Rebase.
 1.41.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.42.2.2 06-Jun-2015  skrll Sync with HEAD
 1.42.2.1 06-Apr-2015  skrll Sync with HEAD
 1.44.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.44.18.1 10-Jun-2019  christos Sync with HEAD
 1.44.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.48.8.1 03-Apr-2021  thorpej Sync with HEAD.
 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.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.51.6.1 09-Sep-2023  martin Pull up following revision(s) (requested by jdc in ticket #360):

sys/arch/sparc64/dev/fdc.c: revision 1.52
sys/arch/sparc64/include/intr.h: revision 1.32
sys/arch/sparc64/sparc64/autoconf.c: revision 1.239
sys/arch/sparc64/include/psl.h: revision 1.64

sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines

Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)

Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c

Add "socal" and "SUNW,bpp" to the interrupt map.
 1.1 06-Oct-2006  jnemeth branches: 1.1.2; 1.1.4; 1.1.8;
Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.1.8.2 30-Dec-2006  yamt sync with head.
 1.1.8.1 06-Oct-2006  yamt file fdcreg.h was added on branch yamt-lazymbuf on 2006-12-30 20:47:02 +0000
 1.1.4.2 18-Nov-2006  ad Sync with head.
 1.1.4.1 06-Oct-2006  ad file fdcreg.h was added on branch newlock2 on 2006-11-18 21:29:32 +0000
 1.1.2.2 22-Oct-2006  yamt sync with head
 1.1.2.1 06-Oct-2006  yamt file fdcreg.h was added on branch yamt-splraiseipl on 2006-10-22 06:05:11 +0000
 1.3 30-Jun-2011  wiz dependant -> dependent
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 06-Oct-2006  jnemeth branches: 1.1.2; 1.1.4; 1.1.8; 1.1.58; 1.1.60; 1.1.62;
Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.1.62.1 16-May-2008  yamt sync with head.
 1.1.60.1 18-May-2008  yamt sync with head.
 1.1.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.8.2 30-Dec-2006  yamt sync with head.
 1.1.8.1 06-Oct-2006  yamt file fdcvar.h was added on branch yamt-lazymbuf on 2006-12-30 20:47:02 +0000
 1.1.4.2 18-Nov-2006  ad Sync with head.
 1.1.4.1 06-Oct-2006  ad file fdcvar.h was added on branch newlock2 on 2006-11-18 21:29:32 +0000
 1.1.2.2 22-Oct-2006  yamt sync with head
 1.1.2.1 06-Oct-2006  yamt file fdcvar.h was added on branch yamt-splraiseipl on 2006-10-22 06:05:11 +0000
 1.2 22-Oct-2001  mrg kill a dead driver. the floppy driver will be shared with sparc anyway...
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28;
Import of sparc64.
 1.1.1.1.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3 22-Oct-2001  mrg kill a dead driver. the floppy driver will be shared with sparc anyway...
 1.2 05-Sep-1998  pk branches: 1.2.26;
Assign my copyrights to TNF.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.68 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.67 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.66 24-Apr-2021  thorpej branches: 1.66.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.65 05-Jul-2020  martin branches: 1.65.4;
Adapt to proplib api changes
 1.64 22-Dec-2019  thorpej Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.63 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.62 26-Mar-2018  jdc branches: 1.62.2;
Correct a typo in the openprom variable name.
 1.61 19-May-2017  macallan branches: 1.61.8;
enable font loading / screen resizing
 1.60 27-Apr-2017  macallan - don't blindly copy attribute bits which we don't support or which make no
sense in the attribute buffer
- support WSATTR_UNDERLINE
- remove unused function
 1.59 22-Apr-2017  macallan branches: 1.59.2;
- set RI_FULLCLEAR
- clear RI_CURSOR when we clear the screen
no more garbage when switching screens
while there set RI_PREFER_ALPHA
 1.58 04-Nov-2016  macallan mmap() memory-ish regions with BUS_SPACE_MAP_PREFETCHABLE
 1.57 07-Jul-2016  msaitoh branches: 1.57.2;
KNF. Remove extra spaces. No functional change.
 1.56 11-Sep-2015  macallan - initialize sc_bg_cache and FFB_FBC_BG along with everything else so things
get redrawn properly when exiting X
- fix off by one in ffb_ras_erasecols(), no more artifacts when the screen
is redrawn
 1.55 09-Oct-2013  macallan branches: 1.55.6;
support WSDISPLAYIO_GET_FBINFO
 1.54 12-Sep-2013  martin Remove unused variable
 1.53 30-Jul-2013  macallan avoid uninitialized use of defattr
 1.52 09-Aug-2012  macallan branches: 1.52.2; 1.52.4;
split ffb_putchar() into a version for mono fonts and one for anti-aliased
ones. While there use the blitter to draw the cursor and remove some waits
that are unnecessary now that characters are drawn by hardware.
 1.51 12-Apr-2012  macallan don't assume that wscons assumes BGR ordering and request it explicitly
 1.50 11-Jan-2012  macallan use rasops_init(0, 0)
 1.49 22-Dec-2011  macallan support anti-aliased fonts and let the hardware do the alpha blending
 1.48 31-Oct-2011  jdc branches: 1.48.2; 1.48.6;
Add support for the WSDISPLAYIO_GET_EDID ioctl (requires passing a device_t
to ffb_attach).
 1.47 23-Oct-2011  jdc Correct the VSYNC-related register definitions and rework how they are used
(only when the monitor supports composite sync). OK macallan@.
 1.46 18-Aug-2011  macallan shut up some debug output accidentially left in
 1.45 16-Aug-2011  macallan use appropriate WID and FBC for high resolution mode
Tested with a 1680x1050 TFT on an ffb2+
 1.44 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.43 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.42 19-May-2011  macallan branches: 1.42.2;
remove obsolete comment - putchar() does in fact use the blitter now
 1.41 09-May-2011  jdc Alter the sync-on-green and composite-sync settings:

if the monitor doesn't support composite sync, enable sync-on-green

then, if the monitor supports separate sync, disable composite vsync

(Prompted by macallan@.)
 1.40 20-Apr-2011  martin Remove some leftovers
 1.39 09-Apr-2011  jdc Add EDID and video mode setting support to FFB.

Add definitions for registers related to video modes, and to DDC. Rename
other registers to be more descriptive.
Add i2c bus routines to read the EDID data via DDC.
Add routines to calculate, and to set, the video mode.

Note, that interlaced and stereo video modes are not supported.

Thanks to Michael Lorenz and Jared McNeill for advice and encouragement,
and to Martin Husemann for testing.
 1.38 21-Sep-2010  macallan branches: 1.38.2;
* implement hw acceleration for putchar()
* use VCONS for copycols()
* don't map the framebuffer now that we don't access it anymore
* make a bunch of drawing engine syncs optional
 1.37 20-Aug-2009  macallan branches: 1.37.2; 1.37.4;
call vcons_replay_msgbuf() when appropriate
 1.36 16-Nov-2008  macallan make this work right with WSDISPLAY_SCROLLSUPPORT
 1.35 28-Aug-2008  martin branches: 1.35.2; 1.35.4;
use device_private() to get the softc
 1.34 13-Jun-2008  cegger branches: 1.34.2;
use device_lookup_private to get softc
 1.33 05-Apr-2008  cegger branches: 1.33.2; 1.33.4; 1.33.6; 1.33.8;
use aprint_*_dev and device_xname
OK martin
 1.32 04-Mar-2007  christos branches: 1.32.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.31 15-Oct-2006  martin branches: 1.31.4;
Missing initializer
 1.30 14-Sep-2006  martin branches: 1.30.2;
Vcons-ify the ffb driver, from macallan.
Also adds some redrawing when entering DDB.
 1.29 07-Sep-2006  martin branches: 1.29.2;
Remove accidently commited debug printf when unblanking, and actually
do the unblank instead.
 1.28 18-Aug-2006  martin Fix wrong prom_getoption() return value checks
 1.27 04-Jul-2006  martin branches: 1.27.2;
Initialize the "console screen" once - no matter if we are console or
not.
 1.26 15-Apr-2006  jmmv branches: 1.26.4;
Remove the getwschar and putwschar accessops from wsdisplay drivers as
requested by uwe@. These were wrong because they were receiving an
emulcookie yet they were accessops (thus having to receive an accesscookie).
Instead, just handle the WSDISPLAYIO_{GET,PUT}WSCHAR ioctls from the
driver's ioctl accessop.

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

Reviewed by, at least, uwe@ and macallan@. No objections in tech-kern@.
 1.25 12-Apr-2006  macallan make this compile again
 1.24 12-Apr-2006  jmmv Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called. The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place. There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
 1.23 29-Mar-2006  thorpej Use device_cfdata().
 1.22 13-Feb-2006  cdi branches: 1.22.2; 1.22.4; 1.22.6;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.21 12-Dec-2005  christos branches: 1.21.2; 1.21.4; 1.21.6;
more proc -> lwp conversions.
 1.20 11-Dec-2005  christos merge ktrace-lwp.
 1.19 04-Jul-2005  jdc branches: 1.19.2;
Only set up the console screen on the console ffb.
Fixes bug where ttyE0 ends up on the 2nd ffb.
Based on dev/sun/cgsix.c:r1.27 (from macallan@).
 1.18 31-May-2005  macallan fixed a stupid typo that chained copycols to itself
 1.17 31-May-2005  macallan added missing ffb_ras_wait()
 1.16 31-May-2005  macallan added support for virtual consoles
 1.15 31-May-2005  christos - sprinkle const
- avoid variable shadow
 1.14 27-May-2005  macallan fixed a bug in ffbfb_mmap to make XFree's sunffb driver work, added another
special case region for afbinit
 1.13 15-May-2005  martin Just ignore (and don't fail) FBIO{S,G}CURSOR.
 1.12 13-May-2005  mhitch Fill in fb_depth, fb_width, and fb_height in the fb_type info. XFree86 works
better now.
 1.11 04-May-2005  martin Make ffb take part in the /dev/fbN circus.
 1.10 04-May-2005  martin Use ansi function header style consistently.
 1.9 29-Apr-2005  martin Avoid returning -1 from ffb_ioctl() - we want EPASSTHROUGH or EIO.
 1.8 19-Jul-2004  heas branches: 1.8.4; 1.8.10;
Collect and save the FFB DAC version, which will be needed for the h/w cursor
since the Elite3d's logic is reversed. From FreeBSD.
Fix comments in wsdisplay_accessops initialisation.
 1.7 21-May-2004  heas Map the ffb's DAC register space and add support for video "blanking"
(aka WSDISPLAYIO_{S,G}VIDEO).
 1.6 21-May-2004  heas ffb wsdisplay type should be sunffb/SUNFFB
 1.5 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.4 17-Mar-2004  pk ffb_attach: Use prom_getoption() and drop home-grown string-to-integer
conversion code.
 1.3 15-Jul-2003  lukem __KERNEL_RCSID()
 1.2 11-Jun-2003  petrov branches: 1.2.2;
Comment out debug output.
 1.1 23-May-2003  petrov Port of OpenBSD ffb driver written by Jason L. Wright.
 1.2.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.11 12-Sep-2006  ghen Pull up following revision(s) (requested by martin in ticket #1507):
sys/arch/sparc64/dev/zs.c: revision 1.61
sys/arch/sparc64/dev/ffb.c: revision 1.28
Fix wrong prom_getoption() return value checks
 1.8.10.10 07-Jun-2005  tron Pull up revision 1.18 (requested by martin in ticket #376):
fixed a stupid typo that chained copycols to itself
 1.8.10.9 07-Jun-2005  tron Pull up revision 1.17 (requested by martin in ticket #376):
added missing ffb_ras_wait()
 1.8.10.8 07-Jun-2005  tron Pull up revision 1.16 (requested by martin in ticket #376):
added support for virtual consoles
 1.8.10.7 07-Jun-2005  tron Pull up revision 1.15 (requested by martin in ticket #376):
- sprinkle const
- avoid variable shadow
 1.8.10.6 07-Jun-2005  tron Pull up revision 1.14 (requested by martin in ticket #376):
fixed a bug in ffbfb_mmap to make XFree's sunffb driver work, added another
special case region for afbinit
 1.8.10.5 07-Jun-2005  tron Pull up revision 1.13 (requested by martin in ticket #376):
Just ignore (and don't fail) FBIO{S,G}CURSOR.
 1.8.10.4 07-Jun-2005  tron Pull up revision 1.12 (requested by martin in ticket #376):
Fill in fb_depth, fb_width, and fb_height in the fb_type info. XFree86 works
better now.
 1.8.10.3 07-Jun-2005  tron Pull up revision 1.11 (requested by martin in ticket #376):
Make ffb take part in the /dev/fbN circus.
 1.8.10.2 07-Jun-2005  tron Pull up revision 1.10 (requested by martin in ticket #376):
Use ansi function header style consistently.
 1.8.10.1 07-Jun-2005  tron Pull up revision 1.9 (requested by martin in ticket #376):
Avoid returning -1 from ffb_ioctl() - we want EPASSTHROUGH or EIO.
 1.8.4.1 29-Apr-2005  kent sync with -current
 1.19.2.3 03-Sep-2007  yamt sync with head.
 1.19.2.2 30-Dec-2006  yamt sync with head.
 1.19.2.1 21-Jun-2006  yamt sync with head.
 1.21.6.1 22-Apr-2006  simonb Sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.21.2.1 18-Feb-2006  yamt sync with head.
 1.22.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.22.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.22.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.22.2.5 14-Sep-2006  yamt sync with head.
 1.22.2.4 03-Sep-2006  yamt sync with head.
 1.22.2.3 11-Aug-2006  yamt sync with head
 1.22.2.2 24-May-2006  yamt sync with head.
 1.22.2.1 01-Apr-2006  yamt sync with head.
 1.26.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.27.2.1 21-Aug-2006  tron Pull up following revision(s) (requested by martin in ticket #34):
sys/arch/sparc64/dev/zs.c: revision 1.61
sys/arch/sparc64/dev/ffb.c: revision 1.28
Fix wrong prom_getoption() return value checks
 1.29.2.1 18-Nov-2006  ad Sync with head.
 1.30.2.1 22-Oct-2006  yamt sync with head
 1.31.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.32.40.4 17-Jan-2009  mjf Sync with HEAD.
 1.32.40.3 28-Sep-2008  mjf Sync with HEAD.
 1.32.40.2 29-Jun-2008  mjf Sync with HEAD.
 1.32.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.8.1 18-Jun-2008  simonb Sync with head.
 1.33.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.33.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.33.4.3 09-Oct-2010  yamt sync with head
 1.33.4.2 16-Sep-2009  yamt sync with head
 1.33.4.1 04-May-2009  yamt sync with head.
 1.33.2.1 17-Jun-2008  yamt sync with head.
 1.34.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.34.2.1 19-Oct-2008  haad Sync with HEAD.
 1.35.4.3 18-Oct-2009  bouyer back out ticket 972
 1.35.4.2 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #972):
sys/arch/sparc64/dev/ffb.c: revision 1.37
call vcons_replay_msgbuf() when appropriate
 1.35.4.1 25-Feb-2009  snj branches: 1.35.4.1.4;
Pull up following revision(s) (requested by macallan in ticket #515):
sys/arch/sparc64/dev/ffb.c: revision 1.36
make this work right with WSDISPLAY_SCROLLSUPPORT
 1.35.4.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.35.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.37.4.4 12-Jun-2011  rmind sync with head
 1.37.4.3 31-May-2011  rmind sync with head
 1.37.4.2 21-Apr-2011  rmind sync with head
 1.37.4.1 05-Mar-2011  rmind sync with head
 1.37.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.38.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.42.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.48.6.2 29-Apr-2012  mrg sync to latest -current.
 1.48.6.1 18-Feb-2012  mrg merge to -current.
 1.48.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.48.2.2 30-Oct-2012  yamt sync with head
 1.48.2.1 17-Apr-2012  yamt sync with head
 1.52.4.2 18-May-2014  rmind sync with head
 1.52.4.1 28-Aug-2013  rmind sync with head
 1.52.2.2 03-Dec-2017  jdolecek update from HEAD
 1.52.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.6.4 28-Aug-2017  skrll Sync with HEAD
 1.55.6.3 05-Dec-2016  skrll Sync with HEAD
 1.55.6.2 09-Jul-2016  skrll Sync with HEAD
 1.55.6.1 22-Sep-2015  skrll Sync with HEAD
 1.57.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.57.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.59.2.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.61.8.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.61.8.1 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.62.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.62.2.1 10-Jun-2019  christos Sync with HEAD
 1.65.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.66.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.15 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.14 04-Nov-2016  macallan branches: 1.14.14; 1.14.16;
set BUS_SPACE_MAP_PREFETCHABLE when mapping the SFB32 range
now using alpha fonts is actually faster than using bitmap fonts
 1.13 22-Dec-2011  macallan branches: 1.13.6; 1.13.24; 1.13.28;
support anti-aliased fonts and let the hardware do the alpha blending
 1.12 31-Oct-2011  jdc branches: 1.12.2; 1.12.6;
Add support for the WSDISPLAYIO_GET_EDID ioctl (requires passing a device_t
to ffb_attach).
 1.11 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.10 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.9 21-Sep-2010  macallan branches: 1.9.2; 1.9.6;
* implement hw acceleration for putchar()
* use VCONS for copycols()
* don't map the framebuffer now that we don't access it anymore
* make a bunch of drawing engine syncs optional
 1.8 11-Dec-2005  christos branches: 1.8.78; 1.8.98; 1.8.100;
merge ktrace-lwp.
 1.7 04-May-2005  martin Make ffb take part in the /dev/fbN circus.
 1.6 04-May-2005  martin Ansify.
 1.5 01-Jul-2004  heas branches: 1.5.10;
The DAC registers do not need to be mapped linearly and thus should not.
 1.4 21-May-2004  heas Map the ffb's DAC register space and add support for video "blanking"
(aka WSDISPLAYIO_{S,G}VIDEO).
 1.3 19-Mar-2004  petrov More on fbnode to prom_stdout_node rename.
 1.2 15-Jul-2003  lukem __KERNEL_RCSID()
 1.1 23-May-2003  petrov branches: 1.1.2;
Port of OpenBSD ffb driver written by Jason L. Wright.
 1.1.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.5.10.2 07-Jun-2005  tron Pull up revision 1.7 (requested by martin in ticket #376):
Make ffb take part in the /dev/fbN circus.
 1.5.10.1 07-Jun-2005  tron Pull up revision 1.6 (requested by martin in ticket #376):
Ansify.
 1.8.100.2 12-Jun-2011  rmind sync with head
 1.8.100.1 05-Mar-2011  rmind sync with head
 1.8.98.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.8.78.1 09-Oct-2010  yamt sync with head
 1.9.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.9.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.12.6.1 18-Feb-2012  mrg merge to -current.
 1.12.2.1 17-Apr-2012  yamt sync with head
 1.13.28.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.13.24.1 05-Dec-2016  skrll Sync with HEAD
 1.13.6.1 03-Dec-2017  jdolecek update from HEAD
 1.14.16.1 10-Jun-2019  christos Sync with HEAD
 1.14.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.12 20-May-2022  andvar s/auxillary/auxiliary/ in comments.
 1.11 09-Aug-2012  macallan split ffb_putchar() into a version for mono fonts and one for anti-aliased
ones. While there use the blitter to draw the cursor and remove some waits
that are unnecessary now that characters are drawn by hardware.
 1.10 22-Dec-2011  macallan support anti-aliased fonts and let the hardware do the alpha blending
 1.9 23-Oct-2011  jdc branches: 1.9.2; 1.9.6;
Correct the VSYNC-related register definitions and rework how they are used
(only when the monitor supports composite sync). OK macallan@.
 1.8 09-May-2011  jdc Correc the "enable pedestal" register definition.
 1.7 09-Apr-2011  jdc Add EDID and video mode setting support to FFB.

Add definitions for registers related to video modes, and to DDC. Rename
other registers to be more descriptive.
Add i2c bus routines to read the EDID data via DDC.
Add routines to calculate, and to set, the video mode.

Note, that interlaced and stereo video modes are not supported.

Thanks to Michael Lorenz and Jared McNeill for advice and encouragement,
and to Martin Husemann for testing.
 1.6 14-Sep-2006  martin branches: 1.6.80; 1.6.86;
Vcons-ify the ffb driver, from macallan.
Also adds some redrawing when entering DDB.
 1.5 11-Dec-2005  christos branches: 1.5.20;
merge ktrace-lwp.
 1.4 19-Jul-2004  heas branches: 1.4.12;
Add comments for a few of the FFB registers.

From FreeBSD.
 1.3 21-May-2004  heas Map the ffb's DAC register space and add support for video "blanking"
(aka WSDISPLAYIO_{S,G}VIDEO).
 1.2 20-May-2004  heas add DAC command/value register offsets
 1.1 23-May-2003  petrov branches: 1.1.2;
Port of OpenBSD ffb driver written by Jason L. Wright.
 1.1.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.12.1 30-Dec-2006  yamt sync with head.
 1.5.20.1 18-Nov-2006  ad Sync with head.
 1.6.86.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.80.2 31-May-2011  rmind sync with head
 1.6.80.1 21-Apr-2011  rmind sync with head
 1.9.6.1 18-Feb-2012  mrg merge to -current.
 1.9.2.2 30-Oct-2012  yamt sync with head
 1.9.2.1 17-Apr-2012  yamt sync with head
 1.13 22-Dec-2011  macallan support anti-aliased fonts and let the hardware do the alpha blending
 1.12 31-Oct-2011  jdc branches: 1.12.2; 1.12.6;
Add support for the WSDISPLAYIO_GET_EDID ioctl (requires passing a device_t
to ffb_attach).
 1.11 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.10 09-Apr-2011  jdc branches: 1.10.2;
Add EDID and video mode setting support to FFB.

Add definitions for registers related to video modes, and to DDC. Rename
other registers to be more descriptive.
Add i2c bus routines to read the EDID data via DDC.
Add routines to calculate, and to set, the video mode.

Note, that interlaced and stereo video modes are not supported.

Thanks to Michael Lorenz and Jared McNeill for advice and encouragement,
and to Martin Husemann for testing.
 1.9 21-Sep-2010  macallan branches: 1.9.2;
* implement hw acceleration for putchar()
* use VCONS for copycols()
* don't map the framebuffer now that we don't access it anymore
* make a bunch of drawing engine syncs optional
 1.8 14-Sep-2006  martin branches: 1.8.58; 1.8.78; 1.8.80;
Vcons-ify the ffb driver, from macallan.
Also adds some redrawing when entering DDB.
 1.7 13-Feb-2006  cdi branches: 1.7.14;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.6 11-Dec-2005  christos branches: 1.6.2; 1.6.4; 1.6.6;
merge ktrace-lwp.
 1.5 31-May-2005  macallan branches: 1.5.2;
added support for virtual consoles
 1.4 04-May-2005  martin Make ffb take part in the /dev/fbN circus.
 1.3 19-Jul-2004  heas branches: 1.3.10;
Collect and save the FFB DAC version, which will be needed for the h/w cursor
since the Elite3d's logic is reversed. From FreeBSD.
Fix comments in wsdisplay_accessops initialisation.
 1.2 21-May-2004  heas Map the ffb's DAC register space and add support for video "blanking"
(aka WSDISPLAYIO_{S,G}VIDEO).
 1.1 23-May-2003  petrov branches: 1.1.2;
Port of OpenBSD ffb driver written by Jason L. Wright.
 1.1.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.2 07-Jun-2005  tron Pull up revision 1.5 (requested by martin in ticket #376):
added support for virtual consoles
 1.3.10.1 07-Jun-2005  tron Pull up revision 1.4 (requested by martin in ticket #376):
Make ffb take part in the /dev/fbN circus.
 1.5.2.2 30-Dec-2006  yamt sync with head.
 1.5.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.6.2.1 18-Feb-2006  yamt sync with head.
 1.7.14.1 18-Nov-2006  ad Sync with head.
 1.8.80.3 12-Jun-2011  rmind sync with head
 1.8.80.2 21-Apr-2011  rmind sync with head
 1.8.80.1 05-Mar-2011  rmind sync with head
 1.8.78.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.8.58.1 09-Oct-2010  yamt sync with head
 1.9.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.12.6.1 18-Feb-2012  mrg merge to -current.
 1.12.2.1 17-Apr-2012  yamt sync with head
 1.11 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.10 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.9 10-May-2021  thorpej branches: 1.9.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.8 24-Apr-2021  thorpej branches: 1.8.2; 1.8.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.7 04-Jan-2021  thorpej branches: 1.7.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.6 10-Nov-2019  chs branches: 1.6.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.5 07-Jul-2016  msaitoh branches: 1.5.18;
KNF. Remove extra spaces. No functional change.
 1.4 10-May-2016  palle sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.3 18-Mar-2012  mrg branches: 1.3.2; 1.3.16;
add missing __KERNEL_RCSID().
 1.2 12-Aug-2011  jdc branches: 1.2.2; 1.2.6;
Set the destination UPAID when establishing the interrupt mapping.
From eeh@.
 1.1 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.2.6.1 05-Apr-2012  mrg sync to latest -current.
 1.2.2.1 17-Apr-2012  yamt sync with head
 1.3.16.2 09-Jul-2016  skrll Sync with HEAD
 1.3.16.1 29-May-2016  skrll Sync with HEAD
 1.3.2.1 03-Dec-2017  jdolecek update from HEAD
 1.5.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.6.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.7.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.8.4.1 31-May-2021  cjep sync with head
 1.8.2.1 13-May-2021  thorpej Sync with HEAD.
 1.9.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 18-Mar-2012  mrg add missing __KERNEL_RCSID().
 1.2 01-Aug-2011  mrg branches: 1.2.2; 1.2.6;
use device_private(). thanks to jmcneill for pointing this out.
 1.1 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.2.6.1 05-Apr-2012  mrg sync to latest -current.
 1.2.2.1 17-Apr-2012  yamt sync with head
 1.3 18-Mar-2012  mrg add missing __KERNEL_RCSID().
 1.2 01-Aug-2011  mrg branches: 1.2.2; 1.2.6;
use device_private(). thanks to jmcneill for pointing this out.
 1.1 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.2.6.1 05-Apr-2012  mrg sync to latest -current.
 1.2.2.1 17-Apr-2012  yamt sync with head
 1.1 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.1 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.12 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.11 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.10 24-Apr-2021  thorpej branches: 1.10.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.9 23-Nov-2016  macallan branches: 1.9.30;
support WSDISPLAYIO_GET_FBINFO
also, use _PREFETCHABLE for rasops
 1.8 07-Jul-2016  msaitoh branches: 1.8.2;
KNF. Remove extra spaces. No functional change.
 1.7 12-Apr-2012  macallan branches: 1.7.2; 1.7.16;
- don't mess with more than 256 colour map entries
- don't assume that wscons assumes BGR
- while there enable alpha
 1.6 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.5 11-Jan-2012  macallan use rasops_init(0, 0)
 1.4 01-Jul-2011  dyoung branches: 1.4.2; 1.4.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.3 31-Aug-2010  macallan remove shadow framebuffer support, use VCONS_DONT_READ instead
 1.2 31-Dec-2009  macallan branches: 1.2.2; 1.2.4; 1.2.6;
add WSDISPLAY_TYPE_XVR1000
 1.1 29-Dec-2009  macallan a simple fb driver for Sun XVR-1000 boards
 1.2.6.1 05-Mar-2011  rmind sync with head
 1.2.4.3 09-Oct-2010  yamt sync with head
 1.2.4.2 11-Mar-2010  yamt sync with head
 1.2.4.1 31-Dec-2009  yamt file gfb.c was added on branch yamt-nfs-mp on 2010-03-11 15:03:00 +0000
 1.2.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.4.6.3 29-Apr-2012  mrg sync to latest -current.
 1.4.6.2 05-Apr-2012  mrg sync to latest -current.
 1.4.6.1 18-Feb-2012  mrg merge to -current.
 1.4.2.1 17-Apr-2012  yamt sync with head
 1.7.16.2 05-Dec-2016  skrll Sync with HEAD
 1.7.16.1 09-Jul-2016  skrll Sync with HEAD
 1.7.2.1 03-Dec-2017  jdolecek update from HEAD
 1.8.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.9.30.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.10.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.6 05-Sep-1998  pk Remove unused files.
 1.5 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.4 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.3 05-Jul-1998  jonathan branches: 1.3.2;
defopt NS, NSIP.
 1.2 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.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.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.7 05-Sep-1998  pk Remove unused files.
 1.6 27-Aug-1998  mrg remove sparc64 "options BUS_DMA" -- it is now standard
 1.5 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.4 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.3 21-Jul-1998  drochner branches: 1.3.2;
adapt to LANCE driver split
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.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.3 05-Sep-1998  pk Remove unused files.
 1.2 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3 05-Sep-1998  pk Remove unused files.
 1.2 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.119 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.118 08-Dec-2023  thorpej Change one vmem_free() in an error path that should be vmem_xfree().
 1.117 01-Dec-2023  thorpej Use vmem(9) rather than extent(9) to manage DVMA mappings.
 1.116 26-Apr-2021  mrg iommu_enter() and iommu_remove() are static to iommu.c.
 1.115 09-Feb-2019  mrg branches: 1.115.16;
on tomatillo unload the map before flushing the iommu, instead of
the reverse. from opensolaris.
 1.114 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.113 07-Mar-2016  christos branches: 1.113.16; 1.113.18;
Better to panic! Otherwise we end in an endless loop.
 1.112 07-Mar-2016  christos Return instead of crashing. This is wrong, and should be fixed properly.
 1.111 07-Mar-2016  christos Don't throw us in the debugger!
 1.110 06-Sep-2015  nakayama Fix build w/o options SUN4V.
 1.109 03-Sep-2015  palle sun4v: iommu setup seems to work now - device detection is now possible - parts from OpenBSD - ok mrg@, martin@
 1.108 24-Aug-2014  palle branches: 1.108.2;
Initialize IOMMU control and status register properly - from OpenBSD - ok mrg@
 1.107 25-Mar-2012  mrg branches: 1.107.2;
replace splhigh() usage with an IPL_HIGH mutex.
 1.106 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.105 08-Oct-2011  nakayama branches: 1.105.2; 1.105.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.
 1.104 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.103 20-Mar-2011  mrg re-add most of the pryo-supporting code, and some general clean up:
- handle setting tsb size in the ptsb via IOMMU_TSBSIZE_IN_PTSB (partly from
openbsd)
- fix IDB_INFO for systems without a STC that fault on accesses to the
flush register (like pyro)
- move iommu_reset() to the end of iommu_init()
- use IOMMUREG_WRITE() in a few places
- add a missing membar_lookaside() (from openbsd)
- if pmap_extract() on the flush buffer fails, disable flushing (from openbsd)
- flush the pyro-style iommu when IOMMU_FLUSH_CACHE is set (partly from openbsd)
- clear up a bit of debugging code so it spew a little less (sometimes you will
get kernel lock spinouts due to long scrolling printfs)
- use __func__ in several places
 1.102 16-Mar-2011  mrg revert the iommu changes for now. my U60 doesn't like them.
 1.101 16-Mar-2011  mrg various changes to adapt for Fire controller support, based upon the
openbsd code to do the same:

- add the tsb size into the ptsb bits
- avoid setting tsbsize in the CR
- disable IDB_INFO for now; it crashes
- add new macros for reading/writing IOMMU registers (need to use
these more regularly across the whole file)
- add a missing membar #lookaside
- add support for flushing the pyro(4) caches
- extend struct iommureg to include everything pyro
 1.100 06-Nov-2010  uebayasi branches: 1.100.2;
Machine dependent code is considered as part of UVM. Include
internal API header.
 1.99 17-Jun-2010  mrg in iommu_remove() don't invalidate the IOMMU mapping. for reasons not
yet determined, some PCI devices (at least fxp(4) and re(4)) sometimes
appear to perform DMA operations while this is happening, and we get
uncorrectable DMA errors. ideally, this "shouldn't happen", but none
of the investigation so far has reveal the problem, and my source
investigation of both opensolaris and linux show that their perform
the invaliation when unmapping.

"handles" PR#43274 as well as other issues...

XXX: candidate for netbsd-5
 1.98 11-Mar-2010  mrg branches: 1.98.2;
various aprint_* fixes.
 1.97 24-Feb-2010  skrll Typo in comment
 1.96 10-Dec-2009  nakayama branches: 1.96.2;
iommu_dvmamap_load:
Split a segment if its size is larger than dm_maxsegsz.

iommu_dvmamap_load_raw:
Don't coalesce segments if total size is larger than dm_maxsegsz.

This should fix port-sparc64/35299.
 1.95 07-Dec-2009  nakayama Print the warning message if extent_free fails.
 1.94 07-Dec-2009  nakayama Add comment about an uncorrectable DMA error sometimes observed on
tlp(4) on Netra X1, and its workaround.

Also add membar_storestore, from OpenBSD.
 1.93 07-Dec-2009  nakayama Calculate DVMA pages correctly.
 1.92 07-Dec-2009  nakayama Avoid use of iommu_dvmamap_unload in error path. It is too
expensive since it contains data cache flushing.

Some driver (tlp(4) with DM9201 on Netra X1) can only handle one
DMA segment, so it was called frequently.
 1.91 06-Dec-2009  nakayama Call iommu_strbuf_flush_done every iommu_enter is too expensive,
so call it once if needed.
 1.90 06-Dec-2009  nakayama Make is_dvmaend point to the last DVMA map address not the next
address, and fix off by one errors.

Also, do some optimization.
 1.89 05-Dec-2009  jdc Avoid a panic if we are asked to sync a zero-length map, by returning
immediately.
 1.88 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.87 24-Oct-2009  nakayama Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.
 1.86 15-Feb-2009  martin fix the formats of a debug printf for the time_t changes.
 1.85 18-Oct-2008  nakayama branches: 1.85.2; 1.85.8;
It is wasteful that reconstructing arguments for inserting the pointer
to streaming buffers in each bus_dma functions on sbus/psycho layer.

Use iommu functions directly with storing the pointer into (unused)
_dm_cookie at bus_dmamap_create time.
 1.84 13-Oct-2008  nakayama Remove unnecessary includes.
 1.83 04-Jun-2008  ad branches: 1.83.4;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.82 30-May-2008  mrg 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.81 04-Mar-2007  christos branches: 1.81.40; 1.81.42; 1.81.44; 1.81.46;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.80 01-Sep-2006  mrg branches: 1.80.8;
s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.
 1.79 13-Feb-2006  cdi branches: 1.79.2; 1.79.12;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.78 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.77 24-Nov-2005  yamt branches: 1.77.2; 1.77.4; 1.77.6;
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.76 01-Apr-2005  yamt branches: 1.76.2; 1.76.8;
merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.75 01-Jul-2004  petrov branches: 1.75.4; 1.75.6;
iommu_dvma_load_raw: reserve extra dvma page. Fixes PR #13654.
 1.74 03-Jun-2004  petrov Add DIAGNOSTIC in iommu_dvmamap_load if pmap_extract fails.
 1.73 22-Mar-2004  nakayama branches: 1.73.2;
Make 32-bit kernels compile with options DIAGNOSTIC.
 1.72 13-Feb-2004  snj s/rediculous/ridiculous/
 1.71 16-Nov-2003  tsutsui Fix address calculation for split segment address when the buffer is
crossing boundary in iommu_dvmamap_load().
Fixes E2BIG error on dmamap with smaller boundary size than maxxfersize
(which is used by recent changed pcscp(4)).

While here, some KNF around debug printf etc.
 1.70 26-Oct-2003  christos Actually initialize the size that is printed in case of an error, so garbage
does not get printed.
 1.69 21-Oct-2003  petrov don't use NULL for u_long initialization.
 1.68 15-Sep-2003  martin Make a panic format 32bit safe.
 1.67 08-Sep-2003  petrov Support multisegment dmamap sync, adopted from OpenBSD.
 1.66 15-Jul-2003  lukem __KERNEL_RCSID()
 1.65 17-May-2003  nakayama branches: 1.65.2;
Avoid comparison is always false warnings in gcc 3.3 w/ 32-bit kernels.
 1.64 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.63 16-Jan-2003  petrov Don't do anything if there are no streaming buffer cache.
 1.62 24-Oct-2002  petrov Remove duplicate code in iommu_dvmamap_sync.
 1.61 16-Oct-2002  martin Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.
 1.60 13-Oct-2002  petrov rearrange streming cache flushes in iommu_dvmamap_sync
 1.59 28-Sep-2002  martin Fix broken timeval comparison.
Reported by Takeshi Nakayama in PR sparc64/18453, but fixed a bit
differently.
 1.58 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.57 29-Aug-2002  chs wrap Debugger() in #ifdef DDB. fixes PR 15881.
 1.56 24-Jun-2002  eeh Fix compilation problems in DEBUG code.
 1.55 20-Jun-2002  eeh Overhaul streaming buffer handling:

sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.

psycho streaming buffer flushes write a 64-byte aligned 64-byte block.

So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
 1.54 14-Jun-2002  eeh NEVER CAST REFERENCE PARAMETERS!!!!!
 1.53 12-Jun-2002  eeh Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>
 1.52 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.51 13-May-2002  eeh branches: 1.51.2; 1.51.4;
Fix off-by-one error in iommu_dvmamap_load_raw() where if a DMA segment
has just one byte on a page the page is never mapped into the IOMMU.
 1.50 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.49 06-Mar-2002  tsutsui Fix calculation of dma segment length
when the DVMA range is crossing the boundary.
Approved by eeh, and fixes port-sparc64/15200.
 1.48 21-Feb-2002  eeh Fix pr sparc64/15633: datafault at tlp_start causes panic
Also clean up some additional 32-bit kernel printf issues.
 1.47 08-Feb-2002  eeh Handle the case where a DMA operation wraps from the end of a page to the
beginning of the same page properly by double-mapping that page.
 1.46 08-Feb-2002  eeh Move a brace so this will compile w/o DEBUG.
 1.45 07-Feb-2002  eeh Overhaul iommu_dvmamap_load_raw().
 1.44 17-Oct-2001  thorpej branches: 1.44.4;
Fix a typo in a DIAGNOSTIC check.
 1.43 08-Oct-2001  eeh Clear the dmamap inside splhigh() protection.
 1.42 07-Oct-2001  eeh Manage both streaming caches on psycho/psycho+.
 1.41 28-Sep-2001  chs don't depend on other headers to include sys/proc.h for us.
 1.40 21-Sep-2001  eeh Handle DMA boundaries a bit better.
 1.39 15-Sep-2001  eeh Added iommu_extract() for debug purposes.
Anyone caught using it for anything other than debug will be shot.
 1.38 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.37 06-Aug-2001  eeh branches: 1.37.2;
Fix bug involving small, non-contiguous dma segments.
From Manuel Bouyer.
 1.36 20-Jul-2001  eeh PCI overhaul.
 1.35 26-May-2001  chs branches: 1.35.2;
replace vm_page_t with struct vm_page *.
 1.34 18-May-2001  mrg move the sbus IOMMU work around into the sbus code, so that the psycho
doesn't have to lose a page.
 1.33 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.32 09-Mar-2001  thorpej Pay attention to BUS_DMA_STREAMING when builing an IOMMU TTE.
 1.31 24-Feb-2001  eeh branches: 1.31.2;
Improve legibility and iommu_dvmamap_sync().
 1.30 06-Feb-2001  eeh Fix D$ aliasing issues in a DIAGNOSTIC check.
 1.29 28-Jan-2001  martin Faster error handling for iommu_dmamap_load_raw; avoid loading the map
and unloading on error when we clearly can't get out without an error.
 1.28 27-Jan-2001  eeh Fix dvma problem caused by previous. Seems like the dvma segment calculation
in iommu_dmamap_unload() was not quite right.
 1.27 25-Jan-2001  martin iommu_dvmamap_load_raw: add a check for creating maps larger than
expected by the creator of the dma map and fail apropriately. This
makes the syssrc/dev/pci/if_vr.c driver work.
 1.26 23-Jan-2001  martin Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.
 1.25 06-Dec-2000  mrg fix warnings in DEBUG & DIAGNSTIC code.
 1.24 28-Sep-2000  eeh Don't take ref/mod faults on DMA segments mapped in to the kernel.
 1.23 01-Aug-2000  eeh Call the parent bus dvmamap_unload function to clear the cache rather
than do it ourselves.
 1.22 07-Jul-2000  mrg split up debug flags so i can turn off some of them
 1.21 07-Jul-2000  eeh Handle bus_dma aligment properly.
 1.20 02-Jul-2000  mrg iommu_dvmamap_load*(), pass an alignment constraint, as well as
EX_BOUNDZERO, to extent_alloc(). this fixes problems with it
(extent_alloc()) returning incorrect values, when the start of
the extent is not aligned as strongly as the requested area..

raw access to ide disks now works.
 1.19 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.18 26-Jun-2000  mrg remove/move more mach vm header files:

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

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.17 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.16 22-Jun-2000  eeh Correct calculation of length for dma segments in iommu_dmamap_load().
 1.15 19-Jun-2000  eeh branches: 1.15.2;
Have separate data and text segments, make text read-only.
 1.14 18-Jun-2000  mrg iommu_flush becomes iommu_strbuf_flush cuz that's what it does.
 1.13 18-Jun-2000  mrg remove an unused variable.
 1.12 12-Jun-2000  mrg formatting nit.
 1.11 08-Jun-2000  eeh Support large (>1 page) DVMA maps so UltraSPARC IIi will work.
 1.10 17-May-2000  mrg branches: 1.10.2;
- in iommu_remove(), move len adjustment outside if statement, leaving
just one copy of this.
- remove duplicate setting of sgsize in iommu_dvmamap_load().
- fix DIAGNOSTIC check in iommu_dvmamap_load_raw() to panic() in unexpected
conditions only (not normal ones), and also add an extra case.
 1.9 17-May-2000  eeh Add support for bus_dma_load_raw() so the le driver will work again.
 1.8 25-Apr-2000  mrg - add a note about streaming buffers and US IIi not having them.
- make some debugging messages in iommu_remove() saner and add some more.
- decrement 'len' in the no streaming buffer case, also.
- in iommu_dvmamem_map(), do not enter these mappings into the IOMMU,
only into the CPU (the former is done at _load time).
- make a panic that shouldn't happen a DIAGNOSTIC.
 1.7 22-Apr-2000  mrg whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.6 08-Apr-2000  mrg with these two, POWEROFSEVEN now compiles cleanly.
 1.5 05-Apr-2000  mrg after enabling the streaming buffer, check to see that it is actually
there and enabled. if it appears to be missing or not enabled, do
not use it.
 1.4 05-Apr-2000  mrg use DPRINTF() style debug messages; s/sbus/iommu/ in a few remaining places.
 1.3 08-Jul-1999  thorpej branches: 1.3.2;
Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.2 20-Jun-1999  eeh branches: 1.2.2;
Move the DVMA mapin/mapout functions from the SBus driver to the iommu driver.
 1.1 04-Jun-1999  mrg pull iommu code out of sbus code so we can share it with the PCI.
define some useful PCI macros.
 1.2.2.3 02-Aug-1999  thorpej Update from trunk.
 1.2.2.2 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 20-Jun-1999  thorpej file iommu.c was added on branch chs-ubc2 on 1999-06-21 01:02:30 +0000
 1.3.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.3.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.2 08-Dec-2000  bouyer Sync with HEAD.
 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.10.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.2.2 07-Aug-2000  mrg pullup 1.23 (approved by thorpej):
>Call the parent bus dvmamap_unload function to clear the cache rather
>than do it ourselves.
 1.15.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.31.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.31.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.35.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.35.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.35.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.35.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.35.2.4 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.35.2.3 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.35.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.35.2.1 03-Aug-2001  lukem update to -current
 1.37.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.37.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.44.4.9 17-Jan-2003  thorpej Sync with HEAD.
 1.44.4.8 11-Nov-2002  nathanw Catch up to -current
 1.44.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.44.4.6 17-Sep-2002  nathanw Catch up to -current.
 1.44.4.5 01-Aug-2002  nathanw Catch up to -current.
 1.44.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.44.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.44.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.44.4.1 17-Oct-2001  nathanw file iommu.c was added on branch nathanw_sa on 2002-02-28 04:12:11 +0000
 1.51.4.6 01-Dec-2002  he Pull up revision 1.59 (requested by martin in ticket #874):
Fix broken timeval comparison. Fixes PR#18453.
 1.51.4.5 08-Nov-2002  tron Pull up revision 1.61 (via patch, requested by martin in ticket #916):
Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.
 1.51.4.4 24-Jun-2002  lukem Pull up revision 1.56 (requested by eeh in ticket #361):
Fix compilation problems in DEBUG code.
 1.51.4.3 21-Jun-2002  lukem Pull up revision 1.55 (requested by eeh in ticket #337):
Overhaul streaming buffer handling:
sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.
psycho streaming buffer flushes write a 64-byte aligned 64-byte block.
So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
[Gets E220R working]
 1.51.4.2 14-Jun-2002  lukem Pull up revision 1.54 (requested by eeh in ticket #271):
NEVER CAST REFERENCE PARAMETERS!!!!!
 1.51.4.1 13-Jun-2002  lukem Pull up revision 1.53 (requested by eeh in ticket #258):
Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>
 1.51.2.3 31-Aug-2002  gehenna catch up with -current.
 1.51.2.2 17-Jul-2002  gehenna catch up with -current.
 1.51.2.1 15-Jul-2002  gehenna catch up with -current.
 1.65.2.5 11-Dec-2005  christos Sync with head.
 1.65.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.65.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.65.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.65.2.1 03-Aug-2004  skrll Sync with HEAD
 1.73.2.1 02-Jul-2004  he Pull up revision 1.75 (requested by petrov in ticket #576):
Reserve extra dvma page in iommu_dvma_load_raw(). Fixes
PR#13654.
 1.75.6.1 12-Feb-2005  yamt use new apis.
 1.75.4.1 29-Apr-2005  kent sync with -current
 1.76.8.1 29-Nov-2005  yamt sync with head.
 1.76.2.3 03-Sep-2007  yamt sync with head.
 1.76.2.2 30-Dec-2006  yamt sync with head.
 1.76.2.1 21-Jun-2006  yamt sync with head.
 1.77.6.1 22-Apr-2006  simonb Sync with head.
 1.77.4.1 09-Sep-2006  rpaulo sync with head
 1.77.2.1 18-Feb-2006  yamt sync with head.
 1.79.12.1 03-Sep-2006  riz Pull up following revision(s) (requested by mrg in ticket #109):
sys/arch/sparc64/sparc64/machdep.c: revision 1.188
sys/arch/sparc64/dev/iommu.c: revision 1.80
s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.
 1.79.2.1 03-Sep-2006  yamt sync with head.
 1.80.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.81.46.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.81.44.3 11-Aug-2010  yamt sync with head.
 1.81.44.2 11-Mar-2010  yamt sync with head
 1.81.44.1 04-May-2009  yamt sync with head.
 1.81.42.2 17-Jun-2008  yamt sync with head.
 1.81.42.1 04-Jun-2008  yamt sync with head
 1.81.40.3 17-Jan-2009  mjf Sync with HEAD.
 1.81.40.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.81.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.83.4.1 19-Oct-2008  haad Sync with HEAD.
 1.85.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.85.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.96.2.3 17-Aug-2010  uebayasi Sync with HEAD.
 1.96.2.2 27-May-2010  uebayasi Fix build.
 1.96.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.98.2.3 21-Apr-2011  rmind sync with head
 1.98.2.2 05-Mar-2011  rmind sync with head
 1.98.2.1 03-Jul-2010  rmind sync with head
 1.100.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.105.6.2 05-Apr-2012  mrg sync to latest -current.
 1.105.6.1 18-Feb-2012  mrg merge to -current.
 1.105.2.1 17-Apr-2012  yamt sync with head
 1.107.2.1 03-Dec-2017  jdolecek update from HEAD
 1.108.2.2 19-Mar-2016  skrll Sync with HEAD
 1.108.2.1 22-Sep-2015  skrll Sync with HEAD
 1.113.18.1 10-Jun-2019  christos Sync with HEAD
 1.113.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.115.16.1 13-May-2021  thorpej Sync with HEAD.
 1.21 24-Aug-2016  mrg use uint64_t consistently.
 1.20 24-Aug-2014  palle branches: 1.20.2;
Initialize IOMMU control and status register properly - from OpenBSD - ok mrg@
 1.19 20-Mar-2011  mrg branches: 1.19.14;
define 'struct iommureg2', that includes the full set of regs for the
schizo and pyro iommu's. use these in IOMMUREG().

add back IOMMUREG_READ() and IOMMUREG_WRITE() macros.
 1.18 16-Mar-2011  mrg revert the iommu changes for now. my U60 doesn't like them.
 1.17 16-Mar-2011  mrg add back the old iommureg definition, as iommureg_old.
 1.16 16-Mar-2011  mrg various changes to adapt for Fire controller support, based upon the
openbsd code to do the same:

- add the tsb size into the ptsb bits
- avoid setting tsbsize in the CR
- disable IDB_INFO for now; it crashes
- add new macros for reading/writing IOMMU registers (need to use
these more regularly across the whole file)
- add a missing membar #lookaside
- add support for flushing the pyro(4) caches
- extend struct iommureg to include everything pyro
 1.15 07-Dec-2008  mrg branches: 1.15.8; 1.15.10;
add INTMAP_IGN_SHIFT and INTIGN() macros for schizo support (from openbsd)
 1.14 13-Feb-2006  cdi branches: 1.14.68; 1.14.72; 1.14.78; 1.14.80;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.13 11-Dec-2005  christos branches: 1.13.2; 1.13.4; 1.13.6;
merge ktrace-lwp.
 1.12 23-Apr-2004  simonb branches: 1.12.12;
s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).
 1.11 11-Oct-2003  petrov When establishing interrupt set CPU_UPAID in mapping register
so that interrupt would be delivered.
 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 06-Jan-2003  wiz branches: 1.9.2;
writable, not writeable.
 1.8 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.7 07-Feb-2002  eeh Overhaul iommu_dvmamap_load_raw().
 1.6 20-Jul-2001  eeh branches: 1.6.6;
PCI overhaul.
 1.5 12-Jun-2000  eeh branches: 1.5.6;
Comment describing the IOMMU DVMA address space layout.
 1.4 08-Jun-2000  eeh Fix DVMA base address calculations.
 1.3 04-Jun-1999  mrg branches: 1.3.2; 1.3.4; 1.3.12;
pull iommu code out of sbus code so we can share it with the PCI.
define some useful PCI macros.
 1.2 24-May-1999  mrg pull struct strbuf + defines into iommureg.h. properly merge previous commit.
 1.1 23-May-1999  mrg place iommu definitions in iommureg.h
 1.3.12.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.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.3.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.6.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.6.2 16-Mar-2002  jdolecek Catch up with -current.
 1.5.6.1 03-Aug-2001  lukem update to -current
 1.6.6.4 07-Jan-2003  thorpej Sync with HEAD.
 1.6.6.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.6.2 28-Feb-2002  nathanw Catch up to -current.
 1.6.6.1 20-Jul-2001  nathanw file iommureg.h was added on branch nathanw_sa on 2002-02-28 04:12:11 +0000
 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.12.12.1 21-Jun-2006  yamt sync with head.
 1.13.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.1 18-Feb-2006  yamt sync with head.
 1.14.80.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.78.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.72.1 04-May-2009  yamt sync with head.
 1.14.68.1 17-Jan-2009  mjf Sync with HEAD.
 1.15.10.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.8.1 21-Apr-2011  rmind sync with head
 1.19.14.1 03-Dec-2017  jdolecek update from HEAD
 1.20.2.1 05-Oct-2016  skrll Sync with HEAD
 1.26 01-Dec-2023  thorpej Use vmem(9) rather than extent(9) to manage DVMA mappings.
 1.25 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.24 26-Apr-2021  mrg iommu_enter() and iommu_remove() are static to iommu.c.
 1.23 09-Feb-2019  mrg branches: 1.23.16;
on tomatillo unload the map before flushing the iommu, instead of
the reverse. from opensolaris.
 1.22 03-Sep-2015  palle branches: 1.22.18;
sun4v: iommu setup seems to work now - device detection is now possible - parts from OpenBSD - ok mrg@, martin@
 1.21 25-Mar-2012  mrg branches: 1.21.2; 1.21.16;
replace splhigh() usage with an IPL_HIGH mutex.
 1.20 20-Mar-2011  mrg branches: 1.20.4; 1.20.8;
add a new is_flags member to strut iommu_state. add two flags:
IOMMU_FLUSH_CACHE - extra flushes needed for some pyro
IOMMU_TSBSIZE_IN_PTSB - different ptsb assignment for pyro

partly from openbsd.
 1.19 16-Mar-2011  mrg revert the iommu changes for now. my U60 doesn't like them.
 1.18 16-Mar-2011  mrg various changes to adapt for Fire controller support, based upon the
openbsd code to do the same:

- add the tsb size into the ptsb bits
- avoid setting tsbsize in the CR
- disable IDB_INFO for now; it crashes
- add new macros for reading/writing IOMMU registers (need to use
these more regularly across the whole file)
- add a missing membar #lookaside
- add support for flushing the pyro(4) caches
- extend struct iommureg to include everything pyro
 1.17 18-Oct-2008  nakayama branches: 1.17.16; 1.17.22;
It is wasteful that reconstructing arguments for inserting the pointer
to streaming buffers in each bus_dma functions on sbus/psycho layer.

Use iommu functions directly with storing the pointer into (unused)
_dm_cookie at bus_dmamap_create time.
 1.16 29-May-2008  mrg branches: 1.16.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.15 04-Mar-2007  christos branches: 1.15.40; 1.15.42; 1.15.44; 1.15.46;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 13-Feb-2006  cdi branches: 1.14.20;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.13 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.12 20-Jun-2002  eeh branches: 1.12.22; 1.12.34; 1.12.36; 1.12.38;
Overhaul streaming buffer handling:

sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.

psycho streaming buffer flushes write a 64-byte aligned 64-byte block.

So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
 1.11 20-Mar-2002  eeh branches: 1.11.4; 1.11.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.10 07-Feb-2002  eeh Overhaul iommu_dvmamap_load_raw().
 1.9 07-Oct-2001  eeh branches: 1.9.4;
Manage both streaming caches on psycho/psycho+.
 1.8 15-Sep-2001  eeh Added iommu_extract() for debug purposes.
Anyone caught using it for anything other than debug will be shot.
 1.7 20-Jul-2001  eeh branches: 1.7.2;
PCI overhaul.
 1.6 07-Jul-2000  mrg branches: 1.6.4;
work around a bug passing arguments to iommu_dvma_load_raw()
 1.5 18-Jun-2000  mrg branches: 1.5.2;
iommu_flush becomes iommu_strbuf_flush cuz that's what it does.
 1.4 17-May-2000  eeh branches: 1.4.2;
Add support for bus_dma_load_raw() so the le driver will work again.
 1.3 22-Apr-2000  mrg whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.2 20-Jun-1999  eeh branches: 1.2.2; 1.2.4;
Move the DVMA mapin/mapout functions from the SBus driver to the iommu driver.
 1.1 04-Jun-1999  mrg pull iommu code out of sbus code so we can share it with the PCI.
define some useful PCI macros.
 1.2.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.2 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 20-Jun-1999  thorpej file iommuvar.h was added on branch chs-ubc2 on 1999-06-21 01:02:31 +0000
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.6.4.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.6.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.4.1 03-Aug-2001  lukem update to -current
 1.7.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.7.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.9.4.4 01-Aug-2002  nathanw Catch up to -current.
 1.9.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.9.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.9.4.1 07-Oct-2001  nathanw file iommuvar.h was added on branch nathanw_sa on 2002-02-28 04:12:11 +0000
 1.11.6.1 21-Jun-2002  lukem Pull up revision 1.12 (requested by eeh in ticket #337):
Overhaul streaming buffer handling:
sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.
psycho streaming buffer flushes write a 64-byte aligned 64-byte block.
So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
[Gets E220R working]
 1.11.4.1 17-Jul-2002  gehenna catch up with -current.
 1.12.38.1 22-Apr-2006  simonb Sync with head.
 1.12.36.1 09-Sep-2006  rpaulo sync with head
 1.12.34.1 18-Feb-2006  yamt sync with head.
 1.12.22.2 03-Sep-2007  yamt sync with head.
 1.12.22.1 21-Jun-2006  yamt sync with head.
 1.14.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.46.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.44.1 04-May-2009  yamt sync with head.
 1.15.42.1 04-Jun-2008  yamt sync with head
 1.15.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.15.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.4.1 19-Oct-2008  haad Sync with HEAD.
 1.17.22.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.16.1 21-Apr-2011  rmind sync with head
 1.20.8.1 05-Apr-2012  mrg sync to latest -current.
 1.20.4.1 17-Apr-2012  yamt sync with head
 1.21.16.1 22-Sep-2015  skrll Sync with HEAD
 1.21.2.1 03-Dec-2017  jdolecek update from HEAD
 1.22.18.1 10-Jun-2019  christos Sync with HEAD
 1.23.16.2 01-Aug-2021  thorpej Sync with HEAD.
 1.23.16.1 13-May-2021  thorpej Sync with HEAD.
 1.3 27-Aug-1998  mrg move isp sbus attachment to dev/sbus and support it on the sparc64
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.9 18-Sep-2025  thorpej In the "i2c-child-devices" array, don't pass in a "cookie" and "cookietype".
Instead, just create the appropriate devhandle and pass that along as a
data object.
 1.8 15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.7 07-Aug-2021  thorpej branches: 1.7.2;
Merge thorpej-cfargs2.
 1.6 24-Apr-2021  thorpej branches: 1.6.2; 1.6.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.5 12-Jun-2020  thorpej branches: 1.5.4;
Update for proplib(3) API changes.
 1.4 22-Dec-2019  thorpej Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.3 03-Nov-2018  martin branches: 1.3.2; 1.3.6;
Use PRIx64 printf format to make the 32bit version compile.
 1.2 26-Oct-2018  macallan - map registers ourselves, no more schizo hackery
- remove some leftover debug code
- print address when attaching
- actually lock/unlock in acquire_bus()/release_bus()
should be ready for general consumption now
 1.1 20-Oct-2018  macallan support for jbus-i2c found in US-IIIi machines
this needs help from schizo to access its registers, which is suboptimal and
should go away. So, for now this is for documentation purposes only.
 1.3.6.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.6.2 10-Jun-2019  christos Sync with HEAD
 1.3.6.1 03-Nov-2018  christos file jbus-i2c.c was added on branch phil-wifi on 2019-06-10 22:06:47 +0000
 1.3.2.2 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.3.2.1 03-Nov-2018  pgoyette file jbus-i2c.c was added on branch pgoyette-compat on 2018-11-26 01:52:27 +0000
 1.5.4.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.6.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.6.2.1 14-May-2021  thorpej Adapt jbusi2c to the new i2c device enumeration scheme.
 1.7.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.53 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.52 16-Mar-2014  dholland branches: 1.52.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.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 24-Apr-2011  rmind branches: 1.50.4; 1.50.14;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.49 28-Apr-2008  martin branches: 1.49.22; 1.49.28;
Remove clause 3 and 4 from TNF licenses
 1.48 30-Mar-2008  tsutsui branches: 1.48.2; 1.48.4;
One missed file in the previous commit:
> Split softc and device_t for zsc(4) and its children.

Pointed out by mrg@.
 1.47 19-Nov-2007  ad branches: 1.47.14;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.46 19-Oct-2007  dogcow branches: 1.46.2;
It's always nice to prototype functions before using them.
 1.45 18-Oct-2007  joerg 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.44 04-Mar-2007  christos branches: 1.44.2; 1.44.18; 1.44.20; 1.44.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.43 16-Feb-2007  ad branches: 1.43.2;
More spllowersoftclock() fallout.
 1.42 15-Oct-2006  martin Initializers
 1.41 01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks!
 1.40 26-Jul-2006  martin branches: 1.40.4; 1.40.6;
Make it compile again
 1.39 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.38 14-May-2006  elad integrate kauth.
 1.37 13-Feb-2006  cdi branches: 1.37.2; 1.37.4; 1.37.6;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.36 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.35 11-Dec-2005  christos branches: 1.35.2; 1.35.4; 1.35.6;
merge ktrace-lwp.
 1.34 06-Sep-2005  kleink Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges. Noted by David Holland in PR kern/31126.
 1.33 25-Feb-2005  martin branches: 1.33.4;
Nuke options RASTERCONSOLE for sparc64
 1.32 21-Mar-2004  pk branches: 1.32.8; 1.32.10;
Use the promlib I/O routines.
 1.31 17-Mar-2004  pk Use prom_getoption() and drop home-grown string-to-integer conversion code.
 1.30 25-Aug-2003  uwe Use dev/sun/fbvar.h instead of machine/fbvar.h (which is just an out
of date copy of the former).

Compile tested with GENERIC32.
Ok by Martin Husemann <martin@netbsd>.
 1.29 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.28 24-Aug-2003  uwe #include "opt_rcons.h"
 1.27 15-Jul-2003  lukem __KERNEL_RCSID()
 1.26 29-Jun-2003  fvdl branches: 1.26.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.25 29-Jun-2003  martin Passing struct lwp * instead of struct proc * to device functions,
replace a homegrown check with proper suser() call.
 1.24 23-Oct-2002  jdolecek merge kqueue branch into -current

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

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

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.23 10-Oct-2002  jdolecek tag the cdevsw as D_TTY
 1.22 10-Oct-2002  martin Pass a struct cons_channel * to cc_iclose, not a struct kbd_softc *.
This argument has been previously unused, thus undetected due to void*
typing. Mmm, copy & paste. Note that sparc got it right though.

Many thanks to Valeriy E. Ushakov <uwe@netbsd.org> for debugging support.
 1.21 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.20 19-Mar-2002  eeh branches: 1.20.4;
Using PSR_PIL in conjunction with the IPL results in a comparison that is
always true.
 1.19 17-Mar-2002  atatat Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.18 26-Sep-2001  eeh branches: 1.18.4;
getprop* -> PROM_getprop*
 1.17 19-Sep-2001  thorpej machine/fbio.h -> dev/sun/fbio.h
 1.16 02-May-2001  scw branches: 1.16.2; 1.16.4;
Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.15 09-Nov-2000  eeh branches: 1.15.2;
Attach the sunkbd line discipline to zstty.
 1.14 02-Nov-2000  eeh Adapt to the new line discipline scheme.
 1.13 21-Sep-2000  eeh Sun Keyboard/Mouse line discipline support.
 1.12 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.11 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.10 21-Mar-2000  pk We need cons_attach_input().
 1.9 20-Mar-2000  pk Call rcons_ttyinit() on first open.
 1.8 19-Mar-2000  pk Nuke dead code.
 1.7 19-Mar-2000  pk Minimal changes to accomodate the console input channel attachment
changes in the keyboard driver (see /sys/dev/sun/kbd*)
 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 23-May-1999  eeh Start putting in hooks for non-zs console devices.
 1.3 22-May-1999  eeh If the zs has not yet attached use the PROM for console input.
 1.2 25-Apr-1999  eeh Defer final console attach to zs_attach().
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.10;
Import of sparc64.
 1.1.1.1.10.1 21-Jun-1999  thorpej Sync w/ -current.
 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.15.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.16.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.16.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.16.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.16.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.16.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.16.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.16.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.4.5 11-Nov-2002  nathanw Catch up to -current
 1.18.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.18.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.18.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.18.4.1 26-Sep-2001  nathanw file kd.c was added on branch nathanw_sa on 2002-04-01 07:43:03 +0000
 1.20.4.1 19-May-2002  gehenna Add device switch.
Replace the access to devsw table and the hard-coded majors with devsw API.
 1.26.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.26.2.5 04-Mar-2005  skrll Sync with HEAD.

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

sparc64 GENERIC compiles.
 1.26.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.32.8.1 29-Apr-2005  kent sync with -current
 1.33.4.6 07-Dec-2007  yamt sync with head
 1.33.4.5 27-Oct-2007  yamt sync with head.
 1.33.4.4 03-Sep-2007  yamt sync with head.
 1.33.4.3 26-Feb-2007  yamt sync with head.
 1.33.4.2 30-Dec-2006  yamt sync with head.
 1.33.4.1 21-Jun-2006  yamt sync with head.
 1.35.6.2 01-Jun-2006  kardel Sync with head.
 1.35.6.1 22-Apr-2006  simonb Sync with head.
 1.35.4.1 09-Sep-2006  rpaulo sync with head
 1.35.2.1 18-Feb-2006  yamt sync with head.
 1.37.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.37.4.3 12-May-2006  elad adapt to kauth kpi, include sys/kauth.h where needed..
 1.37.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.37.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.37.2.2 11-Aug-2006  yamt sync with head
 1.37.2.1 24-May-2006  yamt 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.43.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.44.24.2 21-Nov-2007  bouyer Sync with HEAD
 1.44.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.44.20.2 09-Jan-2008  matt sync with HEAD
 1.44.20.1 06-Nov-2007  matt sync with HEAD
 1.44.18.2 21-Nov-2007  joerg Sync with HEAD.
 1.44.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.44.2.2 03-Dec-2007  ad Sync with HEAD.
 1.44.2.1 23-Oct-2007  ad Sync with head.
 1.46.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.47.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.47.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.48.4.1 16-May-2008  yamt sync with head.
 1.48.2.1 18-May-2008  yamt sync with head.
 1.49.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.49.22.1 31-May-2011  rmind sync with head
 1.50.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.50.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 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 30-Oct-2012  yamt sync with head
 1.51.2.1 18-May-2014  rmind sync with head
 1.52.2.1 10-Aug-2014  tls Rebase.
 1.10 06-Feb-2025  palle sun4v ldc: fix 32-bit build
 1.9 05-Feb-2025  palle sun4v ldc: improve the ldc_send_xxx functions so they can print an error message and return a proper error code
 1.8 20-Dec-2023  thorpej branches: 1.8.2;
Remove unnecessary <sys/malloc.h>.
 1.7 05-Apr-2021  palle sun4v: Ignore spurious ldc CTRL/ACK/VERS messages (do not reset the connection anymore). Fixes occationals stalls when vdsk uses the ldc service. Observed on both T2000 and T5 host systems
 1.6 15-Oct-2019  chs branches: 1.6.10;
convert more KM_NOSLEEP to KM_SLEEP and remove code to handle failures.
 1.5 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.4 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.3 03-Mar-2017  palle branches: 1.3.12; 1.3.14; 1.3.16;
sun4v: Fixed PR 51554 - Avoid unsafe allocation in ldc/vdsk
 1.2 20-Aug-2016  nakayama branches: 1.2.2; 1.2.4; 1.2.6;
Avoid "cast to pointer from integer of different size" warning on
32-bit kernels.
 1.1 19-Aug-2016  palle sun4v: vdsk and ldc drivers - from OpenBSD, but heavily adapted to NetBSD scsipi - access to a virtual disk served from a ldom primary domain now works
 1.2.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.2.4.3 28-Aug-2017  skrll Sync with HEAD
 1.2.4.2 05-Oct-2016  skrll Sync with HEAD
 1.2.4.1 20-Aug-2016  skrll file ldc.c was added on branch nick-nhusb on 2016-10-05 20:55:36 +0000
 1.2.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.2.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.2.2.1 20-Aug-2016  pgoyette file ldc.c was added on branch pgoyette-localcount on 2016-09-14 03:04:17 +0000
 1.3.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.16.1 10-Jun-2019  christos Sync with HEAD
 1.3.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.12.2 03-Dec-2017  jdolecek update from HEAD
 1.3.12.1 03-Mar-2017  jdolecek file ldc.c was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.6.10.1 17-Apr-2021  thorpej Sync with HEAD.
 1.8.2.1 02-Aug-2025  perseant Sync with HEAD
 1.2 05-Feb-2025  palle sun4v ldc: improve the ldc_send_xxx functions so they can print an error message and return a proper error code
 1.1 19-Aug-2016  palle branches: 1.1.2; 1.1.4; 1.1.18; 1.1.58;
sun4v: vdsk and ldc drivers - from OpenBSD, but heavily adapted to NetBSD scsipi - access to a virtual disk served from a ldom primary domain now works
 1.1.58.1 02-Aug-2025  perseant Sync with HEAD
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 19-Aug-2016  jdolecek file ldcvar.h was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.1.4.2 05-Oct-2016  skrll Sync with HEAD
 1.1.4.1 19-Aug-2016  skrll file ldcvar.h was added on branch nick-nhusb on 2016-10-05 20:55:36 +0000
 1.1.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.1.2.1 19-Aug-2016  pgoyette file ldcvar.h was added on branch pgoyette-localcount on 2016-09-14 03:04:17 +0000
 1.2 27-Jul-1998  mrg this has moved (and was never used here anyway)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.16 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.15 27-Apr-2015  martin branches: 1.15.16; 1.15.18;
Print error codes from sysmon
 1.14 21-Feb-2015  nakayama Fix queue handling to make the watchdog timer actually works on
netbsd-7 if it is configured by wdogctl=YES in rc.conf, and also
avoid a hangup duaring shutdown.

- don't put an entry which is already in the queue.
- read a first entry properly to handle the queue.
- check the lom status if input buffer is empty before writing.
 1.13 25-Feb-2014  pooka branches: 1.13.4; 1.13.6;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.12 20-Feb-2014  joerg Don't use conditional format strings, if they aren't equivalent in the
arguments they use.
 1.11 24-Jan-2013  nakayama branches: 1.11.2;
Fix typo in KASSERT, pointed out by riastradh@ and martin@.
 1.10 02-Jun-2012  dsl branches: 1.10.2;
Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.9 20-Jun-2011  pgoyette branches: 1.9.2;
Initialize sensor states before registering.
 1.8 19-Jun-2011  nakayama Limit reading from registers at most once every second with using
ratecheck(9).
 1.7 28-Feb-2011  nakayama branches: 1.7.2;
lom_refresh():
Update only the sensor status specified by the edata as noted in
sysmon_envsys(9).

lom_sysctl_alarm():
Update alarm status before reading via sysctl to make it usable at
a boot time.
 1.6 22-Mar-2010  nakayama branches: 1.6.2; 1.6.4; 1.6.6;
Fix off-by-one in LOMlite hostname code. From rev 1.21 of OpenBSD.
 1.5 28-Dec-2009  nakayama branches: 1.5.2; 1.5.4; 1.5.6;
Make fault LED and alarms status changeable via sysctl(8).
The sysctl entries are created under the hw.lomN MIB.
 1.4 13-Dec-2009  nakayama Merge change of OpenBSD rev 1.20:

Remove debug printf and properly dequeue command instead when a read times out
on LOMLite2.
 1.3 28-Nov-2009  nakayama Add support for monitoring Fault LED and Alarms status.
 1.2 16-Nov-2009  nakayama Merge changes between revision 1.16 and 1.19 of OpenBSD with
shutdownhook_establish(9) to pmf(9) conversion:

- LOMlite seems to get wedged from time to time; add some code to unwedge it.

- Make sure we don't insert and entry into the list of pending commends twice.

- Establish a shutdown hook to disable the watchdog timer to prevent watchdog
triggers after the kernel has been halted.

- Handle LOMlite2 in an interrupt-driven way; avoids using delay(9) once the
machine is up and running.
 1.1 02-Oct-2009  nakayama branches: 1.1.2;
Port lom(4) driver for LOMlite lights out management hardware monitor
and watchdog timer from OpenBSD.

It supports the LOMlite found on Sun Netra t1 and the LOMlite2 found
on Sun Netra T1/X1 and Sun Fire V100/V120.
 1.1.2.8 16-Jul-2011  riz Pull up following revision(s) (requested by nakayama in ticket #1641):
sys/arch/sparc64/dev/lom.c: revision 1.8
Limit reading from registers at most once every second with using
ratecheck(9).
 1.1.2.7 20-Mar-2011  bouyer Pull up following revision(s) (requested by nakayama in ticket #1570):
sys/arch/sparc64/dev/lom.c: revision 1.7
lom_refresh():
Update only the sensor status specified by the edata as noted in
sysmon_envsys(9).
lom_sysctl_alarm():
Update alarm status before reading via sysctl to make it usable at
a boot time.
 1.1.2.6 28-Mar-2010  snj Pull up following revision(s) (requested by nakayama in ticket #1349):
sys/arch/sparc64/dev/lom.c: revision 1.6
Fix off-by-one in LOMlite hostname code. From rev 1.21 of OpenBSD.
 1.1.2.5 09-Jan-2010  snj Pull up following revision(s) (requested by nakayama in ticket #1216):
share/man/man4/man4.sparc64/lom.4: revision 1.4
sys/arch/sparc64/dev/lom.c: revision 1.5
Make fault LED and alarms status changeable via sysctl(8).
The sysctl entries are created under the hw.lomN MIB.
 1.1.2.4 18-Dec-2009  snj Pull up following revision(s) (requested by nakayama in ticket #1193):
sys/arch/sparc64/dev/lom.c: revision 1.4
Merge change of OpenBSD rev 1.20:
Remove debug printf and properly dequeue command instead when a read times out
on LOMLite2.
 1.1.2.3 28-Nov-2009  bouyer Pull up following revision(s) (requested by nakayama in ticket #1151):
share/man/man4/man4.sparc64/lom.4: revision 1.3
sys/arch/sparc64/dev/lom.c: revision 1.2, 1.3
Merge changes between revision 1.16 and 1.19 of OpenBSD with
shutdownhook_establish(9) to pmf(9) conversion:
- LOMlite seems to get wedged from time to time; add some code to unwedge it.
- Make sure we don't insert and entry into the list of pending commends twice.
- Establish a shutdown hook to disable the watchdog timer to prevent watchdog
triggers after the kernel has been halted.
- Handle LOMlite2 in an interrupt-driven way; avoids using delay(9) once the
machine is up and running.
Add support for monitoring Fault LED and Alarms status.
 1.1.2.2 16-Oct-2009  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #1064):
distrib/sets/lists/man/mi: revision 1.1161
share/man/man4/man4.sparc64/Makefile: revision 1.5
share/man/man4/man4.sparc64/lom.4: revision 1.1-1.2
sys/arch/sparc64/conf/GENERIC: revision 1.111
sys/arch/sparc64/conf/files.sparc64: revision 1.121
sys/arch/sparc64/dev/lom.c: revision 1.1
sys/dev/DEVNAMES: revision 1.252

Add a driver for LOMlite lights out management hardware monitor and watchdog
timer.
 1.1.2.1 02-Oct-2009  sborrill file lom.c was added on branch netbsd-5 on 2009-10-16 11:56:11 +0000
 1.5.6.2 05-Mar-2011  rmind sync with head
 1.5.6.1 30-May-2010  rmind sync with head
 1.5.4.3 11-Aug-2010  yamt sync with head.
 1.5.4.2 11-Mar-2010  yamt sync with head
 1.5.4.1 28-Dec-2009  yamt file lom.c was added on branch yamt-nfs-mp on 2010-03-11 15:03:00 +0000
 1.5.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.6.6.1 05-Mar-2011  bouyer Sync with HEAD
 1.6.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.2.2 21-Apr-2010  matt sync to netbsd-5
 1.6.2.1 22-Mar-2010  matt file lom.c was added on branch matt-nb5-mips64 on 2010-04-21 00:33:49 +0000
 1.7.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.9.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.9.2.1 30-Oct-2012  yamt sync with head
 1.10.2.3 03-Dec-2017  jdolecek update from HEAD
 1.10.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.2.1 25-Feb-2013  tls resync with head
 1.11.2.1 18-May-2014  rmind sync with head
 1.13.6.2 06-Jun-2015  skrll Sync with HEAD
 1.13.6.1 06-Apr-2015  skrll Sync with HEAD
 1.13.4.1 21-Feb-2015  martin Pull up following revision(s) (requested by nakayama in ticket #539):
sys/arch/sparc64/dev/lom.c: revision 1.14
Fix queue handling to make the watchdog timer actually works on
netbsd-7 if it is configured by wdogctl=YES in rc.conf, and also
avoid a hangup duaring shutdown.
- don't put an entry which is already in the queue.
- read a first entry properly to handle the queue.
- check the lom status if input buffer is empty before writing.
 1.15.18.1 10-Jun-2019  christos Sync with HEAD
 1.15.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.24 03-May-2014  martin Also attach to devices named "parallel"
 1.23 01-Jul-2011  dyoung branches: 1.23.2; 1.23.12; 1.23.16; 1.23.26;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.22 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.21 07-Mar-2008  cube branches: 1.21.2; 1.21.4; 1.21.6;
Split the softc from the device_t for all lpt(4) variants and attachments
except the ppbus stuff (which doesn't compile) and ulpt(4) which is
unrelated and can be dealt with separately.

As usual, it comes with related cosmetic changes.
 1.20 11-Feb-2006  cdi branches: 1.20.44; 1.20.64; 1.20.68;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.19 11-Dec-2005  christos branches: 1.19.2; 1.19.4; 1.19.6;
merge ktrace-lwp.
 1.18 15-Jul-2003  lukem branches: 1.18.16;
__KERNEL_RCSID()
 1.17 10-Dec-2002  pk branches: 1.17.6;
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 18-Jul-2002  wiz Spell 'should' correctly.
 1.12 21-Mar-2002  eeh branches: 1.12.4;
Cleanup.
 1.11 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.10 16-Mar-2002  mrg convert to using <dev/ebus/ebusvar.h> and it's struct member names.
 1.9 15-Mar-2002  eeh Get PCI working with the new bus_space*.
 1.8 01-Mar-2002  martin Rename EBUS_PADDR_FROM_REG uses to EBUS_ADDR_FROM_REG.
 1.7 22-Oct-2001  mrg branches: 1.7.4;
use <dev/ebus/ebusreg.h>
 1.6 09-Jul-2000  pk branches: 1.6.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.5 15-Apr-2000  mrg branches: 1.5.4;
- auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.4 08-Apr-2000  mrg - store the ebus's parent so we can find the IOMMU
- use generic iommu routines in the ebus code (uses the above)
- add some more comments.
 1.3 05-Apr-2000  mrg add some comments, clean this up a bit.
 1.2 05-Jun-1999  mrg branches: 1.2.2; 1.2.4;
map in registers, configure interrupts, this appears to be OK now.
 1.1 05-Jun-1999  mrg lpt at ebus.
 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.5.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.6.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.6.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.6.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 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 01-Aug-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 22-Oct-2001  nathanw file lpt_ebus.c was added on branch nathanw_sa on 2002-04-01 07:43:03 +0000
 1.12.4.1 21-Jul-2002  gehenna catch up with -current.
 1.17.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.6.1 03-Aug-2004  skrll Sync with HEAD
 1.18.16.2 17-Mar-2008  yamt sync with head.
 1.18.16.1 21-Jun-2006  yamt sync with head.
 1.19.6.1 22-Apr-2006  simonb Sync with head.
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.19.2.1 18-Feb-2006  yamt sync with head.
 1.20.68.2 02-Jun-2008  mjf Sync with HEAD.
 1.20.68.1 03-Apr-2008  mjf Sync with HEAD.
 1.20.64.1 24-Mar-2008  keiichi sync with head.
 1.20.44.1 23-Mar-2008  matt sync with HEAD
 1.21.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.21.4.1 04-May-2009  yamt sync with head.
 1.21.2.1 04-Jun-2008  yamt sync with head
 1.23.26.1 10-Aug-2014  tls Rebase.
 1.23.16.1 18-May-2014  rmind sync with head
 1.23.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.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.4 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.3 19-Apr-2000  mrg branches: 1.3.8; 1.3.12;
add a newline to this fake autoconfig line.
 1.2 06-Apr-2000  mrg make this work with years-old new-style mdsetimage, etc.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.12.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.8.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.14 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.13 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.12 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.11 19-Sep-2012  jdc Use the PROM mapping for the clock, if it exists.
Allows the clock on the Tadpole SPARCle to attach.
Idea from r1.43 of OpenBSD sys/arch/sparc64/sparc64/clock.c
 1.10 11-Aug-2012  mrg branches: 1.10.2;
add an XXXSMP comment.
 1.9 29-Jul-2011  mrg branches: 1.9.2;
port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.8 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.7 12-Mar-2011  nakayama Remove unnecessary headers.
 1.6 24-Oct-2009  nakayama branches: 1.6.4; 1.6.6;
Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.
 1.5 29-Mar-2008  tsutsui branches: 1.5.4;
Don't forget to initialize sc_dev.
 1.4 29-Mar-2008  tsutsui Use device_private(), missed in the previous.
 1.3 28-Mar-2008  tsutsui Split device_t and softc for MI mk48txx(4) and intersil7170(4) clocks,
and other related misc cosmetics.
 1.2 10-Jan-2008  tsutsui branches: 1.2.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.1 09-Nov-2006  tsutsui branches: 1.1.2; 1.1.6; 1.1.8; 1.1.34; 1.1.40; 1.1.48;
More cleanup of sparc64 clock stuff:
- split mkclock attachment from sparc64/clock.c into dev/mkclock.c
(now clock.s only contains clock interrupt and timecounter stuff)
- rename match/attach functions of rtc at ebus to match the device name
- update some comments around clock devices in GENERIC

No objection on port-sparc64 for a month.
 1.1.48.1 10-Jan-2008  bouyer Sync with HEAD
 1.1.40.1 18-Feb-2008  mjf Sync with HEAD.
 1.1.34.1 23-Mar-2008  matt sync with HEAD
 1.1.8.3 21-Jan-2008  yamt sync with head
 1.1.8.2 30-Dec-2006  yamt sync with head.
 1.1.8.1 09-Nov-2006  yamt file mkclock.c was added on branch yamt-lazymbuf on 2006-12-30 20:47:02 +0000
 1.1.6.2 10-Dec-2006  yamt sync with head.
 1.1.6.1 09-Nov-2006  yamt file mkclock.c was added on branch yamt-splraiseipl on 2006-12-10 07:16:36 +0000
 1.1.2.2 18-Nov-2006  ad Sync with head.
 1.1.2.1 09-Nov-2006  ad file mkclock.c was added on branch newlock2 on 2006-11-18 21:29:32 +0000
 1.2.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.5.4.1 11-Mar-2010  yamt sync with head
 1.6.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.4.1 21-Apr-2011  rmind sync with head
 1.9.2.1 30-Oct-2012  yamt sync with head
 1.10.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4 16-May-2002  thorpej branches: 1.4.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.3 13-May-2002  matt Don't panic is no class-code, just return. Needed for NetraX1.
 1.2 06-May-2002  eeh Fix printing during attach and get rid of pci_cd that's provided by the linker.
 1.1 06-May-2002  eeh Add the ofpci driver.
 1.4.2.2 16-May-2002  thorpej * 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.4.2.1 16-May-2002  thorpej file ofpci.c was added on branch gehenna-devsw on 2002-05-16 01:01:45 +0000
 1.2 16-May-2002  thorpej branches: 1.2.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.1 06-May-2002  eeh Add the ofpci driver.
 1.2.2.2 16-May-2002  thorpej * 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.2.2.1 16-May-2002  thorpej file ofpcivar.h was added on branch gehenna-devsw on 2002-05-16 01:01:45 +0000
 1.2 16-May-2002  thorpej branches: 1.2.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.1 06-May-2002  eeh Add ofppb to match ofpci.
 1.2.2.2 16-May-2002  thorpej * 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.2.2.1 16-May-2002  thorpej file ofppb.c was added on branch gehenna-devsw on 2002-05-16 01:01:46 +0000
 1.20 17-Sep-2025  thorpej Don't get the OF phandle from i2c_attach_args::ia_cookie; get it from
self's devhandle.
 1.19 27-Jan-2021  thorpej branches: 1.19.4; 1.19.14;
Use DEVICE_COMPAT_EOL.
 1.18 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.17 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.16 23-Dec-2020  jdc Rename the CPU fan to SYS fan to match what the firmware calls it.
Check for fan failure and high temperature events when setting the fan
speed. If one or both is true, run the fans at full speed.
 1.15 20-Dec-2020  jdc For the E250:
set fans to medium speed when attaching and full speed when detaching.
remove unused PS fan definition.
In general:
return early from attach if the device isn't present.
handle errors from sysmon during attach so that detach doesn't crash.
try to handle errors when acquiring the iic bus during detach.
 1.14 07-Dec-2020  jdc Add some debugging output to check sensor addition and refresh.
 1.13 06-Dec-2020  jdc Don't read from the chip when matching, fail the attach instead (requested
by jmcneill). Reverts previous.
While here, handle errors attaching sysmon and acquiring the iic bus lock.
 1.12 05-Dec-2020  jdc When matching, try a read in case this is an optional device and isn't
actually present.
 1.11 31-Oct-2020  jdc branches: 1.11.2;
Call sysmon_envsys_unregister() not sysmon_envsys_destroy() when
detaching. Pointed out by Michael van Elst.
 1.10 24-Oct-2020  jdc Add support for automatically changing the CPU fan speed on the E250 in a
similar way to the SB1000/SB2000.
The fan control information was determined by experiment, as it's only
partially available in OFW.
Hardcode the missing information for E250 fan control into the driver
(it should be possible to support the E450 in future too).
 1.9 26-Jun-2018  thorpej In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.8 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.7 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.6 18-Mar-2012  mrg branches: 1.6.38;
add missing __KERNEL_RCSID().
 1.5 20-Jun-2011  pgoyette branches: 1.5.2; 1.5.6;
Initialize sensor states before registering.
 1.4 03-Apr-2011  jdc branches: 1.4.2;
Remove ENVSYS_FMONNOTSUPP, so that we can monitor this sensor.
 1.3 28-Feb-2010  martin branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8;
dmesg cosmetics
 1.2 28-Feb-2010  pgoyette Set the FMONNOTSUPP flag for each individual sensor, and add the
FMONLIMITS flag so the sensor is actually monitored and events can
be generated.

As discussed with martin@ in private email.
 1.1 28-Feb-2010  martin Remove the envctrl driver, it is superseeded by the more general pcfiic @
ebus. Add the SB1000/SB2000 fan controll driver (tda). From OpenBSD.
Move config files over to direct configuration of i2c devices.
 1.3.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.3.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.6.1 28-Feb-2010  uebayasi file pcf8591_envctrl.c was added on branch uebayasi-xip on 2010-04-30 14:39:51 +0000
 1.3.4.1 21-Apr-2011  rmind sync with head
 1.3.2.2 11-Mar-2010  yamt sync with head
 1.3.2.1 28-Feb-2010  yamt file pcf8591_envctrl.c was added on branch yamt-nfs-mp on 2010-03-11 15:03:00 +0000
 1.4.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.5.6.1 05-Apr-2012  mrg sync to latest -current.
 1.5.2.1 17-Apr-2012  yamt sync with head
 1.6.38.2 28-Jul-2018  pgoyette Sync with HEAD
 1.6.38.1 25-Jun-2018  pgoyette Sync with HEAD
 1.11.2.3 03-Apr-2021  thorpej Sync with HEAD.
 1.11.2.2 03-Jan-2021  thorpej Sync w/ HEAD.
 1.11.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.19.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.19.4.1 15-May-2021  thorpej - Move all of the stuff-missing-from-OFW-device-tree stuff into a
new function sparc64_device_tree_fixup(), and call it from
device_register().
- sparc64_device_tree_fixup() is table-driven, selecting the table
based on the machine_model. It can appy "dtnode" fixups (by matching
the device's OFW path) and "special" fixups, which are especially
useful when a property needs to be added to another device that happens
to not be in the OFW device tree.
- Implement enumeration of missing-from-OFW-device-tree i2c devices
by "sub-classing" the controller's device handle, intercepting the
"i2c-enumerate-devices" device call. We let the "super" first
enumerate any i2c devices that are in the OFW device tree, and then
enumerate our own additions after that is done. i2c additions are
provided by the machine_model fixup tables.
 1.9 01-Sep-2025  thorpej Put the pcfiic driver declaration in the global location, and adapt
the sparc64 instance to be a proper separate attachment.
 1.8 31-Aug-2025  thorpej Don't rely on pcfiic_attach() to print the newline.
 1.7 23-Oct-2020  jdc branches: 1.7.6; 1.7.16;
Move E250 and E450 i2c patches from dev/pcfiic_ebus.c to sparc64/ofw_patch.c.
They are now co-located with the other OFW patch routines.
New i2c devices are created for E250/E450 and v210/v240, so create new
functions to avoid duplicate code.
 1.6 12-Jun-2020  thorpej Update for proplib(3) API changes.
 1.5 03-Jan-2016  jdc Remove duplicate register definitions and merge them all into pcf8584reg.h.
No functional change.
 1.4 03-Feb-2013  jdc branches: 1.4.14;
Output "iic mux present" if this device has multiple IIC buses (0 and 1).
The device has multiple buses if the second (bus select) register is present.
 1.3 18-Mar-2012  mrg branches: 1.3.2;
add missing __KERNEL_RCSID().
 1.2 01-Jul-2011  dyoung branches: 1.2.2; 1.2.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.1 28-Feb-2010  martin branches: 1.1.2; 1.1.6;
Remove the envctrl driver, it is superseeded by the more general pcfiic @
ebus. Add the SB1000/SB2000 fan controll driver (tda). From OpenBSD.
Move config files over to direct configuration of i2c devices.
 1.1.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.6.1 28-Feb-2010  uebayasi file pcfiic_ebus.c was added on branch uebayasi-xip on 2010-04-30 14:39:51 +0000
 1.1.2.2 11-Mar-2010  yamt sync with head
 1.1.2.1 28-Feb-2010  yamt file pcfiic_ebus.c was added on branch yamt-nfs-mp on 2010-03-11 15:03:00 +0000
 1.2.6.1 05-Apr-2012  mrg sync to latest -current.
 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 17-Apr-2012  yamt sync with head
 1.3.2.2 03-Dec-2017  jdolecek update from HEAD
 1.3.2.1 25-Feb-2013  tls resync with head
 1.4.14.1 19-Mar-2016  skrll Sync with HEAD
 1.7.16.2 12-Sep-2021  thorpej - Improve some comments.
- Update pcfiic_i2c_exec() for the channel split (might fix an issue
spotted by tnn@ in testing).
 1.7.16.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.7.6.1 14-May-2021  thorpej Update the pcfiic driver for the new i2c device enumeration scheme.
Push the multiple-channels complexity up into the ebus front-end,
as that specific to a particular Sun model of controller. Now
the BBC-type controllers get multiple I2C bus instances attached to
them.
 1.84 04-Oct-2025  thorpej Don't use the common OpenFirmware PCI-device-to-devhandle mapping
routine. We've gone through the trouble of encoding the PROM node
into the pcitag_t, and using that ensures we're consistent with
any PROM data quirks.
 1.83 23-Jun-2024  riastradh pci: Pass cookie through pci_find_device, pci_enumerate_bus, take 2.

New functions pci_find_device1 and pci_enumerate_bus1 have the cookie
argument. Existing symbols pci_find_device and pci_enumerate_bus are
now wrappers for the cookieless version.

This will allow pci_find_device callers to pass a cookie through to
the match function so they can keep state or pass in extra parameters
like b/d/f numbers, which will allow us to nix some horrible kludges
in the Linux PCI API emulation for drm (and, perhaps, Intel wifi).

This change drops the symbol pci_probe_device, in favour of a new
pci_probe_device1 with the cookie argument. But I don't think that
requires a revbump because it's only called by MD pci_enumerate_bus1
implementations, which don't live in modules anyway.

Take 2: Make sure to handle NULL match function.
 1.82 20-May-2024  riastradh Revert "pci: Pass cookie through pci_find_device, pci_enumerate_bus."

Evidently something is wrong with this, to be diagnosed and redone
once the builds and tests are in better shape.
 1.81 20-May-2024  riastradh pci: Pass cookie through pci_find_device, pci_enumerate_bus.

New functions pci_find_device1 and pci_enumerate_bus1 have the cookie
argument. Existing symbols pci_find_device and pci_enumerate_bus are
now wrappers for the cookieless version.

This drops the symbol pci_probe_device, in favour of a new
pci_probe_device1 with the cookie argument. But I don't think that
requires a revbump because it's only called by MD pci_enumerate_bus1
implementations, which don't live in modules anyway.
 1.80 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.79 01-Oct-2022  charlotte branches: 1.79.4;
Don't try to make a tag based on node 0
 1.78 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.77 29-Mar-2014  christos branches: 1.77.28; 1.77.30;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.76 26-Mar-2014  christos kill sprintf
 1.75 27-Oct-2012  chs branches: 1.75.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.74 12-Aug-2011  mrg branches: 1.74.2; 1.74.12;
convert some open-coded SPDB_PROBE printf calls to use DPRINTF() macro.
 1.73 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.72 11-May-2011  macallan when looking for a device's node we want to start with the child nodes of the
root bus, not its peers
 1.71 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.70 20-Mar-2011  mrg remove unnecessary iommuvar.h and psycho{reg,var}.h includes.
 1.69 16-Mar-2011  mrg don't try to turn on parity or set the latency timer, or dump pci config
space for the pci bridge in sparc64_pci_enumerate_bus(). it doesn't work
on PCIe adapters. #if 0'ed for now, should move this into psycho/schizo.
 1.68 18-Dec-2010  mrg branches: 1.68.2;
allow sparc64 spc_find_ino() to be NULL; schizo doesn't need it.
 1.67 07-Jan-2010  jdc branches: 1.67.4;
Cope with up to four "interrupts" properties for a node.
Just use the first one for now. This should be improved.
OK: mrg@.
 1.66 06-Jan-2010  mrg move the guts of pci_intr_map() into pci_machdep.c, and move the schizo
ign addition into a hook. also, don't double shift the ign in set_intr.

tested on U60 and SB2500.
 1.65 30-Nov-2009  mrg convert pci_intr_map() into a chipset tag function pointer, and implement
the schizo version slightly differently.

pull out the schizo's IGN from the upaid, not the apparently broken device
ID register. from openbsd.

with this i appear to have valid working interrupts on the SB2500.

tested on U60 and SB2500.


XXX: we can probably kill (*spc_find_ino)() now that pci_intr_map() itself
XXX: is no longer a first class function.
 1.64 28-Nov-2009  mrg give more debug output about mapping interrupts.
 1.63 27-Nov-2009  mrg clean up some debug messages a little bit.
 1.62 10-Dec-2008  nakayama pci_make_tag:
- add assertion for checking spc_busnode initialization.
 1.61 10-Dec-2008  mrg ofpci_make_tag():
don't write PCI_COMMAND_STATUS_REG with
PCI_COMMAND_(MEM|MASTER|IO)_ENABLE, or it in.
sparc_pci_childspace():
move psycho.c:get_childspace() into pci_machdep.c but rename it
psycho_alloc_bus_tag():
use M_ZERO
 1.60 07-Dec-2008  mrg a few clean up/rearrange changes, somewhat inspired from openbsd's
schizo.c:

- rename pp_busnode{} -> spc_busnode{}, and move it to
sparc_pci_chipset{}

- move public pci functions pci_conf_read(), pci_conf_write() and
pci_intr_establish() into psycho.c, renaming them in the process,
and add pointers through sparc_pci_chipset{} to access them.
as part of this, add PDB_INTMAP and PDB_CONF debug options to
psycho.c

- move and rename sparc64 private pci_find_ino() into
sparc_pci_chipset{}, like the above

- update psycho_alloc_chipset() to set the new 4 function members


no functional change intended. XXX: not tested on cardbus.
 1.59 30-May-2008  ad branches: 1.59.4; 1.59.6;
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.58 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.57 24-Mar-2008  cube branches: 1.57.2; 1.57.4; 1.57.6;
Change previous to use aprint_error_dev.
 1.56 23-Mar-2008  macallan use device_xname()
 1.55 03-Feb-2008  martin branches: 1.55.6;
Do not panic when trying to disestablish a pci interrupt.
 1.54 04-Apr-2007  tnn branches: 1.54.14; 1.54.20;
pci_find_ino(): Use interrupt pin from pci_attach_args when mapping interrupts.
Use *ihp as a pure output. Fix case where interrupt pin #D was incorrectly
mapped. Some cosmetic changes while here. Ok'd by martin.
 1.53 21-Oct-2006  mrg branches: 1.53.4; 1.53.8; 1.53.10;
remove "struct cacheline" and the "cacheline" variable. (it was only set
in cpu_attach(), overwritten by multiple cpus, and only one member of the
12 or more were ever used again.) add an ecache_min_line_size to replace
this functionality.

clean up some non-SMP friendly code from cpu_attach():
- only reset the fpu state on the boot cpu
- don't bother printing "FPU version 0" always
- don't call getver() and ignore the result
- print the UPA id on the first cpu0: line

only print mp_tramp address #ifdef DEBUG.

reset the fpu state in cpu_hatch(), like cpu_attach() does for the boot cpu.


cpu_attach() is now free of SMP-unfriendly code.
 1.52 15-Oct-2006  martin Missing initializers
 1.51 11-Feb-2006  cdi branches: 1.51.14; 1.51.16;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.50 11-Dec-2005  christos branches: 1.50.2; 1.50.4; 1.50.6;
merge ktrace-lwp.
 1.49 17-Aug-2004  drochner branches: 1.49.12;
make PCI devices attachable/detachable (as far as the particular drivers
allow), and allow to rescan a bus selectively (ie only the device/
function I'm looking at)
 1.48 29-Jul-2004  drochner give the special PCI bus enumerator a sparc64_ prefix and make the
PCI_MACHDEP_ENUMERATE_BUS macro point to it
 1.47 11-Jun-2004  petrov pci_find_ino: support pci-pci bridges.
 1.46 04-Apr-2004  nakayama Revert a part of rev. 1.44.

OF_getprop can get only the first "reg" property with a statically
allocated buffer, but prom_getprop cannot.
This should fix a "kernel trap 30: data access exception" when you
invoke a pcictl(8).
 1.45 28-Mar-2004  nakayama branches: 1.45.2;
Set prom_getprop args correctly.
 1.44 21-Mar-2004  pk Some more promlib interface conversions.
 1.43 21-Mar-2004  pk Two commas went missing in last commit.
 1.42 21-Mar-2004  pk Partial switch to the promlib interface.
 1.41 21-Jan-2004  petrov For pci devices without ofw mapping find ino by pci bus/slot/device
information, from OpenBSD.
 1.40 09-Nov-2003  martin Nuke bcopy/bzero.
 1.39 22-Aug-2003  petrov Cosmetic: move DEBUG defines.
 1.38 15-Jul-2003  lukem __KERNEL_RCSID()
 1.37 05-May-2003  martin branches: 1.37.2;
When overwriting the cache line size configuration, do not use the magic
value 0x10, but instead calculate a line size that is properly aligned
to the IOMMU strbuf cache and our external cache line size.
From FreeBSD.
 1.36 04-May-2003  martin Move the bus speed query code into it's own function and make it default
to 33 MHz. Cosmetics, no functional change.
 1.35 22-Mar-2003  nakayama PCI-CardBus bridge support for sparc64:
- handle devices which has no OBP node.
- move PCI latency-timer initialization from pci_intr_map to
pci_enumerate_bus.
- make PCI bus free space extents for cardbus devices.
- fix PCI config space map size.
- some code integrations.
 1.34 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.33 28-Sep-2002  martin Set the PCI latency timer for bus master devices.

Slightly different to the patch suggested by Takeshi Nakayama in PR 18451
(idea from FreeBSD).

Additional input from Jason Thorpe: do not hard code the bus frequency,
instead get it from OpenFirmware.
 1.32 29-Jun-2002  eeh Turn on parity checking for the PCI bus.
 1.31 16-May-2002  eeh branches: 1.31.2;
Make the PCI code actually work.
 1.30 16-May-2002  thorpej branches: 1.30.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.29 15-May-2002  thorpej Garbage-collect __PCI_DEV_FUNCORDER.
 1.28 15-May-2002  thorpej Implement pci_decompose_tag().
 1.27 06-May-2002  eeh Add ofpci_make_tag().
 1.26 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.25 17-Oct-2001  thorpej branches: 1.25.4;
Fix the semantics of __PCI_DEV_FUNCORDER so that they're actually useful:
If __PCI_DEV_FUNCORDER is defined, don't do the song-and-dance to check if
a device is multi-function; machdep code is going to tell us exactly which
functions to probe.

Note this required changing how pci_func_devorder() works in the
sparc64 PCI machdep code; now the "curnode" is assumed to point
to the bus, rather than some function (typically 0) on the device,
just as pci_bus_devorder() makes that assumption.

All this should allow the PCI code to actually locate the second
HME device on a Sun Netra t1, which is at 3,1 -- previously, the
PCI code would have missed it because there is no device at 3,0.

(Sun deserves a brick to the head for this one -- this seems clearly
out of line with the PCI spec.)
 1.24 15-Sep-2001  mrg in pci_conf_read() and pci_conf_write(), convert all printf()'s to only
occur if SPDB_CONF (and hence DEBUG). also convert the panic in
pci_conf_write() to a SPDB_CONF warning and a return.

this cleans up pcictl(8) support.
 1.23 23-Aug-2001  eeh branches: 1.23.2;
Fix backwards compare. (From Jason Wright)
 1.22 20-Jul-2001  eeh PCI overhaul.
 1.21 21-Mar-2001  mrg branches: 1.21.2;
adapt to systems with out interrupt-map & interrupt-map-mask properties.
 1.20 06-Mar-2001  mrg rework pci_attach_hook() to just deal with the INO, not the full
interrupt number. properly find interrupts for the E250. modify
pci_intr_map() accordingly. retire psycho_intr_map(). deal with
INO values upto 0x3f, not upto 0x32. restructure sabre_init() and
psycho_init() to be more similar, and display each psycho's IGN.
psycho_intr_establish() deals with INO upto 0x3f, values from 0x32
and higher get 0 for IPL.

tested on E250 & U5.
 1.19 02-Mar-2001  mrg branches: 1.19.2;
use pci_bus_devorder() and pci_dev_funcorder()
 1.18 19-Jan-2001  martin Enable IO space mapping by default.
Fixes PR 11940.
 1.17 14-Jan-2001  martin Fix format warnings to make it compile again.
 1.16 28-Dec-2000  sommerfeld Change pci_intr_map to get interrupt source information from a "struct
pci_attach_args *" instead of from four separate parameters which in
all cases were extracted from the same "struct pci_attach_args".

This both simplifies the driver api, and allows for alternate PCI
interrupt mapping schemes, such as one using the tables described in
the Intel Multiprocessor Spec which describe interrupt wirings for
devices behind pci-pci bridges based on the device's location rather
the bridge's location.

Tested on alpha and i386; welcome to 1.5Q
 1.15 26-Jul-2000  pk On-board devices on psycho machines seem to have the `interrupt' property
in the parent bus format (i.e. an INO) rather than being represented as
an PCI interrupt line. Provide a hack to work around this in pci_attach_hook().
 1.14 18-Jul-2000  pk Use probeget() in pci_config_read() for the psycho, to avoid bus
faults when probing PCI space.
 1.13 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.12 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.11 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.10 18-Jun-2000  mrg branches: 1.10.2;
kill dead code.
 1.9 08-Jun-2000  eeh Turn on PCI MEM and DMA.
 1.8 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.7 24-May-2000  eeh branches: 1.7.2;
Use the PCI function code to distinguish simba bus A from bus B instead
of the current hack.
 1.6 17-May-2000  mrg add a note about US IIi and PCI_INTERRUPT_LINE register
 1.5 08-Apr-2000  mrg - store the ebus's parent so we can find the IOMMU
- use generic iommu routines in the ebus code (uses the above)
- add some more comments.
 1.4 05-Apr-2000  mrg clean this up some.
 1.3 05-Jun-1999  eeh branches: 1.3.2; 1.3.4;
Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.2 05-Jun-1999  mrg clean up a bit, implement pci_conf_{read,write}() with probe[gs]et() (not yet used).
 1.1 04-Jun-1999  mrg PCI driver for the UltraSPARC. this only works on the Ultra5/10 machines
(`SUNW,sabre') for now, and it doesn't really quite work there yet anyway.
the bus space/dma code is cloned from the sbus driver. the IOMMU code also
is cloned from the sbus code, but separated out into iommu.c so that we can
share it with the sbus driver. hopefully, much of the bus space/dma code
can also be re-shared with the sbus driver and the ebus driver but for now
these copies will do.

support for the real UltraSPARC PCI (`SUNW,psycho') is unwritten, though
most of this code is shared with it.

we can probe PCI config space and try to configue devices, but interrupts
don't work yet...
 1.3.4.6 27-Mar-2001  bouyer Sync with HEAD.
 1.3.4.5 12-Mar-2001  bouyer Sync with HEAD.
 1.3.4.4 11-Feb-2001  bouyer Sync with HEAD.
 1.3.4.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.3.4.2 05-Jan-2001  bouyer Sync with HEAD
 1.3.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.3.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.2.2 31-Jul-2000  mrg pull up 1.15 (approved by thorpej):
>On-board devices on psycho machines seem to have the `interrupt' property
>in the parent bus format (i.e. an INO) rather than being represented as
>an PCI interrupt line. Provide a hack to work around this in pci_attach_hook().
 1.10.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.19.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.21.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.21.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.21.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.21.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.21.2.1 03-Aug-2001  lukem update to -current
 1.23.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.25.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.25.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.25.4.4 01-Aug-2002  nathanw Catch up to -current.
 1.25.4.3 20-Jun-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 17-Oct-2001  nathanw file pci_machdep.c was added on branch nathanw_sa on 2002-04-01 07:43:03 +0000
 1.30.2.3 17-Jul-2002  gehenna catch up with -current.
 1.30.2.2 30-May-2002  gehenna Catch up with -current.
 1.30.2.1 16-May-2002  gehenna file pci_machdep.c was added on branch gehenna-devsw on 2002-05-30 15:35:48 +0000
 1.31.2.1 22-Nov-2002  tron Pull up revision 1.33 (requested by martin in ticket #875):
Set the PCI latency timer for bus master devices.
Slightly different to the patch suggested by Takeshi Nakayama in PR 18451
(idea from FreeBSD).
Additional input from Jason Thorpe: do not hard code the bus frequency,
instead get it from OpenFirmware.
 1.37.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.37.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.37.2.2 25-Aug-2004  skrll Sync with HEAD.
 1.37.2.1 03-Aug-2004  skrll Sync with HEAD
 1.45.2.2 14-Jun-2004  jmc Pullup rev 1.47 (requested by petrov in ticket #469)

pci_find_ino: support pci-pci bridges.
 1.45.2.1 05-Apr-2004  tron Pull up revision 1.46 (requested by nakayama in ticket #60):
Revert a part of rev. 1.44.
OF_getprop can get only the first "reg" property with a statically
allocated buffer, but prom_getprop cannot.
This should fix a "kernel trap 30: data access exception" when you
invoke a pcictl(8).
 1.49.12.5 24-Mar-2008  yamt sync with head.
 1.49.12.4 04-Feb-2008  yamt sync with head.
 1.49.12.3 03-Sep-2007  yamt sync with head.
 1.49.12.2 30-Dec-2006  yamt sync with head.
 1.49.12.1 21-Jun-2006  yamt sync with head.
 1.50.6.1 22-Apr-2006  simonb Sync with head.
 1.50.4.1 09-Sep-2006  rpaulo sync with head
 1.50.2.1 18-Feb-2006  yamt sync with head.
 1.51.16.1 22-Oct-2006  yamt sync with head
 1.51.14.1 18-Nov-2006  ad Sync with head.
 1.53.10.1 11-Jul-2007  mjf Sync with head.
 1.53.8.1 10-Apr-2007  ad Sync with head.
 1.53.4.1 15-Apr-2007  yamt sync with head.
 1.54.20.1 18-Feb-2008  mjf Sync with HEAD.
 1.54.14.1 23-Mar-2008  matt sync with HEAD
 1.55.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.55.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.55.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.57.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.57.4.2 11-Mar-2010  yamt sync with head
 1.57.4.1 04-May-2009  yamt sync with head.
 1.57.2.1 04-Jun-2008  yamt sync with head
 1.59.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.59.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.67.4.3 31-May-2011  rmind sync with head
 1.67.4.2 21-Apr-2011  rmind sync with head
 1.67.4.1 05-Mar-2011  rmind sync with head
 1.68.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.74.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.74.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.74.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.74.2.1 30-Oct-2012  yamt sync with head
 1.75.2.1 18-May-2014  rmind sync with head
 1.77.30.1 10-Jun-2019  christos Sync with HEAD
 1.77.28.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.79.4.1 04-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #928):

sys/external/bsd/drm2/dist/drm/drm_gem.c: revision 1.25
sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c: revision 1.7
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/priv.h: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_acpi.c: revision 1.4
sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h: revision 1.6
sys/external/bsd/drm2/dist/drm/i915/i915_drv.h: revision 1.49
sys/external/bsd/drm2/include/linux/mxm-wmi.h: revision 1.1
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_pcie.c: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c: revision 1.13
sys/external/bsd/common/include/linux/bitops.h: revision 1.17
sys/external/bsd/drm2/nouveau/files.nouveau: revision 1.40
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.30
sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_pcie.c: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_base.c: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c: revision 1.12
sys/external/bsd/drm2/dist/drm/radeon/radeon_rv770.c: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_sorgm200.c: revision 1.3
sys/external/bsd/common/include/linux/printk.h: revision 1.14
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_gk20a.c: revision 1.10
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vi.c: revision 1.4
sys/external/bsd/drm2/include/linux/acpi.h: revision 1.11
sys/external/bsd/drm2/drm/drm_cdevsw.c: revision 1.31
sys/external/bsd/drm2/dist/drm/radeon/radeon_si.c: revision 1.6
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c: revision 1.5
sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.h: revision 1.5
sys/external/bsd/drm2/include/acpi/video.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c: revision 1.6
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.h: revision 1.4
sys/arch/sparc64/include/pci_machdep.h: revision 1.31
sys/arch/sparc64/dev/pci_machdep.c: revision 1.83
sys/external/bsd/drm2/include/linux/kref.h: revision 1.14
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_pci.c: revision 1.12
sys/external/bsd/drm2/linux/linux_dma_buf.c: revision 1.17
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_shadowacpi.c: revision 1.4
sys/external/bsd/drm2/drm/drm_module.c: revision 1.32
sys/external/bsd/drm2/dist/drm/i915/i915_gem.h: revision 1.8
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_dmabuf.c: revision 1.7
sys/external/bsd/drm2/include/linux/smp.h: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_si.c: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c: revision 1.20
sys/arch/x86/x86/bus_dma.c: revision 1.91
sys/external/bsd/drm2/radeon/files.radeon: revision 1.40
sys/external/bsd/drm2/include/acpi/acpi_bus.h: revision 1.1
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drv.h: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c: revision 1.21
sys/external/bsd/common/include/asm/barrier.h: revision 1.20
sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h: revision 1.2
sys/external/bsd/common/include/asm/barrier.h: revision 1.21
sys/modules/drmkms/drmkms_pci.h: revision 1.1
sys/external/bsd/drm2/dist/drm/drm_dp_helper.c: revision 1.17
sys/external/bsd/drm2/radeon/radeon_pci.c: revision 1.23
sys/external/bsd/drm2/linux/linux_xa.c: revision 1.4
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.23
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.24
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.25
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.26
sys/dev/pci/pcivar.h: revision 1.120
sys/arch/xen/include/pci_machdep.h: revision 1.24
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.26
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.27
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.27
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.28
sys/external/bsd/drm2/dist/drm/radeon/radeon_cik.c: revision 1.8
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.28
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.29
sys/external/bsd/drm2/include/linux/pci.h: revision 1.57
sys/external/bsd/drm2/include/linux/pci.h: revision 1.58
sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c: revision 1.6
sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_hwmgr.c: revision 1.3
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c: revision 1.3
share/man/man9/bus_dma.9: revision 1.69
sys/external/bsd/drm2/drm/drm_gem_cma_helper.c: revision 1.15
sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c: revision 1.6
sys/external/bsd/drm2/dist/drm/radeon/radeon.h: revision 1.12
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik.c: revision 1.7
sys/dev/acpi/acpi_mcfg.c: revision 1.29
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c: revision 1.6
sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c: revision 1.7
sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c: revision 1.13
sys/modules/amdgpu/Makefile: revision 1.9
sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c: revision 1.14
sys/external/bsd/common/linux/linux_tasklet.c: revision 1.12
sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/device.h: revision 1.10
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.23
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h: revision 1.9
sys/external/bsd/drm2/include/linux/interval_tree.h: revision 1.14
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.26
sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c: revision 1.5
sys/dev/pci/pci.c: revision 1.168
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.27
sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c: revision 1.9
sys/external/bsd/drm2/pci/files.drmkms_pci: revision 1.18
sys/external/bsd/drm2/linux/linux_sync_file.c: revision 1.3
sys/external/bsd/drm2/amdgpu/files.amdgpu: revision 1.31
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_tegra.c: revision 1.4
sys/external/bsd/drm2/dist/drm/drm_gem.c: revision 1.24
sys/arch/xen/xen/xpci_xenbus.c: revision 1.29

drm: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals.
Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html

linux asm/barrier.h: Fix !MULTIPROCESSOR build.

remove "nouveau" from a comment. noted by jmcneill.

drm: KASSERT(A && B) -> KASSERT(A); KASSERT(B)
comment a function that has a clear overbounds read but it isn't used.
found by GCC 12.

nix the NetBSD specific GEM_BUG_ON().
avoids GCC 12 warnings, and matches upstream closer.
avoid uninitialised variable usage in drm_gem_cma_create_internal().
in the case nothing has returned 'error', 'nsegs' and the dma info
are (potentially) uninitialised, so consider this an error.
found by GCC 12.

avoid a GCC 12 warning.
there's a 1-element long array and a loop conditional that tries to see
if indexes for it are not identical. as these indexes will always both
be 0, the only valid index, the condition is always false. GCC 12
triggers a strange warning on this code that can never run (see below),
so simply assert the array size is 1 and comment the rest.
amdgpu_dc_stream.c:470:55: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
470 | stream->writeback_info[j] = stream->writeback_info[i];

convert a KASSERT() into an if () panic() sequence to appease GCC 12.
OK riastradh@.

drm: Fix conditionals around drmkms_pci and agp.
Kernel should build now with all pci drm drivers stripped out but
DRM_LEGACY still enabled. (Might not be very useful, but it'll
build. Maybe we should also have DRM_LEGACY_PCI so those drivers can
be modloaded later.)

drmkms: Fix module build.
avoid an unlikely array bounds issue picked up by GCC 12.
nvkm_pcie_speed() can return -1, which is then used as an array index,
so make this default return PCIe 1.0 speeds.

drm: enable almost all PCIe functionality
linux_pci.c revisions 1.24 and 1.25 implemented most of the remaining
missing PCIe backends, but only enabled them for some amdgpu portions.
this enables all code marked with "XXX amdgpu pcie", "XXX radeon pcie",
and "XXX pcie speed". for most of it, simply removing #ifndefs __NetBSD__
to enable compliation was required, once the new "bus->max_bus_speed"
member was added to struct pci_bus. add an "always fails" backend for
pci_enable_atomic_ops_to_root() which seems to only be necessary
for virtual GPU functionality (and could be implemented if needed.)
tested on radeon 5450, 7750, R7 240 [radeon], and RX 550 [amdgpu], and
nvidia 750 and 1030 [nouveau].
this still does not quite work on nvidia cards. there are two problems
that remain:
- the call to set the link speed is skipped because the speed is set
to the default value of "-1". nvkm_pcie_set_link() will actually
determine the right value for this and for some cards, calling this
function if the current speed is -1 helps set the link speed. it
may be that on linux other paths we don't have enabled properly
would set this (there's one via debugfs, and a jetson specific one,
though perhaps setting either AC or DC speed values as boot options
(after hooking up these for netbsd) would currently work.
- worse, cards newer than kepler - geforce 900, 1000, and newer, are
all lacking the backing support to set pcie link speed. the GT 1030
card i have been testing with remains at pcie 1.0.

radeon: fix and enable ACPI methods for getting ROM BIOS
The hacky way of getting the BIOS mapped only works on x86. ACPI
should be preferred if available. Makes BIOS reading though VFCT
work on aarch64 with EDK2. (But only if EDK2 has POSTed the GPU.)
XXX amdgpu should get the same treatment.

drm: put_cpu() should enable preemption, not disable it again

drm(4): make pr_debug equivalent to aprint_debug
significantly reduces the default spam from amdgpu(4).

drm: Set CONFIG_ACPI in linux/acpi.h and make it build.

Leave a little ACPI-related functionality disabled for now, like
getting EDID out of ACPI -- needs a bit more work to make this work,
and I don't have hardware to work on that.
Should help with failures of the forms:
- unable to locate a BIOS ROM
- bios: unable to locate usable image
on various machines.

radeon_acpi.c: ifdef out unused function on NetBSD.
Should fix syzkaller build.

drm(4): Fix st_rdev in stat.
dminor->index already has the 64*type adjustment, as allocated in
drm_minor_alloc.
PR kern/58180

linux_sync_file: Fix missing init/fini steps.
Noted by rjs@.
PR kern/58210

ttm: Sync ttm_bo_uvm_fault_idle better with Linux.
PR xsrc/58133
ttm: Undo mistake in previous.

PR xsrc/58133
linux: Add a few more cases to pci_get_class.
Should fix crash on boot with amdgpu now that the ACPI business is
enabled.

i915: Fix dmabuf mmap object.

drm: Fix missing bounds checks in dma buf mmap.

drm_gem.c: Fix sense of assertion.
This is the opposite of WARN_ON.
Noted by rjs@.

drm_gem.c: Enable drm_gem_fence_array_add now that we emulate xa.
linux_xa: Delete and replace collision in xa_store as intended.
Don't free the colliding node that's still in the tree.
Noted by rjs@.

i915_gem_mman.c: Apply mmap types via pmap flags.
This way, userland gets buffers mapped write-combining or uncached as
needed.
PR xsrc/58307

x86: Teach bus_dmamem_map about BUS_DMA_PREFETCHABLE.
PR port-amd64/58308

bus_dma(9): Document BUS_DMA_PREFETCHABLE.
Like BUS_DMA_NOCACHE. Doesn't absolve you of the need for
bus_dmamap_sync, but if you later pass the vaddr to bus_dmamap_load,
the DMA map might notice the mapping is write-combining and use this
to make bus_dmamap_sync cheaper.
PR kern/58309

nouveau_nvkm_subdev_instmem_gk20a.c: Use BUS_DMA_PREFETCHABLE.
Matches Linux's pgprot_writecombine.
Unclear where the appropriate bus_dmamap_sync happens, or is supposed
to happen -- not using it would be wrong, but asking for a
prefetchable mapping may paper over symptoms, at least!

ttm: Sync more with Linux.
Add the original copyright and attribution since this is now,
intentionally, a modified copy of the original and not just roughly
the same algorithm.

ttm: Respect PGO_ALLPAGES.
Not sure this is useful but it reduces XXX's and makes this match
udv_fault better so it's easier to understand.

ttm: Sync cacheability flag logic with Linux.

ttm: Add XXX about readahead fault failures.

pci: Pass cookie through pci_find_device, pci_enumerate_bus, take 2.
New functions pci_find_device1 and pci_enumerate_bus1 have the cookie
argument. Existing symbols pci_find_device and pci_enumerate_bus are
now wrappers for the cookieless version.
This will allow pci_find_device callers to pass a cookie through to
the match function so they can keep state or pass in extra parameters
like b/d/f numbers, which will allow us to nix some horrible kludges
in the Linux PCI API emulation for drm (and, perhaps, Intel wifi).
This change drops the symbol pci_probe_device, in favour of a new
pci_probe_device1 with the cookie argument. But I don't think that
requires a revbump because it's only called by MD pci_enumerate_bus1
implementations, which don't live in modules anyway.
Take 2: Make sure to handle NULL match function.
linux_pci: Nix pci enumeration kludges.
Now that we can pass a cookie through, this stuff will be a little
less fragile.

i915: Omit needless i915_gem_object_pin/unpin_pages cycle in fault.
vm_fault_cpu and vm_fault_gtt, called by i915_gem_fault, already do
the pinning and unpinning internally, so there is no need for
i915_gem_fault to do it.
No functional change intended, except that the transient pin count
will be one lower than before during the fault routine (but it will
still be positive).

i915: Match Linux fault routine return code actions.
Omit needless EINTR interception -- this is now handled by
i915_error_to_vmf_fault.
Earlier revert was over a false alarm -- bisection shows the new
warnings arose from linux_pci.c 1.29 here:
https://mail-index.netbsd.org/source-changes/2024/06/23/msg151929.html

linux_pci: Fix shifto in pci_get_class.
It looks like Linux's pci_get_class also matches the interface part
of the PCI class register (but not the revision part), and I hadn't
noticed that in the previous shim structured differently.

With GCC12 kernel ALL/amd64 triggers "'sor' may be used uninitialized".
If "sublinks & 3" is zero GCC is right and sor[1] may be returned unitialized.
Fix by initializing "sor" to zero to return -1 instead of uninitialized value.
Ok: Taylor R Campbell <riastradh@>

amdgpu: Map BAR 2, not BAR 5, on pre-bonaire chips.
PR kern/58384

amdgpu: Map consecutive pages, not the same one over and over again.
PR kern/58385

linux/bitops: Fix overestimate for BITS_TO_LONGS(9)
Fortunately, this seems harmless except for allocating
excessive buffer memory.
Pointed out by nonaka@, OK riastradh@.
 1.3 08-Jun-2001  simonb For ports that wire up pciide in compatibility mode, have
them define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
in pci_machdep.h and pciide_map_compat_intr() only calls
pciide_machdep_compat_intr_establish() if that preprocessor
define exists.

Ports that don't need to do this no longer need to supply a
dummy function.
 1.2 21-Nov-1999  pk Also pull in <pci/pciidereg.h>.
 1.1 04-Jun-1999  mrg branches: 1.1.2; 1.1.4; 1.1.10;
clone this from the macppc port.
 1.1.10.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4 04-Jan-2021  thorpej malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.3 13-Oct-2018  macallan branches: 1.3.12;
config and attachment goop for tadpmu
 1.2 14-Aug-2015  nakayama branches: 1.2.16; 1.2.18;
pckbc@ebus: match "kb_ps2" device to make keyboard and mouse work
on qemu-sparc64.

XXX OpenBIOS doesn't provide interrupts for pckbc currently, so use
the interrupt numbers described in QEMU's hw/sparc64/sun4u.c::isa_irq_handler.
 1.1 09-Oct-2012  jdc branches: 1.1.2; 1.1.4; 1.1.16; 1.1.18;
Driver for pckbc at ebus, as found on Tadpole SPARCle.
Largely based on sparc's pckbc_js.c.
 1.1.18.1 22-Sep-2015  skrll Sync with HEAD
 1.1.16.1 04-Sep-2015  martin Pull up following revision(s) (requested by nakayama in ticket #951):
sys/arch/sparc64/dev/pckbc_ebus.c: revision 1.2
sys/arch/sparc64/sparc64/autoconf.c: revision 1.204
Detect a boot device more precisely on QEMU by checking the device
name.
pckbc@ebus: match "kb_ps2" device to make keyboard and mouse work
on qemu-sparc64.
XXX OpenBIOS doesn't provide interrupts for pckbc currently, so use
the interrupt numbers described in QEMU's hw/sparc64/sun4u.c::isa_irq_handler.
 1.1.4.3 03-Dec-2017  jdolecek update from HEAD
 1.1.4.2 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.1.4.1 09-Oct-2012  tls file pckbc_ebus.c was added on branch tls-maxphys on 2012-11-20 03:01:45 +0000
 1.1.2.2 30-Oct-2012  yamt sync with head
 1.1.2.1 09-Oct-2012  yamt file pckbc_ebus.c was added on branch yamt-pagecache on 2012-10-30 17:20:24 +0000
 1.2.18.1 10-Jun-2019  christos Sync with HEAD
 1.2.16.1 20-Oct-2018  pgoyette Sync with head
 1.3.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.34 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.33 16-Mar-2014  dholland branches: 1.33.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.32 15-Sep-2013  martin Remove an unused variable
 1.31 03-Jun-2011  christos branches: 1.31.2; 1.31.12; 1.31.16;
CFATTACH_DECL_NEW
 1.30 24-Apr-2011  rmind branches: 1.30.2;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.29 13-Jun-2008  cegger branches: 1.29.18; 1.29.24;
use device_lookup_private to get softc
 1.28 19-Nov-2007  ad branches: 1.28.14; 1.28.16; 1.28.18; 1.28.20; 1.28.22;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.27 18-Oct-2007  joerg branches: 1.27.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.26 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.25 09-Jul-2007  ad branches: 1.25.8; 1.25.10; 1.25.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.24 04-Mar-2007  christos branches: 1.24.2; 1.24.4; 1.24.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 01-Oct-2006  elad branches: 1.23.4;
Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks!
 1.22 23-Jul-2006  ad branches: 1.22.4; 1.22.6;
Use the LWP cached credentials where sane.
 1.21 14-May-2006  elad integrate kauth.
 1.20 13-Feb-2006  cdi branches: 1.20.2; 1.20.4; 1.20.6;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.19 11-Dec-2005  christos branches: 1.19.2; 1.19.4; 1.19.6;
merge ktrace-lwp.
 1.18 21-Mar-2004  pk branches: 1.18.16;
Use the promlib I/O routines.
 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  martin Passing struct lwp * instead of struct proc * to device functions.
 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 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.12 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.11 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10 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-Mar-2002  atatat branches: 1.9.4;
Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.8 05-Oct-2001  eeh branches: 1.8.4;
Remove bsd_openprom.h, which is only for compatibility with the sparc port.
 1.7 02-May-2001  scw branches: 1.7.2; 1.7.4;
Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.6 10-Nov-2000  eeh branches: 1.6.2; 1.6.4;
Remove unnecessary header file that causes linker issues.
 1.5 08-Nov-2000  eeh Use new MI console magic framework.
 1.4 02-Nov-2000  eeh Adapt to the new line discipline scheme.
 1.3 10-Jul-2000  eeh Break into debugger by typing `+++++',
 1.2 24-Jun-2000  eeh Remove a couple of references to vaddrs.h that slipped through.
 1.1 20-May-2000  eeh branches: 1.1.4;
Oops. Seems like we do need this file to make pcons work.
 1.1.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.6.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.2.3 22-Nov-2000  bouyer Sync with HEAD.
 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 10-Nov-2000  bouyer file pcons.c was added on branch thorpej_scsipi on 2000-11-20 20:26:44 +0000
 1.7.4.3 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.7.4.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.7.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 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 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.4.5 11-Nov-2002  nathanw Catch up to -current
 1.8.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.8.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.8.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.4.1 05-Oct-2001  nathanw file pcons.c was added on branch nathanw_sa on 2002-04-01 07:43:04 +0000
 1.9.4.1 17-May-2002  gehenna Add device switch.
 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.18.16.5 07-Dec-2007  yamt sync with head
 1.18.16.4 27-Oct-2007  yamt sync with head.
 1.18.16.3 03-Sep-2007  yamt sync with head.
 1.18.16.2 30-Dec-2006  yamt sync with head.
 1.18.16.1 21-Jun-2006  yamt sync with head.
 1.19.6.2 01-Jun-2006  kardel Sync with head.
 1.19.6.1 22-Apr-2006  simonb Sync with head.
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.19.2.1 18-Feb-2006  yamt sync with head.
 1.20.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.20.4.3 12-May-2006  elad adapt to kauth kpi, include sys/kauth.h where needed..
 1.20.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.20.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.20.2.2 11-Aug-2006  yamt sync with head
 1.20.2.1 24-May-2006  yamt sync with head.
 1.22.6.1 22-Oct-2006  yamt sync with head
 1.22.4.1 18-Nov-2006  ad Sync with head.
 1.23.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.10.1 03-Oct-2007  garbled Sync with HEAD
 1.24.4.1 11-Jul-2007  mjf Sync with head.
 1.24.2.3 03-Dec-2007  ad Sync with HEAD.
 1.24.2.2 23-Oct-2007  ad Sync with head.
 1.24.2.1 15-Jul-2007  ad Sync with head.
 1.25.14.2 21-Nov-2007  bouyer Sync with HEAD
 1.25.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.25.10.2 09-Jan-2008  matt sync with HEAD
 1.25.10.1 06-Nov-2007  matt sync with HEAD
 1.25.8.2 21-Nov-2007  joerg Sync with HEAD.
 1.25.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.27.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.28.22.1 18-Jun-2008  simonb Sync with head.
 1.28.20.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.28.18.1 04-May-2009  yamt sync with head.
 1.28.16.1 17-Jun-2008  yamt sync with head.
 1.28.14.1 29-Jun-2008  mjf Sync with HEAD.
 1.29.24.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.18.2 12-Jun-2011  rmind sync with head
 1.29.18.1 31-May-2011  rmind sync with head
 1.30.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.31.16.1 18-May-2014  rmind sync with head
 1.31.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.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.33.2.1 10-Aug-2014  tls Rebase.
 1.2 23-Aug-2000  pk This file is now in sys/dev/sun.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.11 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.10 18-Mar-2012  mrg branches: 1.10.2;
add missing __KERNEL_RCSID().
 1.9 03-Jun-2011  christos branches: 1.9.2; 1.9.6;
forgot _NEW again.
 1.8 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.7 18-Mar-2009  cegger branches: 1.7.4; 1.7.6; 1.7.10;
Ansify function definitions w/o arguments. Generated with sed.
 1.6 28-Apr-2008  martin branches: 1.6.8; 1.6.14;
Remove clause 3 and 4 from TNF licenses
 1.5 05-Apr-2008  cegger branches: 1.5.2; 1.5.4;
use aprint_*_dev and device_xname
OK martin
 1.4 11-Dec-2005  christos branches: 1.4.74;
merge ktrace-lwp.
 1.3 30-Jul-2003  petrov branches: 1.3.4;
It's 2003 now, print newline in attach.
 1.2 24-Jul-2003  petrov ansify.
 1.1 17-Jul-2003  petrov Driver for CP1500/1400 watchdog timer.
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 30-Jul-2003  skrll file pld_wdog.c was added on branch ktrace-lwp on 2004-08-03 10:41:24 +0000
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.4.2 04-May-2009  yamt sync with head.
 1.5.4.1 16-May-2008  yamt sync with head.
 1.5.2.1 18-May-2008  yamt sync with head.
 1.6.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.7.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.7.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.4.1 12-Jun-2011  rmind sync with head
 1.9.6.1 05-Apr-2012  mrg sync to latest -current.
 1.9.2.2 30-Oct-2012  yamt sync with head
 1.9.2.1 17-Apr-2012  yamt sync with head
 1.10.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.13 06-Jul-2017  martin Remove unused "power @ ebus" device, we use the firmware to handle power/
reboot.
 1.12 03-Jun-2011  christos branches: 1.12.12; 1.12.30;
CFATTACH_DECL_NEW
 1.11 18-Mar-2009  cegger branches: 1.11.4; 1.11.6; 1.11.10;
Ansify function definitions w/o arguments. Generated with sed.
 1.10 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.9 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.8 12-May-2006  uwe branches: 1.8.66; 1.8.74; 1.8.80;
De-__P.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6; 1.7.8; 1.7.12;
merge ktrace-lwp.
 1.6 15-Jul-2003  lukem branches: 1.6.16;
__KERNEL_RCSID()
 1.5 05-Feb-2003  perry branches: 1.5.2;
"Utilize" has exactly the same meaning as "use," but it is more
difficult to read and understand. Most manuals of English style
therefore say that you should use "use".
 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 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32;
Import of sparc64.
 1.1.1.1.32.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.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.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.7.8.1 24-May-2006  yamt sync with head.
 1.7.6.1 01-Jun-2006  kardel Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.80.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.74.1 28-Apr-2009  skrll Sync with HEAD.
 1.8.66.1 04-May-2009  yamt sync with head.
 1.11.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.11.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.11.4.1 12-Jun-2011  rmind sync with head
 1.12.30.1 28-Aug-2017  skrll Sync with HEAD
 1.12.12.1 03-Dec-2017  jdolecek update from HEAD
 1.3 06-Jul-2017  martin Remove unused "power @ ebus" device, we use the firmware to handle power/
reboot.
 1.2 12-May-2006  uwe branches: 1.2.110; 1.2.130;
De-__P.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.64; 1.1.1.1.78; 1.1.1.1.80; 1.1.1.1.82; 1.1.1.1.86;
Import of sparc64.
 1.1.1.1.86.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.1.1.82.1 24-May-2006  yamt sync with head.
 1.1.1.1.80.1 01-Jun-2006  kardel Sync with head.
 1.1.1.1.78.1 09-Sep-2006  rpaulo sync with head
 1.1.1.1.64.1 21-Jun-2006  yamt sync with head.
 1.2.130.1 28-Aug-2017  skrll Sync with HEAD
 1.2.110.1 03-Dec-2017  jdolecek update from HEAD
 1.11 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.10 27-Oct-2012  chs branches: 1.10.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.9 01-Jul-2011  dyoung branches: 1.9.2; 1.9.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.8 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.7 05-Apr-2008  cegger branches: 1.7.26; 1.7.32; 1.7.36;
use aprint_*_dev and device_xname
OK martin
 1.6 17-Oct-2007  garbled branches: 1.6.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.5 09-Jul-2007  ad branches: 1.5.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.4 01-Jul-2007  xtraeme Use PSWITCH_EVENT_{PRESSED,RELEASED} for consistency with other drivers
using the sysmon_power framework.
 1.3 23-Aug-2006  jnemeth branches: 1.3.4; 1.3.10; 1.3.16; 1.3.18; 1.3.24;
make this compile when DEBUG is set
 1.2 12-Jul-2006  gdamore branches: 1.2.4;
Initialize batt for gcc 4.x, and while here add $NetBSD$ comment.
 1.1 10-Jul-2006  gdamore New psm driver for use on Ultrabook IIi. Right now it supports the power
button and lid switch. I will add environmentals (battery, etc.) later.
 1.2.4.3 03-Sep-2006  yamt sync with head.
 1.2.4.2 11-Aug-2006  yamt sync with head
 1.2.4.1 12-Jul-2006  yamt file psm.c was added on branch yamt-pdpolicy on 2006-08-11 15:43:00 +0000
 1.3.24.1 03-Oct-2007  garbled Sync with HEAD
 1.3.18.1 11-Jul-2007  mjf Sync with head.
 1.3.16.1 15-Jul-2007  ad Sync with head.
 1.3.10.3 03-Sep-2007  yamt sync with head.
 1.3.10.2 30-Dec-2006  yamt sync with head.
 1.3.10.1 23-Aug-2006  yamt file psm.c was added on branch yamt-lazymbuf on 2006-12-30 20:47:02 +0000
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 23-Aug-2006  rpaulo file psm.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:43:36 +0000
 1.5.10.1 06-Nov-2007  matt sync with HEAD
 1.6.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.36.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.7.32.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.26.1 12-Jun-2011  rmind sync with head
 1.9.12.2 03-Dec-2017  jdolecek update from HEAD
 1.9.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.9.2.1 30-Oct-2012  yamt sync with head
 1.10.14.1 09-Jul-2016  skrll Sync with HEAD
 1.4 28-May-2022  andvar fix various typos in comments.
 1.3 10-Dec-2021  andvar s/occured/occurred/ in comments, log messages and man pages.
 1.2 30-Jun-2011  wiz dependant -> dependent
 1.1 10-Jul-2006  gdamore branches: 1.1.4; 1.1.8; 1.1.14;
New psm driver for use on Ultrabook IIi. Right now it supports the power
button and lid switch. I will add environmentals (battery, etc.) later.
 1.1.14.2 30-Dec-2006  yamt sync with head.
 1.1.14.1 10-Jul-2006  yamt file psmreg.h was added on branch yamt-lazymbuf on 2006-12-30 20:47:02 +0000
 1.1.8.2 09-Sep-2006  rpaulo sync with head
 1.1.8.1 10-Jul-2006  rpaulo file psmreg.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:43:36 +0000
 1.1.4.2 11-Aug-2006  yamt sync with head
 1.1.4.1 10-Jul-2006  yamt file psmreg.h was added on branch yamt-pdpolicy on 2006-08-11 15:43:00 +0000
 1.138 08-Sep-2024  rillig fix a/an grammar in obvious cases
 1.137 23-Feb-2022  andvar branches: 1.137.10;
fix various typos in comments, mainly immediatly/immediately/,
as well shared and recently fixed typos in OpenBSD code by Jonathan Grey.
 1.136 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.135 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.134 10-May-2021  thorpej branches: 1.134.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.133 24-Apr-2021  thorpej branches: 1.133.2; 1.133.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.132 17-Jan-2021  mrg branches: 1.132.2;
reduce the scope of 'ci' variable.
 1.131 07-Jan-2021  nakayama The "available" property requires a variable length buffer, so
leave free(9) until prom_getprop is changed to use kmem_alloc(9)
instead of malloc(9).
 1.130 06-Jan-2021  palle psycho: explicit allocation of memory using kmem(9) instead of using the buffer indirectly allocted in the prom_getprop() function (which is still using malloc(9) for memory allocation
 1.129 04-Jan-2021  thorpej malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.128 10-Nov-2019  chs branches: 1.128.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.127 05-Feb-2019  mrg add or avoid fallthru comments.
 1.126 26-Mar-2017  martin branches: 1.126.14;
Do not call OF_getprop on our node blindly - for the "pcons" hack we may
be called with all zeroed attach args.
 1.125 24-Mar-2017  macallan disable BUS_SPACE_MAP_PREFETCHABLE until I figure out which psychos support
partial writes
apparently the only devices which can actually do that are UPA graphics cards
 1.124 10-May-2016  palle branches: 1.124.2; 1.124.4;
sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.123 27-Nov-2015  mrg s/pa/busaddr/ in a debug message, we print the actual paddr next.
 1.122 26-Nov-2015  mrg adjust a bunch of debugging messages to use __func__ and to normalise
newline usage (some sequences ended up printing blank lines.)
 1.121 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.120 18-Oct-2014  snj branches: 1.120.2;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.119 21-Sep-2014  christos fix leak
 1.118 07-Dec-2013  nakayama branches: 1.118.4;
Timecounter's tc_get_timecount requires only 32-bit (u_int), so
omit unnecessary upper 32-bit read from STICK counter.
 1.117 08-Nov-2013  nakayama "machine_model" is now declared in machine/autoconf.h.
 1.116 24-Sep-2013  jdc Work around invalid root PCI bus bus-range (0x00-0xff) by checking the
bus-range of any child buses, and altering the root bus bus-range to
suit. Required for cardbus bridge attach on SPARCle.
 1.115 22-Aug-2013  nakayama Handle US-IIe's STICK counter as 64-bit explicitly to fix a hang at
boot after about 6.5 minutes on 32-bit kernel.
 1.114 20-Aug-2013  macallan support UltraSPARC-IIe STICK counter as time base
 1.113 21-Jun-2013  nakayama branches: 1.113.2;
Avoid data_access_error trap panic when reading unused PCI
configuration space.

This method is described in UltraSPARC IIi User's Manual "16.2.1
Probing PCI during boot using deferred errors", and refer to the
implementation of OpenBSD.
 1.112 27-Jan-2012  para branches: 1.112.6;
converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.111 04-Sep-2011  nakayama branches: 1.111.2; 1.111.6;
ih_pil is an interrupt level, not an interrupt mask.
 1.110 12-Aug-2011  mrg initialise ih_pending.
 1.109 20-Jul-2011  macallan add per ivec event counters
 1.108 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.107 02-Jun-2011  christos split auxio, ebus, psycho, sab.
 1.106 17-May-2011  dyoung branches: 1.106.2;
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.105 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.104 16-Mar-2011  mrg revert the iommu changes for now. my U60 doesn't like them.
 1.103 16-Mar-2011  mrg use struct iommureg_old.
 1.102 13-Feb-2011  nakayama Don't enable the powerfail interrupt on Netra X1 since it may hang.

Discussed on port-sparc64.
 1.101 10-Jul-2010  nakayama branches: 1.101.2; 1.101.4;
psycho_sabre_dmamap_sync: do nothing if len == 0 like iommu_dvmamap_sync.
 1.100 06-Jan-2010  mrg branches: 1.100.2; 1.100.4;
move the guts of pci_intr_map() into pci_machdep.c, and move the schizo
ign addition into a hook. also, don't double shift the ign in set_intr.

tested on U60 and SB2500.
 1.99 30-Dec-2009  nakayama Fix function name in debug messages, remove trailing space and tabify.
 1.98 06-Dec-2009  nakayama psycho_ue():
- remove printing of pa, it is irrelevant value since va address
passed to iommu_extract is incorrect and we can look at it in
IOTTE.
- print correct IOVA address.

While there, convert printf to aprint_error_dev and remove long
long casts by using PRIx64.
 1.97 30-Nov-2009  mrg convert pci_intr_map() into a chipset tag function pointer, and implement
the schizo version slightly differently.

pull out the schizo's IGN from the upaid, not the apparently broken device
ID register. from openbsd.

with this i appear to have valid working interrupts on the SB2500.

tested on U60 and SB2500.


XXX: we can probably kill (*spc_find_ino)() now that pci_intr_map() itself
XXX: is no longer a first class function.
 1.96 27-Nov-2009  mrg clean up some debug messages a little bit.
 1.95 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.94 10-Dec-2008  mrg ofpci_make_tag():
don't write PCI_COMMAND_STATUS_REG with
PCI_COMMAND_(MEM|MASTER|IO)_ENABLE, or it in.
sparc_pci_childspace():
move psycho.c:get_childspace() into pci_machdep.c but rename it
psycho_alloc_bus_tag():
use M_ZERO
 1.93 09-Dec-2008  nakayama Fix CardBus, PCI-PCI bridge support borked in previous commit.
 1.92 07-Dec-2008  mrg a few clean up/rearrange changes, somewhat inspired from openbsd's
schizo.c:

- rename pp_busnode{} -> spc_busnode{}, and move it to
sparc_pci_chipset{}

- move public pci functions pci_conf_read(), pci_conf_write() and
pci_intr_establish() into psycho.c, renaming them in the process,
and add pointers through sparc_pci_chipset{} to access them.
as part of this, add PDB_INTMAP and PDB_CONF debug options to
psycho.c

- move and rename sparc64 private pci_find_ino() into
sparc_pci_chipset{}, like the above

- update psycho_alloc_chipset() to set the new 4 function members


no functional change intended. XXX: not tested on cardbus.
 1.91 18-Oct-2008  nakayama branches: 1.91.2; 1.91.4;
It is wasteful that reconstructing arguments for inserting the pointer
to streaming buffers in each bus_dma functions on sbus/psycho layer.

Use iommu functions directly with storing the pointer into (unused)
_dm_cookie at bus_dmamap_create time.
 1.90 18-Oct-2008  nakayama UltraSPARC IIi and IIe have PCI DMA Write Synchronization Register to
synchronize the DMA writes. So use it in case of BUS_DMASYNC_POSTREAD.

Tested on my Netra X1 for several years.
 1.89 13-Oct-2008  nakayama Remove unnecessary includes.
 1.88 13-Jun-2008  cegger branches: 1.88.2;
use device_lookup_private to get softc
 1.87 30-May-2008  mrg branches: 1.87.2;
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.86 18-May-2008  martin Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.
 1.85 05-Apr-2008  cegger branches: 1.85.2; 1.85.4; 1.85.6;
use aprint_*_dev and device_xname
OK martin
 1.84 16-Feb-2008  jmcneill branches: 1.84.6;
Use aprint_* instead of printf during attach.
 1.83 30-Dec-2007  jdc Make extent mapping error more meaningful. OK martin@.
 1.82 03-Dec-2007  rafal branches: 1.82.6;
Clear interrupts as they are established, rearrange interrupt-mapping code
to make sure PCI slot 0 interrupt doesn't accidentally match the (unused)
PCI error interrupt.

Fixes kern/25462 at least on my Netra T1 ac200.
From OpenBSD; ok martin@
 1.81 19-Nov-2007  macallan put the physical address of each psycho's memory range into a device
property so we can look it up in device_register() later on
ok'ed by martin
 1.80 04-Mar-2007  christos branches: 1.80.2; 1.80.18; 1.80.20; 1.80.24; 1.80.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.79 08-Mar-2006  lukem branches: 1.79.16;
Use the SI capitalization for "Hz", "kHz", and "MHz" in comments and strings.
Add a space between numbers and Hz unit.
 1.78 25-Feb-2006  wiz branches: 1.78.2; 1.78.4;
Fix some typos.
 1.77 13-Feb-2006  cdi ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.76 01-Feb-2006  martin branches: 1.76.2;
Do not assume the bootstrap CPU has UPA id 0 - on some machines it hasn't.
Explicitly route all interrupts to the current cpu for now, we'll revisit
this when SMP is working.
Problem spotted and analyzed by Stephan Meisinger, fix inspired by FreeBSD.
 1.75 11-Dec-2005  christos branches: 1.75.2; 1.75.4;
merge ktrace-lwp.
 1.74 31-May-2005  christos branches: 1.74.2;
- sprinkle const
- avoid variable shadow
 1.73 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.72 28-Mar-2004  nakayama Set prom_getprop args correctly.
 1.71 22-Mar-2004  nakayama Make 32-bit kernels compile with options DEBUG.
 1.70 21-Mar-2004  martin Make sure prom_getprop is called with the size pointed to by nitem
initialized. (Some of these are more paranoia, but two were actual bugs.)
Print error codes in some panic messages.
 1.69 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.68 21-Jan-2004  petrov For pci devices without ofw mapping find ino by pci bus/slot/device
information, from OpenBSD.
 1.67 09-Nov-2003  martin Nuke bcopy/bzero.
 1.66 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.65 22-Aug-2003  petrov Don't set and check absent interrupts on sabre.
 1.64 15-Jul-2003  lukem __KERNEL_RCSID()
 1.63 15-Jun-2003  fvdl branches: 1.63.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.62 17-May-2003  nakayama Avoid strict-alias warnings in gcc 3.3.
 1.61 03-May-2003  wiz DMA, not dma nor Dma.
 1.60 21-Apr-2003  martin Connect the front panel power button on psycho based machines to sysmon's
/dev/power.

XXX - due to the way interrupt handling is structured we have no easy
way to defer clearing the button interrupt until the sysmon callback
has happened and the event is dispatched. We clear it imediately on
return from the interrupt handler. This means we get an interrupt storm
until the button is released, and then start to handle it.
This needs to be fixed! (But with the default application for the power
button does not make a user visible difference.)
 1.59 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.58 22-Mar-2003  nakayama PCI-CardBus bridge support for sparc64:
- handle devices which has no OBP node.
- move PCI latency-timer initialization from pci_intr_map to
pci_enumerate_bus.
- make PCI bus free space extents for cardbus devices.
- fix PCI config space map size.
- some code integrations.
 1.57 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.56 10-Dec-2002  pk bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.55 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.54 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.53 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.52 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.51 21-Jun-2002  eeh The FFB interrupt mapping registers need to compare IGN as well as INO since
they are totally programmable.
 1.50 20-Jun-2002  eeh Overhaul streaming buffer handling:

sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.

psycho streaming buffer flushes write a 64-byte aligned 64-byte block.

So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
 1.49 12-Jun-2002  eeh Use the correct bus handle to generate the handle for the streaming buffers.
 1.48 16-May-2002  eeh branches: 1.48.2;
Make the PCI code actually work.
 1.47 16-May-2002  thorpej branches: 1.47.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.46 06-May-2002  eeh Add code to attach ofpci.
 1.45 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.44 15-Mar-2002  eeh Get PCI working with the new bus_space*.
 1.43 08-Mar-2002  chs make this compile without DDB.
 1.42 12-Feb-2002  martin Cast/format fix to make this build on 32bit kernels.
 1.41 08-Feb-2002  eeh Provide more info in psycho_ue.
 1.40 14-Jan-2002  eeh Set the interrupt retry timer to 0xff.
 1.39 07-Oct-2001  eeh branches: 1.39.4;
Manage both streaming caches on psycho/psycho+.
 1.38 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.37 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.36 15-Sep-2001  eeh Be a bit more elaborate with UE DMA errors.
 1.35 10-Sep-2001  eeh Sun Blade 100 support (and some psycho fixes from Jason Wright).
 1.34 20-Jul-2001  eeh branches: 1.34.2;
PCI overhaul.
 1.33 18-May-2001  mrg branches: 1.33.2;
minor cleanups.
 1.32 21-Mar-2001  mrg adapt to systems with out interrupt-map & interrupt-map-mask properties.
 1.31 06-Mar-2001  mrg rework pci_attach_hook() to just deal with the INO, not the full
interrupt number. properly find interrupts for the E250. modify
pci_intr_map() accordingly. retire psycho_intr_map(). deal with
INO values upto 0x3f, not upto 0x32. restructure sabre_init() and
psycho_init() to be more similar, and display each psycho's IGN.
psycho_intr_establish() deals with INO upto 0x3f, values from 0x32
and higher get 0 for IPL.

tested on E250 & U5.
 1.30 28-Feb-2001  mrg branches: 1.30.2;
adjust some comments to reality.
 1.29 11-Feb-2001  eeh Print out more useful data if there are interrupt issues.
 1.28 04-Dec-2000  fvdl Make gcc like a cast.
 1.27 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.26 18-Nov-2000  mrg remove dead debugging code.
 1.25 19-Oct-2000  mrg add a cast to fix a warning.
 1.24 18-Jul-2000  pk Set up register bank sharing bwteen psycho A & B based on matching
physical addresses. Allocate IOMMU state separately and refer to it
from both psycho_softc's.
 1.23 14-Jul-2000  pk Use per-PBM control/status register addresses provided by the PROM.
Print version/implementation info.
 1.22 12-Jul-2000  pk No need to fetch the psycho's own registers as thet are already passed
down from the parent bus. Also account for the difference in `reg'
properties in psycho vs sabre chips.
 1.21 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.20 07-Jul-2000  mrg work around a bug passing arguments to iommu_dvma_load_raw()
 1.19 05-Jul-2000  pk We want to index the PCI `interrupt clear' registers with the Interrupt
Number Offset. (this stuff needs a serious cleanup).
 1.18 03-Jul-2000  eeh Use the same IPLs as everyone else.
 1.17 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.16 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.15 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.14 19-Jun-2000  eeh branches: 1.14.2;
Fix uninitialized pointer bug.
 1.13 08-Jun-2000  eeh Support large (>1 page) DVMA maps so UltraSPARC IIi will work.
 1.12 24-May-2000  eeh branches: 1.12.2;
Use the PCI function code to distinguish simba bus A from bus B instead
of the current hack.
 1.11 17-May-2000  mrg fix if/ifdef mistake
 1.10 17-May-2000  mrg - add some psycho interrupt debugging stuff (#if 0'ed out)
- fix arguments passed in psycho_dmamap_load_raw()'s declaration, and
what it passes to it's parent bus.
 1.9 17-May-2000  eeh Add support for bus_dma_load_raw() so the le driver will work again.
 1.8 06-May-2000  mrg implement U2P PCI support in psycho_init. this is completely untested.
 1.7 22-Apr-2000  mrg whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.6 15-Apr-2000  mrg kill dead code
 1.5 10-Apr-2000  mrg - UltraSPARC IIi does not have streaming buffers; don't try to find it's
diag regsiter to work out why the (non-existant) strbufs don't work.
- check for malloc failure in _all_ places.
- setup the PCI control register as recommended in the IIi users manual.
 1.4 08-Apr-2000  mrg with these two, POWEROFSEVEN now compiles cleanly.
 1.3 08-Apr-2000  mrg rearrange a little to accommodate real SUNW,psycho support.
 1.2 08-Jul-1999  thorpej branches: 1.2.2;
Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.1 04-Jun-1999  mrg branches: 1.1.2;
PCI driver for the UltraSPARC. this only works on the Ultra5/10 machines
(`SUNW,sabre') for now, and it doesn't really quite work there yet anyway.
the bus space/dma code is cloned from the sbus driver. the IOMMU code also
is cloned from the sbus code, but separated out into iommu.c so that we can
share it with the sbus driver. hopefully, much of the bus space/dma code
can also be re-shared with the sbus driver and the ebus driver but for now
these copies will do.

support for the real UltraSPARC PCI (`SUNW,psycho') is unwritten, though
most of this code is shared with it.

we can probe PCI config space and try to configue devices, but interrupts
don't work yet...
 1.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.2.2.5 12-Mar-2001  bouyer Sync with HEAD.
 1.2.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.2.2.2 22-Nov-2000  bouyer Sync with HEAD.
 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.12.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.14.2.2 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.14.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 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.33.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.33.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.33.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.33.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.33.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.33.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.33.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.33.2.1 03-Aug-2001  lukem update to -current
 1.34.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.34.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.39.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.39.4.6 18-Oct-2002  nathanw Catch up to -current.
 1.39.4.5 01-Aug-2002  nathanw Catch up to -current.
 1.39.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.39.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.39.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.39.4.1 07-Oct-2001  nathanw file psycho.c was added on branch nathanw_sa on 2002-02-28 04:12:11 +0000
 1.47.2.4 17-Jul-2002  gehenna catch up with -current.
 1.47.2.3 15-Jul-2002  gehenna catch up with -current.
 1.47.2.2 30-May-2002  gehenna Catch up with -current.
 1.47.2.1 16-May-2002  gehenna file psycho.c was added on branch gehenna-devsw on 2002-05-30 15:35:49 +0000
 1.48.2.3 21-Jun-2002  lukem Pull up revision 1.51 (requested by eeh in ticket #338):
The FFB interrupt mapping registers need to compare IGN as well as INO since
they are totally programmable.
 1.48.2.2 21-Jun-2002  lukem Pull up revision 1.50 (requested by eeh in ticket #337):
Overhaul streaming buffer handling:
sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.
psycho streaming buffer flushes write a 64-byte aligned 64-byte block.
So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
[Gets E220R working]
 1.48.2.1 12-Jun-2002  lukem Pull up revision 1.49 (requested by eeh in ticket #254):
Use the correct bus handle to generate the handle for the streaming buffers.
 1.63.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.63.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.63.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.63.2.2 03-Sep-2004  skrll Sync with HEAD
 1.63.2.1 03-Aug-2004  skrll Sync with HEAD
 1.74.2.5 27-Feb-2008  yamt sync with head.
 1.74.2.4 21-Jan-2008  yamt sync with head
 1.74.2.3 07-Dec-2007  yamt sync with head
 1.74.2.2 03-Sep-2007  yamt sync with head.
 1.74.2.1 21-Jun-2006  yamt sync with head.
 1.75.4.1 09-Sep-2006  rpaulo sync with head
 1.75.2.2 01-Mar-2006  yamt sync with head.
 1.75.2.1 18-Feb-2006  yamt sync with head.
 1.76.2.1 22-Apr-2006  simonb Sync with head.
 1.78.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.78.2.1 13-Mar-2006  yamt sync with head.
 1.79.16.1 12-Mar-2007  rmind Sync with HEAD.
 1.80.26.2 18-Feb-2008  mjf Sync with HEAD.
 1.80.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.80.24.1 21-Nov-2007  bouyer Sync with HEAD
 1.80.20.2 23-Mar-2008  matt sync with HEAD
 1.80.20.1 09-Jan-2008  matt sync with HEAD
 1.80.18.2 03-Dec-2007  joerg Sync with HEAD.
 1.80.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.80.2.1 03-Dec-2007  ad Sync with HEAD.
 1.82.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.84.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.84.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.84.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.85.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.85.4.3 11-Aug-2010  yamt sync with head.
 1.85.4.2 11-Mar-2010  yamt sync with head
 1.85.4.1 04-May-2009  yamt sync with head.
 1.85.2.2 17-Jun-2008  yamt sync with head.
 1.85.2.1 04-Jun-2008  yamt sync with head
 1.87.2.1 18-Jun-2008  simonb Sync with head.
 1.88.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.88.2.1 19-Oct-2008  haad Sync with HEAD.
 1.91.4.1 16-Feb-2011  bouyer Pull up following revision(s) (requested by nakayama in ticket #1555):
sys/arch/sparc64/dev/psycho.c: revision 1.102 via patch
Don't enable the powerfail interrupt on Netra X1 since it may hang.
Discussed on port-sparc64.
 1.91.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.100.4.4 12-Jun-2011  rmind sync with head
 1.100.4.3 31-May-2011  rmind sync with head
 1.100.4.2 21-Apr-2011  rmind sync with head
 1.100.4.1 05-Mar-2011  rmind sync with head
 1.100.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.101.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.101.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.106.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.111.6.1 18-Feb-2012  mrg merge to -current.
 1.111.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.111.2.1 17-Apr-2012  yamt sync with head
 1.112.6.3 03-Dec-2017  jdolecek update from HEAD
 1.112.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.112.6.1 23-Jun-2013  tls resync from head
 1.113.2.2 18-May-2014  rmind sync with head
 1.113.2.1 28-Aug-2013  rmind sync with head
 1.118.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.120.2.3 28-Aug-2017  skrll Sync with HEAD
 1.120.2.2 29-May-2016  skrll Sync with HEAD
 1.120.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.124.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.124.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.126.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.126.14.1 10-Jun-2019  christos Sync with HEAD
 1.128.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.132.2.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.133.4.1 31-May-2021  cjep sync with head
 1.133.2.1 13-May-2021  thorpej Sync with HEAD.
 1.134.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.137.10.1 02-Aug-2025  perseant Sync with HEAD
 1.10 22-Apr-2000  mrg whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.9 10-Apr-2000  mrg UltraSPARC IIi CPU has bits 6-10 of the INO hardwired to 1. when we
install an interrupt handler, make sure we set these bits to 1. now,
interrupt_vector in locore can find our registered interrupt handlers
and at least try to setup a call to them.
 1.8 08-Apr-2000  mrg correct the pci ino->ipl table. shut up gcc once more.
 1.7 05-Apr-2000  mrg include opt_ddb.h. use generic iommu enter/remove/flush routines
 1.6 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.5 24-Nov-1999  mrg prefix a variable with "pci_"
 1.4 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.3 08-Jul-1999  thorpej branches: 1.3.2; 1.3.4; 1.3.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.2 07-Jun-1999  eeh branches: 1.2.2;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.1 04-Jun-1999  mrg PCI driver for the UltraSPARC. this only works on the Ultra5/10 machines
(`SUNW,sabre') for now, and it doesn't really quite work there yet anyway.
the bus space/dma code is cloned from the sbus driver. the IOMMU code also
is cloned from the sbus code, but separated out into iommu.c so that we can
share it with the sbus driver. hopefully, much of the bus space/dma code
can also be re-shared with the sbus driver and the ebus driver but for now
these copies will do.

support for the real UltraSPARC PCI (`SUNW,psycho') is unwritten, though
most of this code is shared with it.

we can probe PCI config space and try to configue devices, but interrupts
don't work yet...
 1.2.2.3 02-Aug-1999  thorpej Update from trunk.
 1.2.2.2 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 07-Jun-1999  thorpej file psycho_bus.c was added on branch chs-ubc2 on 1999-06-21 01:02:31 +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 Remove files that are no longer on the trunck
 1.19 20-Aug-2013  macallan support UltraSPARC-IIe STICK counter as time base
 1.18 20-Aug-2013  macallan add US-IIe specific STICK and ESTAR registers
 1.17 16-Mar-2011  mrg branches: 1.17.4; 1.17.14; 1.17.18;
revert the iommu changes for now. my U60 doesn't like them.
 1.16 16-Mar-2011  mrg use struct iommureg_old.
 1.15 10-Mar-2011  mrg fix a typo
 1.14 30-May-2008  mrg branches: 1.14.20; 1.14.26;
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.13 25-Feb-2006  wiz branches: 1.13.68; 1.13.70; 1.13.72; 1.13.74;
Fix typos, reported by Alexey Dobriyan ("Gathered from Linux"),
forwarded by jmc@openbsd.
 1.12 13-Feb-2006  cdi ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.11 17-May-2003  nakayama branches: 1.11.18; 1.11.30; 1.11.32; 1.11.34;
Avoid integer constant is too large warnings in gcc 3.3.
 1.10 17-Apr-2003  nakayama Comment fixes from OpenBSD.
 1.9 15-Sep-2001  eeh branches: 1.9.4;
Be a bit more elaborate with UE DMA errors.
 1.8 10-Sep-2001  eeh Sun Blade 100 support (and some psycho fixes from Jason Wright).
 1.7 20-Jul-2001  eeh branches: 1.7.2;
PCI overhaul.
 1.6 14-Jul-2000  pk branches: 1.6.4;
Provide details on the `psy_csr' register.
 1.5 14-Jul-2000  pk Fix padding in struct pci_ctl.
 1.4 24-May-2000  eeh branches: 1.4.4;
Use the PCI function code to distinguish simba bus A from bus B instead
of the current hack.
 1.3 10-Apr-2000  mrg add 4 more bits for the PCI control register
 1.2 07-Jun-1999  mrg branches: 1.2.2; 1.2.4;
copyright foo. in the future, we will all be binary-redistributable.
 1.1 04-Jun-1999  mrg PCI driver for the UltraSPARC. this only works on the Ultra5/10 machines
(`SUNW,sabre') for now, and it doesn't really quite work there yet anyway.
the bus space/dma code is cloned from the sbus driver. the IOMMU code also
is cloned from the sbus code, but separated out into iommu.c so that we can
share it with the sbus driver. hopefully, much of the bus space/dma code
can also be re-shared with the sbus driver and the ebus driver but for now
these copies will do.

support for the real UltraSPARC PCI (`SUNW,psycho') is unwritten, though
most of this code is shared with it.

we can probe PCI config space and try to configue devices, but interrupts
don't work yet...
 1.2.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.2 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 07-Jun-1999  thorpej file psychoreg.h was added on branch chs-ubc2 on 1999-06-21 01:02:31 +0000
 1.4.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.6.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.6.4.1 03-Aug-2001  lukem update to -current
 1.7.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.9.4.2 15-Sep-2001  eeh Be a bit more elaborate with UE DMA errors.
 1.9.4.1 15-Sep-2001  eeh file psychoreg.h was added on branch nathanw_sa on 2001-09-15 07:10:06 +0000
 1.11.34.1 22-Apr-2006  simonb Sync with head.
 1.11.32.1 09-Sep-2006  rpaulo sync with head
 1.11.30.2 01-Mar-2006  yamt sync with head.
 1.11.30.1 18-Feb-2006  yamt sync with head.
 1.11.18.1 21-Jun-2006  yamt sync with head.
 1.13.74.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.13.72.1 04-May-2009  yamt sync with head.
 1.13.70.1 04-Jun-2008  yamt sync with head
 1.13.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.26.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.20.3 21-Apr-2011  rmind sync with head
 1.14.20.2 10-Mar-2011  mrg revert wrong branch commit
 1.14.20.1 10-Mar-2011  mrg fix a typo
 1.17.18.1 28-Aug-2013  rmind sync with head
 1.17.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.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.21 07-Dec-2013  nakayama Timecounter's tc_get_timecount requires only 32-bit (u_int), so
omit unnecessary upper 32-bit read from STICK counter.
 1.20 22-Aug-2013  nakayama Handle US-IIe's STICK counter as 64-bit explicitly to fix a hang at
boot after about 6.5 minutes on 32-bit kernel.
 1.19 20-Aug-2013  macallan support UltraSPARC-IIe STICK counter as time base
 1.18 02-Jun-2011  christos branches: 1.18.2; 1.18.12; 1.18.16;
split auxio, ebus, psycho, sab.
 1.17 09-Dec-2008  nakayama branches: 1.17.6; 1.17.8; 1.17.12;
Fix CardBus, PCI-PCI bridge support borked in previous commit.
 1.16 07-Dec-2008  mrg a few clean up/rearrange changes, somewhat inspired from openbsd's
schizo.c:

- rename pp_busnode{} -> spc_busnode{}, and move it to
sparc_pci_chipset{}

- move public pci functions pci_conf_read(), pci_conf_write() and
pci_intr_establish() into psycho.c, renaming them in the process,
and add pointers through sparc_pci_chipset{} to access them.
as part of this, add PDB_INTMAP and PDB_CONF debug options to
psycho.c

- move and rename sparc64 private pci_find_ino() into
sparc_pci_chipset{}, like the above

- update psycho_alloc_chipset() to set the new 4 function members


no functional change intended. XXX: not tested on cardbus.
 1.15 29-May-2008  mrg branches: 1.15.4; 1.15.6;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.14 13-Feb-2006  cdi branches: 1.14.68; 1.14.70; 1.14.72; 1.14.74;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.13 11-Dec-2005  christos branches: 1.13.2; 1.13.4; 1.13.6;
merge ktrace-lwp.
 1.12 21-Jan-2004  petrov branches: 1.12.16;
For pci devices without ofw mapping find ino by pci bus/slot/device
information, from OpenBSD.
 1.11 03-May-2003  wiz branches: 1.11.2;
DMA, not dma nor Dma.
 1.10 21-Apr-2003  martin Connect the front panel power button on psycho based machines to sysmon's
/dev/power.

XXX - due to the way interrupt handling is structured we have no easy
way to defer clearing the button interrupt until the sysmon callback
has happened and the event is dispatched. We clear it imediately on
return from the interrupt handler. This means we get an interrupt storm
until the button is released, and then start to handle it.
This needs to be fixed! (But with the default application for the power
button does not make a user visible difference.)
 1.9 22-Mar-2003  nakayama PCI-CardBus bridge support for sparc64:
- handle devices which has no OBP node.
- move PCI latency-timer initialization from pci_intr_map to
pci_enumerate_bus.
- make PCI bus free space extents for cardbus devices.
- fix PCI config space map size.
- some code integrations.
 1.8 20-Jun-2002  eeh Overhaul streaming buffer handling:

sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.

psycho streaming buffer flushes write a 64-byte aligned 64-byte block.

So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
 1.7 20-Mar-2002  eeh branches: 1.7.4; 1.7.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.6 20-Jul-2001  eeh branches: 1.6.6;
PCI overhaul.
 1.5 06-Mar-2001  mrg branches: 1.5.2;
rework pci_attach_hook() to just deal with the INO, not the full
interrupt number. properly find interrupts for the E250. modify
pci_intr_map() accordingly. retire psycho_intr_map(). deal with
INO values upto 0x3f, not upto 0x32. restructure sabre_init() and
psycho_init() to be more similar, and display each psycho's IGN.
psycho_intr_establish() deals with INO upto 0x3f, values from 0x32
and higher get 0 for IPL.

tested on E250 & U5.
 1.4 18-Jul-2000  pk branches: 1.4.2;
Set up register bank sharing bwteen psycho A & B based on matching
physical addresses. Allocate IOMMU state separately and refer to it
from both psycho_softc's.
 1.3 24-May-2000  eeh branches: 1.3.4;
Use the PCI function code to distinguish simba bus A from bus B instead
of the current hack.
 1.2 10-Apr-2000  mrg - UltraSPARC IIi does not have streaming buffers; don't try to find it's
diag regsiter to work out why the (non-existant) strbufs don't work.
- check for malloc failure in _all_ places.
- setup the PCI control register as recommended in the IIi users manual.
 1.1 04-Jun-1999  mrg branches: 1.1.2; 1.1.4;
PCI driver for the UltraSPARC. this only works on the Ultra5/10 machines
(`SUNW,sabre') for now, and it doesn't really quite work there yet anyway.
the bus space/dma code is cloned from the sbus driver. the IOMMU code also
is cloned from the sbus code, but separated out into iommu.c so that we can
share it with the sbus driver. hopefully, much of the bus space/dma code
can also be re-shared with the sbus driver and the ebus driver but for now
these copies will do.

support for the real UltraSPARC PCI (`SUNW,psycho') is unwritten, though
most of this code is shared with it.

we can probe PCI config space and try to configue devices, but interrupts
don't work yet...
 1.1.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.4.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.5.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.5.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.1 03-Aug-2001  lukem update to -current
 1.6.6.3 01-Aug-2002  nathanw Catch up to -current.
 1.6.6.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.6.1 20-Jul-2001  nathanw file psychovar.h was added on branch nathanw_sa on 2002-04-01 07:43:05 +0000
 1.7.6.1 21-Jun-2002  lukem Pull up revision 1.8 (requested by eeh in ticket #337):
Overhaul streaming buffer handling:
sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.
psycho streaming buffer flushes write a 64-byte aligned 64-byte block.
So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
[Gets E220R working]
 1.7.4.1 17-Jul-2002  gehenna catch up with -current.
 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.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.1 18-Feb-2006  yamt sync with head.
 1.14.74.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.14.72.1 04-May-2009  yamt sync with head.
 1.14.70.1 04-Jun-2008  yamt sync with head
 1.14.68.2 17-Jan-2009  mjf Sync with HEAD.
 1.14.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.15.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.17.12.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.17.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.6.1 12-Jun-2011  rmind sync with head
 1.18.16.2 18-May-2014  rmind sync with head
 1.18.16.1 28-Aug-2013  rmind sync with head
 1.18.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.26 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.25 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.24 10-May-2021  thorpej branches: 1.24.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.23 24-Apr-2021  thorpej branches: 1.23.2; 1.23.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.22 17-Jan-2021  mrg branches: 1.22.2;
reduce the scope of 'ci' variable.
 1.21 04-Jan-2021  thorpej malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.20 10-Nov-2019  chs branches: 1.20.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.19 21-Apr-2019  maya wether -> whether
 1.18 10-Nov-2016  macallan branches: 1.18.16;
weed out BUS_SPACE_MAP_PREFETCHABLE in resp. _map() and _mmap() methods
it works with UPA graphics cards and at least some psycho but causes problems
on these
 1.17 10-May-2016  palle branches: 1.17.2;
sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.16 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.15 10-Aug-2013  mrg branches: 1.15.6;
thanks to mhitch, we got all the interrupt issues sorted out for now,
so turn off PDB_INTR in the debug kernel.
 1.14 24-Jun-2013  nakayama branches: 1.14.2;
Fix copy and paste.
 1.13 21-Jun-2013  nakayama Avoid data_access_error trap panic when reading unused PCI
configuration space.

This method is described in UltraSPARC IIi User's Manual "16.2.1
Probing PCI during boot using deferred errors", and refer to the
implementation of OpenBSD.
 1.12 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.11 18-Mar-2012  mrg branches: 1.11.2;
add missing __KERNEL_RCSID().
 1.10 12-Aug-2011  mrg branches: 1.10.2; 1.10.6;
initailise ih_pending and ih_ivec.
 1.9 12-Aug-2011  mrg print the ihandle passed in, not NULL.
 1.8 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.7 03-Jun-2011  christos branches: 1.7.2;
forgot _NEW
 1.6 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.5 17-May-2011  dyoung branches: 1.5.2;
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.4 04-Apr-2011  dyoung branches: 1.4.2;
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.3 20-Mar-2011  mrg remove pyro_xir(). we don't have the MD support for it (yet?).
clean up some debug code. clean up the DPRINTF() code, and expand
the interrupt mapping debug code to match schizo and psycho.
set IOMMU_TSBSIZE_IN_PTSB, and if oberon, IOMMU_FLUSH_CACHE.
disable the STC explicitly.
 1.2 15-Mar-2011  mrg initial port of these drivers to netbsd. both pyro(4) and ebus(4) at
mainbus depend upon other as-yet uncommited changes.
 1.1 15-Mar-2011  mrg branches: 1.1.1;
Initial revision
 1.1.1.1 15-Mar-2011  mrg import the openbsd pyro and ebus_mainbus drivers for base reference.
 1.4.2.4 12-Jun-2011  rmind sync with head
 1.4.2.3 31-May-2011  rmind sync with head
 1.4.2.2 21-Apr-2011  rmind sync with head
 1.4.2.1 04-Apr-2011  rmind file pyro.c was added on branch rmind-uvmplock on 2011-04-21 01:41:27 +0000
 1.5.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.7.2.2 06-Jun-2011  jruoho Sync with HEAD.
 1.7.2.1 03-Jun-2011  jruoho file pyro.c was added on branch jruoho-x86intr on 2011-06-06 09:06:50 +0000
 1.10.6.1 05-Apr-2012  mrg sync to latest -current.
 1.10.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.10.2.2 30-Oct-2012  yamt sync with head
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.11.2.4 03-Dec-2017  jdolecek update from HEAD
 1.11.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.2.2 23-Jun-2013  tls resync from head
 1.11.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.14.2.1 28-Aug-2013  rmind sync with head
 1.15.6.3 05-Dec-2016  skrll Sync with HEAD
 1.15.6.2 29-May-2016  skrll Sync with HEAD
 1.15.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.17.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.18.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.18.16.1 10-Jun-2019  christos Sync with HEAD
 1.20.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.22.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.23.4.1 31-May-2021  cjep sync with head
 1.23.2.1 13-May-2021  thorpej Sync with HEAD.
 1.24.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 03-Jun-2011  christos branches: 1.3.2;
CFATTACH_DECL_NEW
 1.2 15-Mar-2011  mrg branches: 1.2.2; 1.2.4;
initial port of these drivers to netbsd. both pyro(4) and ebus(4) at
mainbus depend upon other as-yet uncommited changes.
 1.1 15-Mar-2011  mrg branches: 1.1.1;
Initial revision
 1.1.1.1 15-Mar-2011  mrg import the openbsd pyro and ebus_mainbus drivers for base reference.
 1.2.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.2.2.3 12-Jun-2011  rmind sync with head
 1.2.2.2 21-Apr-2011  rmind sync with head
 1.2.2.1 15-Mar-2011  rmind file pyrovar.h was added on branch rmind-uvmplock on 2011-04-21 01:41:27 +0000
 1.3.2.2 06-Jun-2011  jruoho Sync with HEAD.
 1.3.2.1 03-Jun-2011  jruoho file pyrovar.h was added on branch jruoho-x86intr on 2011-06-06 09:06:50 +0000
 1.2 13-Apr-1999  ad Fonts for rcons are now handled in sys/dev/wsfont.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.10;
Import of sparc64.
 1.1.1.1.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9 27-Jun-2023  andvar remove double/tripple o in comments, where it likely was not added on purpose.
 1.8 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.7 11-Mar-2010  mrg various aprint_* fixes.
 1.6 14-Dec-2008  mrg branches: 1.6.4;
no need for this to use BUS_SPACE_MAP_LINEAR - it uses bus_space properly
 1.5 29-Mar-2008  tsutsui branches: 1.5.4; 1.5.12;
Don't forget to initialize sc_dev.
 1.4 28-Mar-2008  tsutsui Split device_t and softc for MI mc146818 clock,
and other related misc cosmetics.
 1.3 10-Jan-2008  tsutsui branches: 1.3.6;
Move todr_attach(9) calls from each MD attachment to MI mc146818_attach().
 1.2 09-Nov-2006  tsutsui branches: 1.2.2; 1.2.6; 1.2.32; 1.2.38; 1.2.46;
More cleanup of sparc64 clock stuff:
- split mkclock attachment from sparc64/clock.c into dev/mkclock.c
(now clock.s only contains clock interrupt and timecounter stuff)
- rename match/attach functions of rtc at ebus to match the device name
- update some comments around clock devices in GENERIC

No objection on port-sparc64 for a month.
 1.1 09-Oct-2006  mrg branches: 1.1.2;
avoid bringing in mc146818 routines for kernels that do not have the
'rtc'-style clock linked in. put the rtc code in it's own file and
only link it in if it is actually configured. fixes PR#23342.
 1.1.2.3 10-Dec-2006  yamt sync with head.
 1.1.2.2 22-Oct-2006  yamt sync with head
 1.1.2.1 09-Oct-2006  yamt file rtc.c was added on branch yamt-splraiseipl on 2006-10-22 06:05:11 +0000
 1.2.46.1 10-Jan-2008  bouyer Sync with HEAD
 1.2.38.1 18-Feb-2008  mjf Sync with HEAD.
 1.2.32.1 23-Mar-2008  matt sync with HEAD
 1.2.6.3 21-Jan-2008  yamt sync with head
 1.2.6.2 30-Dec-2006  yamt sync with head.
 1.2.6.1 09-Nov-2006  yamt file rtc.c was added on branch yamt-lazymbuf on 2006-12-30 20:47:02 +0000
 1.2.2.2 18-Nov-2006  ad Sync with head.
 1.2.2.1 09-Nov-2006  ad file rtc.c was added on branch newlock2 on 2006-11-18 21:29:32 +0000
 1.3.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.5.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.4.2 11-Aug-2010  yamt sync with head.
 1.5.4.1 04-May-2009  yamt sync with head.
 1.6.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.58 26-Oct-2022  riastradh sparc64/sab(4): Convert to ttylock/ttyunlock.
 1.57 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.56 24-Apr-2021  thorpej branches: 1.56.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.55 31-Oct-2017  martin branches: 1.55.18;
As discussed on tech-kern: define a new tty internal state flag: TS_KERN_ONLY

Implement it in a few tty drivers. If this flag is set, the underlying
hardware is used by another driver and userland has no right to open
it. A few uses will appear soon in sys/dev/sun/sun{kbd,ms}.c.
 1.54 15-Nov-2014  christos branches: 1.54.12;
centralize the call unit / dialout macros
 1.53 01-Nov-2014  nakayama Convert sab_shutdown from deprecated shutdownhook_establish(9) API
to PMF(9) framework.

Tested on Ultra 60 with serial console.
 1.52 25-Jul-2014  dholland branches: 1.52.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.51 16-Mar-2014  dholland branches: 1.51.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.50 15-Sep-2013  martin Remove unused variable
 1.49 03-Oct-2012  mlelstv branches: 1.49.2;
Only initialize when we are the first opener.
 1.48 02-Jun-2011  christos branches: 1.48.2; 1.48.12;
split auxio, ebus, psycho, sab.
 1.47 24-May-2011  mrg branches: 1.47.2;
also match the fujitsu sab: "FJSV,se" (from openbsd, pointed out by jdc)
 1.46 24-Apr-2011  rmind Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.45 11-Mar-2010  mrg branches: 1.45.2; 1.45.4;
various aprint_* fixes.
 1.44 18-Jan-2010  jdc branches: 1.44.2;
Re-do the previous check for the RSC console:
Do the check in sabtty_console_flags() and set a flag if we are an RSC port.
If we are an RSC port, note that the baud rate is 115200, but don't write a
new value to the baud rate generator register, as this stops the console
working.
 1.43 30-Dec-2009  jdc Check for "ssp-console" and "ssp-control" properties.
If we find them, set the baud rate to 115200.
This allows the RSC to be the console on an E250:

sab1 at ebus0 addr 200000-20007f ipl 35: rev 3.2
sabtty2 at sab1 port 0: console i/o
sabtty3 at sab1 port 1

XXX; We should really check the baud rate properties and use those to set
our rates.
 1.42 11-Jun-2008  cegger branches: 1.42.6; 1.42.14;
use device_lookup_private to get softc
fixes build errors about pointer type mismatches in assignment
 1.41 25-May-2008  ad branches: 1.41.2;
Properly fix the "hanging in tty" bug that was worked around with cv_wakeup()
some time again.
 1.40 28-Nov-2007  ad branches: 1.40.14; 1.40.16; 1.40.18; 1.40.20;
Use the softint API.
 1.39 19-Nov-2007  ad - Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.38 07-Nov-2007  ad Merge tty changes from the vmlocking branch.
 1.37 04-Mar-2007  christos branches: 1.37.2; 1.37.18; 1.37.20; 1.37.24; 1.37.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.36 19-Oct-2006  martin branches: 1.36.4;
kgdb support for sabtty
 1.35 01-Oct-2006  elad More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.
 1.34 01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks!
 1.33 01-Oct-2006  martin When setting parameters, we should not only calculate the settings but
better write them back to the chip.
 1.32 01-Oct-2006  martin Use device_xname() accessor
 1.31 28-Jul-2006  hannken branches: 1.31.4; 1.31.6;
Remove 'unused variable p'.
 1.30 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.29 22-May-2006  christos void casts.
 1.28 14-May-2006  elad branches: 1.28.2;
integrate kauth.
 1.27 18-Apr-2006  martin Invert carrier detect sense, from Jonathan A. Kollasch
 1.26 28-Mar-2006  thorpej Use device_unit().
 1.25 13-Feb-2006  cdi branches: 1.25.2; 1.25.4; 1.25.6;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.24 11-Dec-2005  christos branches: 1.24.2; 1.24.4; 1.24.6;
merge ktrace-lwp.
 1.23 26-Aug-2005  drochner kill some more simple submatch() functions, use config_stdsubmatch()
 1.22 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.21 31-May-2005  christos branches: 1.21.2;
- sprinkle const
- avoid variable shadow
 1.20 13-Sep-2004  drochner clean up the questionable use of sabtty_match() as submatch function
(with no useful contents), and implement a real submatch function instead
 1.19 19-Jul-2004  heas If we are serial console, insert a delay just after switching from prom
i/o functions to talking to the sab directly, allowing any residual prom
output to drain. There does not appear to be a prom "flush" function.

Adresses PR 26226.
 1.18 17-Jul-2004  heas Use aprint_normal consistently.
 1.17 10-Jun-2004  seb Add cnmagic(9) support: previously only <Break> was supported to break
into the debugger or ROM monitor from the console.
Note that <Break> is still the default.

Thanks to martin@ for testing.
Approved by petrov@.
 1.16 21-Mar-2004  pk Use the promlib I/O routines.
 1.15 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.14 15-Jul-2003  lukem __KERNEL_RCSID()
 1.13 29-Jun-2003  fvdl branches: 1.13.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.12 29-Jun-2003  martin Passing struct lwp * instead of struct proc * to device functions.
 1.11 13-Jun-2003  petrov Pick up from OpenBSD:
The sab driver sometimes gets out of sync with the hardware. This can
cause the serial console to hang.
 1.10 11-Jun-2003  petrov Use cdevsw_lookup_major.
 1.9 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.8 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.7 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.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 21-Sep-2002  petrov Use /options instead of /chosen to find out where console is.
(found by Rafal Boni).
 1.2 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.1 16-Aug-2002  petrov branches: 1.1.2; 1.1.4; 1.1.6;
Port Jason L. Wright's sab82532 driver. From OpenBSD.
 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 16-Aug-2002  jdolecek file sab.c was added on branch kqueue on 2002-09-06 08:41:29 +0000
 1.1.4.4 02-Sep-2002  gehenna machine/conf.h has gone.
 1.1.4.3 31-Aug-2002  gehenna Add character device switch.
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 16-Aug-2002  gehenna file sab.c was added on branch gehenna-devsw on 2002-08-31 14:52:28 +0000
 1.1.2.7 03-Jan-2003  thorpej Sync with HEAD.
 1.1.2.6 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.5 11-Nov-2002  nathanw Catch up to -current
 1.1.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.3 17-Sep-2002  nathanw Catch up to -current.
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 16-Aug-2002  nathanw file sab.c was added on branch nathanw_sa on 2002-08-27 23:45:49 +0000
 1.13.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.13.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.13.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.2.5 07-Dec-2007  yamt sync with head
 1.21.2.4 15-Nov-2007  yamt sync with head.
 1.21.2.3 03-Sep-2007  yamt sync with head.
 1.21.2.2 30-Dec-2006  yamt sync with head.
 1.21.2.1 21-Jun-2006  yamt sync with head.
 1.24.6.2 01-Jun-2006  kardel Sync with head.
 1.24.6.1 22-Apr-2006  simonb Sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.24.2.1 18-Feb-2006  yamt sync with head.
 1.25.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.25.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.25.4.4 12-May-2006  elad adapt to kauth kpi, include sys/kauth.h where needed..
 1.25.4.3 19-Apr-2006  elad sync with head - hopefully this will work
 1.25.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.25.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.25.2.3 11-Aug-2006  yamt sync with head
 1.25.2.2 24-May-2006  yamt sync with head.
 1.25.2.1 01-Apr-2006  yamt sync with head.
 1.28.2.1 19-Jun-2006  chap Sync with head.
 1.31.6.1 22-Oct-2006  yamt sync with head
 1.31.4.1 18-Nov-2006  ad Sync with head.
 1.36.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.37.26.2 08-Dec-2007  mjf Sync with HEAD.
 1.37.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.37.24.2 21-Nov-2007  bouyer Sync with HEAD
 1.37.24.1 13-Nov-2007  bouyer Sync with HEAD
 1.37.20.2 09-Jan-2008  matt sync with HEAD
 1.37.20.1 08-Nov-2007  matt sync with -HEAD
 1.37.18.3 03-Dec-2007  joerg Sync with HEAD.
 1.37.18.2 21-Nov-2007  joerg Sync with HEAD.
 1.37.18.1 11-Nov-2007  joerg Sync with HEAD.
 1.37.2.1 03-Dec-2007  ad Sync with HEAD.
 1.40.20.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.40.18.3 11-Aug-2010  yamt sync with head.
 1.40.18.2 11-Mar-2010  yamt sync with head
 1.40.18.1 04-May-2009  yamt sync with head.
 1.40.16.2 17-Jun-2008  yamt sync with head.
 1.40.16.1 04-Jun-2008  yamt sync with head
 1.40.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.40.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.41.2.1 18-Jun-2008  simonb Sync with head.
 1.42.14.1 21-Apr-2010  matt sync to netbsd-5
 1.42.6.1 14-Feb-2010  bouyer Pull up following revision(s) (requested by jdc in ticket #1297):
etc/etc.sparc64/MAKEDEV.conf: revision 1.14
sys/arch/sparc64/dev/sab.c: revision 1.43, 1.44
share/man/man4/man4.sparc64/sab.4: revision 1.4
Allow the RSC to be the console on an E250, by checking for RSC-specific
properties, and by not changing the port baud rate.
 1.44.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.45.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.45.2.2 12-Jun-2011  rmind sync with head
 1.45.2.1 31-May-2011  rmind sync with head
 1.47.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.48.12.3 03-Dec-2017  jdolecek update from HEAD
 1.48.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.48.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.48.2.1 30-Oct-2012  yamt sync with head
 1.49.2.1 18-May-2014  rmind sync with head
 1.51.2.1 10-Aug-2014  tls Rebase.
 1.52.2.1 07-Nov-2014  snj Pull up following revision(s) (requested by nakayama in ticket #186):
sys/arch/sparc64/dev/sab.c: revision 1.53
Convert sab_shutdown from deprecated shutdownhook_establish(9) API
to PMF(9) framework.
Tested on Ultra 60 with serial console.
 1.54.12.1 06-Nov-2017  snj Pull up following revision(s) (requested by martin in ticket #338):
sys/arch/sparc64/dev/sab.c: revision 1.55
sys/dev/ic/com.c: revision 1.345
sys/dev/ic/z8530tty.c: revision 1.132
sys/dev/sun/sunkbd.c: revision 1.30
sys/dev/sun/sunms.c: revision 1.33
sys/sys/tty.h: revision 1.94
As discussed on tech-kern: define a new tty internal state flag: TS_KERN_ONLY
Implement it in a few tty drivers. If this flag is set, the underlying
hardware is used by another driver and userland has no right to open
it. A few uses will appear soon in sys/dev/sun/sun{kbd,ms}.c.
--
PR port-sparc64/52622: mark the parent device as TS_KERN_ONLY,
so userland will not touch it (and change serial params w/o our
control).
 1.55.18.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.55.18.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.56.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 03-May-2003  wiz DMA, not dma nor Dma.
 1.1 16-Aug-2002  petrov branches: 1.1.2; 1.1.4; 1.1.6;
Port Jason L. Wright's sab82532 driver. From OpenBSD.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 16-Aug-2002  jdolecek file sab82532reg.h was added on branch kqueue on 2002-09-06 08:41:29 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 16-Aug-2002  gehenna file sab82532reg.h was added on branch gehenna-devsw on 2002-08-31 14:52:28 +0000
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 16-Aug-2002  nathanw file sab82532reg.h was added on branch nathanw_sa on 2002-08-27 23:45:50 +0000
 1.106 02-Dec-2023  thorpej Use vmem_xalloc_addr() to reserve the first Sbus DVMA page.
 1.105 01-Dec-2023  thorpej Use vmem(9) rather than extent(9) to manage DVMA mappings.
 1.104 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.103 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.102 10-May-2021  thorpej branches: 1.102.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.101 24-Apr-2021  thorpej branches: 1.101.2; 1.101.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.100 04-Jan-2021  thorpej branches: 1.100.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.99 14-Jun-2020  chs branches: 1.99.2;
replace EX_NOWAIT with EX_WAITOK in device attach methods.
remove checks for failures that can no longer occur.
 1.98 01-Jan-2020  thorpej - Introduce a new global kernel variable "shutting_down" to indicate that
the system is shutting down or rebooting.
- Set this global in a new function called kern_reboot(), which is currently
just a basic wrapper around cpu_reboot().
- Call kern_reboot() instead of cpu_reboot() almost everywhere; a few
places remain where it's still called directly, but those are in early
pre-main() machdep locations.

Eventually, all of the various cpu_reboot() functions should be re-factored
and common functionality moved to kern_reboot(), but that's for another day.
 1.97 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.96 10-Nov-2016  macallan branches: 1.96.16;
weed out BUS_SPACE_MAP_PREFETCHABLE in resp. _map() and _mmap() methods
it works with UPA graphics cards and at least some psycho but causes problems
on these
 1.95 07-Jul-2016  msaitoh branches: 1.95.2;
KNF. Remove extra spaces. No functional change.
 1.94 10-May-2016  palle sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.93 30-Jan-2012  mrg branches: 1.93.6; 1.93.24;
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.92 04-Sep-2011  nakayama branches: 1.92.2; 1.92.6;
ih_pil is an interrupt level, not an interrupt mask.
 1.91 12-Aug-2011  mrg initialise ih_pending
 1.90 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.89 20-Jul-2011  macallan add per ivec event counters
 1.88 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.87 16-Mar-2011  mrg revert the iommu changes for now. my U60 doesn't like them.
 1.86 16-Mar-2011  mrg use struct iommureg_old.
 1.85 17-Sep-2009  tsutsui branches: 1.85.6;
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.84 17-May-2009  tsutsui Split device_t/softc. Compile test only, but mostly similar changes
with sparc/dev/sbus.c rev 1.69.

XXX: it looks some functions should be merged between sparc and sparc64.
 1.83 18-Oct-2008  nakayama It is wasteful that reconstructing arguments for inserting the pointer
to streaming buffers in each bus_dma functions on sbus/psycho layer.

Use iommu functions directly with storing the pointer into (unused)
_dm_cookie at bus_dmamap_create time.
 1.82 13-Oct-2008  nakayama Remove unnecessary includes.
 1.81 11-Jun-2008  cegger branches: 1.81.2;
use device_lookup_private to get softc
fixes build errors about pointer type mismatches in assignment
 1.80 18-May-2008  martin branches: 1.80.2;
Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.
 1.79 05-Apr-2008  cegger branches: 1.79.2; 1.79.4; 1.79.6;
use aprint_*_dev and device_xname
OK martin
 1.78 04-Mar-2007  christos branches: 1.78.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.77 23-Feb-2006  thorpej branches: 1.77.20;
Use device_parent().
 1.76 13-Feb-2006  cdi ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.75 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.74 01-Feb-2006  martin branches: 1.74.2;
Do not assume the bootstrap CPU has UPA id 0 - on some machines it hasn't.
Explicitly route all interrupts to the current cpu for now, we'll revisit
this when SMP is working.
Problem spotted and analyzed by Stephan Meisinger, fix inspired by FreeBSD.
 1.73 11-Dec-2005  christos branches: 1.73.2; 1.73.4;
merge ktrace-lwp.
 1.72 31-May-2005  christos branches: 1.72.2;
- sprinkle const
- avoid variable shadow
 1.71 04-Dec-2004  chs the arguments to BUS_ADDR() are (space, offset), not the other way around.
fixes PR 26472.
 1.70 28-Jul-2004  pk _sbus_bus_map: check for the existence of `ranges' in the tag before using them.
 1.69 30-Jun-2004  pk sbus_attach: use bus_space_tag_allocate();
sbus_bus_map: use bus_space_translate_generic();
sbus_bus_addr: use BUS_ADDR().
 1.68 21-Mar-2004  martin Make sure prom_getprop is called with the size pointed to by nitem
initialized. (Some of these are more paranoia, but two were actual bugs.)
Print error codes in some panic messages.
 1.67 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.66 17-Mar-2004  pk Pass the buffer size to PROM_getpropstringA(), as in sparc.
 1.65 09-Nov-2003  martin Nuke bcopy/bzero.
 1.64 26-Oct-2003  christos Fix uninitialized variable warning.
 1.63 11-Oct-2003  petrov When establishing interrupt set CPU_UPAID in mapping register
so that interrupt would be delivered.
 1.62 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.61 15-Jul-2003  lukem __KERNEL_RCSID()
 1.60 17-May-2003  nakayama branches: 1.60.2;
Avoid strict-alias warnings in gcc 3.3.
 1.59 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.58 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.57 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.56 10-Dec-2002  pk bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.55 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.54 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.53 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.52 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.51 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.50 20-Jun-2002  eeh Overhaul streaming buffer handling:

sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.

psycho streaming buffer flushes write a 64-byte aligned 64-byte block.

So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
 1.49 21-Mar-2002  eeh branches: 1.49.2; 1.49.4; 1.49.6;
Cleanup.
 1.48 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.47 14-Mar-2002  eeh bus_space_map2() no longer exists.
 1.46 07-Oct-2001  eeh branches: 1.46.4;
Manage both streaming caches on psycho/psycho+.
 1.45 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.44 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.43 20-Jul-2001  eeh branches: 1.43.2;
PCI overhaul.
 1.42 18-May-2001  mrg branches: 1.42.2;
move the sbus IOMMU work around into the sbus code, so that the psycho
doesn't have to lose a page.
 1.41 16-Mar-2001  hubertf Add comment on what 'overtemp' is about. OK'd by eeh.
 1.40 14-Mar-2001  eeh Handle overtemp intr.
 1.39 06-Dec-2000  mrg branches: 1.39.2;
fix warnings in DEBUG & DIAGNSTIC code.
 1.38 04-Dec-2000  fvdl Avoid (safe) cast warnings.
 1.37 01-Nov-2000  eeh Pass along bus frequency.
 1.36 19-Oct-2000  mrg wrap long lines.
 1.35 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.34 07-Jul-2000  mrg work around a bug passing arguments to iommu_dvma_load_raw()
 1.33 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.32 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.31 24-Jun-2000  eeh Get rid of vaddrs.h.
 1.30 08-Jun-2000  eeh branches: 1.30.2;
Fix ordering of sync operations depending on whether it's PRE- or POST-.
 1.29 17-May-2000  eeh branches: 1.29.2;
Add support for bus_dma_load_raw() so the le driver will work again.
 1.28 22-Apr-2000  mrg whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.27 22-Apr-2000  mrg - convert to DPRINTF() style debug messages.
- kill dead code.
- use the sbus dv_xname to construct a dvma map map, to pass to
extent_alloc(), to help support multiple sbusses
 1.26 10-Apr-2000  pk Get a kernel without DDB to build.
 1.25 08-Apr-2000  mrg - remove unused variable.
- include <sparc64/sparc64/cache.h> to get cache_flush() prototype.
- remove an unnecessary cast.
 1.24 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.23 14-Jan-2000  pk Remove old-style boot device recognition.
 1.22 25-Nov-1999  mrg - pass slot number to sbus_get_intr() as a new argument.
- in sbus_get_intr(), if we are not an onboard device (ie, sbus card),
encode the slot number into the sbi_pri so that we can later extract
it and use it to find the interrupt map & clear registers for this
device.
- remove "intr" support as it is really pre-sun4u only.
- don't "pause" for so long in sbus interrupt debug messages..

with the slot number being passed back from sbus_get_intr(), the FS/BE
card in an ultra2 now appears to get interrupts and gets beyond
waiting for the scsibus probe!
 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 20-Jun-1999  eeh Move the DVMA mapin/mapout functions from the SBus driver to the iommu driver.
 1.18 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.17 05-Jun-1999  mrg use common IOMMU routines.
 1.16 31-May-1999  eeh Garbage collect.
 1.15 30-May-1999  eeh Add code to support using %tick as the system clock if no "counter-timer" node
is found.
 1.14 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.13 23-May-1999  mrg place iommu definitions in iommureg.h
 1.12 22-May-1999  eeh Well, looks like the MI allocsys() broke the dvmamap, so instead of using a
single map move it to the bus controller driver so each bus can handle its own
IOMMU without conflicts.
 1.11 26-Mar-1999  mycroft branches: 1.11.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.10 18-Mar-1999  eeh Some devices don't have a `device-type' property we can use to allocate
an IPL. Check for those by name. Give the rest a default IPL of 2.
(Added `SUNW,CS4231' to the list.)
 1.9 10-Jan-1999  eeh Need to put IGN in SBUS slot interrupt vectors as well. (From Kapil Chowksey)
 1.8 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.7 05-Sep-1998  pk #include <dev/sbus/sbusvar.h>
 1.6 05-Sep-1998  pk Nuke temporary `getpropA()'.
 1.5 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.4 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2.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.11.4.2 02-Aug-1999  thorpej Update from trunk.
 1.11.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.4.1 15-Nov-1999  fvdl Sync with -current
 1.20.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.20.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.20.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.20.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.29.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.30.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.39.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.39.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.42.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.42.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.42.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.42.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.42.2.1 03-Aug-2001  lukem update to -current
 1.43.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.43.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.46.4.7 03-Jan-2003  thorpej Sync with HEAD.
 1.46.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.46.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.46.4.4 27-Aug-2002  nathanw Catch up to -current.
 1.46.4.3 01-Aug-2002  nathanw Catch up to -current.
 1.46.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.46.4.1 07-Oct-2001  nathanw file sbus.c was added on branch nathanw_sa on 2002-04-01 07:43:05 +0000
 1.49.6.2 22-Nov-2002  tron Pull up revision 1.51 (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.49.6.1 21-Jun-2002  lukem Pull up revision 1.50 (requested by eeh in ticket #337):
Overhaul streaming buffer handling:
sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.
psycho streaming buffer flushes write a 64-byte aligned 64-byte block.
So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
[Gets E220R working]
 1.49.4.2 31-Aug-2002  gehenna catch up with -current.
 1.49.4.1 17-Jul-2002  gehenna catch up with -current.
 1.49.2.2 06-Apr-2002  eeh Use DEV_PRIVATE() and distinguish between the softc and the device struct.
 1.49.2.1 26-Mar-2002  eeh Support probing and attaching with device properties too.
 1.60.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.60.2.4 18-Dec-2004  skrll Sync with HEAD.
 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.72.2.2 03-Sep-2007  yamt sync with head.
 1.72.2.1 21-Jun-2006  yamt sync with head.
 1.73.4.1 09-Sep-2006  rpaulo sync with head
 1.73.2.2 01-Mar-2006  yamt sync with head.
 1.73.2.1 18-Feb-2006  yamt sync with head.
 1.74.2.1 22-Apr-2006  simonb Sync with head.
 1.77.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.78.40.3 17-Jan-2009  mjf Sync with HEAD.
 1.78.40.2 29-Jun-2008  mjf Sync with HEAD.
 1.78.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.79.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.79.4.3 11-Mar-2010  yamt sync with head
 1.79.4.2 20-Jun-2009  yamt sync with head
 1.79.4.1 04-May-2009  yamt sync with head.
 1.79.2.2 17-Jun-2008  yamt sync with head.
 1.79.2.1 04-Jun-2008  yamt sync with head
 1.80.2.1 18-Jun-2008  simonb Sync with head.
 1.81.2.1 19-Oct-2008  haad Sync with HEAD.
 1.85.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.92.6.1 18-Feb-2012  mrg merge to -current.
 1.92.2.1 17-Apr-2012  yamt sync with head
 1.93.24.3 05-Dec-2016  skrll Sync with HEAD
 1.93.24.2 09-Jul-2016  skrll Sync with HEAD
 1.93.24.1 29-May-2016  skrll Sync with HEAD
 1.93.6.1 03-Dec-2017  jdolecek update from HEAD
 1.95.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.96.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.96.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.99.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.100.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.101.4.1 31-May-2021  cjep sync with head
 1.101.2.1 13-May-2021  thorpej Sync with HEAD.
 1.102.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.10 16-Mar-2011  mrg revert the iommu changes for now. my U60 doesn't like them.
 1.9 16-Mar-2011  mrg use struct iommureg_old.
 1.8 13-Feb-2006  cdi branches: 1.8.100;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.7 07-Jun-1999  eeh branches: 1.7.52; 1.7.64; 1.7.66; 1.7.68;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.6 24-May-1999  mrg pull struct strbuf + defines into iommureg.h. properly merge previous commit.
 1.5 23-May-1999  mrg place iommu definitions in iommureg.h
 1.4 22-May-1999  eeh Well, looks like the MI allocsys() broke the dvmamap, so instead of using a
single map move it to the bus controller driver so each bus can handle its own
IOMMU without conflicts.
 1.3 05-Sep-1998  eeh branches: 1.3.8;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.1.1.1.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.3.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.68.1 22-Apr-2006  simonb Sync with head.
 1.7.66.1 09-Sep-2006  rpaulo sync with head
 1.7.64.1 18-Feb-2006  yamt sync with head.
 1.7.52.1 21-Jun-2006  yamt sync with head.
 1.8.100.1 06-Jun-2011  jruoho Sync with HEAD.
 1.18 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.17 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.16 17-May-2009  tsutsui Split device_t/softc. Compile test only, but mostly similar changes
with sparc/dev/sbus.c rev 1.69.

XXX: it looks some functions should be merged between sparc and sparc64.
 1.15 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.14 11-Dec-2005  christos branches: 1.14.74; 1.14.76; 1.14.78;
merge ktrace-lwp.
 1.13 30-Jun-2004  pk sbus_attach: use bus_space_tag_allocate();
sbus_bus_map: use bus_space_translate_generic();
sbus_bus_addr: use BUS_ADDR().
 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 23-Aug-2002  thorpej branches: 1.11.6;
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.10 20-Jun-2002  eeh Overhaul streaming buffer handling:

sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.

psycho streaming buffer flushes write a 64-byte aligned 64-byte block.

So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
 1.9 21-Mar-2002  eeh branches: 1.9.4; 1.9.6;
Cleanup.
 1.8 20-Mar-2002  eeh Add sbus_promaddr_to_handle() to convert a prom address to a bus_space_handle_t.
 1.7 05-Jun-1999  mrg branches: 1.7.16; 1.7.20;
use common IOMMU routines.
 1.6 22-May-1999  eeh Well, looks like the MI allocsys() broke the dvmamap, so instead of using a
single map move it to the bus controller driver so each bus can handle its own
IOMMU without conflicts.
 1.5 05-Sep-1998  eeh branches: 1.5.8;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 05-Sep-1998  pk Most of this now comes from <sys/dev/sbus/sbusvar.h>
 1.3 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.1.1.1.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.5.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.20.3 27-Aug-2002  nathanw Catch up to -current.
 1.7.20.2 01-Aug-2002  nathanw Catch up to -current.
 1.7.20.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.7.16.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.7.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.6.2 22-Nov-2002  tron Pull up revision 1.11 (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.9.6.1 21-Jun-2002  lukem Pull up revision 1.10 (requested by eeh in ticket #337):
Overhaul streaming buffer handling:
sysio streaming buffer flushes write a single 8-byte aligned 8-byte
value.
psycho streaming buffer flushes write a 64-byte aligned 64-byte block.
So separate out the streaming buffers into their own structure and pass those
in to all iommu operations. This also means we only flush the correct
streaming buffer for psycho rather than needing to flush both just in case.
[Gets E220R working]
 1.9.4.2 31-Aug-2002  gehenna catch up with -current.
 1.9.4.1 17-Jul-2002  gehenna catch up with -current.
 1.11.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.6.1 03-Aug-2004  skrll Sync with HEAD
 1.14.78.3 11-Mar-2010  yamt sync with head
 1.14.78.2 20-Jun-2009  yamt sync with head
 1.14.78.1 16-May-2008  yamt sync with head.
 1.14.76.1 18-May-2008  yamt sync with head.
 1.14.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.47 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.46 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.45 10-May-2021  thorpej branches: 1.45.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.44 24-Apr-2021  thorpej branches: 1.44.2; 1.44.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.43 17-Jan-2021  mrg branches: 1.43.2;
reduce the scope of 'ci' variable.
 1.42 01-Oct-2019  chs branches: 1.42.8;
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.41 09-Feb-2019  mrg on tomatillo unload the map before flushing the iommu, instead of
the reverse. from opensolaris.
 1.40 05-Feb-2019  mrg add or avoid fallthru comments.
 1.39 03-Jun-2017  mrg branches: 1.39.10;
add __func__ to some panic strings.
 1.38 26-Mar-2017  martin Reorder attach slightly to avoid unintialized use of OF nodes.
 1.37 10-Nov-2016  macallan branches: 1.37.2;
weed out BUS_SPACE_MAP_PREFETCHABLE in resp. _map() and _mmap() methods
it works with UPA graphics cards and at least some psycho but causes problems
on these
 1.36 10-May-2016  palle branches: 1.36.2;
sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.35 27-Nov-2015  martin Use __BIT() for some masks to fix the sparc build.
No binary changes.
 1.34 23-Nov-2015  jdc Set the target JPID for all interrupts on Tomatillo.
If the "ino-bitmap" property is available, use it to route error interrupts.
Minor cosmetic changes.
Add register printing when DEBUG is defined.
 1.33 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.32 21-Sep-2014  christos branches: 1.32.2;
fix leak
 1.31 21-Jun-2013  nakayama branches: 1.31.8;
Avoid data_access_error trap panic when reading unused PCI
configuration space.

This method is described in UltraSPARC IIi User's Manual "16.2.1
Probing PCI during boot using deferred errors", and refer to the
implementation of OpenBSD.
 1.30 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.29 25-Mar-2012  mrg branches: 1.29.2;
- save the "version#" in the softc, we will want it later
- enable some more things in the schizo CSR:
- tomatillo: DMA arbitration enable:
- tomatillo: prefetch read multiple / one / line
- schizo: enable parking unless "no-bus-parking" is set
- schizo: enable streaming buffer interrupts
- schizo: enable bus arbitration for schizo, not these reseved
bits for tomatillo

partly from and entirely inspired by freebsd schizo_attach().
 1.28 18-Mar-2012  mrg add missing __KERNEL_RCSID().
 1.27 04-Sep-2011  nakayama branches: 1.27.2; 1.27.6;
ih_pil is an interrupt level, not an interrupt mask.
 1.26 12-Aug-2011  mrg initialise ih_pending
 1.25 20-Jul-2011  macallan add per ivec event counters
 1.24 20-Jul-2011  macallan some malloc() -> kmem_alloc()
 1.23 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.22 03-Jun-2011  christos forgot the _NEW part
 1.21 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.20 17-May-2011  dyoung branches: 1.20.2;
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.19 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.18 20-Mar-2011  mrg enable the tomatillo iocache.
garbage collect struct iommureg_schizo and use struct iommureg2.
 1.17 02-Jan-2011  mrg branches: 1.17.2;
now that it's optional, kill schizo_pci_find_ino().
prepare to enable the tomatillo iocache.
 1.16 11-Mar-2010  mrg branches: 1.16.2;
various aprint_* fixes.
 1.15 11-Mar-2010  mrg - pay attention to the "no-streaming-cache" flag.
- minor re-structure so this looks a little more like psycho.c.
 1.14 13-Feb-2010  nakayama Make 32-bit kernels compilable.
 1.13 06-Feb-2010  mrg branches: 1.13.2;
- properly map the schizo interrupt registers, so we can use the normal
virtual mappings to access them.
- with the above fxied, kill SCHIZO_BUS_SPACE_BROKEN, and introduce
an options CHEETAH for now, that disables the SPITFIRE code in locore.
- merge schizo_init() into schizo_attach() and clean up the softc a bit.


with this we are only one more step away from GENERIC booting on USIII
machines.
 1.12 06-Jan-2010  mrg move the guts of pci_intr_map() into pci_machdep.c, and move the schizo
ign addition into a hook. also, don't double shift the ign in set_intr.

tested on U60 and SB2500.
 1.11 30-Dec-2009  nakayama It seems that accessing to a PCI configration space where devices
are unavailable causes data_access_error trap. We need to check a
validity of OF node embeded in pcitag to avoid the trap.

Fixes PR port-sparc64/42545.
 1.10 30-Nov-2009  mrg convert pci_intr_map() into a chipset tag function pointer, and implement
the schizo version slightly differently.

pull out the schizo's IGN from the upaid, not the apparently broken device
ID register. from openbsd.

with this i appear to have valid working interrupts on the SB2500.

tested on U60 and SB2500.


XXX: we can probably kill (*spc_find_ino)() now that pci_intr_map() itself
XXX: is no longer a first class function.
 1.9 27-Nov-2009  mrg clean up some debug messages a little bit.
 1.8 16-Dec-2008  christos branches: 1.8.2; 1.8.4; 1.8.8;
replace bitmask_snprintf(9) with snprintb(3)
 1.7 15-Dec-2008  mrg properly calculate the addresses of the interrupt map & clr registers.
now interrupts are working. but /sbin/init is failing to work over nfs.
 1.6 13-Dec-2008  mrg - read AgentID out of the schizo CSR and use that, rather than the
passed in portid, to calculate the IGN.
- don't logical-or in the IGN always, possible twice
 1.5 13-Dec-2008  mrg fix much of the interrupt mapping/establishment code. still does
not yet work, but we are now seeing spurious interrupts (that should
be mapped to some handler..)
 1.4 13-Dec-2008  mrg - enable schizo_dmamap_create() after fixing it
- clean up some debug code
- remove unused schizo_intr_map()
- setup our iommu state properly
- for now, implement a 'struct schizo_iommureg' and use it in schizo.
XXX this should be merged with iommu*

interrupts are still not working but we get to scsi probe now.
 1.3 10-Dec-2008  nakayama branches: 1.3.2;
Add initialization of spc_busmax and spc_busnode in sparc_pci_chipset.
 1.2 10-Dec-2008  mrg checkpoint my work-in-progress port of this driver.
it boots some way but will crash attaching rtc0.

known TODO items:
- figure out why BUS_SPACE_MAP_LINEAR mappings generate data errors
(cause of the rtc issue)
- several interrupt issues
 1.1 10-Dec-2008  mrg branches: 1.1.1;
Initial revision
 1.1.1.1 10-Dec-2008  mrg import the original openbsd "schizo" PCI driver as found on US-III systems.
 1.3.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.3.2.1 10-Dec-2008  haad file schizo.c was added on branch haad-dm on 2008-12-13 01:13:29 +0000
 1.8.8.4 11-Aug-2010  yamt sync with head.
 1.8.8.3 11-Mar-2010  yamt sync with head
 1.8.8.2 04-May-2009  yamt sync with head.
 1.8.8.1 16-Dec-2008  yamt file schizo.c was added on branch yamt-nfs-mp on 2009-05-04 08:11:57 +0000
 1.8.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.8.4.1 16-Dec-2008  skrll file schizo.c was added on branch nick-hppapmap on 2009-01-19 13:16:47 +0000
 1.8.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.2.1 16-Dec-2008  mjf file schizo.c was added on branch mjf-devfs2 on 2009-01-17 13:28:32 +0000
 1.13.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.16.2.4 12-Jun-2011  rmind sync with head
 1.16.2.3 31-May-2011  rmind sync with head
 1.16.2.2 21-Apr-2011  rmind sync with head
 1.16.2.1 05-Mar-2011  rmind sync with head
 1.17.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.20.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.27.6.1 05-Apr-2012  mrg sync to latest -current.
 1.27.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.27.2.2 30-Oct-2012  yamt sync with head
 1.27.2.1 17-Apr-2012  yamt sync with head
 1.29.2.3 03-Dec-2017  jdolecek update from HEAD
 1.29.2.2 23-Jun-2013  tls resync from head
 1.29.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.31.8.2 26-Jan-2016  riz Pull up following revision(s) (requested by jdc in ticket #1064):
sys/arch/sparc64/dev/schizo.c: revision 1.34
sys/arch/sparc64/dev/schizo.c: revision 1.35
sys/arch/sparc64/dev/schizovar.h: revision 1.7
sys/arch/sparc64/dev/schizoreg.h: revision 1.10
sys/arch/sparc64/dev/schizoreg.h: revision 1.11
add some tomatillo specific information to schizo_pbm_regs.
Set the target JPID for all interrupts on Tomatillo.
If the "ino-bitmap" property is available, use it to route error interrupts.
Minor cosmetic changes.
Add register printing when DEBUG is defined.
Use __BIT() for some masks to fix the sparc build.
No binary changes.
 1.31.8.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.32.2.4 28-Aug-2017  skrll Sync with HEAD
 1.32.2.3 05-Dec-2016  skrll Sync with HEAD
 1.32.2.2 29-May-2016  skrll Sync with HEAD
 1.32.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.36.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.36.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.37.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.39.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.39.10.1 10-Jun-2019  christos Sync with HEAD
 1.42.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.43.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.44.4.1 31-May-2021  cjep sync with head
 1.44.2.1 13-May-2021  thorpej Sync with HEAD.
 1.45.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.12 19-Oct-2018  macallan add Tomatillo ESTAR and GPIO registers
 1.11 23-Nov-2015  jdc branches: 1.11.16; 1.11.18;
Set the target JPID for all interrupts on Tomatillo.
If the "ino-bitmap" property is available, use it to route error interrupts.
Minor cosmetic changes.
Add register printing when DEBUG is defined.
 1.10 10-Aug-2015  mrg add some tomatillo specific information to schizo_pbm_regs.
 1.9 25-Mar-2012  mrg branches: 1.9.2; 1.9.14; 1.9.16;
- save the "version#" in the softc, we will want it later
- enable some more things in the schizo CSR:
- tomatillo: DMA arbitration enable:
- tomatillo: prefetch read multiple / one / line
- schizo: enable parking unless "no-bus-parking" is set
- schizo: enable streaming buffer interrupts
- schizo: enable bus arbitration for schizo, not these reseved
bits for tomatillo

partly from and entirely inspired by freebsd schizo_attach().
 1.8 20-Mar-2011  mrg branches: 1.8.4; 1.8.8;
enable the tomatillo iocache.
garbage collect struct iommureg_schizo and use struct iommureg2.
 1.7 02-Jan-2011  mrg branches: 1.7.2;
now that it's optional, kill schizo_pci_find_ino().
prepare to enable the tomatillo iocache.
 1.6 13-Feb-2010  nakayama branches: 1.6.2;
Make 32-bit kernels compilable.
 1.5 13-Dec-2008  mrg branches: 1.5.2; 1.5.4; 1.5.8; 1.5.10;
- read AgentID out of the schizo CSR and use that, rather than the
passed in portid, to calculate the IGN.
- don't logical-or in the IGN always, possible twice
 1.4 13-Dec-2008  mrg - enable schizo_dmamap_create() after fixing it
- clean up some debug code
- remove unused schizo_intr_map()
- setup our iommu state properly
- for now, implement a 'struct schizo_iommureg' and use it in schizo.
XXX this should be merged with iommu*

interrupts are still not working but we get to scsi probe now.
 1.3 10-Dec-2008  mrg branches: 1.3.2;
revert part of the previous.
 1.2 10-Dec-2008  mrg checkpoint my work-in-progress port of this driver.
it boots some way but will crash attaching rtc0.

known TODO items:
- figure out why BUS_SPACE_MAP_LINEAR mappings generate data errors
(cause of the rtc issue)
- several interrupt issues
 1.1 10-Dec-2008  mrg branches: 1.1.1;
Initial revision
 1.1.1.1 10-Dec-2008  mrg import the original openbsd "schizo" PCI driver as found on US-III systems.
 1.3.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.3.2.1 10-Dec-2008  haad file schizoreg.h was added on branch haad-dm on 2008-12-13 01:13:29 +0000
 1.5.10.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.5.8.3 11-Mar-2010  yamt sync with head
 1.5.8.2 04-May-2009  yamt sync with head.
 1.5.8.1 13-Dec-2008  yamt file schizoreg.h was added on branch yamt-nfs-mp on 2009-05-04 08:11:57 +0000
 1.5.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.5.4.1 13-Dec-2008  skrll file schizoreg.h was added on branch nick-hppapmap on 2009-01-19 13:16:47 +0000
 1.5.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.5.2.1 13-Dec-2008  mjf file schizoreg.h was added on branch mjf-devfs2 on 2009-01-17 13:28:32 +0000
 1.6.2.2 21-Apr-2011  rmind sync with head
 1.6.2.1 05-Mar-2011  rmind sync with head
 1.7.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8.8.1 05-Apr-2012  mrg sync to latest -current.
 1.8.4.1 17-Apr-2012  yamt sync with head
 1.9.16.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.9.16.1 22-Sep-2015  skrll Sync with HEAD
 1.9.14.1 26-Jan-2016  riz Pull up following revision(s) (requested by jdc in ticket #1064):
sys/arch/sparc64/dev/schizo.c: revision 1.34
sys/arch/sparc64/dev/schizo.c: revision 1.35
sys/arch/sparc64/dev/schizovar.h: revision 1.7
sys/arch/sparc64/dev/schizoreg.h: revision 1.10
sys/arch/sparc64/dev/schizoreg.h: revision 1.11
add some tomatillo specific information to schizo_pbm_regs.
Set the target JPID for all interrupts on Tomatillo.
If the "ino-bitmap" property is available, use it to route error interrupts.
Minor cosmetic changes.
Add register printing when DEBUG is defined.
Use __BIT() for some masks to fix the sparc build.
No binary changes.
 1.9.2.1 03-Dec-2017  jdolecek update from HEAD
 1.11.18.1 10-Jun-2019  christos Sync with HEAD
 1.11.16.1 20-Oct-2018  pgoyette Sync with head
 1.7 23-Nov-2015  jdc Set the target JPID for all interrupts on Tomatillo.
If the "ino-bitmap" property is available, use it to route error interrupts.
Minor cosmetic changes.
Add register printing when DEBUG is defined.
 1.6 25-Mar-2012  mrg branches: 1.6.2; 1.6.14; 1.6.16;
- save the "version#" in the softc, we will want it later
- enable some more things in the schizo CSR:
- tomatillo: DMA arbitration enable:
- tomatillo: prefetch read multiple / one / line
- schizo: enable parking unless "no-bus-parking" is set
- schizo: enable streaming buffer interrupts
- schizo: enable bus arbitration for schizo, not these reseved
bits for tomatillo

partly from and entirely inspired by freebsd schizo_attach().
 1.5 03-Jun-2011  christos branches: 1.5.2; 1.5.6;
CFATTACH_DECL_NEW
 1.4 06-Feb-2010  mrg branches: 1.4.4; 1.4.6; 1.4.10;
- properly map the schizo interrupt registers, so we can use the normal
virtual mappings to access them.
- with the above fxied, kill SCHIZO_BUS_SPACE_BROKEN, and introduce
an options CHEETAH for now, that disables the SPITFIRE code in locore.
- merge schizo_init() into schizo_attach() and clean up the softc a bit.


with this we are only one more step away from GENERIC booting on USIII
machines.
 1.3 13-Dec-2008  mrg branches: 1.3.2; 1.3.4; 1.3.8;
fix much of the interrupt mapping/establishment code. still does
not yet work, but we are now seeing spurious interrupts (that should
be mapped to some handler..)
 1.2 10-Dec-2008  mrg branches: 1.2.2;
checkpoint my work-in-progress port of this driver.
it boots some way but will crash attaching rtc0.

known TODO items:
- figure out why BUS_SPACE_MAP_LINEAR mappings generate data errors
(cause of the rtc issue)
- several interrupt issues
 1.1 10-Dec-2008  mrg branches: 1.1.1;
Initial revision
 1.1.1.1 10-Dec-2008  mrg import the original openbsd "schizo" PCI driver as found on US-III systems.
 1.2.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.2.1 10-Dec-2008  haad file schizovar.h was added on branch haad-dm on 2008-12-13 01:13:29 +0000
 1.3.8.3 11-Mar-2010  yamt sync with head
 1.3.8.2 04-May-2009  yamt sync with head.
 1.3.8.1 13-Dec-2008  yamt file schizovar.h was added on branch yamt-nfs-mp on 2009-05-04 08:11:57 +0000
 1.3.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.3.4.1 13-Dec-2008  skrll file schizovar.h was added on branch nick-hppapmap on 2009-01-19 13:16:47 +0000
 1.3.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.2.1 13-Dec-2008  mjf file schizovar.h was added on branch mjf-devfs2 on 2009-01-17 13:28:32 +0000
 1.4.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.4.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.4.1 12-Jun-2011  rmind sync with head
 1.5.6.1 05-Apr-2012  mrg sync to latest -current.
 1.5.2.1 17-Apr-2012  yamt sync with head
 1.6.16.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.6.14.1 26-Jan-2016  riz Pull up following revision(s) (requested by jdc in ticket #1064):
sys/arch/sparc64/dev/schizo.c: revision 1.34
sys/arch/sparc64/dev/schizo.c: revision 1.35
sys/arch/sparc64/dev/schizovar.h: revision 1.7
sys/arch/sparc64/dev/schizoreg.h: revision 1.10
sys/arch/sparc64/dev/schizoreg.h: revision 1.11
add some tomatillo specific information to schizo_pbm_regs.
Set the target JPID for all interrupts on Tomatillo.
If the "ino-bitmap" property is available, use it to route error interrupts.
Minor cosmetic changes.
Add register printing when DEBUG is defined.
Use __BIT() for some masks to fix the sparc build.
No binary changes.
 1.6.2.1 03-Dec-2017  jdolecek update from HEAD
 1.4 05-Sep-1998  pk Remove unused files.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 04-Jul-1998  jonathan branches: 1.2.2;
defopt DDB.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.3 20-Jul-2001  eeh PCI overhaul.
 1.2 24-May-2000  eeh branches: 1.2.8;
Use the PCI function code to distinguish simba bus A from bus B instead
of the current hack.
 1.1 04-Jun-1999  mrg branches: 1.1.2; 1.1.4;
PCI driver for the UltraSPARC. this only works on the Ultra5/10 machines
(`SUNW,sabre') for now, and it doesn't really quite work there yet anyway.
the bus space/dma code is cloned from the sbus driver. the IOMMU code also
is cloned from the sbus code, but separated out into iommu.c so that we can
share it with the sbus driver. hopefully, much of the bus space/dma code
can also be re-shared with the sbus driver and the ebus driver but for now
these copies will do.

support for the real UltraSPARC PCI (`SUNW,psycho') is unwritten, though
most of this code is shared with it.

we can probe PCI config space and try to configue devices, but interrupts
don't work yet...
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.8.1 03-Aug-2001  lukem update to -current
 1.2 05-Oct-2001  thorpej Delete this file; nothing includes it, and it is simply an (incomplete)
copy of <dev/pci/ppbreg.h> anyway.
 1.1 04-Jun-1999  mrg branches: 1.1.2; 1.1.16; 1.1.18;
PCI driver for the UltraSPARC. this only works on the Ultra5/10 machines
(`SUNW,sabre') for now, and it doesn't really quite work there yet anyway.
the bus space/dma code is cloned from the sbus driver. the IOMMU code also
is cloned from the sbus code, but separated out into iommu.c so that we can
share it with the sbus driver. hopefully, much of the bus space/dma code
can also be re-shared with the sbus driver and the ebus driver but for now
these copies will do.

support for the real UltraSPARC PCI (`SUNW,psycho') is unwritten, though
most of this code is shared with it.

we can probe PCI config space and try to configue devices, but interrupts
don't work yet...
 1.1.18.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.16.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.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.6 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.5 16-May-2020  jdc Extend the monitoring to battery state, with capacity based on voltage.
Add more PMU definitions.
 1.4 14-Oct-2018  macallan branches: 1.4.2; 1.4.6;
- protect PMU transactions with a mutex
- report lid switch events to powerd
 1.3 13-Oct-2018  macallan config and attachment goop for tadpmu
 1.2 13-Oct-2018  macallan - use interrupts
- report power button to sysmon
 1.1 12-Oct-2018  macallan experimental code to talk to the PMU found in Tadpole Viper laptops
 1.4.6.2 10-Jun-2019  christos Sync with HEAD
 1.4.6.1 14-Oct-2018  christos file tadpmu.c was added on branch phil-wifi on 2019-06-10 22:06:47 +0000
 1.4.2.2 20-Oct-2018  pgoyette Sync with head
 1.4.2.1 14-Oct-2018  pgoyette file tadpmu.c was added on branch pgoyette-compat on 2018-10-20 06:58:29 +0000
 1.3 16-May-2020  jdc Extend the monitoring to battery state, with capacity based on voltage.
Add more PMU definitions.
 1.2 13-Oct-2018  macallan branches: 1.2.2; 1.2.6;
- use interrupts
- report power button to sysmon
 1.1 12-Oct-2018  macallan experimental code to talk to the PMU found in Tadpole Viper laptops
 1.2.6.2 10-Jun-2019  christos Sync with HEAD
 1.2.6.1 13-Oct-2018  christos file tadpmureg.h was added on branch phil-wifi on 2019-06-10 22:06:47 +0000
 1.2.2.2 20-Oct-2018  pgoyette Sync with head
 1.2.2.1 13-Oct-2018  pgoyette file tadpmureg.h was added on branch pgoyette-compat on 2018-10-20 06:58:29 +0000
 1.3 16-May-2020  jdc Extend the monitoring to battery state, with capacity based on voltage.
Add more PMU definitions.
 1.2 13-Oct-2018  macallan branches: 1.2.2; 1.2.6;
- use interrupts
- report power button to sysmon
 1.1 12-Oct-2018  macallan experimental code to talk to the PMU found in Tadpole Viper laptops
 1.2.6.2 10-Jun-2019  christos Sync with HEAD
 1.2.6.1 13-Oct-2018  christos file tadpmuvar.h was added on branch phil-wifi on 2019-06-10 22:06:47 +0000
 1.2.2.2 20-Oct-2018  pgoyette Sync with head
 1.2.2.1 13-Oct-2018  pgoyette file tadpmuvar.h was added on branch pgoyette-compat on 2018-10-20 06:58:29 +0000
 1.6 23-Aug-2000  pk This driver is now in sys/dev/sbus.
 1.5 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.3 23-May-1999  eeh branches: 1.3.2; 1.3.12;
Start putting in hooks for non-zs console devices.
 1.2 05-Sep-1998  pk branches: 1.2.8;
#include <dev/sbus/sbusvar.h>
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.3.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 23-Aug-2000  pk This driver is now in sys/dev/sbus.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.14 31-Oct-2020  jdc Call sysmon_envsys_unregister() not sysmon_envsys_destroy() when
detaching. Pointed out by Michael van Elst.
 1.13 01-Mar-2019  mrg make the conversion from degC to uK a macro instead of open
coding it 4 places.
 1.12 16-Jun-2018  thorpej branches: 1.12.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.11 07-Jul-2016  msaitoh branches: 1.11.16;
KNF. Remove extra spaces. No functional change.
 1.10 27-Apr-2015  martin Print error codes from sysmon
 1.9 26-Oct-2013  jdc branches: 1.9.6;
Use machine_model from autoconf.c, instead of calling the firmware here.
 1.8 03-Feb-2013  jdc branches: 1.8.2;
Add a detach function and use this when shutting down:
halt the fan speed callout
set the speed of both fans to maximum

Also avoids occasional panics in shutdown because the callout is not stopped.
 1.7 02-Feb-2013  jdc Add sysmon support to display the fan-speed related values for the CPU and
system fans.
Fix a bug where the system fan was always set to full speed (63), which was
noticed when viewing the values reported by `envstat`.
 1.6 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.5 18-Mar-2012  mrg branches: 1.5.2;
add missing __KERNEL_RCSID().
 1.4 03-Apr-2011  jdc branches: 1.4.4; 1.4.8; 1.4.10;
Return early if we are called from indirect attach (i.e., not the normal
case).
 1.3 11-Mar-2010  mrg branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8;
various aprint_* fixes.
 1.2 01-Mar-2010  martin Fix printf formats (for 32bit compiles)
 1.1 28-Feb-2010  martin Remove the envctrl driver, it is superseeded by the more general pcfiic @
ebus. Add the SB1000/SB2000 fan controll driver (tda). From OpenBSD.
Move config files over to direct configuration of i2c devices.
 1.3.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.3.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.6.1 11-Mar-2010  uebayasi file tda.c was added on branch uebayasi-xip on 2010-04-30 14:39:51 +0000
 1.3.4.1 21-Apr-2011  rmind sync with head
 1.3.2.3 11-Aug-2010  yamt sync with head.
 1.3.2.2 11-Mar-2010  yamt sync with head
 1.3.2.1 11-Mar-2010  yamt file tda.c was added on branch yamt-nfs-mp on 2010-03-11 15:03:00 +0000
 1.4.10.1 13-Jun-2013  msaitoh Pull up following revision(s) (requested by jdp in ticket #893):
sys/arch/sparc64/dev/tda.c 1.7-1.8
share/man/man4/man4.sparc64/tda.4 1.1-1.3
share/man/man4/man4.sparc64/Makefile 1.7
distrib/sets/lists/man/mi 1.1419
Add sysmon support to display the CPU and Sytem fan speeds for the
tda driver. Add a manual page for tda(4). Fix a bug which caused
the system fan to always run at full speed.
 1.4.8.1 05-Apr-2012  mrg sync to latest -current.
 1.4.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.4.4.2 30-Oct-2012  yamt sync with head
 1.4.4.1 17-Apr-2012  yamt sync with head
 1.5.2.4 03-Dec-2017  jdolecek update from HEAD
 1.5.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.2.2 25-Feb-2013  tls resync with head
 1.5.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.8.2.1 18-May-2014  rmind sync with head
 1.9.6.2 09-Jul-2016  skrll Sync with HEAD
 1.9.6.1 06-Jun-2015  skrll Sync with HEAD
 1.11.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.12.2.1 10-Jun-2019  christos Sync with HEAD
 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 04-Jan-2021  thorpej branches: 1.20.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.19 10-Nov-2019  chs branches: 1.19.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.18 18-Mar-2012  mrg branches: 1.18.40;
add missing __KERNEL_RCSID().
 1.17 01-Jul-2011  dyoung branches: 1.17.2; 1.17.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.16 03-Jun-2011  christos CFATTACH_DECL_NEW
 1.15 12-Jan-2010  martin branches: 1.15.4; 1.15.6; 1.15.10;
Import support for upa64s device (/upa on SB1000/2000) from OpenBSD.
Attach ffb both at mainbus and at upa.
 1.14 20-Oct-2002  martin branches: 1.14.66;
We are not going to get a "upa at mainbus" autoconfig entity, since
UPA is just a physical incarnation of our mainbus0.

Evidence:

- There can only be one!
- The firmware node coresponding to it is the root of the OF tree

So: remove the unused (and uncompilable) upa.c, remove upavar.h after
moving the only declaration used from it to autoconf.h.
 1.13 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.12 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.11 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10 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.9 16-May-2002  wiz #ifdef 1 -> #if 1
 1.8 26-Sep-2001  eeh branches: 1.8.4; 1.8.12;
getprop* -> PROM_getprop*
 1.7 29-Jun-2000  mrg branches: 1.7.2; 1.7.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 14-Jan-2000  pk Remove old-style boot device recognition.
 1.5 07-Jun-1999  eeh branches: 1.5.2;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.4 05-Sep-1998  eeh branches: 1.4.8;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.3 05-Sep-1998  pk Nuke temporary `getpropA()'.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.4.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.8.12.1 30-May-2002  gehenna Catch up with -current.
 1.8.4.4 11-Nov-2002  nathanw Catch up to -current
 1.8.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.8.4.2 20-Jun-2002  nathanw Catch up to -current.
 1.8.4.1 26-Sep-2001  nathanw file upa.c was added on branch nathanw_sa on 2002-06-20 03:41:23 +0000
 1.14.66.1 11-Mar-2010  yamt sync with head
 1.15.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.15.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.4.1 12-Jun-2011  rmind sync with head
 1.17.6.1 05-Apr-2012  mrg sync to latest -current.
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.18.40.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.19.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.20.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.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.3 20-Oct-2002  martin We are not going to get a "upa at mainbus" autoconfig entity, since
UPA is just a physical incarnation of our mainbus0.

Evidence:

- There can only be one!
- The firmware node coresponding to it is the root of the OF tree

So: remove the unused (and uncompilable) upa.c, remove upavar.h after
moving the only declaration used from it to autoconf.h.
 1.2 14-Jan-2000  pk branches: 1.2.12;
Remove old-style boot device recognition.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.12.1 11-Nov-2002  nathanw Catch up to -current
 1.9 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.8 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.7 10-May-2021  thorpej branches: 1.7.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.6 24-Apr-2021  thorpej branches: 1.6.2; 1.6.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.5 04-Jan-2021  thorpej branches: 1.5.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.4 10-Nov-2019  chs branches: 1.4.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.3 17-Feb-2017  palle branches: 1.3.12; 1.3.16;
sun4v: Fix potential memory leaks - spotted by maxv@
 1.2 21-Jun-2016  palle branches: 1.2.2; 1.2.4; 1.2.6;
sun4v: vbus_attach() bugfix - use device_private()
 1.1 17-Jun-2016  palle sun4v: vbus and vrtc drivers - from OpenBSD
 1.2.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.2.4.1 20-Mar-2017  pgoyette Sync with HEAD
 1.2.2.3 28-Aug-2017  skrll Sync with HEAD
 1.2.2.2 09-Jul-2016  skrll Sync with HEAD
 1.2.2.1 21-Jun-2016  skrll file vbus.c was added on branch nick-nhusb on 2016-07-09 20:24:57 +0000
 1.3.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.12.2 03-Dec-2017  jdolecek update from HEAD
 1.3.12.1 17-Feb-2017  jdolecek file vbus.c was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.4.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.5.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.6.4.1 31-May-2021  cjep sync with head
 1.6.2.1 13-May-2021  thorpej Sync with HEAD.
 1.7.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.1 17-Jun-2016  palle branches: 1.1.2; 1.1.18;
sun4v: vbus and vrtc drivers - from OpenBSD
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 17-Jun-2016  jdolecek file vbusvar.h was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.1.2.2 09-Jul-2016  skrll Sync with HEAD
 1.1.2.1 17-Jun-2016  skrll file vbusvar.h was added on branch nick-nhusb on 2016-07-09 20:24:57 +0000
 1.21 26-Jul-2025  palle sun4v: minor updates to please cd(4) so no warning are emitted
 1.20 08-Jul-2025  palle vdsk: ignore commands not implemented yet
 1.19 23-Feb-2025  palle sun4v: Ensure that the ldc map table entries are properly cleared. It has been observed that the inner while loop in vdsk_submit_cmd() may encounter stale entries resulting in an endless loop
 1.18 20-Jun-2024  palle branches: 1.18.2;
sun4v: change some debug printf() to DPRINTF()
 1.17 20-Jun-2024  palle sun4v: add some DPRINTF() to vdsk
 1.16 19-Jun-2024  palle sun4v: revert two new functions introduced in rev. 1.13 - not necessary yet
 1.15 19-Jun-2024  palle sun4v: fix incorrect string length (product name Virtual CDROM)
 1.14 12-Jun-2024  riastradh arch/sparc64/dev/dsk.c: Nix trailing whitespace.

No functional change intended.
 1.13 10-Jun-2024  palle sun4v: add incomplete implementation of the CD-specific READ_DISCINFO and READ_TRACKINFO - probably needs some more work though...
 1.12 09-Jun-2024  palle sun4v: fix vdsk so an iso image exported by the ldom virtual disk service is correctly detected as a cd device + some whitespace fixes
 1.11 12-Dec-2023  andvar extract capacity variable to make VDSK_DEBUG enabled code build.
 1.10 16-May-2022  palle sun4v/vdsk: add handling of SCSI_REPORT_LUNS
 1.9 04-Dec-2021  andvar fix typos in comments and log messages, mainly in establish(ed).
 1.8 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.7 25-Jun-2021  palle branches: 1.7.2;
sun4v: vdsk - restart the ldc state machine when the ldc endpoint resets the link or a DATA/NACK/DRING_DATA message is received. These changes make the driver more robust. In a ldom with Solaris 11.4 SRU30 as primary domain (T5 host system) frequent resets and NACK messages are observed.
 1.6 24-Apr-2021  thorpej branches: 1.6.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.5 19-Nov-2019  palle branches: 1.5.10;
sun4v: added support for handling of opcode SCSI_MAINTENANCE_IN when using ldom based virtual disk
 1.4 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.3 03-Mar-2017  palle branches: 1.3.12; 1.3.16;
sun4v: Fixed PR 51554 - Avoid unsafe allocation in ldc/vdsk
 1.2 20-Aug-2016  nakayama branches: 1.2.2; 1.2.4; 1.2.6;
Avoid "cast to pointer from integer of different size" warning on
32-bit kernels.
 1.1 19-Aug-2016  palle sun4v: vdsk and ldc drivers - from OpenBSD, but heavily adapted to NetBSD scsipi - access to a virtual disk served from a ldom primary domain now works
 1.2.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.2.4.3 28-Aug-2017  skrll Sync with HEAD
 1.2.4.2 05-Oct-2016  skrll Sync with HEAD
 1.2.4.1 20-Aug-2016  skrll file vdsk.c was added on branch nick-nhusb on 2016-10-05 20:55:36 +0000
 1.2.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.2.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.2.2.1 20-Aug-2016  pgoyette file vdsk.c was added on branch pgoyette-localcount on 2016-09-14 03:04:17 +0000
 1.3.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.12.2 03-Dec-2017  jdolecek update from HEAD
 1.3.12.1 03-Mar-2017  jdolecek file vdsk.c was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.5.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.6.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7.2.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.18.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 19-Aug-2016  palle branches: 1.1.2; 1.1.4; 1.1.18;
sun4v: vdsk and ldc drivers - from OpenBSD, but heavily adapted to NetBSD scsipi - access to a virtual disk served from a ldom primary domain now works
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 19-Aug-2016  jdolecek file viovar.h was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.1.4.2 05-Oct-2016  skrll Sync with HEAD
 1.1.4.1 19-Aug-2016  skrll file viovar.h was added on branch nick-nhusb on 2016-10-05 20:55:36 +0000
 1.1.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.1.2.1 19-Aug-2016  pgoyette file viovar.h was added on branch pgoyette-localcount on 2016-09-14 03:04:17 +0000
 1.10 14-Dec-2023  andvar Use console_debugger() vs Debugger() which allows to avoid #ifdef DDB blocks.

From uwe@
 1.9 13-Dec-2023  andvar Add #ifdef DDB blocks around Debugger(); calls to make kernel build without DDB.
 1.8 13-Dec-2023  andvar Make NBPFILTER build by adopting NetBSD's bpf_mtap() interface and definitions.
Condition is also not needed, since this check is performed inside function.
 1.7 18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.6 11-Feb-2022  riastradh sparc64/vnet(4): device_t/softc split
 1.5 15-Mar-2021  palle branches: 1.5.4;
sun4v: vnet - cleanup of debug code (no functional changes)
 1.4 13-Mar-2021  palle sun4v: vnet - reception and transmission of eternet frames seems to work now (it is possible to ping 8.8.8.8 from inside a sun4v ldom). Still cleanup of debug code to be done.
 1.3 11-Mar-2021  palle sun4v: vnet - reception of ethernet frames seems to work now (WIP and code is still full of debug code)
 1.2 04-Mar-2021  palle sun4v: add vnet driver from openbsd - compiles but probably does not work yet - still WIP (now with NetBSD cvs tag and compiles for 32-bit SUN4U
 1.1 04-Mar-2021  palle sun4v: add vnet driver from openbsd - compiles but probably does not work yet - still WIP
 1.5.4.2 03-Apr-2021  thorpej Sync with HEAD.
 1.5.4.1 15-Mar-2021  thorpej file vnet.c was added on branch thorpej-futex on 2021-04-03 22:28:38 +0000
 1.13 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.12 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.11 10-May-2021  thorpej branches: 1.11.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.10 24-Apr-2021  thorpej branches: 1.10.2; 1.10.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.9 04-Jan-2021  thorpej branches: 1.9.2;
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.8 10-Nov-2019  chs branches: 1.8.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.7 10-May-2016  palle branches: 1.7.16; 1.7.20;
sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.6 27-Nov-2015  joerg Shuffle a bit to avoid empty loop body.
 1.5 09-Sep-2015  palle Fixed console logging when booting with -q
 1.4 08-Sep-2015  palle Improve printout duing autoconfiguration
 1.3 06-Sep-2015  nakayama Use <machine/*.h> instead of <sparc64/*.h> for consistency.
 1.2 03-Sep-2015  palle sun4v: iommu setup seems to work now - device detection is now possible - parts from OpenBSD - ok mrg@, martin@
 1.1 12-Feb-2015  palle branches: 1.1.2;
sun4v: vpci driver - initial (and incomplete) version of virtual PCIe host bridge driver for sun4v systems. Based on the NetBSD pyro driver and OpenBSD vpci driver. Future work will include integrating code from the OpenBSD vpci driver.
 1.1.2.5 29-May-2016  skrll Sync with HEAD
 1.1.2.4 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.3 22-Sep-2015  skrll Sync with HEAD
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 12-Feb-2015  skrll file vpci.c was added on branch nick-nhusb on 2015-04-06 15:18:03 +0000
 1.7.20.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7.16.2 03-Dec-2017  jdolecek update from HEAD
 1.7.16.1 10-May-2016  jdolecek file vpci.c was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.8.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.9.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.10.4.1 31-May-2021  cjep sync with head
 1.10.2.1 13-May-2021  thorpej Sync with HEAD.
 1.11.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.1 12-Feb-2015  palle branches: 1.1.2; 1.1.18;
sun4v: vpci driver - initial (and incomplete) version of virtual PCIe host bridge driver for sun4v systems. Based on the NetBSD pyro driver and OpenBSD vpci driver. Future work will include integrating code from the OpenBSD vpci driver.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 12-Feb-2015  jdolecek file vpcivar.h was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 12-Feb-2015  skrll file vpcivar.h was added on branch nick-nhusb on 2015-04-06 15:18:03 +0000
 1.5 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.4 07-Sep-2025  thorpej Keep the TODR handle in vrtc_softc.
 1.3 04-Jan-2021  thorpej malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.2 10-Nov-2019  chs branches: 1.2.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.1 17-Jun-2016  palle branches: 1.1.2; 1.1.18; 1.1.22;
sun4v: vbus and vrtc drivers - from OpenBSD
 1.1.22.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 17-Jun-2016  jdolecek file vrtc.c was added on branch tls-maxphys on 2017-12-03 11:36:44 +0000
 1.1.2.2 09-Jul-2016  skrll Sync with HEAD
 1.1.2.1 17-Jun-2016  skrll file vrtc.c was added on branch nick-nhusb on 2016-07-09 20:24:57 +0000
 1.2.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1 11-May-2020  jdc Add an ebus frontend for the Winbond W83l518D SD card reader as found on
Tadpole SPARCLE latops.
 1.4 05-Sep-1998  pk Remove unused files.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 20-Jun-1998  mrg branches: 1.2.2;
moved <machine/sun_disklabel.h> to <dev/sun/disklabel.h>
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4 05-Sep-1998  pk Remove unused files.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 20-Jun-1998  mrg branches: 1.2.2;
moved <machine/sun_disklabel.h> to <dev/sun/disklabel.h>
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.81 12-Dec-2023  andvar remove TTY_DEBUG code from sun2/sparc64 zs.c code. it doesn't look relevant
to this particular drivers and likely is a leftover from some historical code.
 1.80 26-Oct-2022  riastradh sparc64/zs(4): Convert to ttylock/ttyunlock.
 1.79 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.78 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.77 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.76 24-Apr-2021  thorpej branches: 1.76.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.75 30-Oct-2015  tsutsui branches: 1.75.32;
Add a missing newline in zs at sbus attach message.
 1.74 27-Oct-2012  chs branches: 1.74.12; 1.74.14; 1.74.16;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.73 12-Aug-2011  jdc branches: 1.73.2; 1.73.12;
Use aprint_normal(). From apb@.
 1.72 12-Aug-2011  jdc Add missing new line to zs_attach_fhc()
 1.71 29-Jul-2011  mrg port the openbsd central and fhc drivers, and the clock/zs attachments.
doesn't quite work yet, crashes when central_attach() calls
config_attach() (faulting address is 0xf8000000.)
 1.70 12-Mar-2011  nakayama Remove implicit include <dev/sbus/sbusvar.h> from autoconf.h, and
add it explicitly in files depending on it.
 1.69 26-Oct-2009  martin branches: 1.69.4; 1.69.6;
g/c zssoftpending
 1.68 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.67 13-Jun-2008  cegger branches: 1.67.6;
use device_lookup_private to get softc
 1.66 28-Apr-2008  martin branches: 1.66.2; 1.66.4;
Remove clause 3 and 4 from TNF licenses
 1.65 29-Mar-2008  tsutsui branches: 1.65.2; 1.65.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.64 28-Nov-2007  ad branches: 1.64.14;
Use the softint API.
 1.63 09-Nov-2007  ad Call zs_lock_init() to set up the chanstate's lock.
 1.62 16-Oct-2006  martin branches: 1.62.8; 1.62.26; 1.62.28; 1.62.32; 1.62.34;
Initializers
 1.61 18-Aug-2006  martin branches: 1.61.2; 1.61.4;
Fix wrong prom_getoption() return value checks
 1.60 28-Mar-2006  thorpej branches: 1.60.6;
Use device_is_a().
 1.59 28-Mar-2006  thorpej Use device_unit().
 1.58 13-Feb-2006  cdi branches: 1.58.2; 1.58.4; 1.58.6;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.57 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.56 11-Dec-2005  christos branches: 1.56.2; 1.56.4; 1.56.6;
merge ktrace-lwp.
 1.55 19-Jul-2005  macallan use zstty_get_tty_from_dev() instead of using a zstty_softc lookalike hack,
same as in sparc/dev/zs.c
 1.54 21-Mar-2004  pk branches: 1.54.14; 1.54.16;
Use the promlib I/O routines.
 1.53 19-Mar-2004  pk zs_console_flags: use prom_getoption().
 1.52 19-Mar-2004  pk Drop fbnode & stdinnode.
 1.51 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.50 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.49 09-Nov-2003  martin Nuke bcopy/bzero.
 1.48 31-Oct-2003  petrov Attach zs to sbus only, current driver cannot attach to mainbus.
 1.47 15-Jul-2003  lukem __KERNEL_RCSID()
 1.46 28-Jan-2003  pk branches: 1.46.2;
Provide locking required by the interrupt handlers running at IPL_SERIAL.
 1.45 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.44 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.43 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.42 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.41 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.40 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.39 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.38 26-Sep-2002  thorpej Compare driver name, don't check against zstty_cd.
 1.37 21-Sep-2002  petrov Use /options instead of /chosen to find out where console is.
(found by Rafal Boni).
 1.36 12-Sep-2002  abs Protect extern zstty_cd with (NKBD > 0) || (NMS > 0)
 1.35 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.34 21-Mar-2002  eeh branches: 1.34.4; 1.34.6;
Add missing semicolon.
 1.33 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.32 14-Mar-2002  eeh sbus_bus_map() no longer has a preferred vaddr parameter.
 1.31 05-Oct-2001  eeh branches: 1.31.4;
Remove bsd_openprom.h, which is only for compatibility with the sparc port.
 1.30 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.29 30-May-2001  lukem branches: 1.29.2; 1.29.4;
add missing #include "opt_kgdb.h"
 1.28 03-Dec-2000  fvdl branches: 1.28.2;
Make softintr_establish prototype match other ports, avoiding compile
warnings.
 1.27 10-Nov-2000  mrg remove unused variable
 1.26 09-Nov-2000  eeh Attach the sunkbd line discipline to zstty.
 1.25 10-Jul-2000  eeh Function signature for bus_intr_establish() changed.
 1.24 09-Jul-2000  eeh Upgrate interrupt handling:

1) use interrupt vectors for specific zs chips rather than polling
all of them.

2) use softintr_schedule() and schedule it for a particular device
rather than poll all devices.
 1.23 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.22 24-Jun-2000  eeh Get rid of vaddrs.h.
 1.21 04-Jun-2000  cgd branches: 1.21.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.20 19-May-2000  eeh branches: 1.20.2;
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.19 17-May-2000  mrg move zs_attach() to after the setting of the console device, to avoid
having cn_dev being 0 and thus cnopen() being called recursively. this
fixes this problem for zs-based console's only.
 1.18 13-Apr-2000  mrg this does not need auxreg.h
 1.17 10-Apr-2000  pk Get a kernel without DDB to build.
 1.16 08-Apr-2000  mrg include <ddb/db_output.h> to get the db_printf() prototype.
 1.15 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.14 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.13 11-Oct-1999  eeh branches: 1.13.2;
Update to post 1.4.
 1.12 23-May-1999  eeh branches: 1.12.2;
Start putting in hooks for non-zs console devices.
 1.11 25-Apr-1999  eeh Defer final console attach to zs_attach().
 1.10 24-Apr-1999  eeh Deprecate `findzs()' and try to map in the zs registers if they're not mapped
by the prom.
 1.9 27-Mar-1999  wrstuden branches: 1.9.4;
Add pps support. Only enable pps if CLOCAL & !MDMBUF.
 1.8 28-Feb-1999  eeh Let's try to make prom_cnget() work.
 1.7 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.6 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.5 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 04-Jul-1998  jonathan branches: 1.2.2;
defopt DDB.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.13.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.20.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.21.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.28.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.29.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.29.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.29.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.29.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.29.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.29.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.31.4.6 03-Jan-2003  thorpej Sync with HEAD.
 1.31.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.31.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.31.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.31.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.31.4.1 05-Oct-2001  nathanw file zs.c was added on branch nathanw_sa on 2002-04-01 07:43:07 +0000
 1.34.6.1 07-Dec-2002  he Pull up revision 1.36 (requested by abs in ticket #890):
Allow sparc64 kernels to be compiled without kbd.
 1.34.4.1 19-May-2002  gehenna Remove hard-coded major.
 1.46.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.46.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.46.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.46.2.1 03-Aug-2004  skrll Sync with HEAD
 1.54.16.4 07-Dec-2007  yamt sync with head
 1.54.16.3 15-Nov-2007  yamt sync with head.
 1.54.16.2 30-Dec-2006  yamt sync with head.
 1.54.16.1 21-Jun-2006  yamt sync with head.
 1.54.14.1 12-Sep-2006  ghen Pull up following revision(s) (requested by martin in ticket #1507):
sys/arch/sparc64/dev/zs.c: revision 1.61
sys/arch/sparc64/dev/ffb.c: revision 1.28
Fix wrong prom_getoption() return value checks
 1.56.6.1 22-Apr-2006  simonb Sync with head.
 1.56.4.1 09-Sep-2006  rpaulo sync with head
 1.56.2.1 18-Feb-2006  yamt sync with head.
 1.58.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.58.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.58.2.2 03-Sep-2006  yamt sync with head.
 1.58.2.1 01-Apr-2006  yamt sync with head.
 1.60.6.1 21-Aug-2006  tron Pull up following revision(s) (requested by martin in ticket #34):
sys/arch/sparc64/dev/zs.c: revision 1.61
sys/arch/sparc64/dev/ffb.c: revision 1.28
Fix wrong prom_getoption() return value checks
 1.61.4.1 22-Oct-2006  yamt sync with head
 1.61.2.1 18-Nov-2006  ad Sync with head.
 1.62.34.2 08-Dec-2007  mjf Sync with HEAD.
 1.62.34.1 19-Nov-2007  mjf Sync with HEAD.
 1.62.32.1 13-Nov-2007  bouyer Sync with HEAD
 1.62.28.1 09-Jan-2008  matt sync with HEAD
 1.62.26.2 03-Dec-2007  joerg Sync with HEAD.
 1.62.26.1 11-Nov-2007  joerg Sync with HEAD.
 1.62.8.1 03-Dec-2007  ad Sync with HEAD.
 1.64.14.3 29-Jun-2008  mjf Sync with HEAD.
 1.64.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.64.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.65.4.4 11-Mar-2010  yamt sync with head
 1.65.4.3 20-Jun-2009  yamt sync with head
 1.65.4.2 04-May-2009  yamt sync with head.
 1.65.4.1 16-May-2008  yamt sync with head.
 1.65.2.2 17-Jun-2008  yamt sync with head.
 1.65.2.1 18-May-2008  yamt sync with head.
 1.66.4.1 18-Jun-2008  simonb Sync with head.
 1.66.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.67.6.1 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.69.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.69.4.1 21-Apr-2011  rmind sync with head
 1.73.12.2 03-Dec-2017  jdolecek update from HEAD
 1.73.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.73.2.1 30-Oct-2012  yamt sync with head
 1.74.16.1 26-Dec-2015  snj Pull up following revision(s) (requested by tsutsui in ticket #1050):
sys/arch/sparc64/dev/zs.c: revision 1.75
Add a missing newline in zs at sbus attach message.
 1.74.14.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.74.12.1 26-Dec-2015  snj Pull up following revision(s) (requested by tsutsui in ticket #1050):
sys/arch/sparc64/dev/zs.c: revision 1.75
Add a missing newline in zs at sbus attach message.
 1.75.32.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.76.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.7 17-Jan-2022  andvar fix typos in comments, mainly s/foward/forward/.
 1.6 29-Mar-2008  tsutsui Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.5 04-Mar-2007  christos branches: 1.5.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 11-Dec-2005  christos branches: 1.4.26;
merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 09-Jul-2000  eeh branches: 1.2.24;
Shuffle around some fields to waste less space on LP64.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.24;
Import of sparc64.
 1.1.1.1.24.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.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.3.16.1 03-Sep-2007  yamt sync with head.
 1.4.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.5.40.1 03-Apr-2008  mjf Sync with HEAD.
 1.1 31-Jan-2020  macallan branches: 1.1.2; 1.1.6;
document what I found out about the v210's i2c GPIOs.
 1.1.6.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.6.1 31-Jan-2020  martin file SunFire_v210.txt was added on branch phil-wifi on 2020-04-08 14:07:54 +0000
 1.1.2.2 29-Feb-2020  ad Sync with head.
 1.1.2.1 31-Jan-2020  ad file SunFire_v210.txt was added on branch ad-namecache on 2020-02-29 20:18:31 +0000
 1.49 07-Sep-2025  andvar Fix various typos, mainly in comments.
 1.48 12-Dec-2023  andvar s/maked/marked/
 1.47 15-Jan-2022  palle sun4v: update TODO with T2000 device configuration state
 1.46 05-Jan-2022  andvar fix typos, mainly s/comand/command/
 1.45 23-Sep-2021  palle sun4v: update TODO with current status when running on a T5-based system
 1.44 05-Jul-2021  palle sun4v: update status on S7 systems
 1.43 25-Jun-2021  palle sun4v: update TODO file with current sun4v progress
 1.42 13-Jun-2021  palle sun4v: update TODO file with current sun4v state
 1.41 03-Apr-2021  palle branches: 1.41.2;
update TODO after cpu_idle() has been improved (sun4v only for now)
 1.40 30-Mar-2021  palle sun4v: update TODO after pcb spill improvements and status when running on a S7 host
 1.39 23-Mar-2021  palle sun4v: update TODO with findings related to crashes in user processes (pcbspill)
 1.38 16-Mar-2021  palle branches: 1.38.2;
sun4v: update TODO - update status after hacking on ldom virtual network interfaces
 1.37 04-Mar-2021  palle sun4v: update TODO - removed leftover OpenFirmware interface comment and add comment on idle handling
 1.36 27-Feb-2021  palle sun4v: update TODO file with OpenFirmware interface related improvements
 1.35 27-Feb-2021  palle sun4v: update TODO file with status on sun4v - kernel and userland runs without crashing now - next up is network interfaces
 1.34 22-Feb-2021  palle sun4v: update current status of sun4v
 1.33 14-Feb-2021  palle sun4v: update TODO with status of verified systems(T2000, T5 and qemu)
 1.32 31-Jan-2021  palle sun4v: update TODO with analysis of sun4v crashes
 1.31 04-Jan-2021  skrll Trailing whitespace
 1.30 04-Jan-2021  skrll Spell interrupts correctly
 1.29 08-Feb-2019  palle branches: 1.29.12;
sun4v: update the TODO file noting (at least) some progess with sun4v
 1.28 17-Dec-2018  palle sun4v: note what causes the kernel to crash
 1.27 05-Oct-2018  palle sun4v: update TODO with proper path to sh + list tested platforms so far
 1.26 11-Apr-2018  palle branches: 1.26.2;
sun4v: Update TODO file with current state of sun4v support
 1.25 03-Feb-2018  palle branches: 1.25.2;
sun4v: Update TODO with a detailed description of why the kernel crashes when running on sun4v systems.
 1.24 19-Feb-2017  palle sun4v: Update TODO with the status of the sun4v work so far
 1.23 19-Feb-2017  palle sun4v: Note that the code recently added to locore.s rft_user may not be enough to make things work properly
 1.22 19-Feb-2017  palle sun4v: Note that prom_getprop() leaks memory in vbus.c
 1.21 05-Feb-2017  palle sun4v: update TODO list to reflect the current state - TRAP_SETUP() was adapted to handle both sun4u and sun4v systems in version 1.404 of locore.s
 1.20 19-Aug-2016  palle branches: 1.20.2;
sun4v: vdsk and ldc drivers - from OpenBSD, but heavily adapted to NetBSD scsipi - access to a virtual disk served from a ldom primary domain now works
 1.19 17-Jun-2016  palle branches: 1.19.2;
Update sparc64 TODO: sun4u specfic code in TRAP_SETUP() + make a note about importing the man pages for the sun4v specific drivers
 1.18 04-Jun-2016  palle Update TODO: note that TRAP_SETUP() is stil sun4u-specific
 1.17 17-May-2016  palle Update TODO: sun4v_datatrap handling for trap level 0 is working
 1.16 10-May-2016  palle Update TODO: sun4v interrupts works (mostly) + note issue with mpt(4) on sun4v systems
 1.15 01-May-2016  palle Update TODO: booting from a ISO image on a sun4v system works
 1.14 17-Apr-2016  palle Update sparc64 TODO file: note issue with interrupt handling + issue when booting from iso image
 1.13 06-Sep-2015  palle Update sparc64 TODO list: pmap_calculate_colors() is now working on sun4v planforms (fixed by martin@)
 1.12 05-Sep-2015  palle Note that the FIXMEs in vpci.c/vpcivar.h should be cleaned up
 1.11 07-May-2015  palle sun4v: disable MP suport for now in cpu_boot_secondary_processors() - this will allow the kernel to start probing for devices with the primary cpu as the only active cpu
 1.10 11-Feb-2015  palle Updated todo list with item about v445 and GENERIC.UP kernel that hangs
 1.9 24-Jan-2015  palle Cache info is now printed during bootstrap on the sun4v platform. Make the sun4u centric cache info code in cpu_attach() a bit more general
 1.8 05-Jan-2015  palle Add reminder to change run-time cpu type checks
 1.7 04-Sep-2014  palle branches: 1.7.2;
sun4v: update TODO list
 1.6 27-Jul-2014  palle branches: 1.6.4;
sun4v: Update TODO list with relevant sun4v stuff
 1.5 30-Jun-2014  palle sun4v: The maximum number of register windows is a constant and thus not available via the %ver register (sun4u only). Introduce a macro GET_MAXCWP that handles this, so cpu_switchto() works properly on sun4v. Other relevant reference to %ver can be adapted to use GET_MAXCWP as the sun4v port progresses. OK martin@
 1.4 05-Jun-2014  palle sun4v: note missing handling in cpu_match()
 1.3 31-May-2014  palle Updated TODO with relevant things to fix on sun4v
 1.2 21-Feb-2014  palle branches: 1.2.2; 1.2.4; 1.2.6;
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.1 25-Jan-2014  palle Add a TODO file to document things to be done for the sparc64 port
 1.2.6.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.6.1 21-Feb-2014  yamt file TODO was added on branch yamt-pagecache on 2014-05-22 11:40:09 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 21-Feb-2014  rmind file TODO was added on branch rmind-smpnet on 2014-05-18 17:45:26 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.6.4.3 03-Dec-2017  jdolecek update from HEAD
 1.6.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.4.1 27-Jul-2014  tls file TODO was added on branch tls-maxphys on 2014-08-20 00:03:25 +0000
 1.7.2.8 28-Aug-2017  skrll Sync with HEAD
 1.7.2.7 05-Oct-2016  skrll Sync with HEAD
 1.7.2.6 09-Jul-2016  skrll Sync with HEAD
 1.7.2.5 29-May-2016  skrll Sync with HEAD
 1.7.2.4 22-Apr-2016  skrll Sync with HEAD
 1.7.2.3 22-Sep-2015  skrll Sync with HEAD
 1.7.2.2 06-Jun-2015  skrll Sync with HEAD
 1.7.2.1 06-Apr-2015  skrll Sync with HEAD
 1.19.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.20.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.25.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.25.2.2 20-Oct-2018  pgoyette Sync with head
 1.25.2.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.26.2.1 10-Jun-2019  christos Sync with HEAD
 1.29.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.38.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.41.2.2 01-Aug-2021  thorpej Sync with HEAD.
 1.41.2.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.34 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.33 19-Dec-2018  maxv branches: 1.33.36;
Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.32 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.31 29-Mar-2018  joerg branches: 1.31.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.30 23-Jul-2014  alnsn branches: 1.30.26;
Rename sljitarch.h to sljit_machdep.h.
 1.29 01-Feb-2014  nakayama branches: 1.29.2;
Make sljit usable on sparc64 32-bit kernels.
 1.28 17-Jul-2011  joerg branches: 1.28.2; 1.28.12; 1.28.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.27 09-Jul-2011  dyoung Don't install sparc64/bus.h any more.
 1.26 13-Apr-2011  mrg install <machine/intr.h> for crash(8).

(we could avoid this, but it would require a lot of contortions that
make the header files ugly. maybe someone else can figure out a less
ugly way of doing this later.)
 1.25 31-Jan-2011  christos fenv support for sparc64 from Stathis Kamperis
 1.24 09-Feb-2007  ad branches: 1.24.70; 1.24.76; 1.24.78;
Merge newlock2 to head.
 1.23 26-Jul-2006  drochner branches: 1.23.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.22 11-Dec-2005  christos branches: 1.22.4; 1.22.8;
merge ktrace-lwp.
 1.21 07-Jul-2004  drochner branches: 1.21.12;
also add <machine/joystick.h> to alpha and amd64, to allow compilation
of certain multimedia applications
 1.20 08-May-2004  kleink Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.19 26-Aug-2003  uwe Drop fbvar.h from INCS now that it's been cvs rm'ed here.
 1.18 18-Jan-2003  thorpej branches: 1.18.2;
Merge the nathanw_sa branch.
 1.17 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.16 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.15 07-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.14 19-Sep-2001  thorpej branches: 1.14.4; 1.14.8; 1.14.12;
Use <dev/sun/fbio.h>, not our own copy.
 1.13 15-Apr-2001  kleink branches: 1.13.2; 1.13.4;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.12 15-Apr-2001  kleink Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.11 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.10 14-Apr-2001  kleink Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.9 16-Aug-2000  mrg branches: 1.9.2;
backout previous; unintentional.
 1.8 16-Aug-2000  mrg include the sparc loadfile_machdep.h as-is; we can blow this header away
completely later.
 1.7 26-Jun-2000  kleink Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.6 29-Apr-2000  thorpej Oops, install <machine/lock.h> on these systems, too.
 1.5 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.4 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 27-Nov-1999  mrg these files were removed years ago (exec.h was not even installed).
 1.2 15-Jan-1999  bouyer branches: 1.2.8; 1.2.14;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1 15-Aug-1998  eeh Add a makefile.
 1.2.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.8.2 21-Apr-2001  bouyer Sync with HEAD
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.13.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.13.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.13.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.13.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.12.2 31-Aug-2002  gehenna catch up with -current.
 1.14.12.1 19-May-2002  gehenna Remove port-dependent conf.h.
 1.14.8.1 19-Mar-2002  thorpej First draft of mutex and rwlock implementation for sparc64.
 1.14.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.14.4.4 17-Sep-2002  nathanw Catch up to -current.
 1.14.4.3 13-Aug-2002  nathanw Catch up to -current.
 1.14.4.2 17-Nov-2001  martin Sparc64 *context routines, from Klaus Klein.
 1.14.4.1 19-Sep-2001  martin file Makefile was added on branch nathanw_sa on 2001-11-17 12:24:20 +0000
 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.12.2 26-Feb-2007  yamt sync with head.
 1.21.12.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.4.1 01-Feb-2007  ad Header file cleanup.
 1.24.78.1 08-Feb-2011  bouyer Sync with HEAD
 1.24.76.1 06-Jun-2011  jruoho Sync with HEAD.
 1.24.70.2 21-Apr-2011  rmind sync with head
 1.24.70.1 05-Mar-2011  rmind sync with head
 1.28.16.1 18-May-2014  rmind sync with head
 1.28.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 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.29.2.1 10-Aug-2014  tls Rebase.
 1.30.26.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.30.26.2 28-Jul-2018  pgoyette Sync with HEAD
 1.30.26.1 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.31.2.1 10-Jun-2019  christos Sync with HEAD
 1.33.36.1 02-Aug-2025  perseant Sync with HEAD
 1.19 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.18 17-Jun-2015  martin branches: 1.18.18;
Make clock_t unsigned
 1.17 17-Jul-2011  joerg branches: 1.17.12; 1.17.28; 1.17.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.16 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.15 11-Jan-2009  christos branches: 1.15.4; 1.15.6;
merge christos-time_t
 1.14 17-Oct-2007  garbled branches: 1.14.16; 1.14.18; 1.14.22; 1.14.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.13 03-Sep-2007  drochner clean up some definitions around rune_t which are not needed anymore
 1.12 04-Oct-2006  tnozaki branches: 1.12.8; 1.12.16; 1.12.22; 1.12.26; 1.12.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.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 20-Apr-2005  matt branches: 1.10.2;
For GCC3 and later, use the __builtin_va* constructs.
 1.9 07-Aug-2003  agc branches: 1.9.8; 1.9.14; 1.9.18;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 02-Mar-2003  tshiozak branches: 1.8.2;
add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.7 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.6 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.5 21-Dec-2000  itojun populate _BSD_MBSTATE_T_. add warning regarding to rune_t.
 1.4 27-Jun-2000  kleink G/c _BSD_INTPTR_T_ and _BSD_UINTPTR_T_.
 1.3 31-Jul-1998  ross branches: 1.3.12; 1.3.20;
Following discussions with eeh and mrg, change most of these types so
that they should make an ILP32 setup with an ILP32 compiler and an LP64
setup if run through an LP64 compiler. None of the data sizes actually
change right now, and any type errors that show up would have to be fixed
eventually anyway.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.3.20.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.3.12.2 05-Jan-2001  bouyer Sync with HEAD
 1.3.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.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.9.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.9.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.9.8.1 29-Apr-2005  kent sync with -current
 1.10.2.2 27-Oct-2007  yamt sync with head.
 1.10.2.1 30-Dec-2006  yamt sync with head.
 1.11.22.1 22-Oct-2006  yamt sync with head
 1.11.20.1 18-Nov-2006  ad Sync with head.
 1.12.28.1 06-Nov-2007  matt sync with HEAD
 1.12.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.12.22.1 10-Sep-2007  skrll Sync with HEAD.
 1.12.16.1 03-Oct-2007  garbled Sync with HEAD
 1.12.8.1 09-Oct-2007  ad Sync with head.
 1.14.30.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.22.2 11-Aug-2010  yamt sync with head.
 1.14.22.1 04-May-2009  yamt sync with head.
 1.14.18.2 30-Mar-2008  christos time_t is now __int64_t
 1.14.18.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.14.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.15.6.1 30-May-2010  rmind sync with head
 1.15.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.30.1 22-Sep-2015  skrll Sync with HEAD
 1.17.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.17.12.1 03-Dec-2017  jdolecek update from HEAD
 1.18.18.1 10-Jun-2019  christos Sync with HEAD
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.22 17-Oct-2015  nakayama Move LP64 and ILP32 conversion macros COMBINE, SPLIT from locore.h
to asm.h, and provide SPLIT_RETL for the case SPLIT and then retl
immediately.
 1.21 28-Apr-2013  nakayama branches: 1.21.12;
Use macros in machine/asm.h instead of locally defined, and
introduce CASPTRA for casxa/casa.
 1.20 16-Mar-2013  christos move the useful macros somewhere where they can be used in userland.
 1.19 20-Jul-2002  mrg branches: 1.19.146; 1.19.156;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.18 24-Jun-2002  thorpej Add ENTRY_NOPROFILE().
 1.17 14-Jan-2002  eeh branches: 1.17.8;
Use a more efficient PIC_PROLOG().
 1.16 03-Nov-2001  thorpej branches: 1.16.2;
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.15 02-Aug-2000  eeh branches: 1.15.4; 1.15.6;
Get kernel profiling to work. Now if only gprof worked....
 1.14 01-Aug-2000  eeh Pull in <machine/frame.h> to define BIAS and CC64FSZ.
 1.13 23-Jul-2000  eeh Include <machine/frame.h> to get the definition of BIAS and CC64FSZ.
 1.12 18-Jul-2000  eeh Fix PIC bugs.
 1.11 14-Jul-2000  eeh Add support for 64-bit PIC and dynamic linking.
 1.10 23-Jun-2000  kleink Add a WEAK_ALIAS() macro.
 1.9 05-Oct-1999  eeh branches: 1.9.2; 1.9.12;
Add RODATA() macro.
 1.8 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.7 02-Dec-1998  thorpej Argh, fix the ANSI CPP version of the a.out WARN_REFERENCES().
 1.6 02-Dec-1998  thorpej Implement WARN_REFERENCES().
 1.5 06-Oct-1998  eeh Fix PIC code initialization.
 1.4 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.9.12.4 07-Aug-2000  mrg pull up 1.15 (approved by thorpej):
>Get kernel profiling to work. Now if only gprof worked....
 1.9.12.3 07-Aug-2000  mrg pull up 1.14 (approved by thorpej):
>Pull in <machine/frame.h> to define BIAS and CC64FSZ.
 1.9.12.2 26-Jul-2000  mycroft Approved by thorpej:
Enable pulling this into user-level code to get some definitions (e.g. CC64FSZ).

syssrc/sys/arch/sparc64/include/asm.h 1.11 -> 1.13
syssrc/sys/arch/sparc64/include/frame.h 1.6 -> 1.7
 1.9.12.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 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.15.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.15.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.15.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.15.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.2.3 01-Aug-2002  nathanw Catch up to -current.
 1.16.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.16.2.1 03-Nov-2001  nathanw file asm.h was added on branch nathanw_sa on 2002-02-28 04:12:12 +0000
 1.17.8.2 31-Aug-2002  gehenna catch up with -current.
 1.17.8.1 17-Jul-2002  gehenna catch up with -current.
 1.19.156.2 03-Dec-2017  jdolecek update from HEAD
 1.19.156.1 23-Jun-2013  tls resync from head
 1.19.146.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.21.12.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.33 11-Sep-2017  palle sun4v: Update code to retrieve CPU clock frequency so it can handle (future?) CPU clock frequencies above the 32-bit limit. ok mrg@
 1.32 26-Oct-2013  jdc Allow machine_banner and machine_model to be used outside autoconf.c, for
example, by drivers that need to match on model name. Suggested by mrg@.
 1.31 27-Oct-2012  chs branches: 1.31.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.30 01-Jul-2011  dyoung branches: 1.30.2; 1.30.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.29 12-Mar-2011  nakayama Remove implicit include <dev/sbus/sbusvar.h> from autoconf.h, and
add it explicitly in files depending on it.
 1.28 28-Apr-2008  martin branches: 1.28.22; 1.28.28;
Remove clause 3 and 4 from TNF licenses
 1.27 12-Feb-2008  joerg branches: 1.27.6; 1.27.8; 1.27.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.26 26-Sep-2006  martin branches: 1.26.28; 1.26.34;
Rework boot device matching to get rid of lots of special case code
and tables to map fimware names to driver names. Based on a suggestion
from Eduardo (quite some time ago).
Each device (on busses we can handle and care about) gets a device property
storing the devices OpenFirmware package handle. To match the boot device,
the phandle of the chosen bootpath is compared against this property,
plus some additional string matching for disk/cd devices (where OF only
provides a node for the device class, not each instance).
 1.25 20-Feb-2006  cdi branches: 1.25.14; 1.25.16;
Use ANSI-style function definitions and declarations.
 1.24 27-Jan-2006  cdi branches: 1.24.2; 1.24.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.23 11-Dec-2005  christos branches: 1.23.2;
merge ktrace-lwp.
 1.22 31-May-2005  christos branches: 1.22.2;
sprinkle const.
 1.21 21-Mar-2004  pk Switch to the sparc prom library.
 1.20 19-Mar-2004  pk Drop optionsnode, fbnode and stdinnnode.
 1.19 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.18 17-Mar-2004  pk Pass the buffer size to PROM_getpropstringA(), as in sparc.
 1.17 16-Mar-2004  pk For now, implement prom_getoption() in autoconf.c.
 1.16 16-Mar-2004  pk For now, implement prom_getidprom() and prom_getether() in autoconf.c
 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 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 20-Oct-2002  martin branches: 1.13.6;
We are not going to get a "upa at mainbus" autoconfig entity, since
UPA is just a physical incarnation of our mainbus0.

Evidence:

- There can only be one!
- The firmware node coresponding to it is the root of the OF tree

So: remove the unused (and uncompilable) upa.c, remove upavar.h after
moving the only declaration used from it to autoconf.h.
 1.12 05-Oct-2001  pooka branches: 1.12.4;
prototype rominterpret()
 1.11 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.10 24-Jul-2001  eeh branches: 1.10.2;
Garbage collect.
 1.9 14-Jan-2000  pk branches: 1.9.8;
Remove old-style boot device recognition.
 1.8 08-Nov-1999  eeh Fix boot device detection code.
 1.7 18-Mar-1999  eeh branches: 1.7.8; 1.7.10; 1.7.14;
Some devices don't have a `device-type' property we can use to allocate
an IPL. Check for those by name. Give the rest a default IPL of 2.
(Added `SUNW,CS4231' to the list.)
 1.6 06-Oct-1998  thorpej configure() prototype is in <sys/device.h>
 1.5 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 05-Sep-1998  pk Nuke temporary `getpropA()'.
 1.3 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.7.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.10.1 15-Nov-1999  fvdl Sync with -current
 1.7.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.8.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.8.1 03-Aug-2001  lukem update to -current
 1.10.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.10.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.12.4.2 11-Nov-2002  nathanw Catch up to -current
 1.12.4.1 05-Oct-2001  nathanw file autoconf.h was added on branch nathanw_sa on 2002-11-11 22:04:50 +0000
 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.22.2.3 27-Feb-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.23.2.2 01-Mar-2006  yamt sync with head.
 1.23.2.1 01-Feb-2006  yamt sync with head.
 1.24.4.1 22-Apr-2006  simonb Sync with head.
 1.24.2.1 09-Sep-2006  rpaulo sync with head
 1.25.16.1 22-Oct-2006  yamt sync with head
 1.25.14.1 18-Nov-2006  ad Sync with head.
 1.26.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.26.28.1 23-Mar-2008  matt sync with HEAD
 1.27.10.1 16-May-2008  yamt sync with head.
 1.27.8.1 18-May-2008  yamt sync with head.
 1.27.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.28.22.1 21-Apr-2011  rmind sync with head
 1.30.12.3 03-Dec-2017  jdolecek update from HEAD
 1.30.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.30.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.30.2.1 30-Oct-2012  yamt sync with head
 1.31.2.1 18-May-2014  rmind sync with head
 1.9 08-Jan-2019  jdolecek remove explicit <machine/param.h> include, code including this already includes
<sys/param.h>
 1.8 15-Sep-2017  martin branches: 1.8.2; 1.8.4;
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.7 28-May-2012  martin branches: 1.7.2;
Ooops, remove definitions duplicated in <sparc/bootinfo.h>
 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 02-Apr-2010  martin Add a bootinfo node to allow the loader to override the boot device
 1.4 28-Apr-2008  martin branches: 1.4.20; 1.4.22;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Feb-2006  cdi branches: 1.3.68; 1.3.70; 1.3.72;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.2 27-Jan-2006  cdi branches: 1.2.2; 1.2.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.1 20-Jul-2002  mrg branches: 1.1.2; 1.1.4; 1.1.6; 1.1.28; 1.1.40;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1.40.2 18-Feb-2006  yamt sync with head.
 1.1.40.1 01-Feb-2006  yamt sync with head.
 1.1.28.1 21-Jun-2006  yamt sync with head.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 20-Jul-2002  jdolecek file bootinfo.h was added on branch kqueue on 2002-09-06 08:41:32 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 20-Jul-2002  gehenna file bootinfo.h was added on branch gehenna-devsw on 2002-08-31 14:52:30 +0000
 1.1.2.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 20-Jul-2002  nathanw file bootinfo.h was added on branch nathanw_sa on 2002-08-01 02:43:40 +0000
 1.2.4.1 22-Apr-2006  simonb Sync with head.
 1.2.2.1 09-Sep-2006  rpaulo sync with head
 1.3.72.2 11-Aug-2010  yamt sync with head.
 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.22.1 30-May-2010  rmind sync with head
 1.4.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.7.2.1 03-Dec-2017  jdolecek update from HEAD
 1.8.4.1 10-Jun-2019  christos Sync with HEAD
 1.8.2.1 18-Jan-2019  pgoyette Synch with HEAD
 1.2 27-Nov-1999  mrg these files were removed years ago (exec.h was not even installed).
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 21-Mar-2004  pk Reach over to the sparc versions.
 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 23-Aug-2002  thorpej branches: 1.5.6;
Protect against multiple inclusion.
 1.4 23-Aug-2002  thorpej * Refine the comment describing openprom_addr.
* Add openprom_range and openprom_intr structures.
 1.3 04-Dec-2001  darrenr branches: 1.3.8; 1.3.10;
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.2 13-Mar-2000  soren branches: 1.2.8; 1.2.12;
Fix doubled 'the's in comments.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.12.2 27-Aug-2002  nathanw Catch up to -current.
 1.2.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.8.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.10.2 22-Nov-2002  tron Pull up revision 1.5 (requested by martin in ticket #948):
Protect against multiple inclusion.
 1.3.10.1 22-Nov-2002  tron Pull up revision 1.4 (requested by martin in ticket #948):
* Refine the comment describing openprom_addr.
* Add openprom_range and openprom_intr structures.
 1.3.8.1 31-Aug-2002  gehenna catch up with -current.
 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.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.62 17-Jul-2011  dyoung Switch sparc and sparc64 to new-style <sys/bus.h>.
 1.61 04-Dec-2009  nakayama s/u_intN_t/uintN_t/ and whitespace nit. no functional change.
 1.60 04-Dec-2009  nakayama bus_space_handle_t:
- make _asi and _sasi unsigned to reduce superfluous codes by sign extension.
- remove unused member _virtual.
 1.59 01-Jun-2009  macallan #define BUS_SPACE_MAP_LARGE 0 so SBus framebuffer drivers compile again
 1.58 28-Apr-2008  martin branches: 1.58.10; 1.58.18;
Remove clause 3 and 4 from TNF licenses
 1.57 04-Mar-2007  christos branches: 1.57.40; 1.57.42; 1.57.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.56 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.55 16-Nov-2006  christos branches: 1.55.4;
__unused removal on arguments; approved by core.
 1.54 15-Oct-2006  martin __unused policy
 1.53 20-Feb-2006  cdi branches: 1.53.14; 1.53.16;
Use ANSI-style function definitions and declarations.
 1.52 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.51 24-Dec-2005  perry branches: 1.51.2; 1.51.4; 1.51.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.50 11-Dec-2005  christos merge ktrace-lwp.
 1.49 09-Mar-2005  matt branches: 1.49.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.48 30-Jun-2004  pk branches: 1.48.4; 1.48.6;
Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.
 1.47 28-Jun-2004  pk Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.
 1.46 28-Jun-2004  pk Add openprom range property to the bus space tag.
 1.45 15-Jun-2003  fvdl branches: 1.45.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.44 05-May-2003  martin Make all non-trivial bus space functions "static __inline" (consistently)
and turn all macros with local blocks and declarations into functions.
This fixes PR 19975.
 1.43 30-Jan-2003  martin Sparc64 already had a BUS_DMA_NOCACHE - remove one of the two definitions.
Fortunately the old (local) one had the same semantics as the new one.
 1.42 28-Jan-2003  kent Introduce BUS_DMA_NOCACHE, and bus_dmamem_map() of i386 supports it.
 1.41 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.40 10-Dec-2002  pk bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.39 21-Mar-2002  eeh Parenthesise macro arguments.
 1.38 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.37 15-Mar-2002  eeh Get PCI working with the new bus_space*.
 1.36 14-Mar-2002  eeh Get rid of bus_space_map2().
 1.35 01-Mar-2002  martin For aesthetical reasons use bus_addr_t instead of paddr_t in the BUS_ADDR
makro. Requested by uwe.
 1.34 01-Mar-2002  martin Cast the "io" parameter of BUS_ADDR to paddr_t before it gets shifted.
This makes this makro work with smaller values passed for io. No functional
change.
 1.33 07-Feb-2002  eeh Make bus_space_barrier() an inline instead of a function vector.
 1.32 24-Sep-2001  eeh branches: 1.32.4;
Change bus_space_mmap() signature to the official one.
 1.31 21-Sep-2001  wiz Update copyright, fix typo and remove too many '/'.
Ok'd by eeh.
 1.30 21-Sep-2001  eeh Handle DMA boundaries a bit better.
 1.29 10-Sep-2001  eeh Change some debug printfs to make gcc happy.
 1.28 19-Jul-2001  thorpej branches: 1.28.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.27 07-Mar-2001  thorpej branches: 1.27.2;
Add the BUS_DMA_STREAMING flag.
 1.26 11-Feb-2001  eeh branches: 1.26.2;
Add some extra fields to a dmamap to track what's being mapped.
 1.25 22-Sep-2000  eeh Define __BUS_SPACE_HAS_STREAM_METHODS now we have them.
 1.24 16-Sep-2000  eeh Add bus_space*stream*() methods. I hope they work.
 1.23 14-Jul-2000  eeh Make all the inline functions static.
 1.22 13-Jul-2000  mrg remove old (bogus) comment.
 1.21 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.20 07-Jul-2000  eeh Handle bus_dma aligment properly.
 1.19 29-Jun-2000  pk Fix bus_space_read_region_{2,4,8}().
 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 12-Jun-2000  eeh branches: 1.17.2;
More debugging support.
 1.16 02-Jun-2000  eeh Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).
 1.15 22-Apr-2000  mrg branches: 1.15.2;
whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.14 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.13 07-Jun-1999  eeh branches: 1.13.2;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.12 05-Jun-1999  eeh Fix things up so they compile again.
 1.11 22-May-1999  eeh Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()
 1.10 23-Mar-1999  drochner branches: 1.10.4;
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.9 31-Jan-1999  drochner make the last fix work as intended
 1.8 30-Jan-1999  eeh Fix problems with bus_space*() macros (thanks M.Drochner).
 1.7 06-Sep-1998  eeh 32-bit fixup.
 1.6 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.5 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.4 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2.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.10.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.13.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.17.2.3 17-Oct-2000  tv Pullup 1.24 and 1.25 [eeh]:
Add bus_space*stream*() methods.
 1.17.2.2 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.17.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.26.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.27.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.27.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.27.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.27.2.1 03-Aug-2001  lukem update to -current
 1.28.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.32.4.4 11-Dec-2002  thorpej Sync with HEAD.
 1.32.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.32.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.32.4.1 24-Sep-2001  nathanw file bus.h was added on branch nathanw_sa on 2002-02-28 04:12:12 +0000
 1.45.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.45.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.45.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.45.2.1 03-Aug-2004  skrll Sync with HEAD
 1.48.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.48.4.1 29-Apr-2005  kent sync with -current
 1.49.4.4 03-Sep-2007  yamt sync with head.
 1.49.4.3 26-Feb-2007  yamt sync with head.
 1.49.4.2 30-Dec-2006  yamt sync with head.
 1.49.4.1 21-Jun-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.51.2.2 01-Mar-2006  yamt sync with head.
 1.51.2.1 18-Feb-2006  yamt sync with head.
 1.53.16.2 10-Dec-2006  yamt sync with head.
 1.53.16.1 22-Oct-2006  yamt sync with head
 1.53.14.1 18-Nov-2006  ad Sync with head.
 1.55.4.2 12-Mar-2007  rmind Sync with HEAD.
 1.55.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.57.44.3 11-Mar-2010  yamt sync with head
 1.57.44.2 20-Jun-2009  yamt sync with head
 1.57.44.1 16-May-2008  yamt sync with head.
 1.57.42.1 18-May-2008  yamt sync with head.
 1.57.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.58.18.1 21-Apr-2010  matt sync to netbsd-5
 1.58.10.2 18-Oct-2009  bouyer Back out ticket 967
 1.58.10.1 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #967):
sys/arch/sparc64/include/bus.h: revision 1.59
again
 1.5 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.4 04-Nov-2016  macallan branches: 1.4.16;
add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE
 1.3 07-Jul-2016  msaitoh branches: 1.3.2;
KNF. Remove extra spaces. No functional change.
 1.2 17-Jul-2011  dyoung branches: 1.2.12; 1.2.30;
Switch sparc and sparc64 to new-style <sys/bus.h>.
 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.2.30.2 05-Dec-2016  skrll Sync with HEAD
 1.2.30.1 09-Jul-2016  skrll Sync with HEAD
 1.2.12.1 03-Dec-2017  jdolecek update from HEAD
 1.3.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.4.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5 27-Aug-2018  riastradh Expand to __nothing, not to empty.
 1.4 27-Aug-2018  riastradh Include some needful header files and forward declarations.
 1.3 14-Jul-2014  nakayama branches: 1.3.26; 1.3.28;
Make bus_space_barrier inline to avoid unnecessary argument handling.
 1.2 17-Jul-2011  dyoung branches: 1.2.12; 1.2.26;
Switch sparc and sparc64 to new-style <sys/bus.h>.
 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.2.26.1 10-Aug-2014  tls Rebase.
 1.2.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.28.1 10-Jun-2019  christos Sync with HEAD
 1.3.26.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 20-Mar-1999  thorpej branches: 1.3.22; 1.3.26; 1.3.34;
Garbage-collect.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.34.1 31-Aug-2002  gehenna catch up with -current.
 1.3.26.1 01-Aug-2002  nathanw Catch up to -current.
 1.3.22.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.12 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.11 16-Aug-2002  petrov Add sab.
 1.10 27-Feb-2002  christos branches: 1.10.8;
- define other DEV_ constants that the local port uses.
- delete cdev_decl(mm) since <sys/conf.h> does it.
 1.9 26-Mar-2001  lukem branches: 1.9.2; 1.9.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.8 21-Sep-2000  eeh branches: 1.8.2;
Remove some unsupported devices and add support for the `com' device.
 1.7 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.6 14-Apr-2000  mrg add bpt and lpt. fixes final gcc warnings for GENERIC.
 1.5 05-Jun-1999  eeh branches: 1.5.2;
Fix things up so they compile again.
 1.4 13-Nov-1998  oster branches: 1.4.6;
Updating of bdev's and cdev's to support RAIDframe.
 1.3 10-Oct-1998  thorpej Add scsibus entry points to the cdevsw[].
 1.2 05-Sep-1998  christos Assign copyright to TNF.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.2 27-Mar-2001  bouyer Sync with HEAD.
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.9.8.4 17-Sep-2002  nathanw Catch up to -current.
 1.9.8.3 27-Aug-2002  nathanw Catch up to -current.
 1.9.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.9.8.1 26-Mar-2001  nathanw file conf.h was added on branch nathanw_sa on 2002-02-28 04:12:12 +0000
 1.9.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.9.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.10.8.1 19-May-2002  gehenna Remove port-dependent conf.h.
 1.135 07-Sep-2024  andvar spelling and grammar fixes, mainly in comments.
 1.134 13-Jul-2023  riastradh branches: 1.134.6;
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.133 14-Aug-2021  ryo branches: 1.133.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.132 05-Apr-2021  nakayama Fix build w/o options SUN4V.
 1.131 03-Apr-2021  palle Improve cpu_idle() by allowing a platform specific implementaion (same logic as the sparc implementation) - currently only used by sun4v
 1.130 10-Mar-2020  christos branches: 1.130.4; 1.130.6;
kill extra curproc/curlwp definitions that have no chance of working.
 1.129 29-Dec-2019  martin Simplify some macros: if we only ever use them on the local cpu,
there is no need to do another pointer derefernence to go via the global
address of our cpu info.
Pointed out by ad.
 1.128 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.127 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.126 08-Feb-2019  palle sun4v: initialize %stickcmpr properly when establishing interrupt - fixes issue seen on newer sun4v/SPARC-T5 system where the interrupt never fires.
 1.125 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.124 16-Jan-2018  mrg branches: 1.124.2; 1.124.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.123 10-Feb-2017  palle sun4v: Added handling of trap type 0x034 (address alignment error) + fixed typo mmfsa -> mmufsa. Verified for both sun4u and sun4v using qemu.
 1.122 25-Jun-2016  palle branches: 1.122.2; 1.122.4;
sun4v: fix previous fix - no need to protect "struct inthand" with "#if defined(_KERNEL)" + use proper include file name - sparc64/bus_defs.h -> machine/bus_defs.h
 1.121 23-Jun-2016  palle sun4v: Fix build issue introduced in previous commit - bus stuff is kernel only, so protect this with _KERNEL
 1.120 22-Jun-2016  palle sun4v: add cbus driver - from OpenBSD
 1.119 10-May-2016  palle sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.118 07-Sep-2015  palle Move function prototypes for cpu_ecache_associativity() and cpu_ecache_size() outside the MULTIPROCESSOR block so a GENERIC.UP kernel will build again
 1.117 06-Sep-2015  nakayama Use <machine/*.h> instead of <sparc64/*.h> for consistency.
 1.116 06-Sep-2015  martin On SUN4V make the mdesc data available early in pmap_bootstrap, so we
can set up the uvm page colors correctly.
Based on code from palle@.
 1.115 15-Jun-2015  martin Slightly optimize the ITLB usage on secondary processors
 1.114 03-Jan-2015  palle smp_tlb_flush_pte(): Avoid run-time check for cpu type/implementation by installing correct function pointer in sparc64_ip_init(). sparc64_send_ipi() is changed to a function pointer as well to avoid run-time checks.
 1.113 24-Sep-2014  palle branches: 1.113.2;
sun4v: add code to enable startup of secondary cpus on both sun4u and sun4v systems - ok martin@
 1.112 04-Sep-2014  palle sun4v: All cpus must be setup with a TSB descriptor, so pmap_setup_tsb_sun4v() must take a pointer to the TSB descriptor
 1.111 08-Jun-2014  palle branches: 1.111.2;
sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.110 21-Feb-2014  palle branches: 1.110.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.109 09-Jan-2014  palle sun4v: Update description of the ci_mmfsa field in the cpu_info structure
 1.108 09-Jan-2014  macallan allow non-SUN4V kernels to build
 1.107 07-Jan-2014  palle sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
 1.106 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.105 10-Nov-2013  christos use __unused instead of __USE and void cast to mark iterator variable unused
where needed (from phone)
 1.104 13-Sep-2013  martin Make CPU_INFO_FOREACH more gcc 4.8.1 friendly
 1.103 20-Aug-2013  macallan support UltraSPARC-IIe STICK counter as time base
 1.102 21-Jun-2013  nakayama branches: 1.102.2;
Avoid data_access_error trap panic when reading unused PCI
configuration space.

This method is described in UltraSPARC IIi User's Manual "16.2.1
Probing PCI during boot using deferred errors", and refer to the
implementation of OpenBSD.
 1.101 04-Feb-2013  macallan add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up
 1.100 09-Nov-2012  nakayama Make setstick() and getstick() to inline functions.
 1.99 08-Nov-2012  macallan use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.98 30-Jul-2011  martin branches: 1.98.2; 1.98.8; 1.98.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.97 20-Jul-2011  macallan add per ivec event counters
 1.96 13-Apr-2011  mrg re-include sparc64/sparc64/intreg.h in kernel mode. it's necessary.
 1.95 13-Apr-2011  mrg export a bunch of things to _KMEMUSER as well.

XXX: should consolidate the curcpu/curlwp definitions.
 1.94 24-Jan-2011  martin Provide LWP_PC
 1.93 26-Dec-2010  martin branches: 1.93.2; 1.93.4;
Move ci_data first in struct cpu_info
 1.92 29-May-2010  martin Add a generic ipi to call arbitrary C functions on another (or all other)
cpu(s). Will be used in the near future by some code Mindaugas is working on.
 1.91 24-May-2010  martin Make C declarations match assembler reality: ipi functions get two arguments
(which most of them (partly) ignore, but anyway).
 1.90 28-Mar-2010  mrg - add a kmutex_t ci_ctx_lock to struct cpu_info, and initialise it in
cpu_pmap_init() and replace pmap_ctx_lock usage with this new ci_ctx_lock

- replace smp_dcache_flush_page_all() with smp_dcache_flush_page_cpuset(),
that flushes only on the set of CPUs not, everyone. add new
dcache_flush_page_cpuset() to flush this page from the D$ only
on the specified set of CPUs.

- add a cpuset to pmap_free_page() and use it when freeing PTE pages
when a pmap is destroyed

- introduce pmap_free_page_noflush(), and use it when we allocated a
page for PTEs but didn't use it and don't need to flush it

- don't bother with pmap_lock in pmap_extract(), the only potential
issue is pseg_get() which is already safe


tested on sb2000, sb2500 and ultra80 with a bunch of various heavy
workloads, and seems to give a clear 1-2% speed up for high-forking /
short lived processes, such as ./configure.
 1.89 06-Mar-2010  mrg branches: 1.89.2;
clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.88 02-Feb-2010  mrg branches: 1.88.2;
- split sp_tlb_flush_pte() and switchtoctx() into sp_tlb_flush_pte_us()/
sp_tlb_flush_pte_usiii() and switchtoctx_us()/switchtoctx_usiii() and
implement the latter while i'm here. it works ... sometimes i think,
but also sometimes panics/hangs.
- fix a comment in sparc64_ipi_flush_pte_usiii()
 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 30-May-2009  martin cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.85 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.84 05-Oct-2008  nakayama branches: 1.84.4; 1.84.10;
struct cpu_info: reorder member to avoid a padding.
 1.83 10-Jul-2008  nakayama Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.
 1.82 14-Jun-2008  nakayama branches: 1.82.2;
Remove declarations of unexist variables and functions.
 1.81 18-May-2008  martin branches: 1.81.2;
Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.
 1.80 29-Apr-2008  ad branches: 1.80.2;
Mirror sparc and provide sparc_softintr stuff. There is no functional
change, beyond renaming a function and putting back disestablish/schedule.
PR kern/37540.
 1.79 09-Apr-2008  nakayama branches: 1.79.2; 1.79.4;
Reorganize clock assignments on SMP kernel:
- don't use separate statintr on primary CPU.
- invoke clockintr instead of statintr on secondary CPUs.

This change fixes the problem setitimer(2) didn't work on secodary CPUs.
 1.78 03-Apr-2008  nakayama Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.
 1.77 17-Mar-2008  nakayama Make schedintr interrupt handler per-CPU.
While there rename tickintr interrupt handler and share initialization
code with schedintr.
 1.76 14-Mar-2008  nakayama Improve IPI handling:
- make IPI takes two arguments.
- add IPI event counters per-CPU.
- implement IPI functions which were missing or broken.
- insert DELAY while halting primary CPU in IPI handler.
 1.75 02-Mar-2008  nakayama - make interrupt pending list per-CPU.
- make tickintr() MP-safe.
- remove unused port-sparc derived interrupt code.

Ok by martin@.
 1.74 28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.73 27-Feb-2008  xtraeme Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.72 22-Feb-2008  martin Get rid of the IPI simple_lock.
 1.71 18-Feb-2008  martin branches: 1.71.2; 1.71.6;
remove unused extern declarations
 1.70 18-Feb-2008  martin For non-mpsafe interrupt handlers, grab the kernel lock via a biglock
wrapper. Fixes PR port-sparc64/37468.
 1.69 15-Jan-2008  martin Rename cpuset_t for now to sparc64_cpuset_t, to avoid a name clash with
<sys/pset.h>. Mid-term we should probably convert to the MI cpuset_t.
 1.68 09-Dec-2007  martin branches: 1.68.2;
Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.
 1.67 17-Oct-2007  garbled branches: 1.67.2; 1.67.4; 1.67.6;
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.66 11-Sep-2007  martin Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.
 1.65 09-Sep-2007  martin Make cpufrequency and friends per cpu values.
Prepare a hz tick interrupt on secondary CPUs via %tick, but do not
enable it yet, as it breaks ddb.
 1.64 25-Aug-2007  martin branches: 1.64.2;
Remove INITSTACK completely - at the time we used to switch to it, we
already have access to all of lwp0 and it's uarea - so we can switch
to the correct lwp0 stack easily before calling main.
 1.63 17-May-2007  yamt branches: 1.63.4; 1.63.8;
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.62 04-Mar-2007  christos branches: 1.62.2; 1.62.4; 1.62.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.61 16-Feb-2007  ad branches: 1.61.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.60 09-Feb-2007  ad Merge newlock2 to head.
 1.59 16-Oct-2006  martin Remove obsolet kgdb parts
 1.58 02-Oct-2006  mrg remove some sparc v8 only definitions.
 1.57 18-Sep-2006  martin branches: 1.57.2;
Lazy FPU handling for the MULTIPROCESSOR case
 1.56 15-Sep-2006  martin Do not bother to save fpu state when we are about to get rid of it.
 1.55 13-Sep-2006  mrg SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.54 07-Jun-2006  kardel branches: 1.54.6;
convert to timecounters (from branch simonb-timecounters)
 1.53 20-Feb-2006  cdi branches: 1.53.2; 1.53.8;
Use ANSI-style function definitions and declarations.
 1.52 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.51 27-Jan-2006  cdi branches: 1.51.2; 1.51.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.50 24-Dec-2005  perry branches: 1.50.2;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.49 11-Dec-2005  christos merge ktrace-lwp.
 1.48 27-Oct-2005  martin Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork
 1.47 16-Jun-2005  briggs branches: 1.47.2; 1.47.4;
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.46 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.45 18-Jun-2004  martin Fix small glitches to make SMP kernels compile again.
 1.44 18-Jun-2004  petrov Define mp_pause(resume)_cpus needed for callprom.
 1.43 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.42 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.41 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.40 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 1.39 20-Nov-2003  petrov Set curcpu() for SMP.
 1.38 15-Nov-2003  petrov Compile GENERIC.MP.
 1.37 09-Nov-2003  tsutsui Use #if defined(_KERNEL_OPT) to protect #include "opt_xxx.h"
from building LKM etc. Suggested by mrg.
 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 05-Feb-2003  nakayama branches: 1.35.2;
Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.

This should fix PR port-sparc64/18452.
(approved by martin)
 1.34 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.33 27-Nov-2002  pk Sync machdep sysctls with sparc.
 1.32 29-Sep-2002  chs remove some vestigial FPU and cache code that's not need on ultrasparcs.
misc tidiness.
 1.31 14-May-2002  eeh branches: 1.31.4;
Have CLKF_BASEPRI() always return false for now to prevent hardclock
from being blocked by softclock.
 1.30 09-Feb-2002  eeh Correctly take into account the satck bias in CLKF_INTR().
 1.29 03-Sep-2001  mrg branches: 1.29.6;
don't explicitly size the intrhand[] array; fixes PR#13859 from <martti.kuparinen@iki.fi>
 1.28 14-Jun-2001  thorpej branches: 1.28.2;
Don't need to prototype child_return() here, it's in <sys/proc.h>.
 1.27 15-Jan-2001  thorpej branches: 1.27.2;
Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
 1.26 29-Sep-2000  eeh This seems to fix the interrupt lossage of non-debug kernels.
 1.25 28-Sep-2000  eeh probeget() actually handles 64-bit values so fix the prototype.
 1.24 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.23 03-Jul-2000  eeh Prevent interrupts from being posted if they are active and deprecate polled
interrupts. This seems to eliminate the spurious interrupts.
 1.22 02-Jul-2000  eeh Clean up interrupt handling some more.
 1.21 30-Jun-2000  eeh Fix interrupt delivery on UltraSPARC IIi machines.
 1.20 19-Jun-2000  eeh branches: 1.20.2;
Have separate data and text segments, make text read-only.
 1.19 12-Jun-2000  eeh Start reorganizing the kernel for MULTIPROCESSOR support.
 1.18 12-Jun-2000  mrg ih_map & ih_clr are volatile.
 1.17 26-May-2000  thorpej branches: 1.17.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.16 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.15 30-Dec-1999  eeh Make CLKF_INTR() more intelligent.
 1.14 06-Nov-1999  eeh Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.13 11-Oct-1999  eeh branches: 1.13.2; 1.13.4;
Update to post 1.4.
 1.12 10-Aug-1999  thorpej branches: 1.12.2;
Define cpu_number() as discussed on tech-smp.
 1.11 20-Jun-1999  eeh Move the DVMA mapin/mapout functions from the SBus driver to the iommu driver.
 1.10 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.9 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.8 05-Jun-1999  eeh Fix things up so they compile again.
 1.7 30-May-1999  eeh Add code to support using %tick as the system clock if no "counter-timer" node
is found.
 1.6 30-May-1999  mrg clone intr.h from the SPARC.
 1.5 24-Nov-1998  mrg branches: 1.5.6;
add protos for switchtoctx, fixalign and emulinstr. XXX should all these be here?
 1.4 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.3 05-Oct-1998  thorpej cpu_set_kpc() prototype is already in <sys/systm.h>.
 1.2 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.5.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.4.1 15-Nov-1999  fvdl Sync with -current
 1.13.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 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.17.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.20.2.2 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.20.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.27.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.28.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.28.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.28.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.28.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.29.6.8 11-Dec-2002  thorpej Sync with HEAD.
 1.29.6.7 18-Oct-2002  nathanw Catch up to -current.
 1.29.6.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.29.6.5 20-Jun-2002  nathanw Catch up to -current.
 1.29.6.4 28-Feb-2002  nathanw Catch up to -current.
 1.29.6.3 04-Jan-2002  eeh Cleanup.
 1.29.6.2 03-Jan-2002  petrov make kernel compile
 1.29.6.1 03-Sep-2001  petrov file cpu.h was added on branch nathanw_sa on 2002-01-03 06:42:33 +0000
 1.31.4.1 24-Jun-2003  grant Apply patch (requested by nakayama in ticket #1329):

Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.
 1.35.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.35.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.35.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.35.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.35.2.1 03-Aug-2004  skrll Sync with HEAD
 1.47.4.1 02-Nov-2005  yamt sync with head.
 1.47.2.8 17-Mar-2008  yamt sync with head.
 1.47.2.7 27-Feb-2008  yamt sync with head.
 1.47.2.6 21-Jan-2008  yamt sync with head
 1.47.2.5 27-Oct-2007  yamt sync with head.
 1.47.2.4 03-Sep-2007  yamt sync with head.
 1.47.2.3 26-Feb-2007  yamt sync with head.
 1.47.2.2 30-Dec-2006  yamt sync with head.
 1.47.2.1 21-Jun-2006  yamt sync with head.
 1.50.2.3 01-Mar-2006  yamt sync with head.
 1.50.2.2 18-Feb-2006  yamt sync with head.
 1.50.2.1 01-Feb-2006  yamt sync with head.
 1.51.4.2 02-Jun-2006  kardel - support timecounters
 1.51.4.1 22-Apr-2006  simonb Sync with head.
 1.51.2.1 09-Sep-2006  rpaulo sync with head
 1.53.8.1 19-Jun-2006  chap Sync with head.
 1.53.2.2 14-Sep-2006  yamt sync with head.
 1.53.2.1 26-Jun-2006  yamt sync with head.
 1.54.6.3 11-Jan-2007  ad Checkpoint work in progress.
 1.54.6.2 29-Dec-2006  ad Checkpoint work in progress.
 1.54.6.1 18-Nov-2006  ad Sync with head.
 1.57.2.2 22-Oct-2006  yamt sync with head
 1.57.2.1 18-Sep-2006  yamt file cpu.h was added on branch yamt-splraiseipl on 2006-10-22 06:05:11 +0000
 1.61.2.2 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.61.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.62.10.2 03-Oct-2007  garbled Sync with HEAD
 1.62.10.1 22-May-2007  matt Update to HEAD.
 1.62.4.1 11-Jul-2007  mjf Sync with head.
 1.62.2.2 09-Oct-2007  ad Sync with head.
 1.62.2.1 27-May-2007  ad Sync with head.
 1.63.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.63.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.63.4.2 10-Sep-2007  skrll Sync with HEAD.
 1.63.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.64.2.3 23-Mar-2008  matt sync with HEAD
 1.64.2.2 09-Jan-2008  matt sync with HEAD
 1.64.2.1 06-Nov-2007  matt sync with HEAD
 1.67.6.1 11-Dec-2007  yamt sync with head.
 1.67.4.1 26-Dec-2007  ad Sync with head.
 1.67.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.68.2.1 19-Jan-2008  bouyer Sync with HEAD
 1.71.6.5 05-Oct-2008  mjf Sync with HEAD.
 1.71.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.71.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.71.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.71.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.71.2.1 24-Mar-2008  keiichi sync with head.
 1.79.4.5 11-Aug-2010  yamt sync with head.
 1.79.4.4 11-Mar-2010  yamt sync with head
 1.79.4.3 20-Jun-2009  yamt sync with head
 1.79.4.2 04-May-2009  yamt sync with head.
 1.79.4.1 16-May-2008  yamt sync with head.
 1.79.2.3 17-Jun-2008  yamt sync with head.
 1.79.2.2 04-Jun-2008  yamt sync with head
 1.79.2.1 18-May-2008  yamt sync with head.
 1.80.2.3 10-Oct-2008  skrll Sync with HEAD.
 1.80.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.80.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.81.2.2 18-Jul-2008  simonb Sync with head.
 1.81.2.1 18-Jun-2008  simonb Sync with head.
 1.82.2.1 19-Oct-2008  haad Sync with HEAD.
 1.84.10.1 05-Jun-2009  snj branches: 1.84.10.1.2;
Pull up following revision(s) (requested by martin in ticket #786):
sys/arch/sparc64/include/cpu.h: revision 1.86
sys/arch/sparc64/sparc64/locore.s: revision 1.291
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.89
cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.84.10.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.84.4.1 05-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #786):
sys/arch/sparc64/include/cpu.h: revision 1.86
sys/arch/sparc64/sparc64/locore.s: revision 1.291
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.89
cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.88.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.88.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.89.2.3 21-Apr-2011  rmind sync with head
 1.89.2.2 05-Mar-2011  rmind sync with head
 1.89.2.1 30-May-2010  rmind sync with head
 1.93.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.93.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.98.12.5 03-Dec-2017  jdolecek update from HEAD
 1.98.12.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.98.12.3 23-Jun-2013  tls resync from head
 1.98.12.2 25-Feb-2013  tls resync with head
 1.98.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.98.8.1 23-Nov-2012  riz Pull up following revision(s) (requested by macallan in ticket #695):
sys/arch/sparc64/include/cpu.h: revision 1.99
sys/arch/sparc64/sparc64/cpu.c: revision 1.103
sys/arch/sparc64/include/psl.h: revision 1.50
sys/arch/sparc64/sparc64/clock.c: revision 1.107
sys/arch/sparc64/include/ctlreg.h: revision 1.57
sys/arch/sparc64/sparc64/locore.s: revision 1.342
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.98.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.98.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.102.2.2 18-May-2014  rmind sync with head
 1.102.2.1 28-Aug-2013  rmind sync with head
 1.110.2.1 10-Aug-2014  tls Rebase.
 1.111.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.113.2.5 28-Aug-2017  skrll Sync with HEAD
 1.113.2.4 09-Jul-2016  skrll Sync with HEAD
 1.113.2.3 29-May-2016  skrll Sync with HEAD
 1.113.2.2 22-Sep-2015  skrll Sync with HEAD
 1.113.2.1 06-Apr-2015  skrll Sync with HEAD
 1.122.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.122.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.124.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.124.4.1 10-Jun-2019  christos Sync with HEAD
 1.124.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.130.6.2 17-Apr-2021  thorpej Sync with HEAD.
 1.130.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.130.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.133.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.134.6.1 02-Aug-2025  perseant Sync with HEAD
 1.8 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 28-Mar-2008  martin branches: 1.6.2; 1.6.4;
Use the passed cpu info for returning the frequency, not the current
cpu
 1.5 17-Oct-2007  garbled branches: 1.5.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.4 09-Sep-2007  martin Make cpufrequency and friends per cpu values.
Prepare a hz tick interrupt on secondary CPUs via %tick, but do not
enable it yet, as it breaks ddb.
 1.3 16-Feb-2006  perry branches: 1.3.24; 1.3.32; 1.3.38; 1.3.42; 1.3.44;
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.2 24-Dec-2005  perry branches: 1.2.2; 1.2.4; 1.2.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.1 05-Feb-2003  nakayama branches: 1.1.2; 1.1.20;
Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.

This should fix PR port-sparc64/18452.
(approved by martin)
 1.1.20.1 27-Oct-2007  yamt sync with head.
 1.1.2.2 24-Jun-2003  grant Create new file from rev 1.1 (requested by nakayama in ticket #1329):

Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.
 1.1.2.1 05-Feb-2003  grant file cpu_counter.h was added on branch netbsd-1-6 on 2003-06-24 09:31:35 +0000
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 18-Feb-2006  yamt sync with head.
 1.3.44.1 06-Nov-2007  matt sync with HEAD
 1.3.42.1 02-Oct-2007  joerg Sync with HEAD.
 1.3.38.1 10-Sep-2007  skrll Sync with HEAD.
 1.3.32.1 03-Oct-2007  garbled Sync with HEAD
 1.3.24.1 09-Oct-2007  ad Sync with head.
 1.5.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.5.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.4.2 20-Jun-2009  yamt sync with head
 1.6.4.1 16-May-2008  yamt sync with head.
 1.6.2.1 18-May-2008  yamt sync with head.
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 28-Feb-2008  martin branches: 1.7.2; 1.7.4;
Make TSBs and MMU contexts per-cpu.
 1.6 15-Jan-2008  martin branches: 1.6.2; 1.6.6;
Rename cpuset_t for now to sparc64_cpuset_t, to avoid a name clash with
<sys/pset.h>. Mid-term we should probably convert to the MI cpuset_t.
 1.5 13-Sep-2006  mrg branches: 1.5.30; 1.5.36; 1.5.44;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.4 24-Dec-2005  perry branches: 1.4.8; 1.4.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 14-Mar-2004  simonb branches: 1.2.4; 1.2.18;
Use "#define<tab>" consistently.
 1.1 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.2.18.4 17-Mar-2008  yamt sync with head.
 1.2.18.3 21-Jan-2008  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.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 14-Mar-2004  skrll file cpuset.h was added on branch ktrace-lwp on 2004-08-03 10:41:33 +0000
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.4.8.1 14-Sep-2006  yamt sync with head.
 1.5.44.1 19-Jan-2008  bouyer Sync with HEAD
 1.5.36.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.30.1 23-Mar-2008  matt sync with HEAD
 1.6.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.6.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.2.1 24-Mar-2008  keiichi sync with head.
 1.7.4.1 16-May-2008  yamt sync with head.
 1.7.2.1 18-May-2008  yamt sync with head.
 1.71 10-Mar-2024  rillig sparc: fix snprintb formats for SFSR_BITS
 1.70 02-Feb-2024  andvar fix typos, mainly s/unsupport/unsupported/ in log messages.
 1.69 10-Aug-2023  andvar fix typos in comments.
 1.68 06-May-2023  andvar few more typos in the word "register", mainly s/resister/register/.
In one comment I assume that it was meant to be pull-up resistor.
 1.67 13-Nov-2019  nakayama Revert workarounds for clang.
In-tree clang can now handle the "r" asm constraint for 64-bit values properly.
 1.66 05-Apr-2019  nakayama Redo previous.
In the case of store variant, put dummy constraint in output
instead of input.

Suggested by joerg@ in source-changes-d@
 1.65 05-Apr-2019  nakayama Add dummy constraints to avoid excessive optimization in clang.
GENERIC kernel compiled with clang now boot at least on my Fire V100.
 1.64 28-Dec-2016  martin branches: 1.64.16;
Rename the "flush" macro to "sparc_flush_icache", the former is way too
generic for a macro name.
 1.63 03-Feb-2016  palle branches: 1.63.2;
sun4v: extend dmmu_set_secondary_context() to handle both sun4u and sun4v. ok martin@
 1.62 01-Apr-2015  palle sun4v: Implement handling of cpu_mondo trap - from OpenBSD - tested using the Legion simulator
 1.61 16-Jul-2014  palle branches: 1.61.4;
sun4v: Introduce SET_MMU_CONTEXTID macro for setting the mmu context id on both sun4u and sun4v
 1.60 16-Dec-2013  palle branches: 1.60.2;
Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.59 08-Nov-2012  nakayama branches: 1.59.2;
Rename ASR_IDSR to ASI_IDSR, which is ASI (Address Space Identifier),
not ASR (Ancillary State Register).
 1.58 08-Nov-2012  nakayama Move ASRs macro to more appropriate header.
While there remove useless macro.
 1.57 08-Nov-2012  macallan use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.56 08-Oct-2011  nakayama branches: 1.56.2; 1.56.8; 1.56.12;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.
 1.55 16-Mar-2011  mrg add some control registers found on the Fire and Jupiter busses.
from openbsd.
 1.54 18-Dec-2010  mrg branches: 1.54.2;
add a bit for MCCR_RAW_EN -- enable read-after-write.
 1.53 10-Jul-2010  nakayama Clear the upper word explicitly before combining two 32-bit values to 64-bit
on 32-bit kernels.
 1.52 23-Feb-2010  mrg branches: 1.52.2;
add some bits to set to access all the cheetah dtlb/itlb's.
 1.51 21-Feb-2010  mrg s/D-cache/I-cache/ in some comments.
 1.50 13-Feb-2010  mrg add some defines for the sizes of TLBs in various CPUs.
 1.49 01-Feb-2010  mrg branches: 1.49.2;
for USIII, use the new "tlb demap all" operation in sp_tlb_flush_all()
 1.48 05-Dec-2009  nakayama Garbage collect unused or incomplete definitions.
 1.47 05-Dec-2009  nakayama Bring together similar inline asm codes of ld*a and st*a definitions
using macro, also remove unnecessary membar #Sync and %asi restore in
the case of 32-bit kernel.

While there, introduce an optimization case that asi is constant if
we are using gcc.
 1.46 28-Nov-2009  mrg add some ultrasparcIII defines, from openbsd.
 1.45 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.44 31-Mar-2007  hannken branches: 1.44.38;
Cleanup last by using a "n"umeric address space identifier.

Ok: Martin Husemann <martin@netbsd.org>
 1.43 30-Mar-2007  martin When invalidating a context, make sure to flush user windows upfront.
Do not set the DMMU secondary context to 0 (that would be kernel), and
add a few required membars after switching the secondary dmmu context.

This avoids SIRs caused by double kernel_data_faults, caused by spills
of obsolete user windows after the context for that user pmap is gone.
 1.42 20-Feb-2006  cdi branches: 1.42.18; 1.42.20; 1.42.24; 1.42.26;
Use ANSI-style function definitions and declarations.
 1.41 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.40 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.39 24-Dec-2005  perry branches: 1.39.2; 1.39.4; 1.39.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.38 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.37 11-Dec-2005  christos merge ktrace-lwp.
 1.36 01-Jul-2004  petrov branches: 1.36.12;
Added UPA_MID definitions and macros(similar to FreeBSD).
Added membar_store, membar_load macros.
No need to set %asi _after_ alternate space use in corresponding functions.
Enable(unifdef) casa functions for __arch64__.
 1.35 01-Jul-2004  heas typo in define name, littie -> little
 1.34 24-Jun-2004  martin Add missing ; in inline assembler for 32bit kernels
 1.33 17-Jun-2004  petrov clean-up, reformat __asm statements.
 1.32 22-Mar-2004  nakayama Eliminate cast 64-bit address to u_long.
 1.31 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.30 24-Apr-2002  eeh branches: 1.30.10;
Don't need to flush the d$ for MMU bypass accesses.
 1.29 14-Jan-2002  eeh Make PHYS_ASI() also recognize little-endian ASIs.
 1.28 06-Aug-2001  eeh branches: 1.28.6;
Add some alternate spellings for ASIs.
Make sure ASI_PRIMARY_NOFAULT is always restored.
Garbage collect some old code.
 1.27 19-Jul-2001  eeh Don't bother flushing cache lines for un-cached accesses.
 1.26 29-Jun-2001  eeh branches: 1.26.2;
Add the shorter version of block ASIs used by Sun.
 1.25 29-Dec-2000  eeh Fix some 32-bit assembly code.
 1.24 04-Dec-2000  fvdl Comment out caxsa, it's not used. Avoids 32 bit compile errors.
 1.23 31-Aug-2000  eeh Fix register sheduling bug in st?a() routines and add casxa().
 1.22 14-Jul-2000  eeh Tell gcc that stores clobber "memory". Probably makes no difference since
they should not be used to access normal memory anyway.
 1.21 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.20 24-Jun-2000  eeh More VM cleanup:

Move the cpu_info structure above the interrupt stack so it won't
get corrupted if the stack overflows.

Flush the D$ before and after all MMU bypass accesses since the
D$ latches all of those.
 1.19 20-Jun-2000  eeh lda is unsigned, ldswa is signed. Fixes a 32-bit sign extension bug.
 1.18 19-Jun-2000  eeh branches: 1.18.2;
Have separate data and text segments, make text read-only.
 1.17 10-Jun-2000  eeh Only use 32-bit addresses for all accesses that don't bypass the MMU.
Makes SBus work again.
 1.16 08-Jun-2000  eeh Fixup signed/unsigned issues so 32-bit addresses are not sign extended.
 1.15 07-Jun-2000  pk Add a couple of missing semi-colons.
 1.14 02-Jun-2000  eeh Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).
 1.13 10-Apr-2000  mrg branches: 1.13.2;
- IRSR_BUSY is bit 5 not bit 4.
- IRSR_MID(x) is &'d with 0x1f (5 bits) not 0xf.
 1.12 08-Jun-1999  mrg branches: 1.12.2;
mmm, missing return types make gcc unhappy.
 1.11 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.10 31-May-1999  eeh Fix some bugs in some more of those asm macros.
 1.9 30-May-1999  eeh Re-write ASI load/stores to use full 64-bit addresses so we can use device
register addresses with MMU bypass ASIs.
 1.8 22-May-1999  eeh Fixup argument confusion to __asm() statements. long long is two registers
wide in 32-bit mode. Doh!.
 1.7 11-May-1999  eeh Don't clobber any input regs in __asm statements.
 1.6 22-Mar-1999  eeh branches: 1.6.4;
Flush D$ on bypass accesses.
 1.5 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.4 13-Nov-1998  eeh Fix 32-bit gcc scheduling problems.
 1.3 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.6.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.18.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.26.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.26.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.26.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.26.2.1 03-Aug-2001  lukem update to -current
 1.28.6.3 20-Jun-2002  nathanw Catch up to -current.
 1.28.6.2 28-Feb-2002  nathanw Catch up to -current.
 1.28.6.1 06-Aug-2001  nathanw file ctlreg.h was added on branch nathanw_sa on 2002-02-28 04:12:12 +0000
 1.30.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.30.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.30.10.1 03-Aug-2004  skrll Sync with HEAD
 1.36.12.2 03-Sep-2007  yamt sync with head.
 1.36.12.1 21-Jun-2006  yamt sync with head.
 1.39.6.1 22-Apr-2006  simonb Sync with head.
 1.39.4.1 09-Sep-2006  rpaulo sync with head
 1.39.2.2 01-Mar-2006  yamt sync with head.
 1.39.2.1 18-Feb-2006  yamt sync with head.
 1.42.26.1 11-Jul-2007  mjf Sync with head.
 1.42.24.1 10-Apr-2007  ad Sync with head.
 1.42.20.1 02-Apr-2007  rmind Pull up to the branch:
cvs rdiff -r1.42 -r1.43 src/sys/arch/sparc64/include/ctlreg.h
cvs rdiff -r1.187 -r1.188 src/sys/arch/sparc64/sparc64/pmap.c
Requested by mrg@
 1.42.18.2 31-Mar-2007  bouyer Pull up following revision(s) (requested by hannken in ticket #548):
sys/arch/sparc64/include/ctlreg.h: revision 1.44
Cleanup last by using a "n"umeric address space identifier.
Ok: Martin Husemann <martin@netbsd.org>
 1.42.18.1 31-Mar-2007  bouyer Pull up following revision(s) (requested by martin in ticket #547):
sys/arch/sparc64/sparc64/pmap.c: revision 1.188
sys/arch/sparc64/include/ctlreg.h: revision 1.43
When invalidating a context, make sure to flush user windows upfront.
Do not set the DMMU secondary context to 0 (that would be kernel), and
add a few required membars after switching the secondary dmmu context.
This avoids SIRs caused by double kernel_data_faults, caused by spills
of obsolete user windows after the context for that user pmap is gone.
 1.44.38.3 11-Aug-2010  yamt sync with head.
 1.44.38.2 11-Mar-2010  yamt sync with head
 1.44.38.1 20-Jun-2009  yamt sync with head
 1.49.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.49.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.52.2.2 21-Apr-2011  rmind sync with head
 1.52.2.1 05-Mar-2011  rmind sync with head
 1.54.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.56.12.3 03-Dec-2017  jdolecek update from HEAD
 1.56.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.56.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.56.8.1 23-Nov-2012  riz Pull up following revision(s) (requested by macallan in ticket #695):
sys/arch/sparc64/include/cpu.h: revision 1.99
sys/arch/sparc64/sparc64/cpu.c: revision 1.103
sys/arch/sparc64/include/psl.h: revision 1.50
sys/arch/sparc64/sparc64/clock.c: revision 1.107
sys/arch/sparc64/include/ctlreg.h: revision 1.57
sys/arch/sparc64/sparc64/locore.s: revision 1.342
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.56.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.56.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.59.2.1 18-May-2014  rmind sync with head
 1.60.2.1 10-Aug-2014  tls Rebase.
 1.61.4.3 05-Feb-2017  skrll Sync with HEAD
 1.61.4.2 19-Mar-2016  skrll Sync with HEAD
 1.61.4.1 06-Apr-2015  skrll Sync with HEAD
 1.63.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.64.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.64.16.1 10-Jun-2019  christos Sync with HEAD
 1.36 10-Mar-2020  christos Don't provide things that don't make sense in userland. We don't provide
access to registers crash(8)...
 1.35 06-Nov-2017  christos branches: 1.35.4;
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.34 31-Oct-2015  nakayama Remove #define SUN4U since machine/frame.h doesn't check SUN4U anymore.
 1.33 12-Jul-2011  mrg branches: 1.33.12; 1.33.30;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.32 20-Jun-2011  nakayama Remove frame32 hack with using the same trick in netbsd32_machdep.c.
 1.31 27-May-2011  nakayama branches: 1.31.2;
Fix 32-bit kernel build.
 1.30 26-May-2011  joerg Introduce DDB_EXPR_FMT and replace the logic around DB_EXPR_T_IS_QUAD.
 1.29 13-Apr-2011  mrg this needs sys/types.h in userspace.
 1.28 11-Apr-2011  mrg remove DB_AOUT_SYMBOLS.
 1.27 14-Jan-2011  rmind branches: 1.27.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.26 25-Nov-2008  nakayama branches: 1.26.8;
Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.25 10-Jul-2008  nakayama branches: 1.25.2; 1.25.4;
sparc64_ipi_save_fpstate:
- use primary MMU context for consistency with other trap/interrupt handlers.

sparc64_ipi_save_fpstate, savefpstate:
- avoid storing fp registers as we can.

sparc64_ipi_save_fpstate, savefpstate, loadfpstate:
- remove unaligned case since buffers allocated with pool_cache are ensured
64-byte aligned.

Ok by martin@.
 1.24 29-Feb-2008  martin branches: 1.24.4; 1.24.6; 1.24.8; 1.24.10;
Rearange ddb saved register values slightly.
While there fix completely bogus register access ops for < 64 bit values.
 1.23 22-Feb-2007  matt branches: 1.23.22; 1.23.38; 1.23.42;
More boolean_t -> bool
 1.22 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.21 07-Oct-2006  rjs branches: 1.21.4;
Allow kernel to build with KGDB enabled.
 1.20 13-Sep-2006  mrg branches: 1.20.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.19 01-Apr-2006  cherry branches: 1.19.8;
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.18 20-Feb-2006  cdi branches: 1.18.2; 1.18.4; 1.18.6;
Use ANSI-style function definitions and declarations.
 1.17 11-Dec-2005  christos branches: 1.17.2; 1.17.4; 1.17.6;
merge ktrace-lwp.
 1.16 06-Jan-2004  petrov branches: 1.16.16;
Some cleanup and move ddb_regs declaration to db_interface.c
 1.15 18-May-2003  martin branches: 1.15.2;
My reading of the gdb code seems to indicate it expects 125 registers
from sparc64, not 72 (sparc value). Bump kgdb buffer size a bit too.
 1.14 29-Apr-2003  scw 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.13 09-Nov-2001  thorpej branches: 1.13.2;
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.12 07-Jul-2001  eeh branches: 1.12.2; 1.12.6;
Also handle FPU registers.
 1.11 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.10 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.9 10-Jan-2000  eeh Add debugger single-stepping and fix interrupt dispatch bugs.
 1.8 06-Nov-1999  eeh Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.7 31-Jan-1999  mrg branches: 1.7.8; 1.7.10; 1.7.14;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.6 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.5 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.3 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.7.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.10.1 15-Nov-1999  fvdl Sync with -current
 1.7.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.12.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.12.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.2.2 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.13.2.1 09-Nov-2001  thorpej file db_machdep.h was added on branch nathanw_sa on 2001-11-09 06:52:26 +0000
 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.16.16.4 17-Mar-2008  yamt sync with head.
 1.16.16.3 26-Feb-2007  yamt sync with head.
 1.16.16.2 30-Dec-2006  yamt sync with head.
 1.16.16.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.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.18.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.18.2.2 14-Sep-2006  yamt sync with head.
 1.18.2.1 11-Apr-2006  yamt sync with head
 1.19.8.1 18-Nov-2006  ad Sync with head.
 1.20.2.1 22-Oct-2006  yamt sync with head
 1.21.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.23.42.3 17-Jan-2009  mjf Sync with HEAD.
 1.23.42.2 28-Sep-2008  mjf Sync with HEAD.
 1.23.42.1 03-Apr-2008  mjf Sync with HEAD.
 1.23.38.1 24-Mar-2008  keiichi sync with head.
 1.23.22.1 23-Mar-2008  matt sync with HEAD
 1.24.10.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.24.10.1 19-Oct-2008  haad Sync with HEAD.
 1.24.8.1 18-Jul-2008  simonb Sync with head.
 1.24.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.24.4.1 04-May-2009  yamt sync with head.
 1.25.4.1 27-Nov-2008  snj Pull up following revision(s) (requested by nakayama in ticket #131):
sys/arch/sparc64/sparc64/db_disasm.c: revision 1.15
sys/arch/sparc64/sparc64/db_trace.c: revision 1.41
sys/arch/sparc64/sparc64/db_interface.c: revision 1.113
sys/ddb/db_command.c: revision 1.124
sys/arch/sparc64/include/db_machdep.h: revision 1.26
Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.25.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.26.8.3 31-May-2011  rmind sync with head
 1.26.8.2 21-Apr-2011  rmind sync with head
 1.26.8.1 05-Mar-2011  rmind sync with head
 1.27.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.31.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.33.30.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.33.12.1 03-Dec-2017  jdolecek update from HEAD
 1.35.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 12-Jun-2005  dyoung Make disklabel(8) and fdisk(8) into "host tools " last step: build
and install ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-disklabel,
${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk by "reaching over" to
the sources in ${NETBSDSRCDIR}/sbin/{disklabel fdisk}/.

To avoid clashes with a build-host's header files, especially on
*BSD, the host-tools versions of fdisk and disklabel search for
#includes such as disklabel.h, disklabel_acorn.h, disklabel_gpt.h,
and bootinfo.h in a new #includes namespace, nbinclude/. That is,
they #include <nbinclude/sys/disklabel.h>, <nbinclude/machine/disklabel.h>,
<nbinclude/sparc64/disklabel.h>, instead of <sys/disklabel.h> and
such. I have also updated the system headers to #include from
nbinclude/-space when HAVE_NBTOOL_CONFIG_H is #defined.
 1.2 20-Jul-2002  mrg branches: 1.2.6;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 30-Dec-1999  eeh branches: 1.2.8; 1.2.12; 1.2.20;
Use absolute size structures for H/W registers.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.20.1 31-Aug-2002  gehenna catch up with -current.
 1.2.12.1 01-Aug-2002  nathanw Catch up to -current.
 1.2.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.14 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.13 12-Aug-2017  joerg Add sparc/sparc64 support for irelative relocations.
 1.12 31-Jan-2017  martin PR port-sparc64/51925: remove EM_SPARC32PLUS from the 64 bit ELF machine
ids we accept for our executables - that combination makes no sense
at all (probably copy&pasto).
 1.11 14-Nov-2013  martin branches: 1.11.6; 1.11.10; 1.11.14;
Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.
 1.10 30-May-2009  skrll branches: 1.10.12; 1.10.22; 1.10.26;
Add TLS relocation definitions.
 1.9 14-Mar-2006  cube branches: 1.9.68;
We really have EM_SPARC binaries in 32-bits mode, not EM_SPARC32PLUS.
And yes, we do have EM_SPARCV9 binaries in 64-bits mode.
 1.8 09-Dec-2001  thorpej branches: 1.8.32; 1.8.46; 1.8.48; 1.8.50; 1.8.52;
Add support for dumping ELF-cormat core files.
 1.7 11-Feb-2001  eeh branches: 1.7.4; 1.7.8;
Add some new gunk Sun uses.
 1.6 14-Jul-2000  eeh Add support for 64-bit PIC and dynamic linking.
 1.5 02-Apr-2000  minoura branches: 1.5.4;
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 02-Sep-1998  eeh branches: 1.3.12; 1.3.14; 1.3.16;
Periodic update: now starts probing devices.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.14.1 15-Nov-1999  fvdl Sync with -current
 1.3.12.2 11-Feb-2001  bouyer Sync with HEAD.
 1.3.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.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.7.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.7.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.52.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.8.50.1 01-Apr-2006  yamt sync with head.
 1.8.48.1 22-Apr-2006  simonb Sync with head.
 1.8.46.1 09-Sep-2006  rpaulo sync with head
 1.8.32.1 21-Jun-2006  yamt sync with head.
 1.9.68.1 20-Jun-2009  yamt sync with head
 1.10.26.1 18-May-2014  rmind sync with head
 1.10.22.2 03-Dec-2017  jdolecek update from HEAD
 1.10.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.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.11.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.11.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.11.6.2 28-Aug-2017  skrll Sync with HEAD
 1.11.6.1 05-Feb-2017  skrll Sync with 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.7 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.6 16-Mar-2000  mycroft Foolish consistency. Mainly, always use underscores and sys/endian.h.
 1.5 21-Aug-1999  simonb branches: 1.5.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.4 24-Jan-1999  mycroft Mark [hn]to[nh][ls]() with __const__, so they are subject to CSE.
 1.3 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.2 31-Jul-1998  mycroft (Always) (practice) (safe) (macro expansion).
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 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.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:26:47 +0000
 1.2 27-Nov-1999  mrg these files were removed years ago (exec.h was not even installed).
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 19-Sep-2001  thorpej Use <dev/sun/fbio.h>, not our own copy.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.24; 1.1.1.1.26; 1.1.1.1.28;
Import of sparc64.
 1.1.1.1.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.1.1.26.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.1.1.24.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.7 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.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 26-Jun-2000  simonb branches: 1.5.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.4 13-Apr-1999  ad branches: 1.4.2; 1.4.12;
Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.3 02-Sep-1998  eeh branches: 1.3.8;
Periodic update: now starts probing devices.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.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.3.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 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.24.1 03-Aug-2004  skrll Sync with HEAD
 1.2 20-May-2011  nakayama branches: 1.2.4;
Add fenv support for sparc. Mostly copied from sparc64 and share with it.
 1.1 31-Jan-2011  christos branches: 1.1.2; 1.1.4;
fenv support for sparc64 from Stathis Kamperis
 1.1.4.3 31-May-2011  rmind sync with head
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 31-Jan-2011  rmind file fenv.h was added on branch rmind-uvmplock on 2011-03-05 20:52:07 +0000
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 31-Jan-2011  bouyer file fenv.h was added on branch bouyer-quota2 on 2011-02-08 16:19:41 +0000
 1.2.4.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.4.1 20-May-2011  jruoho file fenv.h was added on branch jruoho-x86intr on 2011-06-06 09:06:52 +0000
 1.8 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.7 11-Dec-2005  christos branches: 1.7.74; 1.7.78; 1.7.84;
merge ktrace-lwp.
 1.6 23-Oct-2003  kleink * Move the definitions for types other than single-precision and double-
precision back to machine-dependent headers. C99 has no strict
requirement which, if any, extended-precision type `long double' must
match, and even between 80-bit formats there are differences in
implementation (m68k vs. x86).
* On arm, consider __VFP_FP__.
 1.5 12-May-2003  kleink branches: 1.5.2;
Rename <sys/float_ieee.h> to <sys/float_ieee754.h>, following libc's
convention for these.
 1.4 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.3 21-Sep-2001  eeh branches: 1.3.4;
Define proper constants for 128-bit floating point.
 1.2 27-Nov-1999  mrg branches: 1.2.6; 1.2.8;
merge cosmetic differences from sparc port.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.4.2 21-Sep-2001  eeh Define proper constants for 128-bit floating point.
 1.3.4.1 21-Sep-2001  eeh file float.h was added on branch nathanw_sa on 2001-09-21 20:48:03 +0000
 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.7.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.78.1 04-May-2009  yamt sync with head.
 1.7.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.15 20-Nov-2008  martin remove duplicate prototype (sys/signalvar.h is authoritive)
 1.14 11-Dec-2005  christos branches: 1.14.74; 1.14.78; 1.14.84; 1.14.86;
merge ktrace-lwp.
 1.13 27-Oct-2003  christos remove buildcontext
 1.12 26-Oct-2003  christos more siginfo glue
 1.11 20-Jul-2002  mrg branches: 1.11.6;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 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 04-Mar-2001  mrg branches: 1.9.4; 1.9.8;
oops; make this build with a 32 bit compiler again.
 1.8 02-Mar-2001  mrg clean up slightly; prepare to make this identical to sparc/frame.h.
 1.7 23-Jul-2000  mrg make this usable for for userland asm, which needs CC64FSZ
 1.6 11-Oct-1999  eeh branches: 1.6.2; 1.6.10;
Update to post 1.4.
 1.5 22-Sep-1998  eeh branches: 1.5.12;
More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.4 07-Sep-1998  eeh Make register32_t unsigned so we don't have sign extension problems.
 1.3 07-Sep-1998  eeh Fix problems copying in extended syscall arguments.
 1.2 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.5.12.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.10.1 26-Jul-2000  mycroft Approved by thorpej:
Enable pulling this into user-level code to get some definitions (e.g. CC64FSZ).

syssrc/sys/arch/sparc64/include/asm.h 1.11 -> 1.13
syssrc/sys/arch/sparc64/include/frame.h 1.6 -> 1.7
 1.6.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.9.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.9.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.8.1 31-Aug-2002  gehenna catch up with -current.
 1.11.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.6.1 03-Aug-2004  skrll Sync with HEAD
 1.14.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.78.1 04-May-2009  yamt sync with head.
 1.14.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.4 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.3 11-Dec-2005  christos branches: 1.3.78; 1.3.98; 1.3.100;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Import of sparc64.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.3.100.1 05-Mar-2011  rmind sync with head
 1.3.98.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.78.1 11-Aug-2010  yamt sync with head.
 1.8 03-Jul-2021  palle sun4v: add support for hypervisor soft state - from OpenBSD
 1.7 27-Apr-2021  palle sun4v: add missing method to set hypervisor api version + add defintion for the interrupt hypervisor api group (to be used)
 1.6 10-Feb-2017  palle branches: 1.6.30;
sun4v: Added handling of trap type 0x034 (address alignment error) + fixed typo mmfsa -> mmufsa. Verified for both sun4u and sun4v using qemu.
 1.5 24-Sep-2014  palle branches: 1.5.2; 1.5.4; 1.5.6;
sun4v: add code to enable startup of secondary cpus on both sun4u and sun4v systems - ok martin@
 1.4 08-Jun-2014  palle branches: 1.4.4;
sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.3 05-Jun-2014  palle sun4v: ensure that it is possible to include the hypervisor.h file more than once
 1.2 07-Dec-2013  palle branches: 1.2.2; 1.2.4; 1.2.6;
Added missing $ to sun4v sypervisor API
 1.1 07-Dec-2013  palle sun4v hypervisor API - from OpenBSD
 1.2.6.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.6.1 07-Dec-2013  yamt file hypervisor.h was added on branch yamt-pagecache on 2014-05-22 11:40:09 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 07-Dec-2013  rmind file hypervisor.h was added on branch rmind-smpnet on 2014-05-18 17:45:26 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.4.4.3 03-Dec-2017  jdolecek update from HEAD
 1.4.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.4.1 08-Jun-2014  tls file hypervisor.h was added on branch tls-maxphys on 2014-08-20 00:03:25 +0000
 1.5.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.5.4.1 20-Mar-2017  pgoyette Sync with HEAD
 1.5.2.1 28-Aug-2017  skrll Sync with HEAD
 1.6.30.2 01-Aug-2021  thorpej Sync with HEAD.
 1.6.30.1 13-May-2021  thorpej Sync with HEAD.
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 04-Dec-2001  darrenr branches: 1.3.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.2 05-Sep-1998  eeh branches: 1.2.26; 1.2.30;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.30.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.30.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.26.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.8.1 31-Aug-2002  gehenna catch up with -current.
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 21-Sep-2001  eeh branches: 1.3.4; 1.3.12;
Correct values for different rounding modes.
 1.2 15-Feb-1999  hubertf branches: 1.2.20; 1.2.22;
RCS ID police
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.22.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.20.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.12.1 31-Aug-2002  gehenna catch up with -current.
 1.3.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.4.1 21-Sep-2001  nathanw file ieeefp.h was added on branch nathanw_sa on 2002-08-01 02:43:41 +0000
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 10-Jan-2000  eeh branches: 1.3.8; 1.3.12; 1.3.20;
Add debugger single-stepping and fix interrupt dispatch bugs.
 1.2 22-Sep-1998  eeh branches: 1.2.12;
More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 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.20.1 31-Aug-2002  gehenna catch up with -current.
 1.3.12.1 01-Aug-2002  nathanw Catch up to -current.
 1.3.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.6; 1.1.12; 1.1.20;
Add definitions of C99 integer constant macros.
 1.1.20.1 31-Aug-2002  gehenna catch up with -current.
 1.1.12.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.12.1 14-Apr-2001  nathanw file int_const.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.1.6.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 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:42 +0000
 1.4 29-Jul-2002  mrg merge with sparc.
 1.3 06-Oct-2001  thorpej branches: 1.3.4; 1.3.12;
Make this match int_mwgwtypes.h (not that that header is really
correct, but they should at least be in-sync -- a PR has been
filed against int_mwgwtypes.h).
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.6;
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:42 +0000
 1.2.6.1 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.2.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 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.12.1 31-Aug-2002  gehenna catch up with -current.
 1.3.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.4.1 06-Oct-2001  nathanw file int_fmtio.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.10; 1.2.18;
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:42 +0000
 1.2.18.1 31-Aug-2002  gehenna catch up with -current.
 1.2.10.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.10.1 26-Apr-2001  nathanw file int_limits.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.2.4.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.6 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.5 15-Oct-2001  kleink branches: 1.5.4; 1.5.12;
Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.4 14-Oct-2001  kleink Fix a pasto in the __COMPILER_INT64__-based definition of {u,}intmax_t.
 1.3 22-Sep-2001  eeh Correct the `fast' int types.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.6;
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:42 +0000
 1.2.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 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.5.12.1 31-Aug-2002  gehenna catch up with -current.
 1.5.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.5.4.1 15-Oct-2001  nathanw file int_mwgwtypes.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.8 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.7 28-Apr-2001  kleink branches: 1.7.2; 1.7.8; 1.7.16;
* 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 17-Apr-2001  kleink Oops, intptrs are always long integers.
 1.5 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.4 03-Jan-2001  takemura branches: 1.4.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.3 27-Jun-2000  kleink branches: 1.3.2;
Typo.
 1.2 27-Jun-2000  kleink 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.3.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.3.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 27-Jun-2000  bouyer file int_types.h was added on branch thorpej_scsipi on 2000-11-20 20:26:48 +0000
 1.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.16.1 31-Aug-2002  gehenna catch up with -current.
 1.7.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.7.8.1 28-Apr-2001  nathanw file int_types.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.7.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.32 02-Sep-2023  jdc sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines
Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)
Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c
Add "socal" and "SUNW,bpp" to the interrupt map.
 1.31 27-Jul-2012  matt branches: 1.31.70;
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.30 13-Apr-2011  mrg branches: 1.30.4;
install <machine/intr.h> for crash(8).

(we could avoid this, but it would require a lot of contortions that
make the header files ugly. maybe someone else can figure out a less
ugly way of doing this later.)
 1.29 24-May-2010  martin branches: 1.29.2;
Make C declarations match assembler reality: ipi functions get two arguments
(which most of them (partly) ignore, but anyway).
 1.28 06-Mar-2010  mrg branches: 1.28.2;
clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.27 01-Feb-2010  mrg branches: 1.27.2;
- add a PDB_CTX_FLUSHALL debug type to pmap.c, and also log the cpu_number()
in a bunch more cases

- make sparc64_ipi_halt_thiscpu() and sparc64_ipi_pause_thiscpu() return void,
their callers never checked anyway.

- remove prototypes for sparc64_ipi_flush_ctx() and sparc64_ipi_flush_all(),
there are no such functions
 1.26 30-Nov-2009  nakayama sparc64_ipi_flush_ctx and sparc64_ipi_flush_all have been removed,
so remove its event counters as well.
 1.25 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.24 22-Apr-2008  nakayama branches: 1.24.2;
#include "opt_multiprocessor.h"
#include <machine/psl.h>

Make sparc64 kernel build again.
 1.23 14-Apr-2008  nakayama branches: 1.23.2;
Remove sparc64_ipi_sync_tick.

Since we can use counter-timer as timecounter instead of %tick on SMP kernel,
it is not necessary to sync all CPUs %tick registers.
 1.22 14-Mar-2008  nakayama Improve IPI handling:
- make IPI takes two arguments.
- add IPI event counters per-CPU.
- implement IPI functions which were missing or broken.
- insert DELAY while halting primary CPU in IPI handler.
 1.21 02-Mar-2008  martin Make ddb's "mach cpu" command do the right thing: run ddb on the requested
cpu. There is a tiny bit of cheating involved, but I assume we won't run
parallel + recursive ddb scripts to play towers of hanoi.

This fixes the wrong prompt, and (more importantly) makes things like
"mach dtlb" display the registers of the right MMU.
 1.20 15-Jan-2008  martin branches: 1.20.2; 1.20.6;
Rename cpuset_t for now to sparc64_cpuset_t, to avoid a name clash with
<sys/pset.h>. Mid-term we should probably convert to the MI cpuset_t.
 1.19 03-Dec-2007  ad branches: 1.19.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.18 17-Oct-2007  garbled branches: 1.18.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.17 17-May-2007  yamt branches: 1.17.8; 1.17.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.16 06-Oct-2006  jnemeth branches: 1.16.4; 1.16.8; 1.16.10; 1.16.16;
Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.15 18-Sep-2006  martin branches: 1.15.2;
Lazy FPU handling for the MULTIPROCESSOR case
 1.14 13-Sep-2006  mrg SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.13 04-May-2006  yamt branches: 1.13.8;
pull splraiseipl() for sparc64 from newlock branch.
reviewed by Martin Husemann.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 20-May-2004  petrov branches: 1.11.12;
De-_P()fy, remove not MULTIPROCESSOR defines for sparc64_ipi_xxx.
 1.10 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.9 16-Jun-2003  thorpej branches: 1.9.2;
Rename IPL_IMP -> IPL_VM.
 1.8 14-Jan-2001  thorpej branches: 1.8.12;
Rename __GENERIC_SOFT_INTERRUPTS to __HAVE_GENERIC_SOFT_INTERRUPTS,
and place the definition in <machine/types.h>. This can now be used
as a flag to indicate whether or not <machine/intr.h> can be included
to get the generic soft interrupt API.
 1.7 03-Dec-2000  fvdl Make softintr_establish prototype match other ports, avoiding compile
warnings.
 1.6 23-Aug-2000  eeh Update the scheduler to the new locking scheme.
 1.5 26-Jun-2000  eeh Advertise we have __GENERIC_SOFT_INTERRUPTS.
 1.4 24-Jun-2000  eeh Make these interrupt levels reflect reality a bit better.
 1.3 02-Jun-2000  eeh branches: 1.3.2;
New softintr interface.
 1.2 16-Mar-2000  eeh branches: 1.2.2;
Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.1 30-May-1999  mrg branches: 1.1.2; 1.1.4;
clone intr.h from the SPARC.
 1.1.4.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.4.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.8.12.1 17-Mar-2002  thorpej IPL_IMP -> IPL_VM
 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.11.12.6 17-Mar-2008  yamt sync with head.
 1.11.12.5 21-Jan-2008  yamt sync with head
 1.11.12.4 07-Dec-2007  yamt sync with head
 1.11.12.3 03-Sep-2007  yamt sync with head.
 1.11.12.2 30-Dec-2006  yamt sync with head.
 1.11.12.1 21-Jun-2006  yamt sync with head.
 1.12.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.12.10.1 11-May-2006  elad sync with head
 1.12.8.2 14-Sep-2006  yamt sync with head.
 1.12.8.1 24-May-2006  yamt sync with head.
 1.12.6.1 01-Jun-2006  kardel Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.8.1 18-Nov-2006  ad Sync with head.
 1.15.2.2 22-Oct-2006  yamt sync with head
 1.15.2.1 18-Sep-2006  yamt file intr.h was added on branch yamt-splraiseipl on 2006-10-22 06:05:11 +0000
 1.16.16.1 22-May-2007  matt Update to HEAD.
 1.16.10.1 11-Jul-2007  mjf Sync with head.
 1.16.8.2 03-Dec-2007  ad Sync with HEAD.
 1.16.8.1 27-May-2007  ad Sync with head.
 1.16.4.1 28-Apr-2007  martin Add missing prototype for MP kernels
 1.17.10.3 23-Mar-2008  matt sync with HEAD
 1.17.10.2 09-Jan-2008  matt sync with HEAD
 1.17.10.1 06-Nov-2007  matt sync with HEAD
 1.17.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.18.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.18.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.19.6.1 19-Jan-2008  bouyer Sync with HEAD
 1.20.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.20.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.20.2.1 24-Mar-2008  keiichi sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.24.2.3 11-Aug-2010  yamt sync with head.
 1.24.2.2 11-Mar-2010  yamt sync with head
 1.24.2.1 16-May-2008  yamt sync with head.
 1.27.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.27.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.28.2.2 21-Apr-2011  rmind sync with head
 1.28.2.1 30-May-2010  rmind sync with head
 1.29.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.4.1 30-Oct-2012  yamt sync with head
 1.31.70.1 09-Sep-2023  martin Pull up following revision(s) (requested by jdc in ticket #360):

sys/arch/sparc64/dev/fdc.c: revision 1.52
sys/arch/sparc64/include/intr.h: revision 1.32
sys/arch/sparc64/sparc64/autoconf.c: revision 1.239
sys/arch/sparc64/include/psl.h: revision 1.64

sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines

Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)

Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c

Add "socal" and "SUNW,bpp" to the interrupt map.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 07-Jul-2004  drochner branches: 1.1.2;
also add <machine/joystick.h> to alpha and amd64, to allow compilation
of certain multimedia applications
 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 07-Jul-2004  skrll file joystick.h was added on branch ktrace-lwp on 2004-08-03 10:41:34 +0000
 1.4 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 04-Dec-2001  darrenr branches: 1.2.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.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32;
Import of sparc64.
 1.1.1.1.32.3 27-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.1.1.28.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.1.1.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.8.1 31-Aug-2002  gehenna catch up with -current.
 1.3 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 18-Jan-2008  martin branches: 1.6.6; 1.6.8; 1.6.10;
Extend the MD kernel core header, so that crashdumps record enough
information to recover all per-cpu mappings. This provides access to
the interrupt stack for example.
 1.5 05-Nov-2007  martin branches: 1.5.2; 1.5.8;
Extend the sparc64 cpu kcore segment so that it records all kernel mappings
done via locked 4 MB pages. The old format could only record physically
continous kernel text mappings.
For compatibility reasons, just extend the structure and fill in all the
old fields as well.
 1.4 01-Aug-2000  eeh branches: 1.4.40; 1.4.76; 1.4.82; 1.4.92; 1.4.100; 1.4.102; 1.4.106;
Overhaul cache flush code and coredump code.
 1.3 13-Aug-1998  eeh branches: 1.3.12; 1.3.22;
Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.3.22.1 07-Aug-2000  mrg pull up 1.4 (approved by thorpej):
>Overhaul cache flush code and coredump code.
 1.3.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.4.106.1 13-Nov-2007  bouyer Sync with HEAD
 1.4.102.2 23-Mar-2008  matt sync with HEAD
 1.4.102.1 06-Nov-2007  matt sync with HEAD
 1.4.100.1 06-Nov-2007  joerg Sync with HEAD.
 1.4.92.2 18-Jan-2008  skrll Backported version of martin's changes to:

Extend the MD kernel core header, so that crashdumps record enough
information to recover all per-cpu mappings. This provides access to
the interrupt stack for example.
 1.4.92.1 30-Dec-2007  skrll Apply changes from ticket #983.

Modified Files:
src/sys/arch/sparc64/include: kcore.h
src/sys/arch/sparc64/sparc64: pmap.c

Log Message:
Extend the sparc64 cpu kcore segment so that it records all kernel mappings
done via locked 4 MB pages. The old format could only record physically
continous kernel text mappings.
For compatibility reasons, just extend the structure and fill in all the
old fields as well.

Modified Files:
src/lib/libkvm: kvm_sparc64.c

Log Message:
Use the new sparc64 kcore cpu segment extensions to properly map VA/PAs
on kernels with more then 4 MB text/rodata segment.
 1.4.82.1 03-Dec-2007  ad Sync with HEAD.
 1.4.76.2 16-Sep-2008  bouyer Sync with the following revisions (requested by skrll in ticket #1196):
gnu/dist/gdb removed
gnu/usr.bin/gdb53 removed
distrib/cats/instkernel/Makefile 1.14.6.1
gnu/dist/gdb6/bfd/config.bfd 1.3.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.c 1.1.1.2.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/Makefile.in 1.2.2.1.2.2
gnu/dist/gdb6/gdb/alpha-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alpha-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/alphabsd-nat.h 1.1.2.1
gnu/dist/gdb6/gdb/alphabsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphanbsd-nat.c 1.1.2.1
gnu/dist/gdb6/gdb/alphanbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64nbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/amd64nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/arm-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/armbsd-tdep.c 1.1.2.1
gnu/dist/gdb6/gdb/armnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/armnbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure.ac 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/m68kbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/mipsnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/nbsd-thread.c 1.1.2.3
gnu/dist/gdb6/gdb/ppcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/ppcnbsd-tdep.c 1.3.6.1
gnu/dist/gdb6/gdb/sh-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/shnbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/shnbsd-tdep.c 1.1.1.2.6.4
gnu/dist/gdb6/gdb/shnbsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc64nbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/sparcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/tramp-frame.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/vaxbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/config/alpha/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/arm/nbsd.mt 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/arm/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/i386/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/m68k/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/mips/nbsd.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/powerpc/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/sh/nbsd.mh 1.1.1.1.6.2
gnu/dist/gdb6/gdb/config/sh/tm-nbsd.h 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/vax/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/opcodes/configure 1.1.1.2.6.1
gnu/dist/gdb6/opcodes/configure.in 1.1.1.2.6.1
gnu/usr.bin/Makefile 1.126.4.1
gnu/usr.bin/gdb6/arch/alpha/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/alpha/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/init.c 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/nm.h 1.2.6.1
gnu/usr.bin/gdb6/arch/arm/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/arm/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/defs.mk 1.1.6.3
gnu/usr.bin/gdb6/arch/armeb/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/i386/defs.mk 1.4.4.1
gnu/usr.bin/gdb6/arch/i386/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68k/defs.mk 1.1.4.1
gnu/usr.bin/gdb6/arch/m68k/init.c 1.1.4.1
gnu/usr.bin/gdb6/arch/mipseb/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/mipseb/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/mipseb/init.c 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/config.h 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/defs.mk 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/init.c 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/tm.h 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/version.c 1.2.6.2
gnu/usr.bin/gdb6/arch/powerpc/defs.mk 1.3.6.1
gnu/usr.bin/gdb6/arch/powerpc/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/sh3eb/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3eb/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3eb/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3eb/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3el/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3el/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3el/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sparc/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/sparc64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc64/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/x86_64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/x86_64/init.c 1.1.6.1
gnu/usr.bin/gdb6/bfd/arch/armeb/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/vax/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/gdb/Makefile 1.5.2.1.2.2
gnu/usr.bin/gdb6/gdbtui/Makefile 1.2.6.1
gnu/usr.bin/gdb6/libiberty/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/sim/arch/mipseb/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/defs.mk 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/defs.mk 1.1.2.1
lib/libkvm/kvm_sparc64.c 1.10.18.2
lib/libpthread/pthread.c 1.48.6.4
lib/libpthread/pthread_barrier.c 1.6.18.1
lib/libpthread/pthread_cond.c 1.18.12.2
lib/libpthread/pthread_debug.h 1.8.18.1
lib/libpthread/pthread_int.h 1.34.4.5
lib/libpthread/pthread_lock.c 1.14.6.1
lib/libpthread/pthread_mutex.c 1.22.4.2
lib/libpthread/pthread_run.c 1.18.12.4
lib/libpthread/pthread_rwlock.c 1.13.6.2
lib/libpthread/pthread_sa.c 1.37.6.5
lib/libpthread/pthread_sig.c 1.47.4.8
lib/libpthread/pthread_sleep.c 1.7.6.2
lib/libpthread/sem.c 1.9.6.2
lib/libpthread/arch/sh3/pthread_md.h 1.3.6.1
regress/lib/libpthread/resolv/Makefile 1.1.12.1
regress/lib/libpthread/sigrunning/Makefile 1.1.2.1
regress/lib/libpthread/sigrunning/sigrunning.c 1.1.2.1
share/mk/bsd.own.mk 1.489.4.3
sys/arch/amd64/amd64/locore.S 1.18.14.1
sys/arch/amd64/amd64/machdep.c 1.44.2.3.2.1
sys/arch/amd64/conf/kern.ldscript 1.1.70.1
sys/arch/cats/conf/Makefile.cats.inc 1.17.30.1
sys/arch/shark/conf/Makefile.shark.inc 1.6.30.1
sys/arch/sparc64/conf/kern.ldscript 1.7.26.2
sys/arch/sparc64/conf/kern32.ldscript 1.6.26.2
sys/arch/sparc64/include/kcore.h 1.4.92.2
sys/arch/sparc64/sparc64/locore.s 1.232.4.4
sys/arch/sparc64/sparc64/machdep.c 1.193.4.3
sys/arch/sparc64/sparc64/pmap.c 1.184.2.1.2.4
sys/conf/newvers.sh 1.42.26.2
sys/kern/kern_sa.c 1.87.4.11
sys/kern/kern_synch.c 1.173.4.2
sys/sys/savar.h 1.20.10.2
tools/gdb/Makefile 1.9.4.1
tools/gdb/mknative-gdb 1.1.6.1

pullup the wrstuden-fixsa CVS branch to netbsd-4:
toolchain/35540 - GDB 6 support for pthreads.
port-sparc64/37534 - ktrace firefox gives
kernel trap 30: data access expection
GDB changes:
- delete gdb53
- enable gdb6 on all architectures
- add support for amd64 crash dumps
- add support for sparc64 crash dumps
- add support for /proc pid to executable filename for all archs
- enable thread support for all architectures
- add a note section to kernels to all platforms
- support detection/unwinding of signals for most architectures.
- Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT on sh3.
- Apply fix from binutils-current so that sparc gdb can be cross built
on a 64bit host.
SA/pthread changes:
Pre-allocate memory needed for event delivery. Eliminates dropped
interrupts under load.
Deliver intra-process signals to running threads
Eliminate some deadlock scenarios
Fix intra-process signal delivery when delivering to a thread waiting
for signals. Makes afs work again!
 1.4.76.1 01-Feb-2008  riz Pull up following revision(s) (requested by martin in ticket #983):
sys/arch/sparc64/include/kcore.h: revision 1.5
lib/libkvm/kvm_sparc64.c: revision 1.11
sys/arch/sparc64/sparc64/pmap.c: revision 1.201
Extend the sparc64 cpu kcore segment so that it records all kernel mappings
done via locked 4 MB pages. The old format could only record physically
continous kernel text mappings.
For compatibility reasons, just extend the structure and fill in all the
old fields as well.
Use the new sparc64 kcore cpu segment extensions to properly map VA/PAs
on kernels with more then 4 MB text/rodata segment.
 1.4.40.2 21-Jan-2008  yamt sync with head
 1.4.40.1 15-Nov-2007  yamt sync with head.
 1.5.8.1 19-Jan-2008  bouyer Sync with HEAD
 1.5.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.6.10.1 16-May-2008  yamt sync with head.
 1.6.8.1 18-May-2008  yamt sync with head.
 1.6.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.10 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.9 03-May-2002  thorpej branches: 1.9.2;
Don't define _LP64 here.
 1.8 08-Aug-2000  tshiozak branches: 1.8.4; 1.8.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.7 07-Mar-2000  kleink branches: 1.7.2; 1.7.4;
Define ISO C99 (unsigned) long long (min, max) symbols.
 1.6 27-Nov-1999  mrg make this idempotent (from sparc/include/limits.h)
 1.5 31-Jan-1999  mrg branches: 1.5.8; 1.5.14;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.4 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.3 11-Sep-1998  eeh Add support for 64-bit types if _LP64 is defined.
 1.2 06-Aug-1998  kleink _POSIX_SOURCE -> _POSIX_C_SOURCE
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.5.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.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.7.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.8.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.8.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.8.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.8.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.1 31-Aug-2002  gehenna catch up with -current.
 1.4 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.3 28-Apr-2008  martin branches: 1.3.44; 1.3.60;
Remove clause 3 and 4 from TNF licenses
 1.2 27-Jan-2006  cdi branches: 1.2.72; 1.2.74; 1.2.76;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.1 16-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.44; 1.1.56;
include the sparc loadfile_machdep.h as-is; we can blow this header away
completely later.
 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 16-Aug-2000  bouyer file loadfile_machdep.h was added on branch thorpej_scsipi on 2000-11-20 20:26:48 +0000
 1.1.2.2 26-Aug-2000  mrg pull up from trunk. approved by thorpej.
 1.1.2.1 16-Aug-2000  mrg file loadfile_machdep.h was added on branch netbsd-1-5 on 2000-08-26 01:00:25 +0000
 1.2.76.1 16-May-2008  yamt sync with head.
 1.2.74.1 18-May-2008  yamt sync with head.
 1.2.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.60.1 10-Aug-2014  tls Rebase.
 1.3.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9 20-Jul-2002  mrg branches: 1.9.52;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.8 05-May-2000  hannken branches: 1.8.8; 1.8.12; 1.8.16; 1.8.20;
Fix for lint during build of libc.
 1.7 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.6 01-May-2000  thorpej Fix a declaration inside __ldstub().
 1.5 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.4 27-Jul-1999  thorpej branches: 1.4.2;
Make a slight rearrangement in how <machine/lock.h> is included.
 1.3 27-Jul-1999  thorpej Define apporpriate an value for SIMPLELOCK_LOCKED, based on the
semantics of ldstub.
 1.2 27-Jul-1999  thorpej Prepend `cpu_' to the machine-dependent atomic locking primitivies.
 1.1 30-May-1999  eeh branches: 1.1.2;
Grab real locks from the sparc port. I suppose we could use casa and casx
instead of ldstub, but since we aren't doing n-way locking it makes little
difference. N.B. Need to decide what to do with sparc64/sparc64/asm.h which
has name conflicts with sparc64/include/asm.h. So far most of
sparc64/sparc64/asm.h has been moved to ctlreg.h.
 1.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.1.2.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.8.20.1 31-Aug-2002  gehenna catch up with -current.
 1.8.16.1 19-Mar-2002  thorpej Change __cpu_simple_lock_t to a single byte.
 1.8.12.1 01-Aug-2002  nathanw Catch up to -current.
 1.8.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.52.2 06-Feb-2007  ad Test for the presence of 'membar' by checking for __sparc_v9__.
 1.9.52.1 29-Dec-2006  ad Checkpoint work in progress.
 1.9 17-Oct-2015  nakayama Move LP64 and ILP32 conversion macros COMBINE, SPLIT from locore.h
to asm.h, and provide SPLIT_RETL for the case SPLIT and then retl
immediately.
 1.8 23-Aug-2015  joerg Remove .proc 1, it has been ignored by gas for ages.
 1.7 23-Aug-2015  joerg .align ensures alignment, so replace .uaword with .word.
 1.6 16-Mar-2013  christos branches: 1.6.14;
move the useful macros somewhere where they can be used in userland.
 1.5 10-Jul-2010  nakayama branches: 1.5.8; 1.5.18;
Clear the upper word explicitly before combining two 32-bit values to 64-bit
on 32-bit kernels.
 1.4 23-May-2010  martin Split copy related functions out of locore.s into copy.S, move functions
only needed on multiprocessors into mp_subr.S.
 1.3 07-Mar-2010  mrg branches: 1.3.2; 1.3.4; 1.3.6;
need _ALIGN in locore.h as well, for DEBUG kernels.
 1.2 07-Mar-2010  mrg gas has supported SPARC ".empty" for a long while; get rid of an
ancient workaround.
 1.1 06-Mar-2010  mrg move the memcpy/memset implementations out into their own file, with the
block copy versions as well. move some of the definitions in locore.s
into a new locore.h.

locore.s is almost 2000 lines shorter with this change.
 1.3.6.3 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.6.1 07-Mar-2010  uebayasi file locore.h was added on branch uebayasi-xip on 2010-04-30 14:39:52 +0000
 1.3.4.2 05-Mar-2011  rmind sync with head
 1.3.4.1 30-May-2010  rmind sync with head
 1.3.2.3 11-Aug-2010  yamt sync with head.
 1.3.2.2 11-Mar-2010  yamt sync with head
 1.3.2.1 07-Mar-2010  yamt file locore.h was added on branch yamt-nfs-mp on 2010-03-11 15:03:00 +0000
 1.5.18.2 03-Dec-2017  jdolecek update from HEAD
 1.5.18.1 23-Jun-2013  tls resync from head
 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.6.14.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.6.14.1 22-Sep-2015  skrll Sync with HEAD
 1.2 30-Nov-2024  uwe branches: 1.2.4;
sparc64/lwp_private.h: just include the sparc version
 1.1 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.2.4.2 02-Aug-2025  perseant Sync with HEAD
 1.2.4.1 30-Nov-2024  perseant file lwp_private.h was added on branch perseant-exfatfs on 2025-08-02 05:56:10 +0000
 1.7 15-Dec-2008  mrg merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.6 11-Dec-2005  christos branches: 1.6.74; 1.6.78; 1.6.86; 1.6.88; 1.6.92;
merge ktrace-lwp.
 1.5 28-Oct-2003  kleink #define __HAVE_LONG_DOUBLE on platforms which implement a distinct
`long double' type.
 1.4 19-Feb-2002  simonb branches: 1.4.16;
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:26:48 +0000
 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.6.92.1 11-May-2009  bouyer branches: 1.6.92.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.6.92.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.6.88.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.6.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.78.1 04-May-2009  yamt sync with head.
 1.6.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.11 18-May-2024  thorpej 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.10 19-Feb-2018  mrg 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.9 12-Sep-2012  manu branches: 1.9.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.8 16-Mar-2006  cube branches: 1.8.102;
s/uint32_t/unsigned int/ because we don't always have the former defined.

Reported by Juergen Hannken-Illjes.

XXX I prefer uint32_t, but there might be some namespace issues so for now
it will do.
 1.7 14-Mar-2006  cube Under COMPAT_NETBSD32 emulation, pointers are not the same size as the
native ones... netbsd32_pointer_t can't be used here though, so uint32_t
is used instead, which is of course the same thing.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.6; 1.6.8; 1.6.10;
merge ktrace-lwp.
 1.5 10-Jul-2005  martin Fix COMPAT_NETBSD32 ucontext padding and move the definition next to the
(sparc) original.
 1.4 26-Oct-2003  christos branches: 1.4.14; 1.4.16;
more siginfo glue
 1.3 13-Oct-2003  christos Add mcontext32_t and friends. This is WIP.
 1.2 18-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 17-Nov-2001  martin branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.4 17-Dec-2002  thorpej Just include <sparc/mcontext.h>
 1.1.2.3 04-Jan-2002  eeh Cleanup.
 1.1.2.2 03-Jan-2002  petrov define _UC_MACHINE_SP
 1.1.2.1 17-Nov-2001  martin Sparc64 *context routines, from Klaus Klein.
 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.4.16.1 21-Jun-2006  yamt sync with head.
 1.4.14.1 11-Jul-2005  tron Pull up revision 1.5 (requested by martin in ticket #570):
Fix COMPAT_NETBSD32 ucontext padding and move the definition next to the
(sparc) original.
 1.6.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.6.8.1 01-Apr-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.8.102.1 30-Oct-2012  yamt sync with head
 1.9.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.9.32.2 26-Feb-2018  snj revert ticket 552, which broke the build
 1.9.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.5 22-Jun-2016  palle branches: 1.5.16;
sun4v: add cbus driver - from OpenBSD
 1.4 06-Sep-2015  martin On SUN4V make the mdesc data available early in pmap_bootstrap, so we
can set up the uvm page colors correctly.
Based on code from palle@.
 1.3 22-Mar-2015  palle branches: 1.3.2;
sun4v: added new function mdesc_name_by_idx() for retrieving the name of a node
 1.2 19-Jan-2015  palle sun4v: Add two new functions to the mdesc api: mdesc_find_node_by_idx() and mdesc_next_node()
 1.1 10-Jan-2015  palle sun4v: add hypervisor machine description (mdesc) functions - from OpenBSD
 1.3.2.4 09-Jul-2016  skrll Sync with HEAD
 1.3.2.3 22-Sep-2015  skrll Sync with HEAD
 1.3.2.2 06-Apr-2015  skrll Sync with HEAD
 1.3.2.1 22-Mar-2015  skrll file mdesc.h was added on branch nick-nhusb on 2015-04-06 15:18:03 +0000
 1.5.16.2 03-Dec-2017  jdolecek update from HEAD
 1.5.16.1 22-Jun-2016  jdolecek file mdesc.h was added on branch tls-maxphys on 2017-12-03 11:36:45 +0000
 1.10 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.9 11-Jul-2023  martin Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE
 1.8 09-Jul-2023  riastradh machine/mutex.h: Sprinkle includes so this can be used by crash(8).

XXX pullup-10
 1.7 25-Aug-2021  thorpej branches: 1.7.4;
- In kern_mutex.c, if MUTEX_CAS() is not defined, define it in terms of
atomic_cas_ulong().
- For arm, ia64, m68k, mips, or1k, riscv, vax: don't define our own
MUTEX_CAS(), as they either use atomic_cas_ulong() or equivalent
(atomic_cas_uint() on m68k).
- For alpha and sparc64, don't define MUTEX_CAS() in terms of their own
_lock_cas(), which has its own memory barriers; the call sites in
kern_mutex.c already have the appropriate memory barrier calls. Thus,
alpha and sparc64 can use default definition.
- For sh3, don't define MUTEX_CAS() in terms of its own _lock_cas();
atomic_cas_ulong() is strong-aliased to _lock_cas(), therefore defining
our own MUTEX_CAS() is redundant.

Per thread:
https://mail-index.netbsd.org/tech-kern/2021/07/25/msg027562.html
 1.6 29-Nov-2019  riastradh Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.
 1.5 29-Nov-2019  riastradh Nix mb_* on sparc and sparc64.
 1.4 28-Apr-2008  martin branches: 1.4.88;
Remove clause 3 and 4 from TNF licenses
 1.3 21-Nov-2007  yamt branches: 1.3.14; 1.3.16; 1.3.18;
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 mutex.h was initially added on branch newlock2.
 1.1.2.3 01-Feb-2007  ad Header file cleanup.
 1.1.2.2 12-Jan-2007  ad Sync with head.
 1.1.2.1 11-Jan-2007  ad Checkpoint work in progress.
 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.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.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 mutex.h was added on branch yamt-lazymbuf on 2007-02-26 09:08:24 +0000
 1.3.18.1 16-May-2008  yamt sync with head.
 1.3.16.1 18-May-2008  yamt sync with head.
 1.3.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.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.1 19-Mar-2002  thorpej branches: 1.1.2;
file mutex_impl.h was initially added on branch newlock.
 1.1.2.5 22-Mar-2002  thorpej Wrap the stuff that manipulates the guts of a mutex in __MUTEX_PRIVATE.
 1.1.2.4 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.3 20-Mar-2002  thorpej mtx_dummy needs to be unsigned.
 1.1.2.2 19-Mar-2002  thorpej Shuffle the mutex structure around and change types such that the
mutex now 8 bytes instead of 16.

Note we need a different layout for LP64 vs ILP32, since we want
one particular field to overlap with the LSB of the "mtx_owner"
field.
 1.1.2.1 19-Mar-2002  thorpej First draft of mutex and rwlock implementation for sparc64.
 1.29 19-Oct-2016  skrll PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.28 04-Jan-2014  dsl branches: 1.28.6; 1.28.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.27 29-May-2008  mrg branches: 1.27.32; 1.27.42; 1.27.48;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.26 27-Jan-2008  dsl branches: 1.26.6; 1.26.8; 1.26.10; 1.26.12;
Remove NETBSD32_OFF_T_RETURN() netbsd32_lseek() now uses MI code to return
all 64 bits of the new position.
 1.25 17-Oct-2007  garbled branches: 1.25.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.24 16-Sep-2007  dsl Fix previous, 'long long' is 8 byte aligned on sparc32
 1.23 16-Sep-2007  dsl Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.
 1.22 16-Mar-2007  dsl branches: 1.22.4; 1.22.12; 1.22.14;
Use NETBSD32PTR64() and NETBSD32PTR32() throughout.
 1.21 14-Mar-2006  cube branches: 1.21.16; 1.21.20; 1.21.22; 1.21.24;
Add the sparc64 MD bits to get usable coredumps for COMPAT_NETBSD32
binaries.
 1.20 11-Feb-2006  cdi branches: 1.20.2; 1.20.4;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.19 11-Dec-2005  christos branches: 1.19.2; 1.19.4; 1.19.6;
merge ktrace-lwp.
 1.18 27-Sep-2005  chs remove unnecessary includes.
 1.17 12-Jul-2005  martin When returning 64bit values (from netbsd32_lseek) fix up the return
value vector (of 32bit values, most likely) via a MD macro.
 1.16 20-Feb-2004  drochner branches: 1.16.16;
provide a definition NETBSD32_MID_MACHINE which tells for the a.out MID
to look for in 32-bit emulation
 1.15 26-Sep-2003  christos move MI stuff to the MI include
 1.14 29-Jun-2003  fvdl branches: 1.14.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.13 29-Jun-2003  martin struct proc * -> struct lwp *
 1.12 16-Apr-2003  dsl change 'data' arg of fo_ioctl to void * to match file.h
 1.11 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.10 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.9 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.8 03-Jan-2002  mrg branches: 1.8.8;
clean up
 1.7 03-Jan-2002  mrg move sparc specific ioctl handling (fb & openprom) into arch/sparc64.
 1.6 09-May-2001  kleink branches: 1.6.2; 1.6.8;
Sync with native emul: rename sc_tstate to sc_psr.
 1.5 30-Dec-1999  eeh branches: 1.5.6;
Update 32-bit sigcontext structures.
 1.4 11-Oct-1999  eeh branches: 1.4.2;
Update to post 1.4.
 1.3 26-Mar-1999  eeh branches: 1.3.8;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.2 25-Mar-1999  mrg clean and up make compile
 1.1 25-Mar-1999  mrg move sparc32 MD bits here.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -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.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.8.6 11-Nov-2002  nathanw Catch up to -current
 1.6.8.5 01-Aug-2002  nathanw Catch up to -current.
 1.6.8.4 28-Feb-2002  nathanw Catch up to -current.
 1.6.8.3 11-Jan-2002  nathanw More catchup.
 1.6.8.2 04-Jan-2002  eeh Cleanup.
 1.6.8.1 09-May-2001  eeh file netbsd32_machdep.h was added on branch nathanw_sa on 2002-01-04 19:12:25 +0000
 1.6.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.8.1 17-Jul-2002  gehenna catch up with -current.
 1.14.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.16.4 04-Feb-2008  yamt sync with head.
 1.16.16.3 27-Oct-2007  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.19.6.1 22-Apr-2006  simonb Sync with head.
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.19.2.1 18-Feb-2006  yamt sync with head.
 1.20.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.20.2.1 01-Apr-2006  yamt sync with head.
 1.21.24.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.21.22.1 11-Jul-2007  mjf Sync with head.
 1.21.20.2 09-Oct-2007  ad Sync with head.
 1.21.20.1 10-Apr-2007  ad Sync with head.
 1.21.16.1 24-Mar-2007  yamt sync with head.
 1.22.14.2 23-Mar-2008  matt sync with HEAD
 1.22.14.1 06-Nov-2007  matt sync with HEAD
 1.22.12.1 02-Oct-2007  joerg Sync with HEAD.
 1.22.4.1 03-Oct-2007  garbled Sync with HEAD
 1.25.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.26.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.26.10.1 04-May-2009  yamt sync with head.
 1.26.8.1 04-Jun-2008  yamt sync with head
 1.26.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.48.1 18-May-2014  rmind sync with head
 1.27.42.2 03-Dec-2017  jdolecek update from HEAD
 1.27.42.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.32.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.10.1 04-Nov-2016  pgoyette Sync with HEAD
 1.28.6.1 05-Dec-2016  skrll Sync with HEAD
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 21-Mar-2004  pk Reach over to the sparc versions.
 1.2 04-Dec-2001  darrenr branches: 1.2.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.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32;
Import of sparc64.
 1.1.1.1.32.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.16.1 03-Aug-2004  skrll Sync with HEAD
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 21-Mar-2004  pk Reach over to the sparc openfirm & openprom implementation.
 1.11 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.10 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.9 05-Oct-2001  eeh branches: 1.9.4; 1.9.20;
Make OF_interpret() handle input and output arguments.
 1.8 20-Jul-2001  eeh branches: 1.8.2;
PCI overhaul.
 1.7 18-Nov-2000  mrg branches: 1.7.4;
sync with sparc port. add support for OF_setprop(), OF_nextprop(),
OF_interpret() and OF_milliseconds().
 1.6 31-Jan-1999  mrg branches: 1.6.8;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.5 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.4 27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.6.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.7.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.4.1 03-Aug-2001  lukem update to -current
 1.8.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.9.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.20.1 03-Aug-2004  skrll Sync with HEAD
 1.9.4.2 05-Oct-2001  eeh Make OF_interpret() handle input and output arguments.
 1.9.4.1 05-Oct-2001  eeh file openfirm.h was added on branch nathanw_sa on 2001-10-05 21:52:44 +0000
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 10-Jan-2002  briggs branches: 1.2.8;
Add OPIOCFINDDEVICE to match dev/ofw/openfirmio.[ch].
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32;
Import of sparc64.
 1.1.1.1.32.3 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.1.1.32.1 11-Jan-2002  nathanw More catchup.
 1.1.1.1.28.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.1.1.28.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.8.1 31-Aug-2002  gehenna catch up with -current.
 1.63 24-Apr-2025  martin Add a STACK_ALIGNBYTES definition
 1.62 31-May-2021  simonb branches: 1.62.18;
Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include <machine/param.h>.
 1.61 28-Sep-2019  christos branches: 1.61.12;
remove local version of mstohz() now that <sys/param.h> provides it.
 1.60 15-May-2019  christos 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.59 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.58 13-Feb-2017  skrll branches: 1.58.12; 1.58.14;
G/C VM_MAX_KERNEL_BUF
 1.57 15-Apr-2016  martin branches: 1.57.2; 1.57.4;
If compiling with SUN4V support, bump MAXCPUS to 256.
 1.56 27-Oct-2015  mrg make sure MSGBUFSIZE can't expand strangely by using parens.
 1.55 08-Oct-2014  macallan branches: 1.55.2;
Ths has been sitting in my tree for years...
Allow the Xserver to map PCI IO space. Not needed for Sun-branded graphics
cards but Xorg can actually cold boot a few others, which will need it.
( if only to access standard VGA registers )
 1.54 10-Jul-2014  jdc Increase maximum MSGBUFSIZE to 248k.
While here, remove 2 sparc(32)-only entries (from mrg@).
 1.53 21-Feb-2014  palle branches: 1.53.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.52 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.51 03-Jan-2013  martin branches: 1.51.2;
Rearange VA layout for 64 bit kernels, as suggested by Lars Heidieker:
move the dynamic kernel memory past 4GB (basically unlimiting it) and
use the now freed address range past kernel data upto 2GB for modules.
 1.50 10-Mar-2012  nakayama branches: 1.50.2;
Fix previous, which causes an integer overflow error in uvm_km.c on
32-bit kernels.
 1.49 09-Mar-2012  jdc Restrict NKMEMPAGES to 2.5GB, otherwise we will run out of space in the
kernel_map on machines with 8GB (or more) main memory.

XXX: Moving KERNBASE/KERNEND is a better long term solution, but this allows
those machines to boot now.
 1.48 04-Feb-2012  para branches: 1.48.2;
improve sizing of kmem_arena now that more allocations are made from it
don't enforce limits if not required

ok: riz@
 1.47 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.46 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.45 12-May-2011  mrg branches: 1.45.4; 1.45.8;
first steps towards fujitsu SPARC64 support:

- add CPU_SUN4US and CPU_SUN4V defines
- re-introduce "cputyp" and use it for sun4u/sun4us/sun4v
 1.44 08-Feb-2010  joerg branches: 1.44.2; 1.44.4;
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.43 26-Aug-2008  rjs branches: 1.43.14;
Set MACHINE to sparc for 32bit kernels.

Approved by martin.
 1.42 17-Oct-2007  garbled branches: 1.42.16; 1.42.20; 1.42.22; 1.42.26;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.41 06-Sep-2007  martin Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.
 1.40 25-Aug-2007  martin branches: 1.40.2;
Remove INITSTACK completely - at the time we used to switch to it, we
already have access to all of lwp0 and it's uarea - so we can switch
to the correct lwp0 stack easily before calling main.
 1.39 17-May-2007  yamt branches: 1.39.4; 1.39.8;
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.38 24-Jan-2007  hubertf branches: 1.38.2; 1.38.6; 1.38.8; 1.38.14;
Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

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

Thanks to martin@ for the input on testing.
 1.37 17-Oct-2006  mrg allocate 128KB (as opposed to 64KB) per-cpu, and place the interrupt
stack, cpu_info structure, panicstack, idle uarea and normal kernel
stack in here. the idle uarea and kernel stack are in the 2nd 64KB
page. the interrupt stack and cpu_info structure are as the same
place in the 1st 64KB page, and the panicstack grows down from the
top of this page. update comments in param.h to suit (XXX: a lot
of these constants should move to a header file that will not pollute
the name space so much.) map these pages identically between
cpu_initialise() and cpu_mp_startup(), and deal with the two 64KB
pages in pmap_extract(). keep an unmapped 64KB page between them.

don't initialise the unused "ci_eintstack" member of the cpu_info
structure

use constants to initialise many addresses in the cpu_info structure,
consolidating these assignments from cpu0 and cpu>0

delete u0/estack0/panicstack from locore.s

clean up some wrong comments in locore.s

fix a 32bit-only bug in cpu_mp_startup().

delete 'u0' entirely.


this fixes recent random lossage seen on port-sparc64: processes
stuck in RUN state, data faults, and hangs.
 1.36 28-Aug-2006  yamt branches: 1.36.2; 1.36.4;
- remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
ctod
dtoc
ctob
btoc
dbtob
btodb
 1.35 20-Feb-2006  cdi branches: 1.35.2;
Use ANSI-style function definitions and declarations.
 1.34 11-Dec-2005  christos branches: 1.34.2; 1.34.4; 1.34.6;
merge ktrace-lwp.
 1.33 12-Dec-2004  abs branches: 1.33.10;
Fix comments slighly
 1.32 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.31 17-Jul-2002  thorpej branches: 1.31.6;
Remove CPU_ISSUN4MOR4U, CPU_ISSUN4OR4C, and CPU_ISSUN4COR4M.
 1.30 18-Apr-2002  eeh branches: 1.30.2;
Calculate NBPG from PGSHFT.
 1.29 08-Apr-2002  eeh Add a nice 64-bit mstohz() and clean out some cruft.
 1.28 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.27 09-Feb-2002  eeh Increase NMBCLUSTERS.
 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 30-May-2001  mrg branches: 1.25.2; 1.25.8;
use _KERNEL_OPT
 1.24 11-Feb-2001  eeh branches: 1.24.2;
Increase NKMEMPAGES to a more useful value.
 1.23 28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.22 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.21 24-Jun-2000  eeh Get rid of vaddrs.h.
 1.20 19-Jun-2000  eeh branches: 1.20.2;
Have separate data and text segments, make text read-only.
 1.19 13-Jun-2000  eeh Missing paren.
 1.18 12-Jun-2000  eeh Start reorganizing the kernel for MULTIPROCESSOR support.
 1.17 22-May-2000  mrg branches: 1.17.2;
add two new CPU_ISXXX versions: CPU_ISSUN4U, CPU_ISSUN4MOR4U
 1.16 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.15 04-Dec-1999  ragge CL* discarding.
 1.14 27-Nov-1999  mrg minor cosmetic merges; long way to go here.
 1.13 21-Nov-1999  eeh Move KERNBASE down from 0xf8000000 to 0xf1000000, just beyond the PROM.
 1.12 20-Nov-1999  eeh Limit buffers to 1/4 of the kernel address space.
 1.11 07-Jun-1999  eeh branches: 1.11.2; 1.11.8;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.10 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.9 31-Jan-1999  mrg branches: 1.9.4;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.8 06-Oct-1998  eeh It seems taht 64-bit kernels need bigger stacks.
 1.7 09-Sep-1998  thorpej If _LP64, set MID_MACHINE to MID_SPARC64, else MID_SPARC. This allows us
to uniquely identify ILP32 vs. LP64 core files, and prevents an LP64 kernel
from incorrectly choosing emul_netbsd when it should choose emul_sparc32.
 1.6 09-Sep-1998  eeh Change to MACHINE_ARCH=sparc64 for LP64 machines.
 1.5 06-Sep-1998  eeh 32-bit fixup.
 1.4 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 20-Jun-1998  mrg branches: 1.2.2;
pull in opt_gateway.h for options GATEWAY
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.8.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.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.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.17.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.20.2.2 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.20.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.24.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.25.8.6 01-Aug-2002  nathanw Catch up to -current.
 1.25.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.25.8.4 17-Apr-2002  nathanw Catch up to -current.
 1.25.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.25.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.25.8.1 30-May-2001  nathanw file param.h was added on branch nathanw_sa on 2002-01-08 00:28:00 +0000
 1.25.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.25.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.25.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.25.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.2.1 21-Jul-2002  gehenna catch up with -current.
 1.31.6.4 18-Dec-2004  skrll Sync with HEAD.
 1.31.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.31.6.1 03-Aug-2004  skrll Sync with HEAD
 1.33.10.5 27-Oct-2007  yamt sync with head.
 1.33.10.4 03-Sep-2007  yamt sync with head.
 1.33.10.3 26-Feb-2007  yamt sync with head.
 1.33.10.2 30-Dec-2006  yamt sync with head.
 1.33.10.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 01-Mar-2006  yamt sync with head.
 1.35.2.1 03-Sep-2006  yamt sync with head.
 1.36.4.1 22-Oct-2006  yamt sync with head
 1.36.2.2 01-Feb-2007  ad Sync with head.
 1.36.2.1 18-Nov-2006  ad Sync with head.
 1.38.14.2 03-Oct-2007  garbled Sync with HEAD
 1.38.14.1 22-May-2007  matt Update to HEAD.
 1.38.8.1 11-Jul-2007  mjf Sync with head.
 1.38.6.2 09-Oct-2007  ad Sync with head.
 1.38.6.1 27-May-2007  ad Sync with head.
 1.38.2.1 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.39.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.39.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.39.4.2 10-Sep-2007  skrll Sync with HEAD.
 1.39.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.40.2.1 06-Nov-2007  matt sync with HEAD
 1.42.26.1 19-Oct-2008  haad Sync with HEAD.
 1.42.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.42.20.2 11-Mar-2010  yamt sync with head
 1.42.20.1 04-May-2009  yamt sync with head.
 1.42.16.1 28-Sep-2008  mjf Sync with HEAD.
 1.43.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.44.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.44.2.1 31-May-2011  rmind sync with head
 1.45.8.2 11-Mar-2012  mrg sync to latest -current
 1.45.8.1 18-Feb-2012  mrg merge to -current.
 1.45.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.45.4.2 23-Jan-2013  yamt sync with head
 1.45.4.1 17-Apr-2012  yamt sync with head
 1.48.2.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by martin in ticket #123):
sys/arch/sparc64/include/param.h: revision 1.49
sys/arch/sparc64/include/param.h: revision 1.50
Restrict NKMEMPAGES to 2.5GB, otherwise we will run out of space in the
kernel_map on machines with 8GB (or more) main memory.
XXX: Moving KERNBASE/KERNEND is a better long term solution, but this allows
those machines to boot now.
Fix previous, which causes an integer overflow error in uvm_km.c on
32-bit kernels.
 1.50.2.3 03-Dec-2017  jdolecek update from HEAD
 1.50.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.50.2.1 25-Feb-2013  tls resync with head
 1.51.2.1 18-May-2014  rmind sync with head
 1.53.2.1 10-Aug-2014  tls Rebase.
 1.55.2.3 28-Aug-2017  skrll Sync with HEAD
 1.55.2.2 22-Apr-2016  skrll Sync with HEAD
 1.55.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.57.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.57.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.58.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.58.14.1 10-Jun-2019  christos Sync with HEAD
 1.58.12.1 18-Jan-2019  pgoyette Synch with HEAD
 1.61.12.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.62.18.1 02-Aug-2025  perseant Sync with HEAD
 1.16 13-Oct-2009  pooka protect against multi-inclusion
 1.15 04-Mar-2007  christos branches: 1.15.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 11-Feb-2006  cdi branches: 1.14.20;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.13 11-Dec-2005  christos branches: 1.13.2; 1.13.4; 1.13.6;
merge ktrace-lwp.
 1.12 27-Mar-2004  eeh branches: 1.12.16;
License cleanup.
 1.11 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 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 16-May-2002  eeh branches: 1.9.8;
Don't use smaller trapframes. Causes more problems that it's worth right now. CVS: ----------------------------------------------------------------------
 1.8 14-May-2002  eeh branches: 1.8.2;
Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.7 29-Dec-2000  eeh branches: 1.7.4; 1.7.8;
64-bit address values should be unsigned.
 1.6 18-Nov-2000  mrg struct pcb's lastcall is const char *
 1.5 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.4 30-Dec-1999  eeh branches: 1.4.4;
struct core32 is now in MI headers.
 1.3 06-Nov-1999  eeh Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.2 11-Oct-1999  eeh branches: 1.2.2; 1.2.4;
Update to post 1.4.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.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.3 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.2 22-Nov-2000  bouyer Sync with HEAD.
 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.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.7.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.7.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.2.1 30-May-2002  gehenna Catch up with -current.
 1.9.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.8.1 03-Aug-2004  skrll 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.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.1 18-Feb-2006  yamt sync with head.
 1.14.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.44.1 11-Mar-2010  yamt sync with head
 1.31 23-Jun-2024  riastradh pci: Pass cookie through pci_find_device, pci_enumerate_bus, take 2.

New functions pci_find_device1 and pci_enumerate_bus1 have the cookie
argument. Existing symbols pci_find_device and pci_enumerate_bus are
now wrappers for the cookieless version.

This will allow pci_find_device callers to pass a cookie through to
the match function so they can keep state or pass in extra parameters
like b/d/f numbers, which will allow us to nix some horrible kludges
in the Linux PCI API emulation for drm (and, perhaps, Intel wifi).

This change drops the symbol pci_probe_device, in favour of a new
pci_probe_device1 with the cookie argument. But I don't think that
requires a revbump because it's only called by MD pci_enumerate_bus1
implementations, which don't live in modules anyway.

Take 2: Make sure to handle NULL match function.
 1.30 20-May-2024  riastradh Revert "pci: Pass cookie through pci_find_device, pci_enumerate_bus."

Evidently something is wrong with this, to be diagnosed and redone
once the builds and tests are in better shape.
 1.29 20-May-2024  riastradh pci: Pass cookie through pci_find_device, pci_enumerate_bus.

New functions pci_find_device1 and pci_enumerate_bus1 have the cookie
argument. Existing symbols pci_find_device and pci_enumerate_bus are
now wrappers for the cookieless version.

This drops the symbol pci_probe_device, in favour of a new
pci_probe_device1 with the cookie argument. But I don't think that
requires a revbump because it's only called by MD pci_enumerate_bus1
implementations, which don't live in modules anyway.
 1.28 07-Jul-2016  msaitoh branches: 1.28.48;
KNF. Remove extra spaces. No functional change.
 1.27 29-Mar-2014  christos branches: 1.27.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.26 27-Oct-2012  chs branches: 1.26.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.25 04-Apr-2011  dyoung branches: 1.25.4; 1.25.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.24 06-Jan-2010  mrg branches: 1.24.4; 1.24.6;
move the guts of pci_intr_map() into pci_machdep.c, and move the schizo
ign addition into a hook. also, don't double shift the ign in set_intr.

tested on U60 and SB2500.
 1.23 30-Nov-2009  mrg convert pci_intr_map() into a chipset tag function pointer, and implement
the schizo version slightly differently.

pull out the schizo's IGN from the upaid, not the apparently broken device
ID register. from openbsd.

with this i appear to have valid working interrupts on the SB2500.

tested on U60 and SB2500.


XXX: we can probably kill (*spc_find_ino)() now that pci_intr_map() itself
XXX: is no longer a first class function.
 1.22 10-Dec-2008  mrg ofpci_make_tag():
don't write PCI_COMMAND_STATUS_REG with
PCI_COMMAND_(MEM|MASTER|IO)_ENABLE, or it in.
sparc_pci_childspace():
move psycho.c:get_childspace() into pci_machdep.c but rename it
psycho_alloc_bus_tag():
use M_ZERO
 1.21 09-Dec-2008  nakayama Fix CardBus, PCI-PCI bridge support borked in previous commit.
 1.20 07-Dec-2008  mrg a few clean up/rearrange changes, somewhat inspired from openbsd's
schizo.c:

- rename pp_busnode{} -> spc_busnode{}, and move it to
sparc_pci_chipset{}

- move public pci functions pci_conf_read(), pci_conf_write() and
pci_intr_establish() into psycho.c, renaming them in the process,
and add pointers through sparc_pci_chipset{} to access them.
as part of this, add PDB_INTMAP and PDB_CONF debug options to
psycho.c

- move and rename sparc64 private pci_find_ino() into
sparc_pci_chipset{}, like the above

- update psycho_alloc_chipset() to set the new 4 function members


no functional change intended. XXX: not tested on cardbus.
 1.19 29-May-2008  mrg branches: 1.19.4; 1.19.6;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.18 11-Feb-2006  cdi branches: 1.18.68; 1.18.70; 1.18.72; 1.18.74;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.17 11-Dec-2005  christos branches: 1.17.2; 1.17.4; 1.17.6;
merge ktrace-lwp.
 1.16 17-Aug-2004  drochner branches: 1.16.12;
make PCI devices attachable/detachable (as far as the particular drivers
allow), and allow to rescan a bus selectively (ie only the device/
function I'm looking at)
 1.15 29-Jul-2004  drochner give the special PCI bus enumerator a sparc64_ prefix and make the
PCI_MACHDEP_ENUMERATE_BUS macro point to it
 1.14 16-May-2002  eeh branches: 1.14.8;
Make the PCI code actually work.
 1.13 16-May-2002  thorpej branches: 1.13.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.12 15-May-2002  thorpej Let machine-dependent code specify how to enumerate the bus.
Currently, everyone uses pci_enumerate_bus_generic().
 1.11 15-May-2002  thorpej Garbage-collect __PCI_DEV_FUNCORDER.
 1.10 15-May-2002  thorpej Implement pci_decompose_tag().
 1.9 26-Feb-2002  eeh Fix PR# port-sparc64/13811: PCITAG_SETNODE() is defined using `x' insted of `t'.
from URA Hiroshi
 1.8 18-Oct-2001  eeh branches: 1.8.4;
Disable __PCI_DEV_FUNCORDER since it's now badly borken.
 1.7 20-Jul-2001  eeh PCI overhaul.
 1.6 02-Mar-2001  mrg branches: 1.6.4;
use pci_bus_devorder() and pci_dev_funcorder()
 1.5 28-Dec-2000  sommerfeld Change pci_intr_map to get interrupt source information from a "struct
pci_attach_args *" instead of from four separate parameters which in
all cases were extracted from the same "struct pci_attach_args".

This both simplifies the driver api, and allows for alternate PCI
interrupt mapping schemes, such as one using the tables described in
the Intel Multiprocessor Spec which describe interrupt wirings for
devices behind pci-pci bridges based on the device's location rather
the bridge's location.

Tested on alpha and i386; welcome to 1.5Q
 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 01-Jun-2000  cgd kill __P in these files. (I had to look at them anyway with an eye for
adding some protos... and adding them with __P seems wrong, but mixing
__P and not __P in the same file seems wrong too, so...)
 1.2 24-May-2000  eeh branches: 1.2.2;
Use the PCI function code to distinguish simba bus A from bus B instead
of the current hack.
 1.1 04-Jun-1999  mrg branches: 1.1.2; 1.1.4;
PCI driver for the UltraSPARC. this only works on the Ultra5/10 machines
(`SUNW,sabre') for now, and it doesn't really quite work there yet anyway.
the bus space/dma code is cloned from the sbus driver. the IOMMU code also
is cloned from the sbus code, but separated out into iommu.c so that we can
share it with the sbus driver. hopefully, much of the bus space/dma code
can also be re-shared with the sbus driver and the ebus driver but for now
these copies will do.

support for the real UltraSPARC PCI (`SUNW,psycho') is unwritten, though
most of this code is shared with it.

we can probe PCI config space and try to configue devices, but interrupts
don't work yet...
 1.1.4.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.4.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.6.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.4.1 03-Aug-2001  lukem update to -current
 1.8.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.8.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.8.4.2 26-Feb-2002  eeh Fix PR# port-sparc64/13811: PCITAG_SETNODE() is defined using `x' insted of `t'.
from URA Hiroshi
 1.8.4.1 18-Oct-2001  eeh file pci_machdep.h was added on branch nathanw_sa on 2002-02-26 22:05:55 +0000
 1.13.2.2 30-May-2002  gehenna Catch up with -current.
 1.13.2.1 16-May-2002  gehenna file pci_machdep.h was added on branch gehenna-devsw on 2002-05-30 15:35:54 +0000
 1.14.8.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.8.3 18-Sep-2004  skrll Sync with HEAD.
 1.14.8.2 25-Aug-2004  skrll Sync with HEAD.
 1.14.8.1 03-Aug-2004  skrll Sync with HEAD
 1.16.12.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 18-Feb-2006  yamt sync with head.
 1.18.74.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.72.2 11-Mar-2010  yamt sync with head
 1.18.72.1 04-May-2009  yamt sync with head.
 1.18.70.1 04-Jun-2008  yamt sync with head
 1.18.68.2 17-Jan-2009  mjf Sync with HEAD.
 1.18.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.24.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.24.4.1 21-Apr-2011  rmind sync with head
 1.25.14.3 03-Dec-2017  jdolecek update from HEAD
 1.25.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 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 30-Oct-2012  yamt sync with head
 1.26.2.1 18-May-2014  rmind sync with head
 1.27.6.1 09-Jul-2016  skrll Sync with HEAD
 1.28.48.1 04-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #928):

sys/external/bsd/drm2/dist/drm/drm_gem.c: revision 1.25
sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c: revision 1.7
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/priv.h: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_acpi.c: revision 1.4
sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h: revision 1.6
sys/external/bsd/drm2/dist/drm/i915/i915_drv.h: revision 1.49
sys/external/bsd/drm2/include/linux/mxm-wmi.h: revision 1.1
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_pcie.c: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c: revision 1.13
sys/external/bsd/common/include/linux/bitops.h: revision 1.17
sys/external/bsd/drm2/nouveau/files.nouveau: revision 1.40
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.30
sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_pcie.c: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_base.c: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c: revision 1.12
sys/external/bsd/drm2/dist/drm/radeon/radeon_rv770.c: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_sorgm200.c: revision 1.3
sys/external/bsd/common/include/linux/printk.h: revision 1.14
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_gk20a.c: revision 1.10
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vi.c: revision 1.4
sys/external/bsd/drm2/include/linux/acpi.h: revision 1.11
sys/external/bsd/drm2/drm/drm_cdevsw.c: revision 1.31
sys/external/bsd/drm2/dist/drm/radeon/radeon_si.c: revision 1.6
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c: revision 1.5
sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.h: revision 1.5
sys/external/bsd/drm2/include/acpi/video.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c: revision 1.6
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.h: revision 1.4
sys/arch/sparc64/include/pci_machdep.h: revision 1.31
sys/arch/sparc64/dev/pci_machdep.c: revision 1.83
sys/external/bsd/drm2/include/linux/kref.h: revision 1.14
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_pci.c: revision 1.12
sys/external/bsd/drm2/linux/linux_dma_buf.c: revision 1.17
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_shadowacpi.c: revision 1.4
sys/external/bsd/drm2/drm/drm_module.c: revision 1.32
sys/external/bsd/drm2/dist/drm/i915/i915_gem.h: revision 1.8
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_dmabuf.c: revision 1.7
sys/external/bsd/drm2/include/linux/smp.h: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_si.c: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c: revision 1.20
sys/arch/x86/x86/bus_dma.c: revision 1.91
sys/external/bsd/drm2/radeon/files.radeon: revision 1.40
sys/external/bsd/drm2/include/acpi/acpi_bus.h: revision 1.1
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drv.h: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c: revision 1.21
sys/external/bsd/common/include/asm/barrier.h: revision 1.20
sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h: revision 1.2
sys/external/bsd/common/include/asm/barrier.h: revision 1.21
sys/modules/drmkms/drmkms_pci.h: revision 1.1
sys/external/bsd/drm2/dist/drm/drm_dp_helper.c: revision 1.17
sys/external/bsd/drm2/radeon/radeon_pci.c: revision 1.23
sys/external/bsd/drm2/linux/linux_xa.c: revision 1.4
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.23
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.24
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.25
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.26
sys/dev/pci/pcivar.h: revision 1.120
sys/arch/xen/include/pci_machdep.h: revision 1.24
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.26
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.27
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.27
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.28
sys/external/bsd/drm2/dist/drm/radeon/radeon_cik.c: revision 1.8
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.28
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.29
sys/external/bsd/drm2/include/linux/pci.h: revision 1.57
sys/external/bsd/drm2/include/linux/pci.h: revision 1.58
sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c: revision 1.6
sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_hwmgr.c: revision 1.3
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c: revision 1.3
share/man/man9/bus_dma.9: revision 1.69
sys/external/bsd/drm2/drm/drm_gem_cma_helper.c: revision 1.15
sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c: revision 1.6
sys/external/bsd/drm2/dist/drm/radeon/radeon.h: revision 1.12
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik.c: revision 1.7
sys/dev/acpi/acpi_mcfg.c: revision 1.29
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c: revision 1.6
sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c: revision 1.7
sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c: revision 1.13
sys/modules/amdgpu/Makefile: revision 1.9
sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c: revision 1.14
sys/external/bsd/common/linux/linux_tasklet.c: revision 1.12
sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/device.h: revision 1.10
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.23
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h: revision 1.9
sys/external/bsd/drm2/include/linux/interval_tree.h: revision 1.14
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.26
sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c: revision 1.5
sys/dev/pci/pci.c: revision 1.168
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.27
sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c: revision 1.9
sys/external/bsd/drm2/pci/files.drmkms_pci: revision 1.18
sys/external/bsd/drm2/linux/linux_sync_file.c: revision 1.3
sys/external/bsd/drm2/amdgpu/files.amdgpu: revision 1.31
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_tegra.c: revision 1.4
sys/external/bsd/drm2/dist/drm/drm_gem.c: revision 1.24
sys/arch/xen/xen/xpci_xenbus.c: revision 1.29

drm: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals.
Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html

linux asm/barrier.h: Fix !MULTIPROCESSOR build.

remove "nouveau" from a comment. noted by jmcneill.

drm: KASSERT(A && B) -> KASSERT(A); KASSERT(B)
comment a function that has a clear overbounds read but it isn't used.
found by GCC 12.

nix the NetBSD specific GEM_BUG_ON().
avoids GCC 12 warnings, and matches upstream closer.
avoid uninitialised variable usage in drm_gem_cma_create_internal().
in the case nothing has returned 'error', 'nsegs' and the dma info
are (potentially) uninitialised, so consider this an error.
found by GCC 12.

avoid a GCC 12 warning.
there's a 1-element long array and a loop conditional that tries to see
if indexes for it are not identical. as these indexes will always both
be 0, the only valid index, the condition is always false. GCC 12
triggers a strange warning on this code that can never run (see below),
so simply assert the array size is 1 and comment the rest.
amdgpu_dc_stream.c:470:55: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
470 | stream->writeback_info[j] = stream->writeback_info[i];

convert a KASSERT() into an if () panic() sequence to appease GCC 12.
OK riastradh@.

drm: Fix conditionals around drmkms_pci and agp.
Kernel should build now with all pci drm drivers stripped out but
DRM_LEGACY still enabled. (Might not be very useful, but it'll
build. Maybe we should also have DRM_LEGACY_PCI so those drivers can
be modloaded later.)

drmkms: Fix module build.
avoid an unlikely array bounds issue picked up by GCC 12.
nvkm_pcie_speed() can return -1, which is then used as an array index,
so make this default return PCIe 1.0 speeds.

drm: enable almost all PCIe functionality
linux_pci.c revisions 1.24 and 1.25 implemented most of the remaining
missing PCIe backends, but only enabled them for some amdgpu portions.
this enables all code marked with "XXX amdgpu pcie", "XXX radeon pcie",
and "XXX pcie speed". for most of it, simply removing #ifndefs __NetBSD__
to enable compliation was required, once the new "bus->max_bus_speed"
member was added to struct pci_bus. add an "always fails" backend for
pci_enable_atomic_ops_to_root() which seems to only be necessary
for virtual GPU functionality (and could be implemented if needed.)
tested on radeon 5450, 7750, R7 240 [radeon], and RX 550 [amdgpu], and
nvidia 750 and 1030 [nouveau].
this still does not quite work on nvidia cards. there are two problems
that remain:
- the call to set the link speed is skipped because the speed is set
to the default value of "-1". nvkm_pcie_set_link() will actually
determine the right value for this and for some cards, calling this
function if the current speed is -1 helps set the link speed. it
may be that on linux other paths we don't have enabled properly
would set this (there's one via debugfs, and a jetson specific one,
though perhaps setting either AC or DC speed values as boot options
(after hooking up these for netbsd) would currently work.
- worse, cards newer than kepler - geforce 900, 1000, and newer, are
all lacking the backing support to set pcie link speed. the GT 1030
card i have been testing with remains at pcie 1.0.

radeon: fix and enable ACPI methods for getting ROM BIOS
The hacky way of getting the BIOS mapped only works on x86. ACPI
should be preferred if available. Makes BIOS reading though VFCT
work on aarch64 with EDK2. (But only if EDK2 has POSTed the GPU.)
XXX amdgpu should get the same treatment.

drm: put_cpu() should enable preemption, not disable it again

drm(4): make pr_debug equivalent to aprint_debug
significantly reduces the default spam from amdgpu(4).

drm: Set CONFIG_ACPI in linux/acpi.h and make it build.

Leave a little ACPI-related functionality disabled for now, like
getting EDID out of ACPI -- needs a bit more work to make this work,
and I don't have hardware to work on that.
Should help with failures of the forms:
- unable to locate a BIOS ROM
- bios: unable to locate usable image
on various machines.

radeon_acpi.c: ifdef out unused function on NetBSD.
Should fix syzkaller build.

drm(4): Fix st_rdev in stat.
dminor->index already has the 64*type adjustment, as allocated in
drm_minor_alloc.
PR kern/58180

linux_sync_file: Fix missing init/fini steps.
Noted by rjs@.
PR kern/58210

ttm: Sync ttm_bo_uvm_fault_idle better with Linux.
PR xsrc/58133
ttm: Undo mistake in previous.

PR xsrc/58133
linux: Add a few more cases to pci_get_class.
Should fix crash on boot with amdgpu now that the ACPI business is
enabled.

i915: Fix dmabuf mmap object.

drm: Fix missing bounds checks in dma buf mmap.

drm_gem.c: Fix sense of assertion.
This is the opposite of WARN_ON.
Noted by rjs@.

drm_gem.c: Enable drm_gem_fence_array_add now that we emulate xa.
linux_xa: Delete and replace collision in xa_store as intended.
Don't free the colliding node that's still in the tree.
Noted by rjs@.

i915_gem_mman.c: Apply mmap types via pmap flags.
This way, userland gets buffers mapped write-combining or uncached as
needed.
PR xsrc/58307

x86: Teach bus_dmamem_map about BUS_DMA_PREFETCHABLE.
PR port-amd64/58308

bus_dma(9): Document BUS_DMA_PREFETCHABLE.
Like BUS_DMA_NOCACHE. Doesn't absolve you of the need for
bus_dmamap_sync, but if you later pass the vaddr to bus_dmamap_load,
the DMA map might notice the mapping is write-combining and use this
to make bus_dmamap_sync cheaper.
PR kern/58309

nouveau_nvkm_subdev_instmem_gk20a.c: Use BUS_DMA_PREFETCHABLE.
Matches Linux's pgprot_writecombine.
Unclear where the appropriate bus_dmamap_sync happens, or is supposed
to happen -- not using it would be wrong, but asking for a
prefetchable mapping may paper over symptoms, at least!

ttm: Sync more with Linux.
Add the original copyright and attribution since this is now,
intentionally, a modified copy of the original and not just roughly
the same algorithm.

ttm: Respect PGO_ALLPAGES.
Not sure this is useful but it reduces XXX's and makes this match
udv_fault better so it's easier to understand.

ttm: Sync cacheability flag logic with Linux.

ttm: Add XXX about readahead fault failures.

pci: Pass cookie through pci_find_device, pci_enumerate_bus, take 2.
New functions pci_find_device1 and pci_enumerate_bus1 have the cookie
argument. Existing symbols pci_find_device and pci_enumerate_bus are
now wrappers for the cookieless version.
This will allow pci_find_device callers to pass a cookie through to
the match function so they can keep state or pass in extra parameters
like b/d/f numbers, which will allow us to nix some horrible kludges
in the Linux PCI API emulation for drm (and, perhaps, Intel wifi).
This change drops the symbol pci_probe_device, in favour of a new
pci_probe_device1 with the cookie argument. But I don't think that
requires a revbump because it's only called by MD pci_enumerate_bus1
implementations, which don't live in modules anyway.
Take 2: Make sure to handle NULL match function.
linux_pci: Nix pci enumeration kludges.
Now that we can pass a cookie through, this stuff will be a little
less fragile.

i915: Omit needless i915_gem_object_pin/unpin_pages cycle in fault.
vm_fault_cpu and vm_fault_gtt, called by i915_gem_fault, already do
the pinning and unpinning internally, so there is no need for
i915_gem_fault to do it.
No functional change intended, except that the transient pin count
will be one lower than before during the fault routine (but it will
still be positive).

i915: Match Linux fault routine return code actions.
Omit needless EINTR interception -- this is now handled by
i915_error_to_vmf_fault.
Earlier revert was over a false alarm -- bisection shows the new
warnings arose from linux_pci.c 1.29 here:
https://mail-index.netbsd.org/source-changes/2024/06/23/msg151929.html

linux_pci: Fix shifto in pci_get_class.
It looks like Linux's pci_get_class also matches the interface part
of the PCI class register (but not the revision part), and I hadn't
noticed that in the previous shim structured differently.

With GCC12 kernel ALL/amd64 triggers "'sor' may be used uninitialized".
If "sublinks & 3" is zero GCC is right and sor[1] may be returned unitialized.
Fix by initializing "sor" to zero to return -1 instead of uninitialized value.
Ok: Taylor R Campbell <riastradh@>

amdgpu: Map BAR 2, not BAR 5, on pre-bonaire chips.
PR kern/58384

amdgpu: Map consecutive pages, not the same one over and over again.
PR kern/58385

linux/bitops: Fix overestimate for BITS_TO_LONGS(9)
Fortunately, this seems harmless except for allocating
excessive buffer memory.
Pointed out by nonaka@, OK riastradh@.
 1.64 06-Sep-2020  mrg forward declare struct vm_page, and include uvm_prot.h and uvm_pmap.h.

fixes build, presumeably after uvm.h external rototill.
 1.63 15-Dec-2019  ad Merge from yamt-pagecache:

- do gang lookup of pages using radixtree.
- remove now unused uvm_object::uo_memq and vm_page::listq.queue.
 1.62 10-Jan-2019  mrg - move pmap_ctx() macro into pmap.h instead of duplicating it.
- fix description of some mach ddb commands.
 1.61 04-Nov-2016  macallan branches: 1.61.14; 1.61.16;
add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE
 1.60 06-Sep-2015  nakayama branches: 1.60.2;
Use <machine/*.h> instead of <sparc64/*.h> for consistency.
 1.59 04-Sep-2014  palle branches: 1.59.2;
sun4v: All cpus must be setup with a TSB descriptor, so pmap_setup_tsb_sun4v() must take a pointer to the TSB descriptor
 1.58 14-Apr-2014  martin Implement and enable TOPDOWN_VM. From Chuck Silvers.
 1.57 27-Dec-2013  palle branches: 1.57.2;
a) make the hunt through the cpus list more generic b) sun4v: ensure that the interrupt stack is mapped permanently and the TSB is setup properly - parts from OpenBSD. OK martin@
 1.56 11-Sep-2013  martin Disallow MAP_FIXED mmap's in the sparc64 VA hole (XXX - need to deal with
different variants of the hole for different CPU types)
 1.55 06-Oct-2011  mrg branches: 1.55.2; 1.55.12; 1.55.16;
make struct page_size_map consistent across DEBUG/!DEBUG kernels.
 1.54 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.53 14-Nov-2010  uebayasi branches: 1.53.6;
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.52 06-Mar-2010  mrg branches: 1.52.2;
clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.51 04-Mar-2010  mrg - in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.
 1.50 24-Feb-2010  mrg move the tlb flush routines into cache.h to avoid machine/pmap.h polution.
 1.49 24-Feb-2010  mrg - re-introduce sp_tlb_flush_pte() and sp_tlb_flush_all() that call
the right USI/USIII version.
- define tlb_flush_pte() in terms of sp_tlb_flush_pte() for the
!MULTIPROCESSOR case

this centralises some CPU_IS_USIII_UP() tests.
 1.48 23-Feb-2010  mrg oops. don't call sp_tlb_flush_pte_usiii() on USI/USII.
 1.47 02-Feb-2010  mrg branches: 1.47.2;
- split sp_tlb_flush_pte() and switchtoctx() into sp_tlb_flush_pte_us()/
sp_tlb_flush_pte_usiii() and switchtoctx_us()/switchtoctx_usiii() and
implement the latter while i'm here. it works ... sometimes i think,
but also sometimes panics/hangs.
- fix a comment in sparc64_ipi_flush_pte_usiii()
 1.46 01-Feb-2010  mrg - sp_tlb_flush_all() becomes sp_tlb_flush_all_us() and sp_tlb_flush_all_usiii()
- sparc64_ipi_flush_pte() becomes sparc64_ipi_flush_pte_us() and
sparc64_ipi_flush_pte_usiii()
- add some commented out code to disable interrupts and raise the traplevel
in sparc64_ipi_flush_pte_usiii()
- cache_flush_phys() was missing a little of code in the cheetah case
 1.45 30-Nov-2009  mrg delete some no longer used code:
- smp_tlb_flush_ctx()
- smp_tlb_flush_all()
- sparc64_ipi_flush_ctx()
- sparc64_ipi_flush_all()
- sp_tlb_flush_ctx()
 1.44 12-Dec-2008  pooka this header needs machine/cpuset.h
 1.43 10-Dec-2008  martin Backout previous - Matt, you probably did a partial update and didn't
pick up the sys/uvm changes.
 1.42 10-Dec-2008  mrg fix sparc64 build: provide pmap_kernel(), re-provide pmap_t.

fixes builds for my U60.
 1.41 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.40 14-Mar-2008  nakayama branches: 1.40.4; 1.40.10; 1.40.12; 1.40.14; 1.40.20;
Complete per-CPU TSBs and MMU contexts changes.
 1.39 28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.38 04-Mar-2007  christos branches: 1.38.20; 1.38.36; 1.38.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.37 20-Feb-2006  cdi branches: 1.37.20;
Use ANSI-style function definitions and declarations.
 1.36 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.35 27-Jan-2006  cdi branches: 1.35.2; 1.35.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.34 11-Dec-2005  christos branches: 1.34.2;
merge ktrace-lwp.
 1.33 25-Feb-2005  heas branches: 1.33.4;
Add a few comments wrt PTEs
 1.32 17-Jan-2005  atatat branches: 1.32.2;
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.31 14-Mar-2004  chs branches: 1.31.8;
checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.30 26-Feb-2004  petrov Correct VA_ALIAS_MASK. From Chuck Silvers.
 1.29 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.28 10-Aug-2003  chs remove some leftover cruft.
 1.27 14-Apr-2003  petrov branches: 1.27.2;
clean-up unused definition.
 1.26 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.25 31-Jan-2003  martin Make the pmap count resident/wired mappings on the fly instead of
walking the page tables whenever this information is needed.

Add an option PMAP_COUNT_DEBUG to assert the new counts and the
page table walk agree.

The old solution had very bad performance impact, for example
by the high CPU load when running top(1).

Thanks to Simon Burge for pointing at the cause of the problem and
to Valeriy E. Ushakov for optimizing my simple minded assembler code.
 1.24 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.23 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.22 16-Apr-2002  eeh We want pages modulo 16K not modulo 32K.
 1.21 24-Sep-2001  eeh branches: 1.21.4;
Change bus_space_mmap() signature to the official one.
 1.20 23-Sep-2001  chs implement pmap_wired_count().
 1.19 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.18 31-Aug-2001  martin branches: 1.18.2;
Move struct segmap declaration inside #ifndef _LOCORE to make locore.s
compilable again.
 1.17 30-Aug-2001  mrg add some sun4/sun4c/sun4m compat code so we can build 32 bit kvm. (these files are not even vaguely syncable.)
 1.16 22-Apr-2001  thorpej branches: 1.16.2;
Undo a misguided previous change to the pmap_update() API.
 1.15 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.14 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.13 29-Oct-2000  eeh branches: 1.13.2;
Add pmap_growkernel().
 1.12 11-Sep-2000  eeh Add locking to pmap operations and support multiple physical memory segments.
 1.11 30-Dec-1999  eeh branches: 1.11.4;
Implement PMAP_PREFER().
 1.10 07-Jun-1999  eeh branches: 1.10.2;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.9 28-Mar-1999  eeh branches: 1.9.4;
Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().
 1.8 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.7 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.6 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.5 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.4 27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.4 09-Aug-1998  eeh General pmap and debug cleanup. Added PMAP_NEW support, but it doesn't work too well yet.
 1.2.2.3 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.2.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2.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.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.10.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.10.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.11.4.1 17-Oct-2000  tv Pullup 1.12 [eeh]:
Add locking to pmap operations and support multiple physical memory segments.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.16.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.16.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.16.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.18.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.21.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.21.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.21.4.3 04-Jan-2002  eeh Cleanup.
 1.21.4.2 03-Jan-2002  petrov make kernel compile
 1.21.4.1 24-Sep-2001  petrov file pmap.h was added on branch nathanw_sa on 2002-01-03 06:42:33 +0000
 1.27.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.27.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.2.1 03-Aug-2004  skrll Sync with HEAD
 1.31.8.1 29-Apr-2005  kent sync with -current
 1.32.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.33.4.3 17-Mar-2008  yamt sync with head.
 1.33.4.2 03-Sep-2007  yamt sync with head.
 1.33.4.1 21-Jun-2006  yamt sync with head.
 1.34.2.3 01-Mar-2006  yamt sync with head.
 1.34.2.2 18-Feb-2006  yamt sync with head.
 1.34.2.1 01-Feb-2006  yamt sync with head.
 1.35.4.1 22-Apr-2006  simonb Sync with head.
 1.35.2.1 09-Sep-2006  rpaulo sync with head
 1.37.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.38.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.38.40.1 03-Apr-2008  mjf Sync with HEAD.
 1.38.36.1 24-Mar-2008  keiichi sync with head.
 1.38.20.1 23-Mar-2008  matt sync with HEAD
 1.40.20.1 21-Apr-2010  matt sync to netbsd-5
 1.40.14.1 17-Mar-2010  snj Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
properly handle flushes in all cpus as necessary
 1.40.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.40.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.40.4.2 11-Mar-2010  yamt sync with head
 1.40.4.1 04-May-2009  yamt sync with head.
 1.47.2.2 16-Nov-2010  uebayasi Sync with HEAD.
 1.47.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.52.2.2 05-Mar-2011  rmind sync with head
 1.52.2.1 16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.53.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.55.16.1 18-May-2014  rmind sync with head
 1.55.12.2 03-Dec-2017  jdolecek update from HEAD
 1.55.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.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.55.2.1 02-Dec-2011  yamt adapt sparc64. compile tested.
 1.57.2.1 10-Aug-2014  tls Rebase.
 1.59.2.2 05-Dec-2016  skrll Sync with HEAD
 1.59.2.1 22-Sep-2015  skrll Sync with HEAD
 1.60.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.61.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.61.16.1 10-Jun-2019  christos Sync with HEAD
 1.61.14.1 18-Jan-2019  pgoyette Synch with 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:41 +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:34 +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:56 +0000
 1.17 06-Dec-2020  christos don't expose register_t
 1.16 22-May-2016  christos branches: 1.16.30;
Account for the VA hole differently (simpler)
 1.15 19-May-2016  christos lose one more bit of ALSR to account for rounding in the VA hole.
 1.14 17-May-2016  christos Clamt the PAX_ASLR random value to the max bits we have for VA.
 1.13 14-Jan-2011  rmind branches: 1.13.18; 1.13.36;
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.12 21-Nov-2009  rmind branches: 1.12.4;
Include sys/proc.h for sparc/sparc64, which is required for now.
 1.11 17-Oct-2007  garbled branches: 1.11.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.10 14-Aug-2007  martin branches: 1.10.2;
Initialize lwp0.l_md.md_tf - it was NULL before. Spotted by tnn.
While there, g/c the unused md_pcbpaddr.
 1.9 11-Dec-2005  christos branches: 1.9.30; 1.9.38; 1.9.44; 1.9.48;
merge ktrace-lwp.
 1.8 27-Oct-2005  martin Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork
 1.7 12-Jul-2005  christos branches: 1.7.2;
change trapframe to trapframe64 in the md_syscall prototype to fix 32
bit kernel builds.
 1.6 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.5 02-Jan-2005  christos branches: 1.5.10;
add a linted comment.
 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 18-Jan-2003  thorpej branches: 1.3.2;
Merge the nathanw_sa branch.
 1.2 06-Nov-1999  eeh branches: 1.2.12;
Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.16; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.12.2 04-Jan-2002  eeh Cleanup.
 1.2.12.1 03-Jan-2002  petrov make kernel compile
 1.3.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.4 17-Jan-2005  skrll Sync with HEAD.
 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.10.2 03-Sep-2007  yamt sync with head.
 1.5.10.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 02-Nov-2005  yamt sync with head.
 1.9.48.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.9.44.1 15-Aug-2007  skrll Sync with HEAD.
 1.9.38.1 03-Oct-2007  garbled Sync with HEAD
 1.9.30.1 20-Aug-2007  ad Sync with HEAD.
 1.10.2.1 06-Nov-2007  matt sync with HEAD
 1.11.20.1 11-Mar-2010  yamt sync with head
 1.12.4.1 05-Mar-2011  rmind sync with head
 1.13.36.1 29-May-2016  skrll Sync with HEAD
 1.13.18.1 03-Dec-2017  jdolecek update from HEAD
 1.16.30.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.6 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.5 03-Nov-2001  thorpej branches: 1.5.2; 1.5.10;
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.4 02-Aug-2000  eeh branches: 1.4.4; 1.4.6;
Get kernel profiling to work. Now if only gprof worked....
 1.3 08-Oct-1998  eeh branches: 1.3.12; 1.3.22;
Fix more syscall32 and signal breakage.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.22.1 07-Aug-2000  mrg pull up 1.4 (approved by thorpej):
>Get kernel profiling to work. Now if only gprof worked....
 1.3.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.4.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.4.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.10.1 31-Aug-2002  gehenna catch up with -current.
 1.5.2.2 01-Aug-2002  nathanw Catch up to -current.
 1.5.2.1 03-Nov-2001  nathanw file profile.h was added on branch nathanw_sa on 2002-08-01 02:43:44 +0000
 1.1 20-Jul-2002  mrg branches: 1.1.2; 1.1.4; 1.1.6;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 20-Jul-2002  jdolecek file promlib.h was added on branch kqueue on 2002-09-06 08:41:42 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 20-Jul-2002  gehenna file promlib.h was added on branch gehenna-devsw on 2002-08-31 14:52:34 +0000
 1.1.2.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 20-Jul-2002  nathanw file promlib.h was added on branch nathanw_sa on 2002-08-01 02:43:44 +0000
 1.66 20-May-2025  macallan provide splsoftbio()
 1.65 07-Apr-2024  rillig branches: 1.65.2;
sparc: fix typos and omissions in PSTATE_BITS and ECC_AFR_BITS

Fixes PR 57869.
 1.64 02-Sep-2023  jdc sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines
Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)
Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c
Add "socal" and "SUNW,bpp" to the interrupt map.
 1.63 11-Jul-2023  martin Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.
 1.62 02-Nov-2021  ryo branches: 1.62.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.61 13-Nov-2019  nakayama Revert workarounds for clang.
In-tree clang can now handle the "r" asm constraint for 64-bit values properly.
 1.60 06-Apr-2019  nakayama The real cause for removing asm inline code on clang is that the
"r" constraint cannot handle 64-bit and is treated as 32-bit.

So code that refers to the upper 32-bit (manuf or impl) of the %ver
register is removed by optimization.

Use 32-bit kernel code as a workaround when referring to the %ver
register.
 1.59 05-Apr-2019  nakayama Put "memory" to asm inline reading privilege registers for clang to
prevent it from being removed by excessive optimization.
 1.58 08-Feb-2019  palle Introduce getstickcmpr() function
 1.57 18-May-2016  nakayama branches: 1.57.18;
Fix (unused) pstate mask bits in tstate and comment.
 1.56 25-Dec-2014  nakayama Put "memory" to asm inline for reading privilege registers on sun4v
to avoid issuing rdpr %ver before checking cputyp as a result of
code moving by compiler optimization.
 1.55 05-Dec-2014  nakayama Use GETVER_CPU_* macros.
 1.54 05-Dec-2014  nakayama Make getver() into a constant function since Version Register (%ver)
is read only and its value is constant.

This change reduces multipule %ver reads to one in the functions
which uses a number of CPU_IS_* macros.
 1.53 18-Aug-2013  martin branches: 1.53.4; 1.53.6;
Remove ancient spl* variants no longer used
 1.52 09-Nov-2012  nakayama branches: 1.52.2;
Make setstick() and getstick() to inline functions.
 1.51 08-Nov-2012  nakayama Move ASRs macro to more appropriate header.
While there remove useless macro.
 1.50 08-Nov-2012  macallan use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.49 12-Jul-2011  mrg branches: 1.49.2; 1.49.8; 1.49.12;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.48 25-May-2011  mrg define MANUF_FUJITSU (and fix CPU_IS_SPARC64_V_UP()) and MANUF_SUN.

use CPU_IS_SPARC64_V_UP() to choose some US-III versions of some
cache functions.
 1.47 12-May-2011  mrg first steps towards fujitsu SPARC64 support:

- add IMPL_* defines for fujitsu SPARC64 processors (mostly from openbsd)
- rename CPU_IS_JALAPENO() as CPU_IS_USIIIi()
- add GETVER_CPU_MANUF()
- add CPU_IS_SPITFIRE() and CPU_IS_SPARC64_V_UP()
 1.46 01-Feb-2010  mrg branches: 1.46.4; 1.46.6;
add some macros to check cpu type:
GETVER_CPU_IMPL()
CPU_IS_JALAPENO()
CPU_IS_USIII_UP()
and use them in a couple places to choose the right method/index
 1.45 15-Jan-2010  nakayama Add processor implementation codes, from OpenBSD.
 1.44 15-Jan-2010  nakayama Add function names defined by macro in comment for reference.
 1.43 04-Dec-2009  nakayama Bring together similar definitions of inline functions manipulating
privileged registers using macro. no functional change.
 1.42 25-Nov-2009  rmind Remove IPL_LPT and IPL_IPI aliases, use the actual IPLs.
Fix some broken comments.
 1.41 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.40 02-Mar-2008  nakayama branches: 1.40.4;
Correct TSTATE_KERN and TSTATE_USER macros.
 1.39 25-Feb-2008  nakayama Fix macro to convert CCR field between PSR and TSTATE.
CCR filed in PSR starts from bit 20, not from bit 19.
 1.38 11-Dec-2007  martin branches: 1.38.4; 1.38.8;
Make sure the compiler does not reorder stores accross spl...() calls
[or, for completeness, calls changing the processor state]. The mutex
code has small race windows otherwise.
 1.37 03-Dec-2007  ad branches: 1.37.2; 1.37.4; 1.37.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.36 16-Feb-2007  ad branches: 1.36.6; 1.36.22; 1.36.24; 1.36.30;
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.35 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.34 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.33 04-May-2006  yamt branches: 1.33.8; 1.33.10;
pull splraiseipl() for sparc64 from newlock branch.
reviewed by Martin Husemann.
 1.32 20-Feb-2006  cdi branches: 1.32.2; 1.32.4; 1.32.6;
Use ANSI-style function definitions and declarations.
 1.31 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.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 19-Jun-2005  thorpej branches: 1.28.2;
Small clean-ups before an overhaul.
 1.27 27-Jan-2005  martin Remove orphaned extern declaration.
 1.26 14-Mar-2004  chs branches: 1.26.8; 1.26.10;
checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.25 15-Nov-2003  petrov Compile GENERIC.MP.
 1.24 09-Nov-2003  petrov Lower PIL_AUD so /dev/audio will not interrupt and interfere with
scheduler. Fixes kern/23382.
 1.23 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.22 22-Mar-2003  nakayama branches: 1.22.2;
PCI-CardBus bridge support for sparc64:
- add splsoftserial.
 1.21 29-Sep-2002  chs avoid reading %pil in splx() if !SPLDEBUG.
misc tidiness.
 1.20 13-Apr-2001  thorpej branches: 1.20.2; 1.20.8; 1.20.12; 1.20.18;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.19 02-Mar-2001  mrg branches: 1.19.2;
clean up slightly.
 1.18 14-Jan-2001  thorpej 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.17 29-Dec-2000  eeh Lower PIL_SCHED below the zs interrupt so we don't get silo overflows.
 1.16 23-Aug-2000  eeh Update the scheduler to the new locking scheme.
 1.15 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.14 21-Aug-2000  thorpej Make sure we provide splsched() as described in spl(9).
 1.13 23-Jul-2000  eeh Give 64-bit processes access to a full 64-bit address space (90% of which
they can't use anyway, but that's another issue.)
 1.12 09-Jul-2000  eeh Use TSO memory model for 32-bit userland.
 1.11 05-Aug-1999  thorpej branches: 1.11.2; 1.11.12;
Fix the raise/lower semantics of splsoftclock()/spllowersoftclock().
 1.10 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.9 18-Jul-1999  eeh Lower spl for softints.
 1.8 05-Jun-1999  eeh Fix things up so they compile again.
 1.7 26-Mar-1999  eeh branches: 1.7.4;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.6 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.5 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.3 28-Jul-1998  eeh That last change to reduce warnings wasn't quite right.
 1.2 27-Jul-1998  mrg don't provide a static splx prototype if SPLDEBUG. avoids warnings...
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.7.4.2 02-Aug-1999  thorpej Update from trunk.
 1.7.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.12.2 31-Jul-2000  mrg pull up 1.13 (approved by thorpej):
>Give 64-bit processes access to a full 64-bit address space (90% of which
>they can't use anyway, but that's another issue.)
 1.11.12.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.11.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.11.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.11.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.11.2.2 05-Jan-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.19.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.20.18.1 14-Nov-2003  jmc Pullup rev 1.24 (requested by petrov in ticket #1559)

Lower PIL_AUD so /dev/audio will not interrupt and interfere with scheduler.
Fixes PR#23382
 1.20.12.1 19-Mar-2002  thorpej Implement splraiseipl(), as used by the new mutex code.
 1.20.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.20.8.1 13-Apr-2001  nathanw file psl.h was added on branch nathanw_sa on 2002-10-18 02:40:06 +0000
 1.20.2.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.22.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.22.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.22.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.26.10.1 12-Feb-2005  yamt sync with head.
 1.26.8.1 29-Apr-2005  kent sync with -current
 1.28.2.7 17-Mar-2008  yamt sync with head.
 1.28.2.6 27-Feb-2008  yamt sync with head.
 1.28.2.5 21-Jan-2008  yamt sync with head
 1.28.2.4 07-Dec-2007  yamt sync with head
 1.28.2.3 26-Feb-2007  yamt sync with head.
 1.28.2.2 30-Dec-2006  yamt sync with head.
 1.28.2.1 21-Jun-2006  yamt sync with head.
 1.30.6.2 01-Jun-2006  kardel 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.2 01-Mar-2006  yamt sync with head.
 1.30.2.1 18-Feb-2006  yamt sync with head.
 1.32.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.32.4.1 11-May-2006  elad sync with head
 1.32.2.1 24-May-2006  yamt sync with head.
 1.33.10.1 19-Sep-2006  yamt implement new api for sparc64.
 1.33.8.1 12-Jan-2007  ad Sync with head.
 1.36.30.2 27-Dec-2007  mjf Sync with HEAD.
 1.36.30.1 08-Dec-2007  mjf Sync with HEAD.
 1.36.24.2 23-Mar-2008  matt sync with HEAD
 1.36.24.1 09-Jan-2008  matt sync with HEAD
 1.36.22.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.36.6.1 03-Dec-2007  ad Sync with HEAD.
 1.37.6.1 13-Dec-2007  bouyer Sync with HEAD
 1.37.4.1 11-Dec-2007  yamt sync with head.
 1.37.2.1 26-Dec-2007  ad Sync with head.
 1.38.8.1 03-Apr-2008  mjf Sync with HEAD.
 1.38.4.1 24-Mar-2008  keiichi sync with head.
 1.40.4.2 11-Mar-2010  yamt sync with head
 1.40.4.1 20-Jun-2009  yamt sync with head
 1.46.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.46.4.1 31-May-2011  rmind sync with head
 1.49.12.3 03-Dec-2017  jdolecek update from HEAD
 1.49.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.49.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.49.8.1 23-Nov-2012  riz Pull up following revision(s) (requested by macallan in ticket #695):
sys/arch/sparc64/include/cpu.h: revision 1.99
sys/arch/sparc64/sparc64/cpu.c: revision 1.103
sys/arch/sparc64/include/psl.h: revision 1.50
sys/arch/sparc64/sparc64/clock.c: revision 1.107
sys/arch/sparc64/include/ctlreg.h: revision 1.57
sys/arch/sparc64/sparc64/locore.s: revision 1.342
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.49.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.49.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.52.2.1 28-Aug-2013  rmind sync with head
 1.53.6.2 29-May-2016  skrll Sync with HEAD
 1.53.6.1 06-Apr-2015  skrll Sync with HEAD
 1.53.4.1 13-Dec-2014  martin Pull up following revision(s) (requested by nakayama in ticket #318):
sys/arch/sparc64/include/psl.h: revision 1.54
sys/arch/sparc64/include/psl.h: revision 1.55
sys/arch/sparc64/sparc64/cpu.c: revision 1.121
Make getver() into a constant function since Version Register (%ver)
is read only and its value is constant.
This change reduces multipule %ver reads to one in the functions
which uses a number of CPU_IS_* macros.
Use GETVER_CPU_* macros.
 1.57.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.57.18.1 10-Jun-2019  christos Sync with HEAD
 1.62.4.3 28-May-2025  martin Pull up following revision(s) (requested by bouyer in ticket #1121):

sys/arch/ia64/include/intr.h: revision 1.9
sys/uvm/uvm_pdpolicy_clock.c: revision 1.41
sys/sys/spl.h: revision 1.11
sys/uvm/uvm_pdpolicy_clock.c: revision 1.42
sys/arch/sparc64/include/psl.h: revision 1.66

uvmpdpol_pagerealize(): ucpu->pdqhead is used by a single CPU; but

kpreempt_disable() isn't enough to guard against concurent access;
interrupts also need to be disabled.

If my analysis is correct, the only place using ucpu->pdqhead which
can be called from interrupt context it uvmpdpol_pagerealize(), and only
from softbio().

So:
- introduce splsoftbio() in sys/spl.h
- protect all accesses to ucpu->pdqhead with splsoftbio()
fixes pr kern/59412: uvmpdpol_pagerealize() queue index out of bound

Provide splsoftbio()

Remove the redundant kpreempt_disable/kpreempt_enable now that we're
running at splsoftbio. Pointed out by thorpej@
 1.62.4.2 09-Sep-2023  martin Pull up following revision(s) (requested by jdc in ticket #360):

sys/arch/sparc64/dev/fdc.c: revision 1.52
sys/arch/sparc64/include/intr.h: revision 1.32
sys/arch/sparc64/sparc64/autoconf.c: revision 1.239
sys/arch/sparc64/include/psl.h: revision 1.64

sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines

Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)

Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c

Add "socal" and "SUNW,bpp" to the interrupt map.
 1.62.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.65.2.1 02-Aug-2025  perseant Sync with HEAD
 1.29 07-Jan-2025  andvar s/bitfeilds/bitfields/ in comment.
 1.28 04-Nov-2016  macallan branches: 1.28.52;
add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE
 1.27 03-Apr-2015  palle branches: 1.27.2;
sun4v: There is no L-bit (Locked) in the sun4v tte
 1.26 03-Mar-2014  palle branches: 1.26.6;
sun4v: SUN4V_TLB_TSB_LOCK define should have the same LL (instead of UL) as the other defines
 1.25 21-Feb-2014  palle 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.24 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.23 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.22 15-Jan-2010  nakayama branches: 1.22.12; 1.22.22; 1.22.26;
Fix typo in previous.
 1.21 05-Dec-2009  mrg - update the TLB_SOFT2_MASK and TLB_DIAG_MASK definitions for USIII. partly
from openbsd.
- rename TLB_DIAG_MASK to TLB_RESERVED_MASK. from openbsd.
- fix the TLB_PA_MASK definition to be correct. our old one was 4 bits
too wide.
- fix various errors in the #if 0 bitfield version of struct sun4u_tag_fields.

tested on U60 and SB2500.
 1.20 14-Mar-2008  nakayama branches: 1.20.4;
Complete per-CPU TSBs and MMU contexts changes.
 1.19 22-Feb-2008  martin Get rid of the IPI simple_lock.
 1.18 08-Sep-2006  mrg branches: 1.18.30; 1.18.50; 1.18.54;
make this idempotent.
 1.17 20-Feb-2006  cdi branches: 1.17.2; 1.17.14;
Use ANSI-style function definitions and declarations.
 1.16 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.15 11-Dec-2005  christos branches: 1.15.2; 1.15.4; 1.15.6;
merge ktrace-lwp.
 1.14 22-Feb-2005  martin branches: 1.14.4;
Cleanup: the PG_SZ macro was buggy (pointed out by Tim Newsham).
It was only used by (the also buggy/not ready for prime time) PMAP_PAGE_SIZE,
which in turn only was used in one place.

Get rid of all this and hardcode the result at the single place of use.
 1.13 14-Mar-2004  chs branches: 1.13.8; 1.13.10;
checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.12 06-Jan-2003  wiz branches: 1.12.2;
writable, not writeable.
 1.11 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.10 20-Mar-2002  eeh Add PTE_WIRED bit to keep track of wired pages.
 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 30-Aug-2001  mrg branches: 1.8.6;
add some sun4/sun4c/sun4m compat code so we can build 32 bit kvm. (these files are not even vaguely syncable.)
 1.7 31-Jul-2001  eeh Dump some enums that make lint unhappy and we never really use anyway.
 1.6 21-Jun-2001  eeh branches: 1.6.2;
Allow multiple 4MB pages for both kernel text and kernel data.

Note: DEBUG checks will not allow accesses to the hole between
text and data segments, so you may need to update programs that
use libkvm before relocating the start of kernel data.
 1.5 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.4 30-May-1999  eeh Make pmap_enter() handle little-endian mappings properly.
 1.3 05-Sep-1998  eeh branches: 1.3.8;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.3.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.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.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.6.2.1 03-Aug-2001  lukem update to -current
 1.8.6.5 07-Jan-2003  thorpej Sync with HEAD.
 1.8.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.8.6.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.8.6.1 30-Aug-2001  nathanw file pte.h was added on branch nathanw_sa on 2002-01-08 00:28:00 +0000
 1.12.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.8.1 29-Apr-2005  kent sync with -current
 1.14.4.4 17-Mar-2008  yamt sync with head.
 1.14.4.3 27-Feb-2008  yamt sync with head.
 1.14.4.2 30-Dec-2006  yamt sync with head.
 1.14.4.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.15.2.2 01-Mar-2006  yamt sync with head.
 1.15.2.1 18-Feb-2006  yamt sync with head.
 1.17.14.1 18-Nov-2006  ad Sync with head.
 1.17.2.1 14-Sep-2006  yamt sync with head.
 1.18.54.1 03-Apr-2008  mjf Sync with HEAD.
 1.18.50.1 24-Mar-2008  keiichi sync with head.
 1.18.30.1 23-Mar-2008  matt sync with HEAD
 1.20.4.1 11-Mar-2010  yamt sync with head
 1.22.26.1 18-May-2014  rmind sync with head
 1.22.22.2 03-Dec-2017  jdolecek update from HEAD
 1.22.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.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.26.6.2 05-Dec-2016  skrll Sync with HEAD
 1.26.6.1 06-Apr-2015  skrll Sync with HEAD
 1.27.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.28.52.1 02-Aug-2025  perseant Sync with HEAD
 1.5 19-Oct-2016  skrll PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.4 28-Sep-2016  skrll Whitespace
 1.3 14-Mar-2006  cube branches: 1.3.112; 1.3.132; 1.3.136;
Add the sparc64 MD bits to get usable coredumps for COMPAT_NETBSD32
binaries.
 1.2 20-Jul-2002  mrg branches: 1.2.22; 1.2.36; 1.2.38; 1.2.40; 1.2.42;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.42.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.2.40.1 01-Apr-2006  yamt sync with head.
 1.2.38.1 22-Apr-2006  simonb Sync with head.
 1.2.36.1 09-Sep-2006  rpaulo sync with head
 1.2.22.1 21-Jun-2006  yamt sync with head.
 1.3.136.1 04-Nov-2016  pgoyette Sync with HEAD
 1.3.132.2 05-Dec-2016  skrll Sync with HEAD
 1.3.132.1 05-Oct-2016  skrll Sync with HEAD
 1.3.112.1 03-Dec-2017  jdolecek update from HEAD
 1.3 26-Jun-2008  nakayama Ansify and follow the recent cardbus changes:
- split device/softc
- avoid the use of i82365var.h
 1.2 31-May-2008  nakayama branches: 1.2.2;
Change my license to 2 clause.
 1.1 22-Mar-2003  nakayama branches: 1.1.104; 1.1.106; 1.1.108; 1.1.110;
PCI-CardBus bridge support for sparc64:
- add MD part of cardbus support.
 1.1.110.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.110.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.1.108.1 04-May-2009  yamt sync with head.
 1.1.106.1 04-Jun-2008  yamt sync with head
 1.1.104.2 29-Jun-2008  mjf Sync with HEAD.
 1.1.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.1 27-Jun-2008  simonb Sync with head.
 1.15 30-Dec-2016  christos - make fpreg{32,64} actually members of fsstate{32,64}.
- allocate fpstate if we did not have one and we need to write it.
 1.14 12-Jul-2011  mrg branches: 1.14.12; 1.14.30; 1.14.34;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 27-Mar-2004  eeh License cleanup.
 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 16-May-2002  eeh branches: 1.10.8;
Don't use smaller trapframes. Causes more problems that it's worth right now. CVS: ----------------------------------------------------------------------
 1.9 14-May-2002  eeh branches: 1.9.2;
Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.8 19-Jun-2001  wiz branches: 1.8.2; 1.8.8;
`accessible' only has one `a'.
 1.7 08-Jul-2000  eeh branches: 1.7.2;
gdb requires a `struct fpstate' so provide one.
 1.6 10-Jan-2000  eeh branches: 1.6.4;
Add debugger single-stepping and fix interrupt dispatch bugs.
 1.5 30-Dec-1999  eeh Add the %gsr to our fpstate structure.
 1.4 06-Nov-1999  eeh Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.3 11-Oct-1999  eeh branches: 1.3.2; 1.3.4;
Update to post 1.4.
 1.2 12-May-1999  eeh branches: 1.2.2;
Add some more 32-bit emulation support.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.10;
Import of sparc64.
 1.1.1.1.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.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.6.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.8.8.1 19-Jun-2001  nathanw file reg.h was added on branch nathanw_sa on 2002-06-20 03:41:25 +0000
 1.8.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.1 30-May-2002  gehenna Catch up with -current.
 1.10.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.8.1 03-Aug-2004  skrll Sync with HEAD
 1.14.34.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.14.30.1 05-Feb-2017  skrll Sync with HEAD
 1.14.12.1 03-Dec-2017  jdolecek update from HEAD
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 25-Aug-2001  mrg branches: 1.3.6; 1.3.14;
update a comment about R_UA_32 relocs.
 1.2 14-Jul-2000  eeh branches: 1.2.4;
Add support for 64-bit PIC and dynamic linking.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.24;
Import of sparc64.
 1.1.1.1.24.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.3.14.1 31-Aug-2002  gehenna catch up with -current.
 1.3.6.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.6.1 25-Aug-2001  nathanw file reloc.h was added on branch nathanw_sa on 2002-08-01 02:43:45 +0000
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2 05-Feb-2003  nakayama Replace machine/rnd.h with more appropriate name to share it
with cycle counter based microtime in kern/kern_microtime.c.
 1.1 07-Oct-2002  martin branches: 1.1.2; 1.1.4;
All sparc64 CPUs do __HAVE_CPU_COUNTER (aka %tick).
 1.1.4.2 07-Dec-2002  he Pull up revision 1.1 (new, requested by martin in ticket #907):
All sparc64 CPUs do __HAVE_CPU_COUNTER (aka %tick).
 1.1.4.1 07-Oct-2002  he file rnd.h was added on branch netbsd-1-6 on 2002-12-07 21:52:25 +0000
 1.1.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.1 07-Oct-2002  nathanw file rnd.h was added on branch nathanw_sa on 2002-10-18 02:40:06 +0000
 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 05-Jan-2008  martin branches: 1.4.6; 1.4.8; 1.4.10;
Include lock.h, as we are using memory barrier macros defined there.
 1.3 21-Nov-2007  yamt branches: 1.3.6;
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 29-Dec-2006  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 29-Dec-2006  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.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 21-Jan-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:25 +0000
 1.3.6.1 08-Jan-2008  bouyer Sync with HEAD
 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 19-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 19-Mar-2002  thorpej First draft of mutex and rwlock implementation for sparc64.
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 22-Sep-1998  eeh branches: 1.2.26; 1.2.30; 1.2.38;
More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 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.11 09-Jan-2003  thorpej Merge sparc and sparc64 <machine/signal.h>.
 1.10 09-May-2001  kleink branches: 1.10.8;
Sync sc_psr comments with reality.
 1.9 09-May-2001  kleink In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.
 1.8 26-Mar-1999  eeh branches: 1.8.20;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.7 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.6 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.5 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.4 17-Sep-1998  thorpej For _LP64, sigcontext must contain longs!
 1.3 17-Sep-1998  thorpej Minor cosmetic change.
 1.2 13-Sep-1998  mycroft Update these for signal handling changes.
XXX Not tested yet.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.8.20.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.8.2 09-Jan-2003  thorpej Sync with HEAD.
 1.10.8.1 09-May-2001  thorpej file signal.h was added on branch nathanw_sa on 2003-01-09 23:33:14 +0000
 1.1 23-Jul-2014  alnsn branches: 1.1.2; 1.1.6;
Rename sljitarch.h to sljit_machdep.h.
 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:25 +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.2 23-Jul-2014  alnsn Rename sljitarch.h to sljit_machdep.h.
 1.1 01-Feb-2014  nakayama branches: 1.1.2; 1.1.4; 1.1.6;
Make sljit usable on sparc64 32-bit kernels.
 1.1.6.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.6.1 01-Feb-2014  yamt file sljitarch.h was added on branch yamt-pagecache on 2014-05-22 11:40:09 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 01-Feb-2014  rmind file sljitarch.h was added on branch rmind-smpnet on 2014-05-18 17:45:26 +0000
 1.1.2.1 10-Aug-2014  tls Rebase.
 1.15 10-Jan-2022  palle sun4v: add function to retrieve hypervisor api version
 1.14 03-Jul-2021  palle sun4v: add support for hypervisor soft state - from OpenBSD
 1.13 06-Sep-2014  palle branches: 1.13.36;
sun4v: New function prom_startcpu_by_cpuid() necessary for starting cpus on sun4v
 1.12 07-Jan-2014  palle sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
 1.11 20-Feb-2010  martin branches: 1.11.10; 1.11.20; 1.11.24;
Select the shutdown method for secondary CPUs by available firmware
methods, not properties of the CPU.
Inspired by OpenSolaris, pointed out by eeh.
 1.10 18-May-2009  nakayama branches: 1.10.2;
Using OpenFirmware calls properly about 64-bit physical address handling.
Old code trancate a physical address to 32-bit width. Idea from OpenBSD.
 1.9 11-Feb-2006  cdi branches: 1.9.72;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.8 11-Dec-2005  christos branches: 1.8.2; 1.8.4; 1.8.6;
merge ktrace-lwp.
 1.7 21-Mar-2004  pk branches: 1.7.16;
Switch to the sparc prom library.
 1.6 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.5 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.4 08-Dec-2003  petrov Remove prototypes of non-existant functions, ansify and knf.
 1.3 20-Oct-2000  mrg branches: 1.3.24;
fix a comment.
 1.2 13-Aug-1998  eeh branches: 1.2.12;
Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.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.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.7.16.1 21-Jun-2006  yamt sync with head.
 1.8.6.1 22-Apr-2006  simonb Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.8.2.1 18-Feb-2006  yamt sync with head.
 1.9.72.2 11-Mar-2010  yamt sync with head
 1.9.72.1 20-Jun-2009  yamt sync with head
 1.10.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.11.24.1 18-May-2014  rmind sync with head
 1.11.20.2 03-Dec-2017  jdolecek update from HEAD
 1.11.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.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.13.36.1 01-Aug-2021  thorpej Sync with HEAD.
 1.14 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.13 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.12 18-Aug-2001  eeh branches: 1.12.6; 1.12.14;
Make lint happier.
 1.11 23-Jul-2000  mycroft branches: 1.11.4;
Fix multiple problems with floating point and structure handling.
 1.10 29-Jun-2000  eeh This seems to fix the problem in __semctl13.c without breaking anyghing else.
 1.9 03-Feb-2000  kleink branches: 1.9.4;
Add a C99-style va_copy macro.
 1.8 04-May-1999  christos branches: 1.8.2;
clean up old GCC.1 stuff; move common definitions to the top.
 1.7 03-May-1999  christos Define __extension__ if __GNUC__ < 2
Define __builtin_*() for lint
 1.6 31-Jan-1999  mrg branches: 1.6.4;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.5 09-Jan-1999  eeh Don't use `long' instead of `int64_t' since the latter may not be in scope.
 1.4 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.3 11-Sep-1998  eeh A (slightly modified) version of tv's fix for va_args for kern_printf.
 1.2 27-Jul-1998  mycroft Delint.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.6.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.4.2 26-Jul-2000  mycroft Approved by thorpej:
Fix multiple problems with floating point and structure handling.

syssrc/sys/arch/sparc64/include/stdarg.h 1.10 -> 1.11
 1.9.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.11.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.12.14.1 31-Aug-2002  gehenna catch up with -current.
 1.12.6.2 01-Aug-2002  nathanw Catch up to -current.
 1.12.6.1 18-Aug-2001  nathanw file stdarg.h was added on branch nathanw_sa on 2002-08-01 02:43:45 +0000
 1.2 20-Jun-1998  mrg moved <machine/sun_disklabel.h> to <dev/sun/disklabel.h>
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 11-Dec-2005  christos branches: 1.2.18;
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:59:18 +0000
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file sunos_machdep.h was added on branch yamt-lazymbuf on 2006-06-21 14:56:47 +0000
 1.10 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.9 28-Apr-2008  martin branches: 1.9.86; 1.9.88;
Remove clause 3 and 4 from TNF licenses
 1.8 20-Feb-2006  cdi branches: 1.8.68; 1.8.70; 1.8.72;
Use ANSI-style function definitions and declarations.
 1.7 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.6 11-Dec-2005  christos branches: 1.6.2; 1.6.4; 1.6.6;
merge ktrace-lwp.
 1.5 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.4 18-Jan-2003  thorpej branches: 1.4.2; 1.4.18;
Merge the nathanw_sa branch.
 1.3 11-May-2001  kleink branches: 1.3.8;
* Fix remaining 32-bit vs. native pointer problems in data structures;
reviewed by Eduardo.
* Define the size of uc_pad, so ucontext32_t will have the correct size.
 1.2 11-May-2001  kleink svr4_32_mcontext.gwin is a pointer 32 bits wide.
 1.1 11-Feb-2001  eeh branches: 1.1.2; 1.1.4;
Add support for COMPAT_SVR4_32.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 11-Feb-2001  bouyer file svr4_32_machdep.h was added on branch thorpej_scsipi on 2001-02-11 19:12:32 +0000
 1.3.8.2 04-Jan-2002  eeh Cleanup.
 1.3.8.1 11-May-2001  eeh file svr4_32_machdep.h was added on branch nathanw_sa on 2002-01-04 19:12:25 +0000
 1.4.18.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.2 01-Mar-2006  yamt sync with head.
 1.6.2.1 18-Feb-2006  yamt 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.88.1 10-Jun-2019  christos Sync with HEAD
 1.9.86.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.13 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.12 28-Apr-2008  martin branches: 1.12.86; 1.12.88;
Remove clause 3 and 4 from TNF licenses
 1.11 20-Feb-2006  cdi branches: 1.11.68; 1.11.70; 1.11.72;
Use ANSI-style function definitions and declarations.
 1.10 11-Dec-2005  christos branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.
 1.9 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.8 18-Jan-2003  thorpej branches: 1.8.2; 1.8.18;
Merge the nathanw_sa branch.
 1.7 22-Feb-2001  eeh branches: 1.7.8;
Somehow this didn't get checked in with the rest of the SVR4 64-bit fixes.
 1.6 11-Feb-2001  eeh A register is 64-bits unless we're emulating 32-bit.
 1.5 04-Dec-2000  mrg remove duplicate function prototypes.
 1.4 21-Jan-1999  christos branches: 1.4.8;
move prototypes to mi locations and add the xrs gunk.
 1.3 13-Sep-1998  mycroft Update these for signal handling changes.
XXX Not tested yet.
 1.2 05-Sep-1998  christos Assign copyright to TNF.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.8.3 12-Mar-2001  bouyer Sync with HEAD.
 1.4.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.8.1 08-Dec-2000  bouyer Sync with HEAD.
 1.7.8.1 04-Jan-2002  eeh Cleanup.
 1.8.18.1 21-Jun-2006  yamt sync with head.
 1.8.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.10.2.1 01-Mar-2006  yamt sync with head.
 1.11.72.1 16-May-2008  yamt sync with head.
 1.11.70.1 18-May-2008  yamt sync with head.
 1.11.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.88.1 10-Jun-2019  christos Sync with HEAD
 1.12.86.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.12 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.11 01-Apr-2015  palle branches: 1.11.16; 1.11.18;
sun4v: Implement handling of cpu_mondo trap - from OpenBSD - tested using the Legion simulator
 1.10 08-Jun-2014  palle branches: 1.10.4;
sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.9 27-Mar-2011  martin branches: 1.9.14; 1.9.28;
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.8 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.7 13-Dec-2010  mrg branches: 1.7.2;
add definitions for T_DATA_MMU_MISS, T_FAST_ECC_ERROR, T_DC_PAR_ERR
and T_IC_PAR_ERR, all are >= USIII only.
 1.6 19-Sep-2006  mrg branches: 1.6.78;
normalise case in some macro values to be all the same (lower case)
 1.5 21-Jan-2003  martin branches: 1.5.18; 1.5.48; 1.5.50;
Rename the DIV0 traps to avoid confusion with the usage on the sparc
port: T_IDIV0 is the hardware trap generated on integer division by
zero, T_DIV0 is the software trap used to signal the same event.

This makes 32 bit kernels able to run sparc code with the v7 multiply/
divide library.

Spotted by Valeriy E. Ushakov.
 1.4 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.3 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.2 07-Sep-1998  eeh branches: 1.2.8;
Add new 64-bit specific traps and 64-bit Solaris syscall.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.50.1 22-Oct-2006  yamt sync with head
 1.5.48.1 18-Nov-2006  ad Sync with head.
 1.5.18.1 30-Dec-2006  yamt sync with head.
 1.6.78.2 21-Apr-2011  rmind sync with head
 1.6.78.1 05-Mar-2011  rmind sync with head
 1.7.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.28.1 10-Aug-2014  tls Rebase.
 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.10.4.1 06-Apr-2015  skrll Sync with HEAD
 1.11.18.1 10-Jun-2019  christos Sync with HEAD
 1.11.16.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.29 08-Aug-2021  thorpej Define preprocessor symbols (__HAVE_OPENFIRMWARE_VARIANT_AAPL and
__HAVE_OPENFIRMWARE_VARIANT_SUNW) that lets generic OpenFirmware
code deal with differences / quirks among implementation variants.
 1.28 06-Apr-2019  thorpej branches: 1.28.16;
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.27 26-Jan-2017  christos branches: 1.27.14;
provide __HAVE_COMPAT_NETBSD32 and fix multiple include protection consistently.
 1.26 14-Nov-2013  martin branches: 1.26.6; 1.26.10; 1.26.14;
Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.
 1.25 11-Dec-2005  christos branches: 1.25.6; 1.25.112; 1.25.122; 1.25.128;
merge ktrace-lwp.
 1.24 10-Jul-2005  christos Now that sparc has syscall intern, no need to define it here too.
 1.23 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.22 20-Jul-2002  mrg branches: 1.22.6;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.21 03-May-2002  thorpej branches: 1.21.2;
Revert revision 1.20.
 1.20 03-May-2002  eeh Provide _LP64 definition if we are generating LP64 binaries.
 1.19 28-Feb-2002  simonb Use "#define<tab>".
 1.18 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.17 12-May-2001  kleink branches: 1.17.2; 1.17.8;
Delint my previous change.
 1.16 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.15 14-Jan-2001  thorpej branches: 1.15.2;
Rename __GENERIC_SOFT_INTERRUPTS to __HAVE_GENERIC_SOFT_INTERRUPTS,
and place the definition in <machine/types.h>. This can now be used
as a flag to indicate whether or not <machine/intr.h> can be included
to get the generic soft interrupt API.
 1.14 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.13 04-Dec-2000  mrg Remove __BROKEN_CONFIG_UNIT_USAGE. (sync with sparc)
 1.12 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.11 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.10 27-Nov-1999  eeh Apparently sys/sysctl.h includes vm/vm_map.h which makes use of vaddr_t,
 1.9 27-Nov-1999  mrg merge sparc64 types.h; these files are now identical.
 1.8 31-Jan-1999  mrg branches: 1.8.8; 1.8.14;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.7 07-Sep-1998  eeh Make register32_t unsigned so we don't have sign extension problems.
 1.6 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.5 22-Aug-1998  eeh Fix typo in previous fix.
 1.4 22-Aug-1998  eeh 64-bit-ify this. Depend on _lp64.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 20-Jun-1998  kleink branches: 1.2.2;
Merge in recent changes:
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.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.2.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.8.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.8.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.8.8.3 05-Jan-2001  bouyer Sync with HEAD
 1.8.8.2 08-Dec-2000  bouyer Sync with HEAD.
 1.8.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.8.5 01-Aug-2002  nathanw Catch up to -current.
 1.17.8.4 20-Jun-2002  nathanw Catch up to -current.
 1.17.8.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.17.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.17.8.1 12-May-2001  nathanw file types.h was added on branch nathanw_sa on 2002-01-08 00:28:00 +0000
 1.17.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.17.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.17.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.21.2.1 31-Aug-2002  gehenna catch up with -current.
 1.22.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.25.128.1 18-May-2014  rmind sync with head
 1.25.122.2 03-Dec-2017  jdolecek update from HEAD
 1.25.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.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.25.6.2 02-Jun-2006  kardel - support timecounters
 1.25.6.1 27-May-2006  kardel sparc64 has yet to be converted so #undef __HAVE_TIMECOUNTER
 1.26.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.26.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.26.6.1 05-Feb-2017  skrll Sync with HEAD
 1.27.14.1 10-Jun-2019  christos Sync with HEAD
 1.28.16.1 14-May-2021  thorpej Define __HAVE_OPENFIRMWARE_VARIANT_SUNW for sparc64 systems and handle
its OpenFirmware quirks with respect to i2c:

- "reg" property is 2 cells, the first one containing the channel the
device is on, the second one containing the i2c device address.
- The i2c device address is shifted left 1 bit to account for the r/w
bit on the wire.
 1.9 17-Oct-2009  nakayama Merge want_ast check in userret() into trap handler, and repeat
preempt() call while want_resched is true. While there remove
unnecessary #if 1.

This should fix a performance degradation of disk I/O on heavy load.
 1.8 30-Jun-2008  nakayama branches: 1.8.6; 1.8.12; 1.8.14;
Avoid use of "<< TSTATE_PSTATE_SHIFT".
 1.7 05-Nov-2007  ad branches: 1.7.16; 1.7.20; 1.7.22; 1.7.24;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.6 09-Feb-2007  ad branches: 1.6.6; 1.6.22; 1.6.24; 1.6.28;
Merge newlock2 to head.
 1.5 20-Feb-2006  cdi branches: 1.5.12; 1.5.16;
Use ANSI-style function definitions and declarations.
 1.4 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.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;
Forgot to add this.
 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:59:18 +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.2 01-Mar-2006  yamt sync with head.
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.5.16.1 11-Jan-2007  ad Checkpoint work in progress.
 1.5.12.4 15-Nov-2007  yamt sync with head.
 1.5.12.3 26-Feb-2007  yamt sync with head.
 1.5.12.2 21-Jun-2006  yamt sync with head.
 1.5.12.1 20-Feb-2006  yamt file userret.h was added on branch yamt-lazymbuf on 2006-06-21 14:56:47 +0000
 1.6.28.1 13-Nov-2007  bouyer Sync with HEAD
 1.6.24.1 06-Nov-2007  matt sync with HEAD
 1.6.22.1 06-Nov-2007  joerg Sync with HEAD.
 1.6.6.1 03-Dec-2007  ad Sync with HEAD.
 1.7.24.1 03-Jul-2008  simonb Sync with head.
 1.7.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.20.2 11-Mar-2010  yamt sync with head
 1.7.20.1 04-May-2009  yamt sync with head.
 1.7.16.1 02-Jul-2008  mjf Sync with HEAD.
 1.8.14.1 21-Apr-2010  matt sync to netbsd-5
 1.8.12.1 19-Oct-2009  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #1103):
sys/arch/sparc64/include/userret.h: revision 1.9
sys/arch/sparc64/sparc64/trap.c: revision 1.158

Merge want_ast check in userret() into trap handler, and repeat preempt()
call while want_resched is true. While there remove unnecessary #if 1. This
should fix a performance degradation of disk I/O on heavy load.
 1.8.6.1 19-Oct-2009  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #1103):
sys/arch/sparc64/include/userret.h: revision 1.9
sys/arch/sparc64/sparc64/trap.c: revision 1.158

Merge want_ast check in userret() into trap handler, and repeat preempt()
call while want_resched is true. While there remove unnecessary #if 1. This
should fix a performance degradation of disk I/O on heavy load.
 1.3 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.43 07-Feb-2023  hgutch Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.
 1.42 26-Feb-2021  simonb branches: 1.42.18;
Say what 1UL<<39 (MAXDSIZ value) is in the comment.
 1.41 06-Oct-2020  christos branches: 1.41.2;
GC unused MAXTSIZ32
 1.40 22-Jan-2020  ad Bump UBC defaults on sparc64 & aarch64, which already have a large pager_map.
 1.39 03-Sep-2018  riastradh branches: 1.39.4; 1.39.6;
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.38 14-Nov-2017  martin branches: 1.38.2; 1.38.4;
Bump PAGER_MAP_DEFAULT_SIZE to 512 MB (like amd64 recently did).
 1.37 26-Mar-2016  martin branches: 1.37.10;
Fix comment
 1.36 22-Nov-2015  martin Reduce the "MAXDSIZ" limit for bottom-up-VA (i.e. old binaries) processes
to the old limit of 1 GB. Some old binaries can not deal with more.
 1.35 15-Nov-2015  martin PR 32999: adjust VM parameters for 64 bit kernel/userlands.
Limit old binaries (i.e. processes not using topdown VA layout) to 2 GB
data size.
Use the same limits as native sparc for netbsd32 emulation - we need to
revisit this, but currently automatic test runs in this environment
fail big time, so there is no easy way to verify any changes.
 1.34 14-Apr-2014  martin branches: 1.34.4;
Implement and enable TOPDOWN_VM. From Chuck Silvers.
 1.33 03-Jan-2013  martin branches: 1.33.2; 1.33.10;
Rearange VA layout for 64 bit kernels, as suggested by Lars Heidieker:
move the dynamic kernel memory past 4GB (basically unlimiting it) and
use the now freed address range past kernel data upto 2GB for modules.
 1.32 14-Nov-2010  uebayasi branches: 1.32.8; 1.32.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.31 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.30 06-Mar-2009  joerg branches: 1.30.2; 1.30.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.29 27-Jan-2006  cdi branches: 1.29.76; 1.29.84; 1.29.90;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.28 11-Dec-2005  christos branches: 1.28.2;
merge ktrace-lwp.
 1.27 26-Mar-2005  fvdl branches: 1.27.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.26 21-Oct-2003  kleink branches: 1.26.8; 1.26.10; 1.26.14;
Don't use NULL in integer-type assignments/comparisons.
 1.25 10-Aug-2003  chs remove some leftover cruft.
 1.24 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.23 01-Apr-2003  thorpej branches: 1.23.2;
We use 8K VM pages on Sun4U, so make PAGE_SIZE, PAGE_SHIFT, and PAGE_MASK
into compile-time constants.
 1.22 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.21 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.20 03-Sep-2002  thorpej Increase the default stack limit to 2M (from 512K on sparc and 1M
on sparc64).
 1.19 15-Nov-2001  soren branches: 1.19.2; 1.19.12;
MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.18 01-May-2001  thorpej branches: 1.18.2;
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.17 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.16 16-Feb-2001  eeh branches: 1.16.2;
Define VM_MASUSER_ADDRESS32.
 1.15 11-Feb-2001  eeh Increase limits slightly. We're still not using all 32 address bits yet,
let alone 64.....
 1.14 18-Dec-2000  mrg - rename 32bit USRSTACK32, and define USRSTACK to that if !__arch64__, so that
64bit code can see USRSTACK32
- bump the limits
 1.13 28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.12 31-Aug-2000  eeh Add support for multiple memory segments.
 1.11 13-Jul-2000  mrg remove old (bogus) comment.
 1.10 11-Feb-2000  thorpej branches: 1.10.4;
Update for the NKMEMPAGES changes.
 1.9 26-Jan-2000  tsutsui Remove obsoleted macros.
 1.8 04-Dec-1999  ragge CL* discarding.
 1.7 20-Nov-1999  eeh Limit buffers to 1/4 of the kernel address space.
 1.6 26-Apr-1999  thorpej branches: 1.6.2; 1.6.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.5 16-Jan-1999  chuck branches: 1.5.4;
MNN is no longer optional, remove dead code
 1.4 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.3 08-Jul-1998  thorpej branches: 1.3.2;
Define one page free list, and put all pages on it.
 1.2 20-Jun-1998  mrg merge comment fix.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.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.5.4.2 06-Aug-1999  chs take an initial guess at UBC parameters.
 1.5.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.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.6.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.6.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.4.2 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.10.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.16.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.18.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.18.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.18.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.12.1 30-Nov-2002  he Pull up revision 1.20 (requested by thorpej in ticket #763):
Increase the default stack limit to 2M (from 512K on sparc
and 1M on sparc64).
 1.19.2.8 11-Dec-2002  thorpej Sync with HEAD.
 1.19.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.19.2.6 17-Sep-2002  nathanw Catch up to -current.
 1.19.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.19.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.19.2.3 04-Jan-2002  eeh Cleanup.
 1.19.2.2 03-Jan-2002  petrov make kernel compile
 1.19.2.1 15-Nov-2001  petrov file vmparam.h was added on branch nathanw_sa on 2002-01-03 06:42:33 +0000
 1.23.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.26.14.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.26.10.1 26-Mar-2005  yamt sync with head.
 1.26.8.1 29-Apr-2005  kent sync with -current
 1.27.2.1 21-Jun-2006  yamt sync with head.
 1.28.2.1 01-Feb-2006  yamt sync with head.
 1.29.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.29.76.1 04-May-2009  yamt sync with head.
 1.30.4.1 05-Mar-2011  rmind sync with head
 1.30.2.3 16-Nov-2010  uebayasi Sync with HEAD.
 1.30.2.2 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.30.2.1 23-Feb-2010  uebayasi Convert all VM_MDPAGE_INIT()'s to take struct vm_page_md * and paddr_t.
 1.32.18.3 03-Dec-2017  jdolecek update from HEAD
 1.32.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.18.1 25-Feb-2013  tls resync with head
 1.32.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.32.8.1 23-Jan-2013  yamt sync with head
 1.33.10.1 10-Aug-2014  tls Rebase.
 1.33.2.1 18-May-2014  rmind sync with head
 1.34.4.2 22-Apr-2016  skrll Sync with HEAD
 1.34.4.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.37.10.1 11-Apr-2018  martin Pull up following revision(s) (requested by mrg in ticket #733):

sys/arch/amd64/include/vmparam.h: revision 1.44
sys/arch/amd64/include/vmparam.h: revision 1.45
sys/arch/sparc64/include/vmparam.h: revision 1.38

bump PAGER_MAP_DEFAULT_SIZE to 512MB. this should allow more
concurrent IOs to be possible, and i'm unable to see pager_map
contention any more.

other larger platforms should probably do this too.
ok chs@.

Remove superfluous word in comment. Noted by Geoff Wing.

Bump PAGER_MAP_DEFAULT_SIZE to 512 MB (like amd64 recently did).
 1.38.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.38.4.1 10-Jun-2019  christos Sync with HEAD
 1.38.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.39.6.1 25-Jan-2020  ad Sync with head.
 1.39.4.1 08-Feb-2023  martin Pull up following revision(s) (requested by hgutch in ticket #1588):

sys/arch/sparc64/include/vmparam.h: revision 1.43

Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.
 1.41.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.42.18.1 08-Feb-2023  martin Pull up following revision(s) (requested by hgutch in ticket #71):

sys/arch/sparc64/include/vmparam.h: revision 1.43

Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.
 1.3 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 08-May-2004  kleink branches: 1.1.2;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 08-May-2004  skrll file wchar_limits.h was added on branch ktrace-lwp on 2004-08-03 10:41:34 +0000
 1.13 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.12 29-Mar-2008  tsutsui Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.11 07-Nov-2007  ad branches: 1.11.14;
Merge tty changes from the vmlocking branch.
 1.10 13-Feb-2006  cdi branches: 1.10.24; 1.10.42; 1.10.44; 1.10.48; 1.10.50;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.9 11-Dec-2005  christos branches: 1.9.2; 1.9.4; 1.9.6;
merge ktrace-lwp.
 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 03-May-2003  wiz branches: 1.7.2;
DMA, not dma nor Dma.
 1.6 30-Sep-2002  abs #include "kbd.h" for NKBD and only override cn_isconsole to check cn_hw if set.
Fixes compilation without kbd.
 1.5 11-Mar-2002  chs branches: 1.5.6;
override cn_trap() with zs_abort() so we can drop to the monitor
if there's no DDB. fixes PR 12547.
 1.4 08-Nov-2000  eeh branches: 1.4.4; 1.4.8;
Support for MI console magic framework.
 1.3 09-Jul-2000  eeh Upgrate interrupt handling:

1) use interrupt vectors for specific zs chips rather than polling
all of them.

2) use softintr_schedule() and schedule it for a particular device
rather than poll all devices.
 1.2 19-May-2000  eeh branches: 1.2.4;
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.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.4.8.2 18-Oct-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.6.1 07-Dec-2002  he Pull up revision 1.6 (requested by abs in ticket #890):
Allow sparc64 kernels to be compiled without kbd.
 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.16.2 15-Nov-2007  yamt sync with head.
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.9.2.1 18-Feb-2006  yamt sync with head.
 1.10.50.1 19-Nov-2007  mjf Sync with HEAD.
 1.10.48.1 13-Nov-2007  bouyer Sync with HEAD
 1.10.44.1 08-Nov-2007  matt sync with -HEAD
 1.10.42.1 11-Nov-2007  joerg Sync with HEAD.
 1.10.24.1 03-Dec-2007  ad Sync with HEAD.
 1.11.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.2 05-Sep-1998  pk Remove unused files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.6 07-Oct-2002  martin Remove obsolete and unused file (there still is ../include/asm.h, which is
shared with sparc)
 1.5 30-May-1999  eeh branches: 1.5.20;
Grab real locks from the sparc port. I suppose we could use casa and casx
instead of ldstub, but since we aren't doing n-way locking it makes little
difference. N.B. Need to decide what to do with sparc64/sparc64/asm.h which
has name conflicts with sparc64/include/asm.h. So far most of
sparc64/sparc64/asm.h has been moved to ctlreg.h.
 1.4 31-Jan-1999  mrg branches: 1.4.4;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.3 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.20.1 18-Oct-2002  nathanw Catch up to -current.
 1.246 13-Oct-2025  thorpej Implement ether-get-mac-address to handle the logic around where an
interface's Ethernet MAC address comes from, and stop fiddling around
with properties in dictionaries.
 1.245 17-Sep-2025  thorpej No need to get ofnode from i2c_attach_args::ia_cookie; we will have already
extracted it from dev's devhandle.

Fix a typo while here.
 1.244 16-Sep-2025  thorpej As with ACPI, iic_attach() now fetches the child device array directly
in the FDT case. Adjust the OFW case so that we're not forced to indirect
through a dictionary if it's not needed.
 1.243 19-Nov-2024  palle sun4v: revert changes introduced in rev. 1.242 - root fs on a cdrom *does* make sense (read-only)
 1.242 17-Nov-2024  palle sun4v: revert changes introduced in rev. 1.241 - root fs on a cdrom does make sense (read-only)
 1.241 20-Jun-2024  palle branches: 1.241.2;
sun4v: fix booting from both virtual disk (sd) and cdrom (cd) devices
 1.240 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.239 02-Sep-2023  jdc sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines
Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)
Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c
Add "socal" and "SUNW,bpp" to the interrupt map.
 1.238 22-Jan-2022  thorpej branches: 1.238.4;
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.237 04-Oct-2021  andvar remove duplicate the article in comments.
 1.236 07-Sep-2021  andvar s/aquire/acquire/ in comments, also one typo fix acqure->acquire.
 1.235 21-Aug-2021  andvar fix some more typos in comments/log messages, improve wording as well.
 1.234 07-Aug-2021  thorpej branches: 1.234.2;
Merge thorpej-cfargs2.
 1.233 03-Jul-2021  palle branches: 1.233.2;
sun4v: request hypervisor api major version 3 for the interrupt group - should solve issues when setting up interrupts on S7 systems
 1.232 03-Jul-2021  palle sun4v: add support for hypervisor soft state - from OpenBSD
 1.231 12-May-2021  thorpej - Define a device call for PCI bus instances to fetch a direct child's
device handle given the device's device/function #s (extracted from
a pcitag_t). Use it to associate the handle with the child device
at config_found() time.
- Implement this device call for ACPI and OpenFirmware.
- Enable the OpenFirmware variant for evbarm FDT, macppc, ofppc, sparc64.
- Obsolete acpi_device_register(); it is no longer needed.
- Obsolete setting the OpenFirmware handle in PCI devices in the
sparc64 device_register(); it is no longer needed.
 1.230 11-May-2021  thorpej All of the OFW-enumerated busses now associate the OFW node with the
device at config_found() time, so we can remove all of the stuff from
device_register() that does it, leaving only the @pci case to fix that
up (similar situation with ACPI on ARM and x86).

Adapt the boot device matching code to use the devhandle from the
device_t rather than the previous mechanism, and add some comments
explaining what's going on and some assertions to validate the
comments.

Collapse the sun4v vdsk boot device detection into the normal "sd"
case because it's almost identical to the normal "sd" case anyhow.
 1.229 10-May-2021  thorpej Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.228 24-Apr-2021  thorpej branches: 1.228.2; 1.228.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.227 29-Oct-2020  jdc branches: 1.227.4;
Add information about GPIO pin assignments and drive bays in the E250 and
v240. Consolidate common code for v210/v240 and E250.
Modify the GPIO pin names to include a type (currently LED or INDICATOR)
which we can then handle in the driver.
 1.226 23-Oct-2020  jdc Move E250 and E450 i2c patches from dev/pcfiic_ebus.c to sparc64/ofw_patch.c.
They are now co-located with the other OFW patch routines.
New i2c devices are created for E250/E450 and v210/v240, so create new
functions to avoid duplicate code.
 1.225 17-Oct-2020  jdc Avoid declaring autoconf_debug twice when building with DEBUG.
Pointed out by palle@ - thanks!
 1.224 16-Oct-2020  jdc Move OFW patching routines into their own file.
 1.223 11-Oct-2020  jdc Add a static EDID entry for the Mesostation-999.
Use the same logic as macppc for adding the entry.
 1.222 23-Jul-2020  jdc Move machine-specific fixes into separate functions to improve readability.
 1.221 05-Jul-2020  martin Adapt to proplib api changes
 1.220 05-Jul-2020  martin Adapt to proplib api changes
 1.219 12-Jun-2020  thorpej i2c-indirect-config == false --> i2c-no-indirect-config == true
 1.218 09-Jun-2020  macallan proplib API catchup
NFCI, tested on v210
 1.217 23-Feb-2020  macallan add location info to sd instances if we know which drive bay they live in
Sun Fire v210 only for now, others should be easy to add
 1.216 02-Feb-2020  macallan pass pin info to pcagpio instances, so far for front panel LEDs on
Sun Fire v210 only
 1.215 05-Jan-2019  martin branches: 1.215.6;
Remove debugging leftover, pointed out by mrg
 1.214 04-Jan-2019  martin PR port-sparc64/53830: adapt QEMU workarounds to newer OpenBIOS device
tree layout.
 1.213 15-Sep-2017  martin branches: 1.213.2; 1.213.4;
If the bootloader passes us information about the boot device lun/target/
and wwn, use those to properly match the boot device.
If the new bootinfo is not available, fall back to the old heuristic
trying to match the pathname of the boot device (which is ugly, firmware
dependend and known to fail in some QEMU configurations).
 1.212 11-Sep-2017  palle sun4v: Update code to retrieve CPU clock frequency so it can handle (future?) CPU clock frequencies above the 32-bit limit. ok mrg@
 1.211 26-Mar-2017  martin Simplify boot device detection for ld @ virtio
 1.210 26-Mar-2017  martin Use new accessor to get the PCI attach args from a virtio device.
 1.209 25-Mar-2017  martin Add boot device recognition for ld @ virtio.
 1.208 19-Aug-2016  palle branches: 1.208.2;
sun4v: vdsk and ldc drivers - from OpenBSD, but heavily adapted to NetBSD scsipi - access to a virtual disk served from a ldom primary domain now works
 1.207 16-Dec-2015  jdc branches: 1.207.2;
Add V210/V240 environmental sensors that are not in the OFW tree.
Add device properties for adm1026hm on V210, V240, and V440.
 1.206 13-Dec-2015  jmcneill pass addr_shift 1 to of_enter_i2c_devs
 1.205 06-Sep-2015  martin On SUN4V make the mdesc data available early in pmap_bootstrap, so we
can set up the uvm page colors correctly.
Based on code from palle@.
 1.204 14-Aug-2015  nakayama Detect a boot device more precisely on QEMU by checking the device
name.
 1.203 14-Jun-2015  martin 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.
 1.202 15-Mar-2015  nakayama Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.
 1.201 10-Jan-2015  palle sun4v: add hypervisor machine description (mdesc) functions - from OpenBSD
 1.200 18-Oct-2014  snj branches: 1.200.2;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.199 11-Aug-2014  martin Match firmware paths for the boot device in Mac style, as used by
QEMU/OpenBIOS.
 1.198 25-Jul-2014  nakayama branches: 1.198.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.197 26-Mar-2014  christos branches: 1.197.2;
use humanize_number per gimpy.
 1.196 26-Mar-2014  christos fix fraction part of printing (from apb)
 1.195 26-Mar-2014  christos simplify snprintf.
 1.194 26-Mar-2014  christos kill sprintf
 1.193 21-Feb-2014  palle 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.192 24-Sep-2013  jdc If we're running on SPARCle, add spdmem entries on the i2c bus directly,
because they are not known by firmware. Idea from martin@.
 1.191 02-Nov-2012  jdc branches: 1.191.2;
In register_device(), skip indirectly attached iic children (ia_name is NULL).
 1.190 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.189 31-Jul-2012  martin branches: 1.189.2;
Set up cn_tab in bootstrap() instead of initializing it statically.
Fixes -Wno-common fallout, idea from tsutsui.
 1.188 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.187 10-Jun-2012  mlelstv Make detection of root on wedges (dk(4)) machine independent. Remove
MD code for x86, xen, sparc64.
 1.186 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.185 30-Jan-2012  martin branches: 1.185.2;
Set up cache line sizes early in the MULTIPROCESSOR case (where we already
pass by all the notes anyway), and default them to small-but-working
values in the UP case. Avoids an endless loop when trying to flush
caches before we pass through cpu_attach().
 1.184 22-Jan-2012  nakayama pmu's i2c devices are under the "i2c" node, so find it out before
calling of_enter_i2c_devs().
 1.183 09-Jul-2011  mrg branches: 1.183.2; 1.183.6;
apply some (uintptr_t) between pointer and int assignments.
 1.182 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.181 03-Jun-2011  christos more CFATTACH_DECL_NEW fixes
 1.180 02-Jun-2011  christos split mainbus
 1.179 01-Jun-2011  macallan allow display devices to work if they have been set up by OF even of they're
not the firmware console. While there get rid of some more code carried over
from macppc that doesn't work on sparc64 and consistently use node vs.
console_node.
 1.178 24-May-2011  mrg branches: 1.178.2;
for SPI devices, allow platform code to set "scsi-initiator-id" device
property, and if set, use it instead of pfp.PortSCSIID.

on sparc64 systems on "scsi" or "scsi-2" devices, look from our node
up the tree for a "scsi-initiator-id" property, and if present, copy
it into the device properties.

this fixes mpt(4) issues on PRIMEPOWER250 (and probably other) systems.
idea from freebsd r207243/r207287, but reworked to use our device
properties instead of platform #ifdefs.


look in "device_type" as well as "name" for "ethernet" or "network",
and also look to see if a "local-mac-address" is set when choosing if
this may be a network device. fixes bge(4) nul ethernet address on
the same PRIMEPOWER250.
 1.177 12-May-2011  mrg first steps towards fujitsu SPARC64 support:

- re-add cputyp, default to sun4u
- set cputyp for sun4us or sun4v systems (from openbsd)
 1.176 11-Aug-2010  macallan branches: 1.176.2;
look for DDC data in both EDID and edid properties so we can use firmware
provided data on my XVR-100
 1.175 04-Apr-2010  nakayama Avoid use of LOOKUP_BOOTINFO, since LOOKUP_BOOTINFO causes panic
when BTINFO_XXX is not passed from ofwboot.

This makes -current kernel bootable with old ofwboot.
 1.174 02-Apr-2010  martin Add a bootinfo node to allow the loader to override the boot device
 1.173 11-Mar-2010  mrg branches: 1.173.2;
various aprint_* fixes.
 1.172 06-Mar-2010  mrg clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.171 01-Mar-2010  macallan Don't call frame-buffer-adr since it doesn't work as expected by the code
that got cargo culted over from macppc. While there shut up some leftover
debug printf.
 1.170 28-Feb-2010  martin Interpret the "reg" property of i2c nodes more liberal, and depending
on the cell size in use.
I have been unable to find any documents about the i2c bindings for OF,
so this is all pretty much voodoo.
 1.169 28-Feb-2010  martin Add support for direct configuration of i2c devices
 1.168 22-Feb-2010  mrg - store the maximum [id]cache size / line size for each cpu

- remove patch_kernel() since it isn't necessary and has been patching
the wrong thing in general.

- implement USIII versions of blast_icache(), dcache_flush_page() and
cache_flush_phys(). use the newly recorded cache size/line sizes.

- in winfixsave, flush the D$ with the right size index and ops. this
kills one of the wrong tag->inval patches.

- for blast_dcache(), use the newly recorded dcache_size/line_size.

- for blast_icache(), use the newly recorded cache size/line sizes.
for the USIII verison, disable the I$ while writing to ASI_ICACHE_TAG.


these changes removed several hard coded cache sizes values, some very
wrong kernel patching, and seem to make the current failure modes for
USIII less common, but not gone.
 1.167 15-Feb-2010  mrg introduce a new patch_kernel() and call it from the end of bootstrap().
use it to patch up TLB flush instructions that don't match for USI/II
and later. we can also hopefully use this to make GENERIC.MP minimally
expensive on single CPU machines as well.

this is the last piece needed to get GENERIC/GENERIC.MP to boot on the
USIII* machines.

idea and some initial code from openbsd.
 1.166 21-Jan-2010  martin branches: 1.166.2;
Copy the "shared-pins" property over to device_props as well.
 1.165 21-Jan-2010  martin Make sure to not provide the global ethernet address for add on
interfaces w/o FCode (the respective driver will know what to do).
 1.164 20-Jan-2010  martin Add the mac address as device property "mac-address" to all devices that
look like a network interface.
Also add a boolean "without-seeprom" to all apparently on-board network
interface (which usually have no eeprom of their own on Suns), this
latter can be used to enable driver hacks.
 1.163 10-Jan-2010  martin 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.162 05-Dec-2009  martin Refactor device_register code slightly in preparation for further changes.
No functional changes.
 1.161 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.160 13-Dec-2008  mrg branches: 1.160.2;
look for "portid" as well as "upa-portid".
 1.159 01-Dec-2008  martin Fix "target" calculation (for the sake of matching OF path names) for
atapi cdrom drives - we need to add an offset if the whole atabus is
the second ata bus on the controller since firmware adds 2 to the
target in this case. Avoids a bogus match of cd0 if booting from wd0 on
a U5/U10 (both connected to the same internal ide controller).
Problem reported by Urban Boquist and Greg Oster.
 1.158 30-Nov-2008  martin As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.
 1.157 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.156 21-Oct-2008  macallan branches: 1.156.2; 1.156.4;
If output-device contains a video mode specifier ( as in
screen:r1152x900x76 ) cut it off and pass it to the console driver. This
way radeonfb has a fighting chance to setup a mode similar or identical to
the firmware's.
 1.155 06-May-2008  jdc branches: 1.155.6;
Treat ledma the same way as sbus and dma when looking for the boot path.
Original Ultra 1's with sbus -> ledma -> le can now network boot again.
(From martin@).
 1.154 21-Apr-2008  martin branches: 1.154.2;
Be more precise when matching the boot device - with ata disks and
atapibus cdrom drives both using the same "target/lun" space, we could
confuse cdrom@0,0 for disk@0,0. Now match the complete string (we still
don't care how firmware calls a device, just rely on it being consistent).

Problem noticed by Jonathan A. Kollasch.
 1.153 14-Mar-2008  nakayama branches: 1.153.2;
#include "opt_multiprocessor.h"
 1.152 14-Mar-2008  martin If a cd(4) is attaching on ata instead of scsi, the controller is
the grandparent, not the parent.
 1.151 12-Feb-2008  joerg branches: 1.151.2; 1.151.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.150 11-Feb-2008  mrg be more explicit about needing version 1.9 of ofwboot for new kernels.
 1.149 15-Jan-2008  macallan work around yet another PGX32/Raptor firmware bug
from Peter Bex
 1.148 03-Jan-2008  jdc Print the "banner-name" property (up to the first '(' character), if
it is present, as well as the "name" property.
 1.147 31-Dec-2007  martin Fix unusued variable warning (depending on options). Noticed by
Adrian Portelli on port-sparc64.
 1.146 05-Dec-2007  tsutsui branches: 1.146.4;
Use TAILQ_FIRST(3) and TAILQ_NEXT(3) macro.
 1.145 28-Nov-2007  he branches: 1.145.2;
Allow this to build both for sparc64 and for the GENERIC_SUN4U sparc kernel.
 1.144 20-Nov-2007  macallan don't bother looking for console-specific properties on devices that aren't
PCI_CLASS_DISPLAY
 1.143 19-Nov-2007  macallan do as macppc does and pass a bunch of parameters to PCI console framebuffers
With this we no longer need machine-dependent code in framebuffer console
drivers and we can use genfb at pci for otherwise unsupported graphics
chips as long as there's firmware support.
 1.142 17-Oct-2007  garbled branches: 1.142.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.141 01-Oct-2007  martin branches: 1.141.2;
Turn a few printf into DPRINTF
 1.140 14-Aug-2007  martin branches: 1.140.2; 1.140.4;
Backout the md_tf part of the previous change - it was wrong and should
not be needed, needs more investigation.
 1.139 14-Aug-2007  martin Initialize lwp0.l_md.md_tf - it was NULL before. Spotted by tnn.
While there, g/c the unused md_pcbpaddr.
 1.138 24-Jun-2007  dyoung branches: 1.138.4; 1.138.8;
Extract common code from i386, xen, and sparc64, creating
config_handle_wedges() and read_disk_sectors(). On x86, handle_wedges()
is a thin wrapper for config_handle_wedges(). Share opendisk()
across architectures.

Add kernel code in support of specifying a root partition by wedge
name. E.g., root specifications "wedge:wd0a", "wedge:David's Root
Volume" are possible. (Patches for config(1) coming soon.)

In support of moving disks between architectures (esp. i386 <->
evbmips), I've written a routine convertdisklabel() that ensures
that the raw partition is at RAW_DISK by following these steps:

0 If we have read a disklabel that has a RAW_PART with
p_offset == 0 and p_size != 0, then use that raw partition.

1 If we have read a disklabel that has both partitions 'c'
and 'd', and RAW_PART has p_offset != 0 or p_size == 0,
but the other partition is suitable for a raw partition
(p_offset == 0, p_size != 0), then swap the two partitions
and use the new raw partition.

2 If the architecture's raw partition is 'd', and if there
is no partition 'd', but there is a partition 'c' that
is suitable for a raw partition, then copy partition 'c'
to partition 'd'.

3 Determine the drive's last sector, using either the
d_secperunit the drive reported, or by guessing (0x1fffffff).
If we cannot read the drive's last sector, then fail.

4 If we have read a disklabel that has no partition slot
RAW_PART, then create a partition RAW_PART. Make it span
the whole drive.

5 If there are fewer than MAXPARTITIONS partitions,
then "slide" the unsuitable raw partition RAW_PART, and
subsequent partitions, into partition slots RAW_PART+1
and subsequent slots. Create a raw partition at RAW_PART.
Make it span the whole drive.

The convertdisklabel() procedure can probably stand to be simplified,
but it ought to deal with all but an extraordinarily broken disklabel,
now.

i386: compiled and tested, sparc64: compiled, evbmips: compiled.
 1.137 04-Mar-2007  christos branches: 1.137.2; 1.137.4; 1.137.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.136 24-Jan-2007  hubertf branches: 1.136.2;
Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

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

Thanks to martin@ for the input on testing.
 1.135 16-Nov-2006  christos branches: 1.135.2; 1.135.4;
__unused removal on arguments; approved by core.
 1.134 26-Oct-2006  macallan Take into accout that SCSI controllers may attach to other things than
pci or sbus, like esp at dma.
So now my U1 can find its boot device again.
 1.133 19-Oct-2006  martin Remove obsolete (and partially accidently commited) kgdb parts
 1.132 15-Oct-2006  martin Sprinkle some __unused
 1.131 10-Oct-2006  tsutsui Print ofboottarget and ofbootpartition on DEBUG even if they are not set.
 1.130 09-Oct-2006  martin Ooops, stupid typo prevented recognizing wd* as boot device
(and stupid me tested on a machine with RAID 1 autoconfigured as root).
While there, make -Wextra ready and add another debug message.
 1.129 09-Oct-2006  martin More debug output for matching the boot device.
 1.128 07-Oct-2006  rjs Allow kernel to build with KGDB enabled.
 1.127 05-Oct-2006  martin After detecting wedges, close the disk vnode - otherwise things like
root on raid 1 will not be happy - fixes PR kern/34696.
 1.126 03-Oct-2006  mrg make get_ncpus() set sparc_ncpus = 1 in the !MULTIPROCESSOR case.
 1.125 01-Oct-2006  martin Oops, now *realy* do print the non-truncated firmware boot path
 1.124 01-Oct-2006  martin Print the raw bootpath value
 1.123 01-Oct-2006  martin Use more device_ accessor macros
 1.122 26-Sep-2006  martin Minor cosmetics and error checking for probably impossible corner
cases.
 1.121 26-Sep-2006  thorpej device_setofnode(): Release the number object after storing it in the
device properties dictionary. The dictionary also retains the object,
so if we don't release it, the initial reference leaks.
 1.120 26-Sep-2006  martin Rework boot device matching to get rid of lots of special case code
and tables to map fimware names to driver names. Based on a suggestion
from Eduardo (quite some time ago).
Each device (on busses we can handle and care about) gets a device property
storing the devices OpenFirmware package handle. To match the boot device,
the phandle of the chosen bootpath is compared against this property,
plus some additional string matching for disk/cd devices (where OF only
provides a node for the device class, not each instance).
 1.119 12-Sep-2006  martin branches: 1.119.2;
We need to call setroot() even if we don't know about the boot device.
 1.118 07-Sep-2006  martin branches: 1.118.2;
If we have not found our booted_device, tell the user and do not crash.
This seems more sensible than a simple KASSERT.
 1.117 27-Aug-2006  christos This is why we should not copy buggy code... You get to fix bugs multiple
times: Wedges don't have partitions, so don't use MAKEDISKDEV
 1.116 14-Aug-2006  martin Allow booting from wedges.
 1.115 29-Mar-2006  thorpej Use device_cfdata().
 1.114 28-Mar-2006  thorpej Use device_unit().
 1.113 03-Mar-2006  cube branches: 1.113.2; 1.113.4; 1.113.6;
"device_is_a() == 0" means device_is_not_a, and that's_not_what_we_want.
[hi thropej!]
 1.112 26-Feb-2006  thorpej Use device_is_a().
 1.111 25-Feb-2006  wiz Fix typos, reported by Alexey Dobriyan ("Gathered from Linux"),
forwarded by jmc@openbsd.
 1.110 23-Feb-2006  thorpej Use device_parent().
 1.109 20-Feb-2006  cdi Use ANSI-style function definitions and declarations.
 1.108 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.107 27-Jan-2006  cdi branches: 1.107.2; 1.107.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.106 24-Dec-2005  perry branches: 1.106.2;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.105 11-Dec-2005  christos merge ktrace-lwp.
 1.104 14-Aug-2005  mrg match isp as a PCI device called "SUNW,isptwo". from Eric Benoit.
 1.103 16-Jun-2005  briggs branches: 1.103.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.102 31-May-2005  christos - sprinkle const
- avoid shadowed variables
 1.101 28-Apr-2005  matt Match a device_type of scsi-2 as SCSI (as found in a Netra 1405).
 1.100 07-Mar-2005  martin Make it compile for 32bit kernels. XXX - does OF realy return pointers to
64 bit entities here?
 1.99 25-Feb-2005  martin Nuke options RASTERCONSOLE for sparc64
 1.98 23-Oct-2004  thorpej branches: 1.98.4; 1.98.6;
Centralize the declaration of booted_device and booted_partition.
 1.97 30-Mar-2004  petrov Recognize tlp and ethernet as bootpath.
 1.96 23-Mar-2004  martin branches: 1.96.2;
Replace intrcnts by evcnts. XXX - needs slight tweaking for MULTIPROCESSOR.
 1.95 21-Mar-2004  pk Switch to the sparc prom library.
 1.94 19-Mar-2004  pk Drop optionsnode, fbnode and stdinnnode.
 1.93 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.92 17-Mar-2004  pk Pass the buffer size to PROM_getpropstringA(), as in sparc.
 1.91 17-Mar-2004  pk Print the host Id in mainbus_attach() instead of clock_attach().
 1.90 16-Mar-2004  pk For now, implement prom_getoption() in autoconf.c.
 1.89 16-Mar-2004  pk For now, implement prom_getidprom() and prom_getether() in autoconf.c
 1.88 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.87 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.86 14-Dec-2003  thorpej No need to include wdvar.h anymore.
 1.85 09-Nov-2003  martin bzero/bcopy -> memset/memcpy
 1.84 21-Oct-2003  petrov don't use NULL for an int initialization.
 1.83 09-Oct-2003  bouyer After pciide split, add cmdide and aceride to bus_class_tab[], per Martin
Husemann and Takeshi Nakayama requests.
XXX others IDE controller drivers needs to be added too, or a better
way of handling it has to be found.
 1.82 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.81 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.80 24-Aug-2003  uwe #include "opt_rcons.h"
 1.79 07-Aug-2003  martin Add "esiop" driver to PCI bus table, so mapping OF boot device pathes
to autoconfig device nodes works when booting from a esiop attached drive
(instead of the old siop)
 1.78 29-Jul-2003  petrov Remove autoconf_nzs, seems no-one uses it now.
 1.77 15-Jul-2003  lukem __KERNEL_RCSID()
 1.76 18-Jun-2003  drochner branches: 1.76.2;
don't #include <sys/dkstat.h> where it is (appearently) unused
 1.75 18-May-2003  martin Make kernels with options KGDB at least compile.
Still needs some work to make it working.
 1.74 17-May-2003  nakayama Avoid strict-alias warnings in gcc 3.3.
 1.73 10-May-2003  martin We are always using ELF on sparc64, so nuke bogus test for DB_ELF_SYMBOLS.
 1.72 26-Apr-2003  ragge Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)
 1.71 04-Jan-2003  mrg use "booted_device" when calling setroot(), so that raidframe autoconfigured
root works... now with a "/boot" partition holding /ofwboot & /netbsd i can
have a raidframe root without hard coding root at in my kernel.
 1.70 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.69 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.68 03-Nov-2002  mrg redo the previous: it seems that the 2nd prom address value is ignored/useless
(it seems to be always zero), and that the channel & drive are encoded into the
first value as "channel * 2 + drive", so, look for this.
 1.67 02-Nov-2002  mrg match channel & disk when trying to determine if this IDE disk is the boot device.
now we can boot from any IDE disk on the system.
 1.66 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.65 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.64 29-Sep-2002  chs remove some vestigial FPU and cache code that's not need on ultrasparcs.
misc tidiness.
 1.63 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.62 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.61 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.60 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.59 24-Sep-2002  thorpej Fix some const warnings.
 1.58 04-Jun-2002  eeh Make the code that matches boot devices much more flexible so it handles
device classes as well as funny names for matching. This should allow
us to properly recognize we're booted from a SCSI disk on a PCI controller.
 1.57 16-May-2002  thorpej branches: 1.57.2; 1.57.4;
* 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.56 06-May-2002  eeh Recognize `ofpci' as a PCI bus.
 1.55 02-Dec-2001  bouyer branches: 1.55.6;
Convert to new ata/atapi attach structs.
 1.54 05-Oct-2001  eeh branches: 1.54.4;
Make OF_interpret() handle input and output arguments.
 1.53 05-Oct-2001  pooka include <machine/bsd_openprom.h> to make this compile with RASTERCONSOLE
 1.52 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.51 24-Jul-2001  eeh branches: 1.51.2;
Garbage collect.
 1.50 23-Jul-2001  eeh Fix bootpath checks on machines with simbas.
 1.49 19-Jul-2001  eeh Add 'ide' to the IPL table and fix things so we don't rely on the PROM
mapping things in for us.
 1.48 30-May-2001  lukem branches: 1.48.2;
add missing #include "opt_kgdb.h"
 1.47 18-May-2001  mrg notice siop boot devices.
 1.46 18-May-2001  mrg kill dead code.
 1.45 10-May-2001  petrov john heasley patch <heas@shrubbery.net>, PR port-sparc/12885
added PROM name translations for hme and fas
 1.44 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.43 11-Feb-2001  eeh branches: 1.43.2;
Save the machine model string in case someone needs it (like slowlaris).
 1.42 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.41 04-Oct-2000  jdolecek bootpath_build(): implement slighly more clever algorith to find boot
flags in the bootpath: only treat the rest as boot flags if the '-'
follows whitespace (space or tab)

This should fix the "boot disk4 netbsd-20001004-RFHS8036" lossage
Hubert Feyer pointed out in private e-mail.

Tested by: jdolecek (userland version)
Reviewed by: eeh
 1.40 27-Sep-2000  eeh Fix for prev (define fl).
 1.39 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.38 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.37 20-Jul-2000  pk For now, alias `network' to `hme'.
 1.36 07-Jul-2000  mrg check that this *entry* is BUSCLASS_NONE (not the current device) in
bus_compatible(). fixes boot device detection on sbus. while i'm here,
sprinkle DPRINTF()s in the boot device detection code.
 1.35 03-Jul-2000  mrg - add a bus class check to the conversion of prom names to NetBSD driver
names, as we need to convert `pci' to both `psycho' and `simba'. add
a member to dev_compat_table[] for this, using BUSCLASS_NONE for when
we don't care (all other cases, currently). add `ide' -> `pciide' and
`disk' -> `wd' mappings here, also.
- "psycho" is a BUSCLASS_MAINBUS device; it has UPA attachment semantics.


this fixes bootpath detection for IDE disks.
 1.34 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.33 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.32 24-Jun-2000  eeh Add PROM symbols to 32-bit kernels too.
 1.31 19-Jun-2000  eeh branches: 1.31.2;
Have separate data and text segments, make text read-only.
 1.30 19-May-2000  eeh branches: 1.30.2;
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.29 12-Apr-2000  pk Ignore unknown devices on mainbus.
 1.28 12-Apr-2000  mrg deja vu: add "struct device *booted_device;" so raidframe links.
 1.27 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.26 16-Jan-2000  eeh The bootpath element must point to the appropriate bus node to work correctly.
 1.25 14-Jan-2000  pk Remove old-style boot device recognition.
Sync device_register() et. al. with sparc/sparc/autoconf.c
 1.24 21-Nov-1999  pk Avoid unused symbol warnings when not using DDB.
 1.23 08-Nov-1999  eeh Fix boot device detection code.
 1.22 17-Sep-1999  thorpej branches: 1.22.2; 1.22.4; 1.22.8;
Centralize the declaration and clearing of `cold'.
 1.21 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.20 23-Aug-1999  thorpej Garbage-collect reference to <sys/dmap.h>.
 1.19 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.18 04-Jun-1999  mrg GC dead code. add support for PCI and IDE boot device detection, plus hme ethernet.
should probably deal with be and qe, etc.
 1.17 30-May-1999  eeh Add code to support using %tick as the system clock if no "counter-timer" node
is found.
 1.16 23-May-1999  eeh Start putting in hooks for non-zs console devices.
 1.15 22-May-1999  eeh Well, looks like the MI allocsys() broke the dvmamap, so instead of using a
single map move it to the bus controller driver so each bus can handle its own
IOMMU without conflicts.
 1.14 25-Apr-1999  eeh Garbage collect some old stuff.
 1.13 18-Mar-1999  eeh branches: 1.13.4;
Some devices don't have a `device-type' property we can use to allocate
an IPL. Check for those by name. Give the rest a default IPL of 2.
(Added `SUNW,CS4231' to the list.)
 1.12 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.11 09-Jan-1999  eeh New style bootpath propagation to match the sparc port.
 1.10 04-Dec-1998  thorpej Pass the symbol table size, like a.out.
 1.9 06-Oct-1998  thorpej Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.
 1.8 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.7 05-Sep-1998  pk Use auto-generated `dev_name2blk[]'.
 1.6 05-Sep-1998  pk Nuke temporary `getpropA()'.
 1.5 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.4 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 04-Jul-1998  jonathan branches: 1.2.2;
defopt DDB.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2.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.13.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.22.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.4.1 15-Nov-1999  fvdl Sync with -current
 1.22.2.4 14-Mar-2001  bouyer Make it compile again.
 1.22.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.22.2.2 22-Jan-2001  bouyer first cut at converting to thorpej_scsipi
 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.30.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.31.2.3 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.31.2.2 31-Jul-2000  mrg pull up 1.37 (approved by thorpej)
>For now, alias `network' to `hme'.
 1.31.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.43.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.48.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.48.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.48.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.48.2.1 03-Aug-2001  lukem update to -current
 1.51.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.51.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.54.4.8 07-Jan-2003  thorpej Sync with HEAD.
 1.54.4.7 03-Jan-2003  thorpej Sync with HEAD.
 1.54.4.6 29-Dec-2002  thorpej Sync with HEAD.
 1.54.4.5 11-Nov-2002  nathanw Catch up to -current
 1.54.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.54.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.54.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.54.4.1 05-Oct-2001  nathanw file autoconf.c was added on branch nathanw_sa on 2002-01-08 00:28:00 +0000
 1.55.6.1 26-Mar-2002  eeh Implement dev_mdgetprop().
 1.57.4.3 15-Nov-2002  lukem Pull up revision 1.68 (requested by mrg in ticket #959):
redo the previous: it seems that the 2nd prom address value is ignored/useless
(it seems to be always zero), and that the channel & drive are encoded into the
first value as "channel * 2 + drive", so, look for this.
 1.57.4.2 15-Nov-2002  lukem Pull up revision 1.67 (requested by mrg in ticket #959):
match channel & disk when trying to determine if this IDE disk is the boot device.
now we can boot from any IDE disk on the system.
 1.57.4.1 05-Jun-2002  lukem Pull up revision 1.58 (requested by eeh in ticket #155):
Make the code that matches boot devices much more flexible so it handles
device classes as well as funny names for matching. This should allow
us to properly recognize we're booted from a SCSI disk on a PCI controller.
 1.57.2.2 15-Jul-2002  gehenna catch up with -current.
 1.57.2.1 16-May-2002  gehenna file autoconf.c was added on branch gehenna-devsw on 2002-07-15 01:21:45 +0000
 1.76.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.76.2.6 08-Mar-2005  skrll Sync with HEAD.
 1.76.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.76.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.76.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.76.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.76.2.1 03-Aug-2004  skrll Sync with HEAD
 1.96.2.1 09-May-2004  jdc Pull up revision 1.97 (requested by petrov in ticket #268)

Recognize tlp and ethernet as bootpath.
 1.98.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.98.4.1 29-Apr-2005  kent sync with -current
 1.103.2.10 17-Mar-2008  yamt sync with head.
 1.103.2.9 27-Feb-2008  yamt sync with head.
 1.103.2.8 11-Feb-2008  yamt sync with head.
 1.103.2.7 21-Jan-2008  yamt sync with head
 1.103.2.6 07-Dec-2007  yamt sync with head
 1.103.2.5 27-Oct-2007  yamt sync with head.
 1.103.2.4 03-Sep-2007  yamt sync with head.
 1.103.2.3 26-Feb-2007  yamt sync with head.
 1.103.2.2 30-Dec-2006  yamt sync with head.
 1.103.2.1 21-Jun-2006  yamt sync with head.
 1.106.2.3 01-Mar-2006  yamt sync with head.
 1.106.2.2 18-Feb-2006  yamt sync with head.
 1.106.2.1 01-Feb-2006  yamt sync with head.
 1.107.4.1 22-Apr-2006  simonb Sync with head.
 1.107.2.1 09-Sep-2006  rpaulo sync with head
 1.113.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.113.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.113.2.3 14-Sep-2006  yamt sync with head.
 1.113.2.2 03-Sep-2006  yamt sync with head.
 1.113.2.1 01-Apr-2006  yamt sync with head.
 1.118.2.2 01-Feb-2007  ad Sync with head.
 1.118.2.1 18-Nov-2006  ad Sync with head.
 1.119.2.2 10-Dec-2006  yamt sync with head.
 1.119.2.1 22-Oct-2006  yamt sync with head
 1.135.4.1 03-Jun-2008  skrll Sync with netbsd-4.
 1.135.2.2 25-May-2008  bouyer Pull up following revision(s) (requested by jdc in ticket #1152):
sys/arch/sparc64/sparc64/autoconf.c: revision 1.155
Treat ledma the same way as sbus and dma when looking for the boot path.
Original Ultra 1's with sbus -> ledma -> le can now network boot again.
(From martin@).
 1.135.2.1 02-Feb-2008  riz Pull up following revision(s) (requested by martin in ticket #1030):
sys/arch/sparc64/sparc64/autoconf.c: revision 1.147
Fix unusued variable warning (depending on options). Noticed by
Adrian Portelli on port-sparc64.
 1.136.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.137.10.2 03-Oct-2007  garbled Sync with HEAD
 1.137.10.1 26-Jun-2007  garbled Sync with HEAD.
 1.137.4.1 11-Jul-2007  mjf Sync with head.
 1.137.2.3 03-Dec-2007  ad Sync with HEAD.
 1.137.2.2 09-Oct-2007  ad Sync with head.
 1.137.2.1 15-Jul-2007  ad Sync with head.
 1.138.8.5 09-Dec-2007  jmcneill Sync with HEAD.
 1.138.8.4 03-Dec-2007  joerg Sync with HEAD.
 1.138.8.3 21-Nov-2007  joerg Sync with HEAD.
 1.138.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.138.8.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.138.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.140.4.1 06-Oct-2007  yamt sync with head.
 1.140.2.3 23-Mar-2008  matt sync with HEAD
 1.140.2.2 09-Jan-2008  matt sync with HEAD
 1.140.2.1 06-Nov-2007  matt sync with HEAD
 1.141.2.1 21-Nov-2007  bouyer Sync with HEAD
 1.142.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.142.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.145.2.1 08-Dec-2007  ad Sync with head.
 1.146.4.3 19-Jan-2008  bouyer Sync with HEAD
 1.146.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.146.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.151.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.151.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.151.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.151.2.1 24-Mar-2008  keiichi sync with head.
 1.153.2.1 18-May-2008  yamt sync with head.
 1.154.2.5 09-Oct-2010  yamt sync with head
 1.154.2.4 11-Aug-2010  yamt sync with head.
 1.154.2.3 11-Mar-2010  yamt sync with head
 1.154.2.2 04-May-2009  yamt sync with head.
 1.154.2.1 16-May-2008  yamt sync with head.
 1.155.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.156.4.1 04-Dec-2008  snj Pull up following revision(s) (requested by martin in ticket #157):
sys/arch/sparc64/sparc64/autoconf.c: revision 1.159
Fix "target" calculation (for the sake of matching OF path names) for
atapi cdrom drives - we need to add an offset if the whole atabus is
the second ata bus on the controller since firmware adds 2 to the
target in this case. Avoids a bogus match of cd0 if booting from wd0 on
a U5/U10 (both connected to the same internal ide controller).
Problem reported by Urban Boquist and Greg Oster.
 1.156.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.156.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.160.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.166.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.166.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.173.2.4 12-Jun-2011  rmind sync with head
 1.173.2.3 31-May-2011  rmind sync with head
 1.173.2.2 05-Mar-2011  rmind sync with head
 1.173.2.1 30-May-2010  rmind sync with head
 1.176.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.178.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.183.6.2 02-Jun-2012  mrg sync to latest -current.
 1.183.6.1 18-Feb-2012  mrg merge to -current.
 1.183.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.183.2.3 16-Jan-2013  yamt sync with (a bit old) head
 1.183.2.2 30-Oct-2012  yamt sync with head
 1.183.2.1 17-Apr-2012  yamt sync with head
 1.185.2.3 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.185.2.2 05-Jul-2012  riz Pull up following revision(s) (requested by mlelstv in ticket #402):
sys/dev/vnd.c: revision 1.221
sys/kern/init_main.c: revision 1.443
sys/kern/init_main.c: revision 1.444
sys/dev/dkwedge/dk.c: revision 1.64
sys/arch/x86/x86/x86_autoconf.c: revision 1.63
sys/arch/sparc64/sparc64/autoconf.c: revision 1.187
sys/sys/device.h: revision 1.141
sys/dev/dkwedge/dkwedge_bsdlabel.c: revision 1.17
sys/kern/kern_subr.c: revision 1.213
sys/arch/zaurus/zaurus/autoconf.c: revision 1.11
sys/arch/xen/x86/autoconf.c: revision 1.14
sys/sys/disk.h: revision 1.57
Use the label's packname to create wedge names instead of the classic
device names. Fall back to classic device names when the label has an
empty name or the default name 'fictitious'.
autodiscover wedges
Make detection of root on wedges (dk(4)) machine independent. Remove
MD code for x86, xen, sparc64.
Make detection of root on wedges (dk(4)) machine independent. Remove
MD code for zaurus.
Do not try to find the wedge we booted from if opendisk(booted_device)
failed.
 1.185.2.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.189.2.3 03-Dec-2017  jdolecek update from HEAD
 1.189.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.189.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.191.2.1 18-May-2014  rmind sync with head
 1.197.2.1 10-Aug-2014  tls Rebase.
 1.198.2.4 04-Sep-2015  martin Pull up following revision(s) (requested by nakayama in ticket #951):
sys/arch/sparc64/dev/pckbc_ebus.c: revision 1.2
sys/arch/sparc64/sparc64/autoconf.c: revision 1.204
Detect a boot device more precisely on QEMU by checking the device
name.
pckbc@ebus: match "kb_ps2" device to make keyboard and mouse work
on qemu-sparc64.
XXX OpenBIOS doesn't provide interrupts for pckbc currently, so use
the interrupt numbers described in QEMU's hw/sparc64/sun4u.c::isa_irq_handler.
 1.198.2.3 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.198.2.2 21-Mar-2015  snj Pull up following revision(s) (requested by nakayama in ticket #628):
sys/arch/sparc64/sparc64/autoconf.c: revision 1.202
sys/arch/sparc64/sparc64/machdep.c: revision 1.281
Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.
This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.
 1.198.2.1 12-Aug-2014  riz Pull up following revision(s) (requested by martin in ticket #2):
sys/arch/sparc64/sparc64/autoconf.c: revision 1.199
Match firmware paths for the boot device in Mac style, as used by
QEMU/OpenBIOS.
 1.200.2.5 28-Aug-2017  skrll Sync with HEAD
 1.200.2.4 05-Oct-2016  skrll Sync with HEAD
 1.200.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.200.2.2 22-Sep-2015  skrll Sync with HEAD
 1.200.2.1 06-Apr-2015  skrll Sync with HEAD
 1.207.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.208.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.213.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.213.4.1 10-Jun-2019  christos Sync with HEAD
 1.213.2.1 18-Jan-2019  pgoyette Synch with HEAD
 1.215.6.1 29-Feb-2020  ad Sync with head.
 1.227.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.228.4.1 31-May-2021  cjep sync with head
 1.228.2.3 01-Aug-2021  thorpej Sync with HEAD.
 1.228.2.2 15-May-2021  thorpej - Move all of the stuff-missing-from-OFW-device-tree stuff into a
new function sparc64_device_tree_fixup(), and call it from
device_register().
- sparc64_device_tree_fixup() is table-driven, selecting the table
based on the machine_model. It can appy "dtnode" fixups (by matching
the device's OFW path) and "special" fixups, which are especially
useful when a property needs to be added to another device that happens
to not be in the OFW device tree.
- Implement enumeration of missing-from-OFW-device-tree i2c devices
by "sub-classing" the controller's device handle, intercepting the
"i2c-enumerate-devices" device call. We let the "super" first
enumerate any i2c devices that are in the OFW device tree, and then
enumerate our own additions after that is done. i2c additions are
provided by the machine_model fixup tables.
 1.228.2.1 13-May-2021  thorpej Sync with HEAD.
 1.233.2.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.234.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.238.4.1 09-Sep-2023  martin Pull up following revision(s) (requested by jdc in ticket #360):

sys/arch/sparc64/dev/fdc.c: revision 1.52
sys/arch/sparc64/include/intr.h: revision 1.32
sys/arch/sparc64/sparc64/autoconf.c: revision 1.239
sys/arch/sparc64/include/psl.h: revision 1.64

sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines

Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)

Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c

Add "socal" and "SUNW,bpp" to the interrupt map.
 1.241.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 18-Jul-2000  mrg kill dead files.
 1.2 23-Mar-2000  thorpej branches: 1.2.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.2 18-Jul-2000  mrg kill dead files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.24;
Import of sparc64.
 1.1.1.1.24.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.3 13-Jul-2000  mrg remove vaddrs.h
 1.2 15-Apr-2000  mrg branches: 1.2.4;
- auxio cleanup and sbus support.
- make GENERIC64 include GENERIC and set the 3 optoins it needs. suggested
by hubert feyrer.
- add a comment that we maybe should use the `bpp' driver, not the lpt, on
the ebus because the `bpp' driver does DMA already.
- ebus_attach_args got a member renamed
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.12 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.11 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.10 05-Jan-2015  palle cache_flush_phys(): Avoid run-time check for cpu type/implementation by installing correct function pointer in cache_setup_funcs()
 1.9 30-Dec-2014  palle sp_tlb_flush_*: Avoid run-time check for cpu type/implementation by installing correct function in cache_setup_funcs()
 1.8 06-Jun-2011  mrg branches: 1.8.2; 1.8.14; 1.8.32;
convert dcache_flush_page() into a function pointer. introduce a
sp_dcache_flush_page() to help the smp version.

XXX: probably best to have usI/II and usIII (and nop) of this and
XXX: avoid the need for sp_dcache_flush_page at all.
 1.7 06-Jun-2011  mrg re-implement blast_dcache() and blast_icache() via function pointers so that
we can set these to functions that simply return on sun4us/sun4v systems.

also include some work-in-progress #if 0'ed code to do the same for the
dcache_flush*() functions.


(some of these could probably move into the cpuinfo except that sparc64
systems don't really ever work with mismatches AFAICT.)
 1.6 29-Sep-2002  chs branches: 1.6.82; 1.6.88;
remove some vestigial FPU and cache code that's not need on ultrasparcs.
misc tidiness.
 1.5 06-Dec-2000  mrg branches: 1.5.4; 1.5.8;
fix warnings in DEBUG & DIAGNSTIC code.
 1.4 04-Dec-2000  fvdl More cast / format cleanup to make this compile cleanly in 32bit mode.
 1.3 01-Aug-2000  eeh Revamp cache flush routines.
 1.2 05-Sep-1998  eeh branches: 1.2.12; 1.2.22;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.22.1 07-Aug-2000  mrg pull up 1.3 (approved by thorpej):
>Revamp cache flush routines.
 1.2.12.2 08-Dec-2000  bouyer Sync with HEAD.
 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.5.8.1 18-Oct-2002  nathanw Catch up to -current.
 1.5.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.6.88.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.82.1 12-Jun-2011  rmind sync with head
 1.8.32.2 09-Jul-2016  skrll Sync with HEAD
 1.8.32.1 06-Apr-2015  skrll Sync with HEAD
 1.8.14.1 03-Dec-2017  jdolecek update from HEAD
 1.8.2.2 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8.2.1 06-Jun-2011  cherry file cache.c was added on branch cherry-xenmp on 2011-06-23 14:19:43 +0000
 1.31 16-May-2022  mrg try to handle ultrasparc III* "fast ecc error" traps.

i had a sunblade 2500 reset with this trap recently, and the
manual says it should have been recoverable. in particular,
the US IIIv2 manual says in section 12.4.4.2 that the i-cache
won't see this data ever (so nothing needed there), and that
the d-cache needs to be disabled, and all the entries flushed,
and then re-enabled.

tested with a "trap 0x70" from kernel space, that trap.c
converted the "0x170" back to "0x70" (with an ADVANCE). this
code not commited.
 1.30 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.29 09-Jan-2019  mrg avoid function param names in prototypes.
 1.28 05-Jan-2015  palle branches: 1.28.16; 1.28.18;
cache_flush_phys(): Avoid run-time check for cpu type/implementation by installing correct function pointer in cache_setup_funcs()
 1.27 30-Dec-2014  palle sp_tlb_flush_*: Avoid run-time check for cpu type/implementation by installing correct function in cache_setup_funcs()
 1.26 05-Nov-2014  nakayama branches: 1.26.2;
Simplify a condition.
 1.25 05-Nov-2014  nakayama Remove more #ifdef SUN4V to make compilable w/o options SUN4V.
 1.24 04-Nov-2014  palle sun4v: Removed a bunch of ifdef SUN4V since the CPU_ISSUN4V already has the necessary logic. Noticed by mrg@
 1.23 08-Jun-2014  palle sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.22 06-Jun-2011  mrg branches: 1.22.12; 1.22.26;
convert dcache_flush_page() into a function pointer. introduce a
sp_dcache_flush_page() to help the smp version.

XXX: probably best to have usI/II and usIII (and nop) of this and
XXX: avoid the need for sp_dcache_flush_page at all.
 1.21 06-Jun-2011  mrg re-implement blast_dcache() and blast_icache() via function pointers so that
we can set these to functions that simply return on sun4us/sun4v systems.

also include some work-in-progress #if 0'ed code to do the same for the
dcache_flush*() functions.


(some of these could probably move into the cpuinfo except that sparc64
systems don't really ever work with mismatches AFAICT.)
 1.20 25-May-2011  mrg branches: 1.20.2;
define MANUF_FUJITSU (and fix CPU_IS_SPARC64_V_UP()) and MANUF_SUN.

use CPU_IS_SPARC64_V_UP() to choose some US-III versions of some
cache functions.
 1.19 12-May-2011  mrg first steps towards fujitsu SPARC64 support:

- sun4us and sun4v systems don't need dcache_flush_page or
blast_icache ops
 1.18 28-Mar-2010  mrg branches: 1.18.2;
- add a kmutex_t ci_ctx_lock to struct cpu_info, and initialise it in
cpu_pmap_init() and replace pmap_ctx_lock usage with this new ci_ctx_lock

- replace smp_dcache_flush_page_all() with smp_dcache_flush_page_cpuset(),
that flushes only on the set of CPUs not, everyone. add new
dcache_flush_page_cpuset() to flush this page from the D$ only
on the specified set of CPUs.

- add a cpuset to pmap_free_page() and use it when freeing PTE pages
when a pmap is destroyed

- introduce pmap_free_page_noflush(), and use it when we allocated a
page for PTEs but didn't use it and don't need to flush it

- don't bother with pmap_lock in pmap_extract(), the only potential
issue is pseg_get() which is already safe


tested on sb2000, sb2500 and ultra80 with a bunch of various heavy
workloads, and seems to give a clear 1-2% speed up for high-forking /
short lived processes, such as ./configure.
 1.17 08-Mar-2010  mrg branches: 1.17.2;
blast_dcache() SMP friendly:

- blast_dcache() becomes sp_blast_dcache(dcache_size, dcache_line_size)
- new smp_blast_dcache(sparc64_cpuset_t) that blasts the D$ on this cpuset
- sparc64_ipi_blast_dcache() to support the above
- in pmap_remove_all(), when freeing mmu contexts for this pmap, mark
the set of cpus to blast the d$ on as well and convert the
blast_dcache() call into smp_blast_dcache() on the cpus who ran this
pmap, or, sp_blast_dcache(dcache_size, dcache_line_size)
- convert the remaining blast_dcache() in machdep.c to sp_blast_dcache()
- in pmap_destroy()/pmap_remove_all() take the pmap_lock() always since
we assert it is held always.

with these changes, NFS builds on the U60 seem to be stable now, and
the USIII machines also can often complete a single build.sh run now,
diskful or diskless.


reviewed by mlelstv and partially by martin, tested by martin and myself,
with some ideas from chuq as well.
 1.16 06-Mar-2010  mrg clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.15 24-Feb-2010  mrg when handing back page table pages to UVM, flush them from the dcache
on all CPUs.

idea from skrll@, and makes my disk-based SB2000 stable.

tested on U60, SB2000 and SB2500.
 1.14 24-Feb-2010  mrg fix MULTIPROCESSOR build for previous.
 1.13 24-Feb-2010  mrg move the tlb flush routines into cache.h to avoid machine/pmap.h polution.
 1.12 22-Feb-2010  mrg - store the maximum [id]cache size / line size for each cpu

- remove patch_kernel() since it isn't necessary and has been patching
the wrong thing in general.

- implement USIII versions of blast_icache(), dcache_flush_page() and
cache_flush_phys(). use the newly recorded cache size/line sizes.

- in winfixsave, flush the D$ with the right size index and ops. this
kills one of the wrong tag->inval patches.

- for blast_dcache(), use the newly recorded dcache_size/line_size.

- for blast_icache(), use the newly recorded cache size/line sizes.
for the USIII verison, disable the I$ while writing to ASI_ICACHE_TAG.


these changes removed several hard coded cache sizes values, some very
wrong kernel patching, and seem to make the current failure modes for
USIII less common, but not gone.
 1.11 01-Feb-2010  mrg branches: 1.11.2;
remove unused icache_flush_page() implementation.
 1.10 21-Oct-2006  mrg branches: 1.10.56; 1.10.66; 1.10.74;
remove "struct cacheline" and the "cacheline" variable. (it was only set
in cpu_attach(), overwritten by multiple cpus, and only one member of the
12 or more were ever used again.) add an ecache_min_line_size to replace
this functionality.

clean up some non-SMP friendly code from cpu_attach():
- only reset the fpu state on the boot cpu
- don't bother printing "FPU version 0" always
- don't call getver() and ignore the result
- print the UPA id on the first cpu0: line

only print mp_tramp address #ifdef DEBUG.

reset the fpu state in cpu_hatch(), like cpu_attach() does for the boot cpu.


cpu_attach() is now free of SMP-unfriendly code.
 1.9 11-Feb-2006  cdi branches: 1.9.14; 1.9.16;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.8 11-Dec-2005  christos branches: 1.8.2; 1.8.4; 1.8.6;
merge ktrace-lwp.
 1.7 03-Dec-2004  chs branches: 1.7.12;
remove cache_flush_virt() and PADDRT, they're no longer used.
allocate a stack frame for blast_dcache() when profiling so it shows up.
in dcache_flush_page(), use a stride of 32 instead of 16 to match the
cache line size. correct various comments.
 1.6 29-Sep-2002  chs branches: 1.6.6;
remove some vestigial FPU and cache code that's not need on ultrasparcs.
misc tidiness.
 1.5 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.4 16-Apr-2002  eeh Add icache_flus_page() to go with dcache_flush_page().
 1.3 01-Aug-2000  eeh branches: 1.3.4; 1.3.8;
Revamp cache flush routines.
 1.2 05-Sep-1998  eeh branches: 1.2.12; 1.2.22;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.22.1 07-Aug-2000  mrg pull up 1.3 (approved by thorpej):
>Revamp cache flush routines.
 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.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.3.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.6.1 18-Dec-2004  skrll Sync with HEAD.
 1.7.12.2 30-Dec-2006  yamt sync with head.
 1.7.12.1 21-Jun-2006  yamt sync with head.
 1.8.6.1 22-Apr-2006  simonb Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.8.2.1 18-Feb-2006  yamt sync with head.
 1.9.16.1 22-Oct-2006  yamt sync with head
 1.9.14.1 18-Nov-2006  ad Sync with head.
 1.10.74.1 21-Apr-2010  matt sync to netbsd-5
 1.10.66.1 17-Mar-2010  snj Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
properly handle flushes in all cpus as necessary
 1.10.56.2 11-Aug-2010  yamt sync with head.
 1.10.56.1 11-Mar-2010  yamt sync with head
 1.11.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.2.3 12-Jun-2011  rmind sync with head
 1.17.2.2 31-May-2011  rmind sync with head
 1.17.2.1 30-May-2010  rmind sync with head
 1.18.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.20.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.22.26.1 10-Aug-2014  tls Rebase.
 1.22.12.2 03-Dec-2017  jdolecek update from HEAD
 1.22.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.2.1 06-Apr-2015  skrll Sync with HEAD
 1.28.18.1 10-Jun-2019  christos Sync with HEAD
 1.28.16.1 18-Jan-2019  pgoyette Synch with HEAD
 1.124 12-Jul-2024  andvar s/calibrarion/calibration/ in debug message and comments.
 1.123 29-May-2020  rin branches: 1.123.26;
For struct timecounter, use C99 initializers.
Compile tested. No functional changes intended.
 1.122 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.121 08-Feb-2019  palle sun4v: initialize %stickcmpr properly when establishing interrupt - fixes issue seen on newer sun4v/SPARC-T5 system where the interrupt never fires.
 1.120 07-Jul-2016  msaitoh branches: 1.120.18;
KNF. Remove extra spaces. No functional change.
 1.119 13-May-2016  nakayama Allocate interrupt handlers for clockintr and statintr dynamically.
 1.118 13-Dec-2015  christos PR/50531: David Binderman: Add missing printf args
 1.117 25-Jul-2014  nakayama branches: 1.117.4;
Use clockfreq() to print a system tick frequency.

The stick-frequency of Fire V100 is 5555555Hz and printing it as
5.555MHz instead of 5MHz is more precise.
 1.116 10-Jun-2014  palle sun4v: make cpu_initclocks() work on sun4v - %tick and %stick on sun4v systems are read-only. ok martin@
 1.115 30-Apr-2014  mrg avoid divide by zero when setting 'hz' low.
 1.114 07-Dec-2013  nakayama branches: 1.114.2;
Timecounter's tc_get_timecount requires only 32-bit (u_int), so
omit unnecessary upper 32-bit read from STICK counter.
 1.113 12-Sep-2013  martin Slightly rearange stopcounter() to compile warning-free with newer gcc
 1.112 10-Sep-2013  macallan update comment about which CPU uses what counter/timer
 1.111 27-Aug-2013  macallan sprinkle #if NPSYCHO > 0
now this builds again on kernels without psycho
 1.110 22-Aug-2013  nakayama Make timecounter "tick-counter" mandatory.
 1.109 20-Aug-2013  macallan support UltraSPARC-IIe STICK counter as time base
 1.108 24-May-2013  nakayama branches: 1.108.2;
- use gettick directly, not via cpu_counter.
- bump timecounter quality of stick-counter so we prefer to use it.
 1.107 08-Nov-2012  macallan use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.106 04-Sep-2011  nakayama branches: 1.106.2; 1.106.8; 1.106.12;
Preset ih_pil.
 1.105 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.104 03-Jun-2011  christos more CFATTACH_DECL_NEW fixes
 1.103 12-May-2011  mrg branches: 1.103.2;
first steps towards fujitsu SPARC64 support:

- use INTVEC() for the interrupt number, avoids overflow in the (normally)
11 bit interrupt number (from openbsd)
 1.102 12-Mar-2011  nakayama Remove unnecessary headers.
 1.101 11-Mar-2010  mrg branches: 1.101.2; 1.101.4;
various aprint_* fixes.
 1.100 16-May-2009  nakayama branches: 1.100.2;
- move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.99 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.98 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.97 18-May-2008  martin branches: 1.97.6; 1.97.12;
Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.
 1.96 29-Apr-2008  ad branches: 1.96.2;
Mirror sparc and provide sparc_softintr stuff. There is no functional
change, beyond renaming a function and putting back disestablish/schedule.
PR kern/37540.
 1.95 14-Apr-2008  nakayama branches: 1.95.2; 1.95.4;
Reduce use of curcpu() in tickintr_establish.
 1.94 09-Apr-2008  nakayama Reorganize clock assignments on SMP kernel:
- don't use separate statintr on primary CPU.
- invoke clockintr instead of statintr on secondary CPUs.

This change fixes the problem setitimer(2) didn't work on secodary CPUs.
 1.93 17-Mar-2008  nakayama Change statintr and schedintr similar to kern/kern_clock.c.
 1.92 17-Mar-2008  nakayama Make schedintr interrupt handler per-CPU.
While there rename tickintr interrupt handler and share initialization
code with schedintr.
 1.91 15-Mar-2008  nakayama Use macros to specify a interrupt level.
 1.90 14-Mar-2008  nakayama On SMP kernel,
- use "tick" interrupt for per-CPU statclock.
- disable "counter-timer" #1 interrupt and use it as timecounter.
 1.89 02-Mar-2008  nakayama - make interrupt pending list per-CPU.
- make tickintr() MP-safe.
- remove unused port-sparc derived interrupt code.

Ok by martin@.
 1.88 17-Oct-2007  garbled branches: 1.88.12; 1.88.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.87 09-Sep-2007  martin Make cpufrequency and friends per cpu values.
Prepare a hz tick interrupt on secondary CPUs via %tick, but do not
enable it yet, as it breaks ddb.
 1.86 29-Aug-2007  martin Remove unused stuff
 1.85 17-May-2007  yamt branches: 1.85.4; 1.85.8; 1.85.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.84 09-Nov-2006  tsutsui branches: 1.84.4; 1.84.8; 1.84.10; 1.84.16;
More cleanup of sparc64 clock stuff:
- split mkclock attachment from sparc64/clock.c into dev/mkclock.c
(now clock.s only contains clock interrupt and timecounter stuff)
- rename match/attach functions of rtc at ebus to match the device name
- update some comments around clock devices in GENERIC

No objection on port-sparc64 for a month.
 1.83 10-Oct-2006  tsutsui Remove eeprom and clock at mainbus stuff.
They are available only on sun4 or sun4c.
 1.82 09-Oct-2006  martin Missing initializers
 1.81 09-Oct-2006  mrg avoid bringing in mc146818 routines for kernels that do not have the
'rtc'-style clock linked in. put the rtc code in it's own file and
only link it in if it is actually configured. fixes PR#23342.
 1.80 03-Sep-2006  gdamore branches: 1.80.2; 1.80.4;
Convert both sparc and sparc64 to MI todr.
 1.79 07-Jun-2006  kardel convert to timecounters (from branch simonb-timecounters)
 1.78 20-Feb-2006  cdi branches: 1.78.2; 1.78.8;
Use ANSI-style function definitions and declarations.
 1.77 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.76 24-Dec-2005  perry branches: 1.76.2; 1.76.4; 1.76.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.75 11-Dec-2005  christos merge ktrace-lwp.
 1.74 31-May-2005  martin branches: 1.74.2;
Rearange slightly to avoid the use of an unitialized variable in the
(unlikely) case that we do not have any hardware clock.
 1.73 31-May-2005  macallan added initialization for tv in resettodr()
 1.72 31-May-2005  christos Deal with the fact that time is volatile and todr_*() are not. This needs
to be fixed properly.
 1.71 01-Aug-2004  martin Allow bigger time skips (root fs vs. rtc), only warn if we skip more
than two days backward (same as old behaviour) or more than two years
forward. I have lots of test machines I don't power on every two days.
XXX - this should be handled more consistent across the different
ports. While here, move the default time -- in the unlikely event that
we have neither rtc nor file system time -- to this millenium.
 1.70 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.69 17-Mar-2004  pk Print the host Id in mainbus_attach() instead of clock_attach().
 1.68 17-Mar-2004  pk Drop myetheraddr();
 1.67 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.66 01-Nov-2003  tsutsui - Adapt to MI mk48txx(4) changes.
- Switch rtc (M5819) routines to use MI mc146818(4) driver.

Tested on Ultra5 (mkclock_ebus), but mkclock_sbus and rtc_ebus are not tested.

XXX This file should be split into each device and each bus attachment,
XXX and moved into sys/arch/sparc64/dev or sys/dev/sun.
 1.65 21-Oct-2003  petrov Don't use NULL for an int comparsion.
 1.64 15-Oct-2003  petrov Set CPU_UPAID when enabling timer interrupts.
 1.63 30-Aug-2003  nakayama Wrap diag message with #ifdef DIAGNOSTIC.
 1.62 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.61 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.60 15-Jul-2003  lukem __KERNEL_RCSID()
 1.59 23-Jun-2003  martin branches: 1.59.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.58 17-May-2003  nakayama Avoid strict-alias warnings in gcc 3.3.
 1.57 10-May-2003  martin Remove a spurious Debugger() call.
 1.56 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.55 05-Feb-2003  nakayama Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.

This should fix PR port-sparc64/18452.
(approved by martin)
 1.54 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.53 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.52 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.51 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.50 11-Jun-2002  eeh Fixes for the rtc clock on Netra X1 machines from PRs 15611 and 16816
by Takeshi Nakayama.
 1.49 20-Mar-2002  eeh branches: 1.49.4; 1.49.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.48 16-Mar-2002  mrg convert to using <dev/ebus/ebusvar.h> and it's struct member names.
 1.47 14-Mar-2002  eeh bus_space_map2() has gone away.
 1.46 01-Mar-2002  martin Rename EBUS_PADDR_FROM_REG uses to EBUS_ADDR_FROM_REG.
 1.45 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.44 22-Oct-2001  mrg branches: 1.44.4;
use <dev/ebus/ebusreg.h>
 1.43 02-Oct-2001  eeh Fix rtc_write_reg().
 1.42 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.41 24-Jul-2001  eeh branches: 1.41.2;
Support for pc-style `rtc' real-time clocks.
Doesn't work right. There are still issues w/register accesses.
 1.40 19-Jul-2001  eeh Don't fall over if the TOD clock could not be found.
 1.39 20-Jan-2001  pk branches: 1.39.4;
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.38 30-Dec-2000  mjacob Fix a 'defined but not used' error (GENERIC doesn't define DEBUG).
 1.37 29-Dec-2000  eeh Separate schedclock from statclock on machines w/counter-timers. This
lets us lower splsched().
 1.36 19-Dec-2000  mrg clockattach(): print the hostid as a 32-bit value to avoid 64-bit sign extension.
 1.35 17-Dec-2000  pk Literal `%' in format string => `%%'
 1.34 04-Dec-2000  fvdl Make gcc happy about casts.
 1.33 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.32 17-Sep-2000  eeh Make the improved %tick changes work with machines that use the counter-timer
for the clock.
 1.31 11-Sep-2000  eeh (Hopefully) fix clock skew on machines that us %tick for the clock (UIIi).
 1.30 09-Sep-2000  eeh Make sbus_wenable() and ebus_wenable() work on 32-bit kernels.
 1.29 01-Sep-2000  eeh Add support for write protecting clock registers.
 1.28 26-Jul-2000  pk Use the mk48txx driver for time-of-day clock access.
 1.27 26-Jul-2000  pk Remove unused <sys/dev/ic/intersil7170.h>
Remove unused `extern struct idprom idprom'
Pull in <dev/clock_subr.h>
 1.26 19-Jul-2000  eeh Add an option to poll the ROM console from hardclock you can break into DDB
even if callouts are disabled.
 1.25 19-Jul-2000  mrg make myetheraddr() work even if the clock hasn't been setup yet
 1.24 17-Jul-2000  pk IF we're changing hz, change tick accordingly too.
 1.23 06-Jul-2000  eeh Fixup counter-timer interrupt lossage.
 1.22 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.21 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.20 24-Jun-2000  eeh Get rid of vaddrs.h.
 1.19 09-Jun-2000  mrg branches: 1.19.2;
myetheraddr(): don't lose badly when the clock hasn't been attached yet.
 1.18 19-Mar-2000  pk branches: 1.18.2;
Nuke dead code.
 1.17 14-Mar-2000  soren Fix doubled 'the the' in comment.
 1.16 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.15 08-Jul-1999  thorpej branches: 1.15.2; 1.15.4; 1.15.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.14 21-Jun-1999  mrg fix compile warning.
 1.13 10-Jun-1999  eeh Don't change protection on the clock for the moment.
 1.12 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.11 05-Jun-1999  mrg clock attaches at ebus also now.
 1.10 30-May-1999  eeh Add code to support using %tick as the system clock if no "counter-timer" node
is found.
 1.9 22-Nov-1998  mrg branches: 1.9.6;
fix some warnings, and some not DEBUG problems.
 1.8 06-Sep-1998  eeh 32-bit fixup.
 1.7 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.6 05-Sep-1998  pk #include <sys/dev/sbus/sbusvar.h>
 1.5 05-Sep-1998  pk Nuke temporary `getpropA()'.
 1.4 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.3 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.3 09-Aug-1998  eeh General pmap and debug cleanup. Added PMAP_NEW support, but it doesn't work too well yet.
 1.1.1.1.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.1.1.1.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.9.6.3 02-Aug-1999  thorpej Update from trunk.
 1.9.6.2 01-Jul-1999  thorpej Sync w/ -current.
 1.9.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.15.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.4.1 15-Nov-1999  fvdl Sync with -current
 1.15.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.15.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.15.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.15.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.18.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.19.2.3 18-Oct-2000  tv Pullup 1.29 by patch [eeh]:
Add support for write protecting clock registers.
 1.19.2.2 31-Jul-2000  mrg pull up 1.25 & 1.26 (approved by thorpej):
1.25:
>make myetheraddr() work even if the clock hasn't been setup yet
1.26
>Add an option to poll the ROM console from hardclock you can break into DDB
>even if callouts are disabled.
 1.19.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.39.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.39.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.39.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.39.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.39.4.1 03-Aug-2001  lukem update to -current
 1.41.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.41.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.44.4.6 18-Oct-2002  nathanw Catch up to -current.
 1.44.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.44.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.44.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.44.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.44.4.1 22-Oct-2001  nathanw file clock.c was added on branch nathanw_sa on 2002-02-28 04:12:13 +0000
 1.49.6.2 24-Jun-2003  grant Pull up revision 1.55 (requested by nakayama in ticket #1329):

Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.
 1.49.6.1 01-Dec-2002  he Pull up revision 1.50 (requested by martin in ticket #868):
Fix the rtc clock on Netra X1 machines; fixes PR#15611
and PR#16816.
 1.49.4.1 15-Jul-2002  gehenna catch up with -current.
 1.59.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.59.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.59.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.59.2.1 03-Aug-2004  skrll Sync with HEAD
 1.74.2.6 24-Mar-2008  yamt sync with head.
 1.74.2.5 17-Mar-2008  yamt sync with head.
 1.74.2.4 27-Oct-2007  yamt sync with head.
 1.74.2.3 03-Sep-2007  yamt sync with head.
 1.74.2.2 30-Dec-2006  yamt sync with head.
 1.74.2.1 21-Jun-2006  yamt sync with head.
 1.76.6.3 03-Jun-2006  kardel adjust quality to 100 for interpolation capable counter implementations
0 would be used for interupt based counters
 1.76.6.2 02-Jun-2006  kardel - support timecounters
 1.76.6.1 22-Apr-2006  simonb Sync with head.
 1.76.4.1 09-Sep-2006  rpaulo sync with head
 1.76.2.2 01-Mar-2006  yamt sync with head.
 1.76.2.1 18-Feb-2006  yamt sync with head.
 1.78.8.1 19-Jun-2006  chap Sync with head.
 1.78.2.2 14-Sep-2006  yamt sync with head.
 1.78.2.1 26-Jun-2006  yamt sync with head.
 1.80.4.2 10-Dec-2006  yamt sync with head.
 1.80.4.1 22-Oct-2006  yamt sync with head
 1.80.2.1 18-Nov-2006  ad Sync with head.
 1.84.16.2 03-Oct-2007  garbled Sync with HEAD
 1.84.16.1 22-May-2007  matt Update to HEAD.
 1.84.10.1 11-Jul-2007  mjf Sync with head.
 1.84.8.2 09-Oct-2007  ad Sync with head.
 1.84.8.1 27-May-2007  ad Sync with head.
 1.84.4.1 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.85.10.2 23-Mar-2008  matt sync with HEAD
 1.85.10.1 06-Nov-2007  matt sync with HEAD
 1.85.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.85.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.85.4.2 10-Sep-2007  skrll Sync with HEAD.
 1.85.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.88.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.88.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.88.12.1 24-Mar-2008  keiichi sync with head.
 1.95.4.4 11-Aug-2010  yamt sync with head.
 1.95.4.3 20-Jun-2009  yamt sync with head
 1.95.4.2 04-May-2009  yamt sync with head.
 1.95.4.1 16-May-2008  yamt sync with head.
 1.95.2.2 04-Jun-2008  yamt sync with head
 1.95.2.1 18-May-2008  yamt sync with head.
 1.96.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.97.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.97.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.100.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.101.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.101.2.3 12-Jun-2011  rmind sync with head
 1.101.2.2 31-May-2011  rmind sync with head
 1.101.2.1 21-Apr-2011  rmind sync with head
 1.103.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.106.12.4 03-Dec-2017  jdolecek update from HEAD
 1.106.12.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.106.12.2 23-Jun-2013  tls resync from head
 1.106.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.106.8.1 23-Nov-2012  riz Pull up following revision(s) (requested by macallan in ticket #695):
sys/arch/sparc64/include/cpu.h: revision 1.99
sys/arch/sparc64/sparc64/cpu.c: revision 1.103
sys/arch/sparc64/include/psl.h: revision 1.50
sys/arch/sparc64/sparc64/clock.c: revision 1.107
sys/arch/sparc64/include/ctlreg.h: revision 1.57
sys/arch/sparc64/sparc64/locore.s: revision 1.342
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.106.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.106.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.108.2.2 18-May-2014  rmind sync with head
 1.108.2.1 28-Aug-2013  rmind sync with head
 1.114.2.1 10-Aug-2014  tls Rebase.
 1.117.4.3 09-Jul-2016  skrll Sync with HEAD
 1.117.4.2 29-May-2016  skrll Sync with HEAD
 1.117.4.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.120.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.120.18.1 10-Jun-2019  christos Sync with HEAD
 1.123.26.1 02-Aug-2025  perseant Sync with HEAD
 1.2 26-Jul-2000  pk Use the mk48txx driver for time-of-day clock access.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.24 22-Aug-2017  maxv Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.

ok martin
 1.23 21-Nov-2009  rmind branches: 1.23.18; 1.23.22; 1.23.24; 1.23.32; 1.23.38; 1.23.40; 1.23.42; 1.23.50; 1.23.56;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.22 23-Nov-2008  nakayama Wrap #include "opt_*.h" with #ifdef _KERNEL_OPT.
 1.21 28-Apr-2008  martin branches: 1.21.2; 1.21.6; 1.21.8;
Remove clause 3 and 4 from TNF licenses
 1.20 24-Apr-2008  ad branches: 1.20.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.19 20-Dec-2007  dsl branches: 1.19.6; 1.19.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.18 04-Mar-2007  christos branches: 1.18.20; 1.18.28; 1.18.32;
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 11-Dec-2005  christos branches: 1.16.20;
merge ktrace-lwp.
 1.15 13-Sep-2005  christos compat reorg.
 1.14 15-Jul-2003  lukem branches: 1.14.16;
__KERNEL_RCSID()
 1.13 18-Jan-2003  thorpej branches: 1.13.2;
Merge the nathanw_sa branch.
 1.12 29-Dec-2000  eeh branches: 1.12.8;
Fix broken printf()s.
 1.11 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.10 17-Dec-2000  pk Make pointer formats work with a 32-bit compiler.
 1.9 01-Aug-2000  eeh Garbage collection.
 1.8 10-Apr-2000  pk Get a kernel without DDB to build.
 1.7 06-Apr-2000  mrg - #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.
 1.6 06-Nov-1999  eeh Explicitly use 64-bit types.
 1.5 26-Mar-1999  eeh branches: 1.5.8; 1.5.10; 1.5.14;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.4 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.3 16-Nov-1998  eeh Fixup the last broken bits of the signal handling code.
 1.2 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.1 17-Sep-1998  thorpej Make the signal code look a bit more like the 32-bit SPARC port's.
 1.5.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.10.1 15-Nov-1999  fvdl Sync with -current
 1.5.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.5.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.12.8.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.12.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.12.8.2 04-Jan-2002  eeh Cleanup.
 1.12.8.1 03-Jan-2002  petrov make kernel compile
 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.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.16.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.16.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.17.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.18.28.1 26-Dec-2007  ad Sync with head.
 1.18.20.1 09-Jan-2008  matt sync with HEAD
 1.19.8.1 18-May-2008  yamt sync with head.
 1.19.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.19.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.2.3 11-Mar-2010  yamt sync with head
 1.20.2.2 04-May-2009  yamt sync with head.
 1.20.2.1 16-May-2008  yamt sync with head.
 1.21.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.21.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.21.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.21.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.23.56.1 04-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #264):
sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24
Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.
ok martin
 1.23.50.1 04-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1504):
sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24
Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.
ok martin
 1.23.42.1 04-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1504):
sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24
Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.
ok martin
 1.23.40.1 28-Aug-2017  skrll Sync with HEAD
 1.23.38.1 04-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1504):
sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24
Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.
ok martin
 1.23.32.1 04-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1501):
sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24
Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.
ok martin
 1.23.24.1 04-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1501):
sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24
Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.
ok martin
 1.23.22.1 03-Dec-2017  jdolecek update from HEAD
 1.23.18.1 04-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1501):
sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24
Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.
ok martin
 1.18 27-Oct-2021  thorpej Use the signal trampoline version constants from <sys/signal.h>.
 1.17 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.16 11-Mar-2016  christos PR/50945: David Binderman: sprinkle parens
 1.15 21-Nov-2009  rmind branches: 1.15.22; 1.15.40;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.14 23-Nov-2008  nakayama Wrap #include "opt_*.h" with #ifdef _KERNEL_OPT.
 1.13 28-Apr-2008  martin branches: 1.13.2; 1.13.6; 1.13.8;
Remove clause 3 and 4 from TNF licenses
 1.12 24-Apr-2008  ad branches: 1.12.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.11 20-Dec-2007  dsl branches: 1.11.6; 1.11.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.10 04-Mar-2007  christos branches: 1.10.20; 1.10.28; 1.10.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 09-Feb-2007  ad branches: 1.9.2;
Merge newlock2 to head.
 1.8 11-Feb-2006  cdi branches: 1.8.14;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.7 11-Dec-2005  christos branches: 1.7.2; 1.7.4; 1.7.6;
merge ktrace-lwp.
 1.6 13-Sep-2005  christos compat reorg.
 1.5 31-May-2005  christos branches: 1.5.2;
add a const and remove bogus casts.
 1.4 20-May-2004  martin branches: 1.4.2;
We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.
 1.3 27-Oct-2003  christos eliminate buildcontext, and fix siginfo delivery.
 1.2 26-Oct-2003  christos Fix an uinitialized variable warning
 1.1 26-Oct-2003  christos Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.
 1.4.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.2 03-Aug-2004  skrll Sync with HEAD
 1.4.2.1 20-May-2004  skrll file compat_16_machdep.c was added on branch ktrace-lwp on 2004-08-03 10:41:35 +0000
 1.5.2.4 21-Jan-2008  yamt sync with head
 1.5.2.3 03-Sep-2007  yamt sync with head.
 1.5.2.2 26-Feb-2007  yamt sync with head.
 1.5.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.7.2.1 18-Feb-2006  yamt sync with head.
 1.8.14.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.8.14.1 11-Jan-2007  ad Checkpoint work in progress.
 1.9.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.10.28.1 26-Dec-2007  ad Sync with head.
 1.10.20.1 09-Jan-2008  matt sync with HEAD
 1.11.8.1 18-May-2008  yamt sync with head.
 1.11.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.11.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.2.3 11-Mar-2010  yamt sync with head
 1.12.2.2 04-May-2009  yamt sync with head.
 1.12.2.1 16-May-2008  yamt sync with head.
 1.13.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.13.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.13.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.13.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.15.40.2 09-Jul-2016  skrll Sync with HEAD
 1.15.40.1 19-Mar-2016  skrll Sync with HEAD
 1.15.22.1 03-Dec-2017  jdolecek update from HEAD
 1.26 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.25 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.24 16-Aug-2002  petrov Add sab.
 1.23 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.22 17-Jun-2002  christos MD systrace gluons.
 1.21 16-Mar-2002  martin branches: 1.21.4; 1.21.6;
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.20 12-Jan-2002  manu Added clockctl
 1.19 06-Oct-2001  mrg branches: 1.19.4;
sync with sparc: add cdtty
 1.18 15-Sep-2001  mrg add coda (untested; same cdev number as sparc) and pci (tested).
 1.17 26-Mar-2001  lukem branches: 1.17.2; 1.17.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.16 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.15 28-Feb-2001  mjacob branches: 1.15.2;
add SES device (unused #4)
 1.14 02-Feb-2001  mrg add "wd" to chrtoblktbl
 1.13 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.12 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.11 28-Oct-2000  eeh Add bpp and make com match the sparc port.
 1.10 21-Sep-2000  eeh Remove some unsupported devices and add support for the `com' device.
 1.9 25-Aug-2000  pk The `fb' device is optional.
 1.8 23-May-2000  eeh Need to be able to turn off pcons.
 1.7 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.6 14-Apr-2000  tsutsui Typo in comments. (Zilog 8350 -> 8530)
 1.5 04-Jun-1999  mrg branches: 1.5.2;
eek. sparc can have "wd" disks.
 1.4 18-Dec-1998  drochner branches: 1.4.4;
get "opt_compat_svr4.h" out of <sys/conf.h>
 1.3 13-Nov-1998  oster Updating of bdev's and cdev's to support RAIDframe.
 1.2 10-Oct-1998  thorpej Add scsibus entry points to the cdevsw[].
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.5.2.5 12-Mar-2001  bouyer Sync with HEAD.
 1.5.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.5.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 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.15.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.17.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.17.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.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.17.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.17.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.17.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.4.8 11-Nov-2002  nathanw Catch up to -current
 1.19.4.7 17-Sep-2002  nathanw Catch up to -current.
 1.19.4.6 27-Aug-2002  nathanw Catch up to -current.
 1.19.4.5 01-Aug-2002  nathanw Catch up to -current.
 1.19.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.19.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.19.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.19.4.1 06-Oct-2001  nathanw file conf.c was added on branch nathanw_sa on 2002-02-28 04:12:15 +0000
 1.21.6.2 12-Dec-2002  he Apply patch (requested by martin in ticket #1012):
Add MAKEDEV and cdevsw entries for the already existing
``lpt* at ebus?'' driver.
 1.21.6.1 07-Dec-2002  he Apply patch (requested by martin in ticket #873):
Add support for various USB devices.
 1.21.4.4 31-Aug-2002  gehenna catch up with -current.
 1.21.4.3 21-Jul-2002  gehenna catch up with -current.
 1.21.4.2 15-Jul-2002  gehenna catch up with -current.
 1.21.4.1 16-May-2002  gehenna Bye block/character device swicth tables.
 1.9 30-Jun-2020  maxv 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.8 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.7 07-Aug-2016  palle branches: 1.7.16;
Make comment more readable - no functional changes
 1.6 22-Nov-2015  martin Removy now unused {s,f}uword
 1.5 17-Oct-2015  nakayama Move LP64 and ILP32 conversion macros COMBINE, SPLIT from locore.h
to asm.h, and provide SPLIT_RETL for the case SPLIT and then retl
immediately.
 1.4 10-Jul-2010  nakayama branches: 1.4.2; 1.4.4; 1.4.22; 1.4.40;
ucas_64: reorder 64-bit args on 32-bit kernels.
 1.3 24-May-2010  mrg branches: 1.3.2;
this needs <machine/psl.h> for PSTATE_AM on 32 bit kernels.
 1.2 23-May-2010  martin Add ucas_32 and ucas_64 functions - untested.
 1.1 23-May-2010  martin Split copy related functions out of locore.s into copy.S, move functions
only needed on multiprocessors into mp_subr.S.
 1.3.2.3 05-Mar-2011  rmind sync with head
 1.3.2.2 30-May-2010  rmind sync with head
 1.3.2.1 24-May-2010  rmind file copy.S was added on branch rmind-uvmplock on 2010-05-30 05:17:08 +0000
 1.4.40.2 05-Oct-2016  skrll Sync with HEAD
 1.4.40.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.4.22.1 03-Dec-2017  jdolecek update from HEAD
 1.4.4.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.4.4.1 10-Jul-2010  uebayasi file copy.S was added on branch uebayasi-xip on 2010-08-17 06:45:19 +0000
 1.4.2.2 11-Aug-2010  yamt sync with head.
 1.4.2.1 10-Jul-2010  yamt file copy.S was added on branch yamt-nfs-mp on 2010-08-11 22:52:48 +0000
 1.7.16.1 10-Jun-2019  christos Sync with HEAD
 1.7 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.6 01-Jan-2014  dsl branches: 1.6.30;
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 01-Jul-2011  dyoung branches: 1.5.2; 1.5.12; 1.5.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.4 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.3 21-Nov-2009  rmind branches: 1.3.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.2 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.12;
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.12.4 11-Mar-2010  yamt sync with head
 1.1.12.3 19-Aug-2009  yamt sync with head.
 1.1.12.2 04-May-2009  yamt sync with head.
 1.1.12.1 19-Nov-2008  yamt file core_machdep.c was added on branch yamt-nfs-mp on 2009-05-04 08:11:58 +0000
 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:51 +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:32 +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:29 +0000
 1.3.4.1 05-Mar-2011  rmind sync with head
 1.5.16.1 18-May-2014  rmind sync with head
 1.5.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.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.6.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.140 05-Apr-2021  nakayama Fix build w/o options SUN4V.
 1.139 03-Apr-2021  palle Improve cpu_idle() by allowing a platform specific implementaion (same logic as the sparc implementation) - currently only used by sun4v
 1.138 07-Aug-2020  fcambus branches: 1.138.2; 1.138.4;
Use CPU_IS_PRIMARY macro on alpha and sparc64.
 1.137 30-Dec-2019  macallan add highly experimental NUMA support for US-IIIi machines
 1.136 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.135 06-Jun-2018  maya branches: 1.135.2;
Remove duplicate ;
 1.134 19-Jan-2018  nakayama branches: 1.134.2;
sun4v doesn't have %ver register.
 1.133 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.132 11-Sep-2017  palle sun4v: Update code to retrieve CPU clock frequency so it can handle (future?) CPU clock frequencies above the 32-bit limit. ok mrg@
 1.131 27-Aug-2017  palle sun4v: Change clk and sclk variables to unsigned type so modern faster systems with CPU frequencies above 2 Ghz are shown correctly. Example is a 3599.910 MHz SPARC T5-2 system that otherwise is shown incorrectly as -695.-57 MHz. Based on code from OpenBSD cpu.c rev. 1.41. Verified on sun4u using qemu and sun4v on SPARC T5-2
 1.130 10-Feb-2017  palle sun4v: Added handling of trap type 0x034 (address alignment error) + fixed typo mmfsa -> mmufsa. Verified for both sun4u and sun4v using qemu.
 1.129 28-Dec-2016  martin branches: 1.129.2;
Rename the "flush" macro to "sparc_flush_icache", the former is way too
generic for a macro name.
 1.128 17-Apr-2016  martin branches: 1.128.2;
Move the SMP-disabled hack for SUN4V a bit earlier
 1.127 06-Sep-2015  nakayama Use <machine/*.h> instead of <sparc64/*.h> for consistency.
 1.126 06-Sep-2015  martin On SUN4V make the mdesc data available early in pmap_bootstrap, so we
can set up the uvm page colors correctly.
Based on code from palle@.
 1.125 07-May-2015  palle sun4v: disable MP suport for now in cpu_boot_secondary_processors() - this will allow the kernel to start probing for devices with the primary cpu as the only active cpu
 1.124 22-Mar-2015  palle sun4v: Fixed bug in cpu_cache_info_sun4v() causing non-cache nodes to be processed - this should fix crashes on T2-based systems (e.g. T5120) when retrieving L2$ info during bootstrap. Tested by rodent@
 1.123 11-Feb-2015  palle sun4v: Ensure that sane values are returned in scenarios where no x_cache_associativity info is present, e.g. in a simulated environment like the Legion simulator
 1.122 24-Jan-2015  palle Cache info is now printed during bootstrap on the sun4v platform. Make the sun4u centric cache info code in cpu_attach() a bit more general
 1.121 05-Dec-2014  nakayama Use GETVER_CPU_* macros.
 1.120 05-Nov-2014  nakayama branches: 1.120.2;
Remove more #ifdef SUN4V to make compilable w/o options SUN4V.
 1.119 04-Nov-2014  palle sun4v: Removed a bunch of ifdef SUN4V since the CPU_ISSUN4V already has the necessary logic. Noticed by mrg@
 1.118 24-Sep-2014  palle sun4v: add code to enable startup of secondary cpus on both sun4u and sun4v systems - ok martin@
 1.117 01-Sep-2014  palle cpu_boot_secondary_processors() needs a platform independent way to get the cpu id, so use cpu_myid() instead of sun4u specific CPU_UPAID
 1.116 25-Jul-2014  nakayama branches: 1.116.2;
Output CPU manufacturer, implementation and mask code.
 1.115 25-Jul-2014  nakayama Use clockfreq() to print a system tick frequency.

The stick-frequency of Fire V100 is 5555555Hz and printing it as
5.555MHz instead of 5MHz is more precise.
 1.114 25-Jul-2014  nakayama 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.113 10-Jun-2014  palle sun4v: make cpu_initclocks() work on sun4v - %tick and %stick on sun4v systems are read-only. ok martin@
 1.112 08-Jun-2014  palle sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.111 03-Jun-2014  palle sun4v: rename upaid_from_node() to cpuid_from_node() - make the function able to extract the cpuid from the cpu nodes reg property (sun4v only) - ok martin@
 1.110 15-Apr-2014  macallan fix same pasto as in sparc/cpu.c - print frequency in MHz if we say it's in MHz
 1.109 24-Mar-2014  christos branches: 1.109.2;
use cpu_{g,s}etmodel
 1.108 09-Jan-2014  palle Coding style fixes (whitespace) - no functional changes
 1.107 07-Jan-2014  palle sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
 1.106 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.105 08-Nov-2013  nakayama "machine_model" is now declared in machine/autoconf.h.
 1.104 20-Aug-2013  macallan support UltraSPARC-IIe STICK counter as time base
 1.103 08-Nov-2012  macallan branches: 1.103.2;
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.102 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.101 08-Oct-2011  nakayama branches: 1.101.2; 1.101.8; 1.101.12;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.
 1.100 12-Jul-2011  mrg rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.99 18-Jun-2011  nakayama Add fast softint(9) support for sparc64.

Reviewed on port-sparc64.
 1.98 06-Nov-2010  uebayasi branches: 1.98.6;
Machine dependent code is considered as part of UVM. Include
internal API header.
 1.97 06-Aug-2010  macallan do a better job synchronizing %tick across CPUs
ok'ed by mrg
 1.96 28-Jul-2010  macallan try to synchronize %tick registers across CPUs during startup
this should take care of a lot of clock-gone-backwards problems I've seen on
my Blade 2500
 1.95 18-May-2010  mrg move the mutex_init() for ci_ctx_lock inside cpu_attach() so that
we don't try to mutex_init() before lockdebug is available.

fixes LOCKDEBUG crashes at startup (for USII systems.)
 1.94 13-Mar-2010  nakayama branches: 1.94.2;
Trim extra space, introduced in aprintfy.
 1.93 11-Mar-2010  mrg various aprint_* fixes.
 1.92 11-Mar-2010  mrg convert to CFATTACH_DECL_NEW().
 1.91 08-Mar-2010  mrg - when given "boot -1", apply the !MULTIPROCESSOR cpu_match() criteria.

- don't print cache sizes * associativity. this has been wrong for years.
 1.90 06-Mar-2010  mrg clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.89 22-Feb-2010  mrg - store the maximum [id]cache size / line size for each cpu

- remove patch_kernel() since it isn't necessary and has been patching
the wrong thing in general.

- implement USIII versions of blast_icache(), dcache_flush_page() and
cache_flush_phys(). use the newly recorded cache size/line sizes.

- in winfixsave, flush the D$ with the right size index and ops. this
kills one of the wrong tag->inval patches.

- for blast_dcache(), use the newly recorded dcache_size/line_size.

- for blast_icache(), use the newly recorded cache size/line sizes.
for the USIII verison, disable the I$ while writing to ASI_ICACHE_TAG.


these changes removed several hard coded cache sizes values, some very
wrong kernel patching, and seem to make the current failure modes for
USIII less common, but not gone.
 1.88 02-Dec-2009  mrg branches: 1.88.2;
count IPI's as interrupts, not misc counters.
 1.87 01-Dec-2009  martin Revert part of previous - the removal of the "first cpu to attach is
bootstrap cpu" requirement already fixed everything - no need to use
cf_unit for a bogus test here.
 1.86 01-Dec-2009  martin Remove restriction that cpu0 has to attach first.
Make sure cpu0 attaches to the bootstrap cpu only (equivalent of previous
change but not restricted to UP kernels).
 1.85 29-Nov-2009  martin On non-multiprocessor kernels, when running on SMP machines, make sure to
attach cpu0 (the one and only cpu* ever) to the firmware node describing
the cpu we are currently running on.
Otherwise we will have a mismatch on the UPA-ID in the cpuinfo and
eventually allocate a second cpuinfo overriding all the initializations
done early for the boot cpu.
 1.84 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.83 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.82 16-May-2009  nakayama Remove clear %tick in locore.s since it is cleared at cpu_initclocks() in
clock.c.
 1.81 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.80 25-Jan-2009  martin branches: 1.80.2;
On SMP kernels, if -1 is passed as boot arg, only use the boot cpu.
This is mostly intended as a debugging tool.
 1.79 07-Dec-2008  mrg look for "portid" as well as "upa-portid", as seen on schizo.
 1.78 18-Oct-2008  nakayama branches: 1.78.2; 1.78.4; 1.78.8;
Change type of per-CPU event counters to EVCNT_TYPE_MISC.
 1.77 10-Jul-2008  nakayama sparc64_ipi_save_fpstate:
- use primary MMU context for consistency with other trap/interrupt handlers.

sparc64_ipi_save_fpstate, savefpstate:
- avoid storing fp registers as we can.

sparc64_ipi_save_fpstate, savefpstate, loadfpstate:
- remove unaligned case since buffers allocated with pool_cache are ensured
64-byte aligned.

Ok by martin@.
 1.76 10-Jul-2008  nakayama Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.
 1.75 14-Apr-2008  nakayama branches: 1.75.4; 1.75.6; 1.75.8; 1.75.10;
Remove sparc64_ipi_sync_tick.

Since we can use counter-timer as timecounter instead of %tick on SMP kernel,
it is not necessary to sync all CPUs %tick registers.
 1.74 09-Apr-2008  nakayama Reorganize clock assignments on SMP kernel:
- don't use separate statintr on primary CPU.
- invoke clockintr instead of statintr on secondary CPUs.

This change fixes the problem setitimer(2) didn't work on secodary CPUs.
 1.73 05-Apr-2008  cegger use aprint_*_dev and device_xname
OK martin
 1.72 17-Mar-2008  nakayama Make schedintr interrupt handler per-CPU.
While there rename tickintr interrupt handler and share initialization
code with schedintr.
 1.71 15-Mar-2008  nakayama Use macros to specify a interrupt level.
 1.70 14-Mar-2008  nakayama Improve IPI handling:
- make IPI takes two arguments.
- add IPI event counters per-CPU.
- implement IPI functions which were missing or broken.
- insert DELAY while halting primary CPU in IPI handler.
 1.69 06-Mar-2008  nakayama tickintr() event counter is not specific to MULTIPROCESSOR.
 1.68 02-Mar-2008  nakayama - make interrupt pending list per-CPU.
- make tickintr() MP-safe.
- remove unused port-sparc derived interrupt code.

Ok by martin@.
 1.67 28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.66 15-Jan-2008  martin branches: 1.66.2; 1.66.6;
Rename cpuset_t for now to sparc64_cpuset_t, to avoid a name clash with
<sys/pset.h>. Mid-term we should probably convert to the MI cpuset_t.
 1.65 09-Dec-2007  martin branches: 1.65.2;
Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.
 1.64 17-Oct-2007  garbled branches: 1.64.2; 1.64.4; 1.64.6;
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.63 11-Sep-2007  martin Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.
 1.62 09-Sep-2007  martin Make cpufrequency and friends per cpu values.
Prepare a hz tick interrupt on secondary CPUs via %tick, but do not
enable it yet, as it breaks ddb.
 1.61 06-Sep-2007  martin Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.
 1.60 25-Aug-2007  martin branches: 1.60.2;
Remove INITSTACK completely - at the time we used to switch to it, we
already have access to all of lwp0 and it's uarea - so we can switch
to the correct lwp0 stack easily before calling main.
 1.59 25-May-2007  martin branches: 1.59.4; 1.59.8;
remove some debugging printfs for the MULTIPROCESSOR case
 1.58 22-May-2007  martin In cpu_hatch() set curlwp to the idlelwp.
While here, remove a few debug printfs we no longer need.
 1.57 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.56 21-Oct-2006  mrg branches: 1.56.4; 1.56.8; 1.56.10; 1.56.16;
remove "struct cacheline" and the "cacheline" variable. (it was only set
in cpu_attach(), overwritten by multiple cpus, and only one member of the
12 or more were ever used again.) add an ecache_min_line_size to replace
this functionality.

clean up some non-SMP friendly code from cpu_attach():
- only reset the fpu state on the boot cpu
- don't bother printing "FPU version 0" always
- don't call getver() and ignore the result
- print the UPA id on the first cpu0: line

only print mp_tramp address #ifdef DEBUG.

reset the fpu state in cpu_hatch(), like cpu_attach() does for the boot cpu.


cpu_attach() is now free of SMP-unfriendly code.
 1.55 17-Oct-2006  mrg allocate 128KB (as opposed to 64KB) per-cpu, and place the interrupt
stack, cpu_info structure, panicstack, idle uarea and normal kernel
stack in here. the idle uarea and kernel stack are in the 2nd 64KB
page. the interrupt stack and cpu_info structure are as the same
place in the 1st 64KB page, and the panicstack grows down from the
top of this page. update comments in param.h to suit (XXX: a lot
of these constants should move to a header file that will not pollute
the name space so much.) map these pages identically between
cpu_initialise() and cpu_mp_startup(), and deal with the two 64KB
pages in pmap_extract(). keep an unmapped 64KB page between them.

don't initialise the unused "ci_eintstack" member of the cpu_info
structure

use constants to initialise many addresses in the cpu_info structure,
consolidating these assignments from cpu0 and cpu>0

delete u0/estack0/panicstack from locore.s

clean up some wrong comments in locore.s

fix a 32bit-only bug in cpu_mp_startup().

delete 'u0' entirely.


this fixes recent random lossage seen on port-sparc64: processes
stuck in RUN state, data faults, and hangs.
 1.54 03-Oct-2006  mrg cb_cpuinfo member is a paddr_t - make it printable as 64bits in 32bit mode.
 1.53 20-Sep-2006  martin Cosmetic nit - print the correct cpu number in the spin up message
 1.52 19-Sep-2006  mrg remove unused dump_rtf_info variable.
 1.51 15-Sep-2006  martin branches: 1.51.2;
Ooops, manually mis-merged this - this is only called for secondary CPUs,
so we better not start with 0 as cpu_number.
 1.50 14-Sep-2006  martin mrg does not like me (ab)using dv_unit ;-)
Redo previous by just counting cpu instances, just like sparc does.
 1.49 14-Sep-2006  martin Pass the current cpu unit no to alloc_cpuinfo and use it as ci_number
(instead of the UPA id). That way we have consistent cpu* names.
XXX - cpu_attach needs SMP work
 1.48 08-Sep-2006  martin Print the correct UPA id for non-boot CPUs
 1.47 20-Feb-2006  cdi branches: 1.47.2; 1.47.14;
Use ANSI-style function definitions and declarations.
 1.46 02-Feb-2006  he branches: 1.46.2;
Use PRIu64 instead of ld to print CPU_UPAID. Makes sparc GENERIC_SUN4U
build again.
 1.45 01-Feb-2006  martin Do not assume the bootstrap CPU has UPA id 0 - on some machines it hasn't.
Explicitly route all interrupts to the current cpu for now, we'll revisit
this when SMP is working.
Problem spotted and analyzed by Stephan Meisinger, fix inspired by FreeBSD.
 1.44 27-Jan-2006  cdi branches: 1.44.2;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.43 24-Dec-2005  perry branches: 1.43.2;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.42 11-Dec-2005  christos merge ktrace-lwp.
 1.41 16-Jun-2005  briggs branches: 1.41.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.40 31-May-2005  christos - sprinkle const
- avoid shadowed variables
 1.39 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.38 02-Jul-2004  petrov branches: 1.38.4; 1.38.6;
Remove unused var, correct formats.
 1.37 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.36 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.35 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.34 06-Jan-2004  martin Cosmetics
 1.33 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.32 15-Nov-2003  petrov Add stub for cpu_boot_secondary_processors.
 1.31 26-Oct-2003  christos Oops, the code that initialized pagesize was not actually used in the place
it was...
 1.30 15-Jul-2003  lukem __KERNEL_RCSID()
 1.29 01-Apr-2003  thorpej branches: 1.29.2;
Use PAGE_SIZE rather than NBPG.
 1.28 05-Feb-2003  nakayama Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.

This should fix PR port-sparc64/18452.
(approved by martin)
 1.27 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.26 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.25 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.24 29-Sep-2002  chs remove some vestigial FPU and cache code that's not need on ultrasparcs.
misc tidiness.
 1.23 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.22 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.21 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.20 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.19 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.18 31-Dec-2001  matt branches: 1.18.8; 1.18.10;
Make the same change to icache/dcache size calculation as was done to ecache.
Fixes PR 12844.
 1.17 31-Dec-2001  matt When determining ecache size, try using ecache-size. if it doesn't exist,
fallback to the old method (ecache-nlines * ecache-linesize).
 1.16 26-Sep-2001  eeh branches: 1.16.4;
getprop* -> PROM_getprop*
 1.15 21-Sep-2001  thorpej Recolor pages as we disocver the cache sizes.
 1.14 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.13 26-May-2001  chs branches: 1.13.2; 1.13.4;
replace vm_page_t with struct vm_page *.
 1.12 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.11 04-Dec-2000  fvdl branches: 1.11.2;
Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.10 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.9 26-Jun-2000  mrg remove/move more mach vm header files:

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

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.8 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.7 19-Jun-2000  eeh branches: 1.7.2;
Have separate data and text segments, make text read-only.
 1.6 12-Jun-2000  eeh Start reorganizing the kernel for MULTIPROCESSOR support.
 1.5 06-Nov-1999  eeh branches: 1.5.2;
Explicitly use 64-bit types.
 1.4 30-May-1999  eeh branches: 1.4.2; 1.4.4; 1.4.8;
Add code to support using %tick as the system clock if no "counter-timer" node
is found.
 1.3 05-Sep-1998  eeh branches: 1.3.8;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.4.1 15-Nov-1999  fvdl Sync with -current
 1.4.2.2 08-Dec-2000  bouyer Sync with HEAD.
 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.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.11.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.13.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.13.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.13.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.16.4.5 29-Dec-2002  thorpej Sync with HEAD.
 1.16.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.16.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.16.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.16.4.1 26-Sep-2001  nathanw file cpu.c was added on branch nathanw_sa on 2002-01-08 00:28:01 +0000
 1.18.10.1 24-Jun-2003  grant Apply patch (requested by nakayama in ticket #1329):

Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.
 1.18.8.1 15-Jul-2002  gehenna catch up with -current.
 1.29.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.29.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.29.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.1 03-Aug-2004  skrll Sync with HEAD
 1.38.6.1 26-Jan-2005  yamt convert arch/sparc64 to new apis.
 1.38.4.1 29-Apr-2005  kent sync with -current
 1.41.2.6 17-Mar-2008  yamt sync with head.
 1.41.2.5 21-Jan-2008  yamt sync with head
 1.41.2.4 27-Oct-2007  yamt sync with head.
 1.41.2.3 03-Sep-2007  yamt sync with head.
 1.41.2.2 30-Dec-2006  yamt sync with head.
 1.41.2.1 21-Jun-2006  yamt sync with head.
 1.43.2.3 01-Mar-2006  yamt sync with head.
 1.43.2.2 18-Feb-2006  yamt sync with head.
 1.43.2.1 01-Feb-2006  yamt sync with head.
 1.44.2.1 09-Sep-2006  rpaulo sync with head
 1.46.2.1 22-Apr-2006  simonb Sync with head.
 1.47.14.1 18-Nov-2006  ad Sync with head.
 1.47.2.1 14-Sep-2006  yamt sync with head.
 1.51.2.1 22-Oct-2006  yamt sync with head
 1.56.16.3 03-Oct-2007  garbled Sync with HEAD
 1.56.16.2 26-Jun-2007  garbled Sync with HEAD.
 1.56.16.1 22-May-2007  matt Update to HEAD.
 1.56.10.1 11-Jul-2007  mjf Sync with head.
 1.56.8.2 09-Oct-2007  ad Sync with head.
 1.56.8.1 27-May-2007  ad Sync with head.
 1.56.4.1 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.59.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.59.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.59.4.2 10-Sep-2007  skrll Sync with HEAD.
 1.59.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.60.2.3 23-Mar-2008  matt sync with HEAD
 1.60.2.2 09-Jan-2008  matt sync with HEAD
 1.60.2.1 06-Nov-2007  matt sync with HEAD
 1.64.6.1 11-Dec-2007  yamt sync with head.
 1.64.4.1 26-Dec-2007  ad Sync with head.
 1.64.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.65.2.1 19-Jan-2008  bouyer Sync with HEAD
 1.66.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.66.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.66.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.66.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.66.2.1 24-Mar-2008  keiichi sync with head.
 1.75.10.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.75.10.1 19-Oct-2008  haad Sync with HEAD.
 1.75.8.1 18-Jul-2008  simonb Sync with head.
 1.75.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.75.4.4 11-Aug-2010  yamt sync with head.
 1.75.4.3 11-Mar-2010  yamt sync with head
 1.75.4.2 20-Jun-2009  yamt sync with head
 1.75.4.1 04-May-2009  yamt sync with head.
 1.78.8.1 21-Apr-2010  matt sync to netbsd-5
 1.78.4.1 17-Mar-2010  snj Pull up following revision(s) (requested by mrg in ticket #1331):
sys/arch/sparc64/sparc64/cpu.c: revision 1.91
- don't print cache sizes * associativity. this has been wrong for years.
 1.78.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.78.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.78.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.80.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.88.2.3 17-Aug-2010  uebayasi Sync with HEAD.
 1.88.2.2 27-May-2010  uebayasi Fix build.
 1.88.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.94.2.2 05-Mar-2011  rmind sync with head
 1.94.2.1 30-May-2010  rmind sync with head
 1.98.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.101.12.3 03-Dec-2017  jdolecek update from HEAD
 1.101.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.101.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.101.8.1 23-Nov-2012  riz Pull up following revision(s) (requested by macallan in ticket #695):
sys/arch/sparc64/include/cpu.h: revision 1.99
sys/arch/sparc64/sparc64/cpu.c: revision 1.103
sys/arch/sparc64/include/psl.h: revision 1.50
sys/arch/sparc64/sparc64/clock.c: revision 1.107
sys/arch/sparc64/include/ctlreg.h: revision 1.57
sys/arch/sparc64/sparc64/locore.s: revision 1.342
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.101.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.101.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.101.2.1 30-Oct-2012  yamt sync with head
 1.103.2.2 18-May-2014  rmind sync with head
 1.103.2.1 28-Aug-2013  rmind sync with head
 1.109.2.1 10-Aug-2014  tls Rebase.
 1.116.2.1 13-Dec-2014  martin Pull up following revision(s) (requested by nakayama in ticket #318):
sys/arch/sparc64/include/psl.h: revision 1.54
sys/arch/sparc64/include/psl.h: revision 1.55
sys/arch/sparc64/sparc64/cpu.c: revision 1.121
Make getver() into a constant function since Version Register (%ver)
is read only and its value is constant.
This change reduces multipule %ver reads to one in the functions
which uses a number of CPU_IS_* macros.
Use GETVER_CPU_* macros.
 1.120.2.6 28-Aug-2017  skrll Sync with HEAD
 1.120.2.5 05-Feb-2017  skrll Sync with HEAD
 1.120.2.4 22-Apr-2016  skrll Sync with HEAD
 1.120.2.3 22-Sep-2015  skrll Sync with HEAD
 1.120.2.2 06-Jun-2015  skrll Sync with HEAD
 1.120.2.1 06-Apr-2015  skrll Sync with HEAD
 1.128.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.128.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.129.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.134.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.135.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.135.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.138.4.2 17-Apr-2021  thorpej Sync with HEAD.
 1.138.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.138.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.4 17-Oct-2015  nakayama LDPTR is defined in machine/asm.h.
 1.3 22-Dec-2012  nakayama branches: 1.3.14;
Use LDPTR macro.
 1.2 19-Oct-2009  snj branches: 1.2.12; 1.2.22;
Move Eduardo Horvath's license to 2 clause. OK eeh@.
 1.1 03-Feb-2008  martin branches: 1.1.2; 1.1.4; 1.1.12; 1.1.16;
Adjust assembler in_cksum code to new signature and re-enable it.
 1.1.16.1 11-Mar-2010  yamt sync with head
 1.1.12.2 23-Mar-2008  matt sync with HEAD
 1.1.12.1 03-Feb-2008  matt file cpu_in_cksum.S was added on branch matt-armv6 on 2008-03-23 02:04:23 +0000
 1.1.4.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.4.1 03-Feb-2008  mjf file cpu_in_cksum.S was added on branch mjf-devfs on 2008-02-18 21:05:06 +0000
 1.1.2.2 04-Feb-2008  yamt sync with head.
 1.1.2.1 03-Feb-2008  yamt file cpu_in_cksum.S was added on branch yamt-lazymbuf on 2008-02-04 09:22:33 +0000
 1.2.22.2 03-Dec-2017  jdolecek update from HEAD
 1.2.22.1 25-Feb-2013  tls resync with head
 1.2.12.1 23-Jan-2013  yamt sync with head
 1.3.14.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.4 18-Apr-2002  eeh Remove unused file.
 1.3 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.2 06-Nov-1999  eeh branches: 1.2.8; 1.2.12;
Explicitly use 64-bit types.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.16; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.12.3 20-Jun-2002  nathanw Catch up to -current.
 1.2.12.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.12.1 04-Jan-2002  eeh Cleanup.
 1.2.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19 06-Apr-2021  simonb Fix a typo, remove a useless blank line.
 1.18 04-Oct-2015  joerg branches: 1.18.32;
Avoid left-shifting negative values.
 1.17 27-Feb-2014  joerg branches: 1.17.6;
Cast argument to abs, not the result.
 1.16 13-Apr-2011  mrg branches: 1.16.4; 1.16.14; 1.16.18;
this needs db_user.h and stdlib.h in userland.
 1.15 25-Nov-2008  nakayama branches: 1.15.8; 1.15.10;
Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.14 21-Feb-2007  thorpej branches: 1.14.42; 1.14.46; 1.14.52; 1.14.54; 1.14.56;
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.13 25-Feb-2006  wiz branches: 1.13.20;
Fix some typos.
 1.12 11-Dec-2005  christos branches: 1.12.2; 1.12.4; 1.12.6;
merge ktrace-lwp.
 1.11 31-May-2005  christos branches: 1.11.2;
- sprinkle const
- avoid shadowed variables
 1.10 15-Jul-2003  lukem __KERNEL_RCSID()
 1.9 16-Aug-2000  pk branches: 1.9.24;
Fix two printf formats: `%ld' -> `%d'.
 1.8 20-Jul-2000  eeh Clean up disassembly of sparc v9 insns and handling of negative values.
 1.7 19-Jun-2000  eeh branches: 1.7.2;
Have separate data and text segments, make text read-only.
 1.6 25-May-2000  jhawk branches: 1.6.2;
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.5 28-Feb-1999  eeh branches: 1.5.8;
Teach it some VIS instructions.
 1.4 07-Sep-1998  eeh Misc. cleanup.
 1.3 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.5.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.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.2.1 31-Jul-2000  mrg pull up 1.8 (approved by thorpej):
>Clean up disassembly of sparc v9 insns and handling of negative values.
 1.9.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.11.2.2 26-Feb-2007  yamt sync with head.
 1.11.2.1 21-Jun-2006  yamt sync with head.
 1.12.6.1 22-Apr-2006  simonb Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.12.2.1 01-Mar-2006  yamt sync with head.
 1.13.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.14.56.1 27-Nov-2008  snj Pull up following revision(s) (requested by nakayama in ticket #131):
sys/arch/sparc64/sparc64/db_disasm.c: revision 1.15
sys/arch/sparc64/sparc64/db_trace.c: revision 1.41
sys/arch/sparc64/sparc64/db_interface.c: revision 1.113
sys/ddb/db_command.c: revision 1.124
sys/arch/sparc64/include/db_machdep.h: revision 1.26
Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.14.54.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.52.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.46.1 04-May-2009  yamt sync with head.
 1.14.42.1 17-Jan-2009  mjf Sync with HEAD.
 1.15.10.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.8.1 21-Apr-2011  rmind sync with head
 1.16.18.1 18-May-2014  rmind sync with head
 1.16.14.2 03-Dec-2017  jdolecek update from HEAD
 1.16.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.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.17.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.18.32.1 17-Apr-2021  thorpej Sync with HEAD.
 1.138 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.137 11-May-2022  andvar fix various typos in comments.
 1.136 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.135 01-Apr-2019  msaitoh branches: 1.135.12;
s/adddress/address/
 1.134 10-Jan-2019  mrg - move pmap_ctx() macro into pmap.h instead of duplicating it.
- fix description of some mach ddb commands.
 1.133 01-May-2016  palle branches: 1.133.16; 1.133.18;
fill_ddb_regs_from_tf() now fetches Local and In registers as well.
 1.132 12-Sep-2013  martin branches: 1.132.6;
Remove unused variable
 1.131 03-Jan-2013  martin branches: 1.131.2;
There is no point in trying to tell userland access from kernel access by
looking at the address on sparc64 - so, let us believe the comment and always
deal with kernel access here.
While there, fix write access to kernel text for bigger kernels.
 1.130 18-Feb-2012  christos branches: 1.130.2;
Move the ddb registers and empty command table into a separate file, like
other archs do for the benefit of crash.
 1.129 22-Jun-2011  mrg branches: 1.129.2; 1.129.6;
there's no fr_arg[6] or fr_arg[7] -- they're called fr_fp and fr_pc.
use the right names and avoid some array bounds violations picked up
by GCC 4.5. it's a real bug, but the code would have been generated
correctly for the sparc* ABIs.
 1.128 13-Apr-2011  mrg port to userspace. this needs db_user.h, stddef.h, stdbool.h and not
promlib.h. put db_read/write_bytes() under _KERNEL.

XXX: for now, provide an empty db_machine_command_table[].

XXX2: this file puts a lot of it under #ifdef DDB, but i'm not sure
why this is done. for now it makes it easier to port to userspace :)
 1.127 13-Apr-2011  mrg apply s/TRUE/true/; s/FALSE/false/;. needed for userland.
 1.126 14-Jan-2011  rmind branches: 1.126.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.125 06-Nov-2010  uebayasi Machine dependent code is considered as part of UVM. Include
internal API header.
 1.124 10-Mar-2010  mrg branches: 1.124.2;
XXX: workaround we'd like to remove when pmap / uvm locking is cleaned up:

- rename pseg_get() and pseg_set() to pseg_get_real() and pseg_set_real().
- if USE_LOCKSAFE_PSEG_GETSET is defined, which it current is by default,
define pseg_[gs]et() in terms of functions that take a new pseg_lock
mutex at IPL_VM while calling into the real functions.

this seems to avoid the pseg_set() crashes we've seen:
1 - spare needed, when pseg_get() just worked for this pmap
2 - the 2rd ldxa via ASI_PHYS_CACHED in pseg_set() loads garbage
into %o4, and causes the 3rd ldxa to fault
 1.123 06-Mar-2010  mrg clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.122 23-Feb-2010  mrg change print_dtlb() and print_itlb() to take (tlb_size, tlb_selectbits).
for cheetah, print the 3 dtlb's and 2 itlb's.

now "mach dtlb" and "mach itlb" work for cheetah.
 1.121 02-Feb-2010  mrg branches: 1.121.2;
- split sp_tlb_flush_pte() and switchtoctx() into sp_tlb_flush_pte_us()/
sp_tlb_flush_pte_usiii() and switchtoctx_us()/switchtoctx_usiii() and
implement the latter while i'm here. it works ... sometimes i think,
but also sometimes panics/hangs.
- fix a comment in sparc64_ipi_flush_pte_usiii()
 1.120 02-Dec-2009  mrg print the fplwp in "mach cpu" list.
 1.119 01-Dec-2009  martin Remove restriction of "mach prom" to cpu0 - it does not make sense now
that cpu0 is not always the bootstrap cpu, and in the majority of cases
the prom abort will just work fine on any cpu.
 1.118 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.117 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.116 11-Jan-2009  nakayama branches: 1.116.2;
Redo previous for 32-bit kernel.
 1.115 11-Jan-2009  nakayama p_timer has been changed to struct itimerspec.
 1.114 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.113 25-Nov-2008  nakayama Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.112 08-Aug-2008  skrll branches: 1.112.2; 1.112.4;
Make "show uvmhist" available to all arches (not just sparc*) in ddb.
 1.111 27-Mar-2008  martin branches: 1.111.4; 1.111.6; 1.111.10;
Restrict the "mach prom" command to the primary cpu - it hangs the machine
hard on every other try on some machines.
 1.110 14-Mar-2008  nakayama #include "opt_multiprocessor.h"
 1.109 02-Mar-2008  martin Make ddb's "mach cpu" command do the right thing: run ddb on the requested
cpu. There is a tiny bit of cheating involved, but I assume we won't run
parallel + recursive ddb scripts to play towers of hanoi.

This fixes the wrong prompt, and (more importantly) makes things like
"mach dtlb" display the registers of the right MMU.
 1.108 29-Feb-2008  martin Rearange ddb saved register values slightly.
While there fix completely bogus register access ops for < 64 bit values.
 1.107 28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.106 30-Jan-2008  ad branches: 1.106.2; 1.106.6;
Remove lock/simplelock cruft.
 1.105 05-Nov-2007  ad branches: 1.105.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.104 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.103 24-Sep-2007  martin branches: 1.103.2;
Cosmetic changes in ddb online help strings.
 1.102 23-Sep-2007  martin The "mach dtlb" and "mach itlb" had two ways to produce the same output
(depending on an address given or not) - simplify to always use the
locore.s version.
 1.101 23-Sep-2007  martin branches: 1.101.2;
Add verbose help for ddb mach commands.
 1.100 22-Sep-2007  martin Remove the driver specific "mach esp" command from the "mach" table.
We can do that better now.
 1.99 22-Sep-2007  martin 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.98 11-Sep-2007  martin Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.
 1.97 17-May-2007  yamt branches: 1.97.8; 1.97.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.96 04-Mar-2007  christos branches: 1.96.2; 1.96.4; 1.96.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.95 22-Feb-2007  matt More boolean_t -> bool
 1.94 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.93 21-Oct-2006  mrg branches: 1.93.4;
add a "mach sir" command to call sir instruction ('software initiated
reset'). this is a much more drastic way to do "mach prom", but it
works when used from cpu>0, which "mach prom" currently does not.
 1.92 16-Oct-2006  martin Initializers
 1.91 15-Oct-2006  martin Missing initializers
 1.90 03-Oct-2006  mrg ddb_suspend() takes a struct trapframe64 *.
 1.89 14-Sep-2006  he branches: 1.89.2;
Make the sparc GENERIC_SUN4U kernel build by casting via an uintptr_t
before casting to a pointer.
 1.88 13-Sep-2006  mrg SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.87 12-May-2006  uwe branches: 1.87.8;
De-__P.
 1.86 20-Feb-2006  cdi branches: 1.86.2; 1.86.6;
Use ANSI-style function definitions and declarations.
 1.85 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.84 27-Jan-2006  cdi branches: 1.84.2; 1.84.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.83 24-Dec-2005  perry branches: 1.83.2;
bare asm -> __asm
 1.82 11-Dec-2005  christos merge ktrace-lwp.
 1.81 29-Oct-2005  jdc Don't drop to ddb in the default case if ddb.onpanic is 0.
OK'd by martin@.
 1.80 02-Jun-2005  jdc branches: 1.80.2; 1.80.4;
Remove prototypes for non-existent db_dump_buf() and db_dump_espcmd().
 1.79 01-Jun-2005  jdc Add const (catching up with additions to MI ddb code).
 1.78 31-May-2005  christos - sprinkle const
- avoid shadowed variables
 1.77 20-May-2004  petrov branches: 1.77.10;
ifdef protection for sparc64_ipi_ function calls.
 1.76 21-Mar-2004  pk Switch to promlib interface.
 1.75 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.74 06-Jan-2004  petrov Some cleanup and move ddb_regs declaration to db_interface.c
 1.73 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 1.72 10-Oct-2003  chs add a command to dump the ITSB, now that it's separate from the DTSB.
 1.71 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.70 15-Jul-2003  lukem __KERNEL_RCSID()
 1.69 18-May-2003  martin branches: 1.69.2;
Make kernels with options KGDB at least compile.
Still needs some work to make it working.
 1.68 17-May-2003  nakayama Avoid strict-alias warnings in gcc 3.3.
 1.67 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.66 25-Dec-2002  petrov add db_dump_itlb.
 1.65 14-Jun-2002  eeh Fix hardware watchpoints and add an extract function so we can easily find
the physical addresses of things (to feed to the physical watchpoint).
 1.64 14-May-2002  eeh branches: 1.64.2;
Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.63 13-May-2002  matt Nuke local extern label_t *db_recover; it's now in <ddb/db_extern.h>
 1.62 12-Jan-2002  eeh Trap types should be printed in hex.
 1.61 31-Jul-2001  eeh branches: 1.61.6;
Dump some enums that make lint unhappy and we never really use anyway.
 1.60 07-Jul-2001  eeh branches: 1.60.2;
Also handle FPU registers.
 1.59 04-Jun-2001  mrg fix lint exposed by GCC 3.0 20010604 (prerelease).
 1.58 26-May-2001  chs replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.57 18-May-2001  mrg update some unused code to reality.
 1.56 22-Mar-2001  petrov fix 'show registers' mis-aligned access, PR11580
 1.55 22-Jan-2001  jdolecek branches: 1.55.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.54 18-Jan-2001  jdolecek make db_[e]regs[] const
 1.53 29-Dec-2000  eeh Fix broken printf().
 1.52 18-Dec-2000  mrg s/%qx/%llx/
 1.51 17-Dec-2000  pk Fix printf() pointer formats & make them work with a 32-bit compiler.
 1.50 08-Dec-2000  martin Remove esp specific function from ddb when esp @ sbus is not included
in the kernel config. Makes compiling sbus-less kernels possible again.
 1.49 07-Dec-2000  eeh Add a call to db_esp() and make `mach phys /u' read user addresses.
 1.48 04-Dec-2000  fvdl More cast / format cleanup to make this compile cleanly in 32bit mode.
 1.47 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.46 21-Nov-2000  chs remove MD functions for printing vnodes and buffers since there are
MI versions now.
 1.45 19-Oct-2000  mrg - remove an unused variable
- in db_setpcb(), update 'struct proc *p' each loop iteration. (found by
gcc warning).
 1.44 28-Sep-2000  eeh Fix the `trap type 0x10' problem. Apparently, something has changed and
now makes use of lockmgr(). Since we broke into the debugger from an interrupt,
we don't have a curproc, so when lockmgr() tries to find our PID it barfs,
causing another break into DDB which then calls the mysterious code that
calls lockmgr() again.....

So set doing_shutdown while we're in DDB so lockmgr ignores locks.
 1.43 28-Sep-2000  eeh Add a command that locates the page structure corresponding to a pa.
 1.42 25-Aug-2000  pk The `fb' device is optional.
 1.41 08-Aug-2000  tv sizeof(fmtstring) + 8 wasn't enough for the string; that won't cope with the
printed version. Make a little more room for the bitmask_snprintf() call.
 1.40 07-Aug-2000  tv %b -> bitmask_snprintf()
 1.39 02-Aug-2000  nathanw Use the same idiom for iterating over allproc as everywhere else in the kernel.
 1.38 27-Jul-2000  mrg fix warnings.
 1.37 18-Jul-2000  pk Cast pointer to `u_long' (not `long') for correct results.
 1.36 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.35 23-Jun-2000  eeh Use probeget to read kernel data to prevent the machine from falling over if the PC goes bad.
 1.34 19-Jun-2000  eeh branches: 1.34.2;
Have separate data and text segments, make text read-only.
 1.33 08-Jun-2000  eeh Print all 64-bits of TTE data in db_pmap_kernel().
 1.32 25-May-2000  jhawk branches: 1.32.2;
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.31 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.30 14-Apr-2000  mrg add some casts to (u_long) to shut up gcc. cleanup unused variables
 1.29 06-Apr-2000  mrg avoid some more compiler warnings, and fix a couple of errors.
 1.28 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.27 21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.26 10-Jan-2000  eeh Add debugger single-stepping and fix interrupt dispatch bugs.
 1.25 30-Dec-1999  eeh Fixup 64-bit type conversion issues.
 1.24 06-Nov-1999  eeh Explicitly use 64-bit types.
 1.23 28-Oct-1999  lukem sort sparc_db_command_table[]
 1.22 12-Oct-1999  jdolecek branches: 1.22.2; 1.22.4;
rename the MD Debugger() to cpu_Debugger()
add MI Debugger() which switches to console if wscons is used prior
to calling cpu_Debugger()
 1.21 22-Jul-1999  thorpej branches: 1.21.2;
XXX LOCKING XXX of allproc; DDB runs with interrupts blocked, and MD
code should suspend other processors, so this probably isn't a problem,
but the comment is added anyhow.
 1.20 21-Jun-1999  eeh Improve TRAPTRACE. Add FLTRACE that only tracks MMU faults.
 1.19 12-Apr-1999  pk Quote "AS IS" as in the majority of Carnegy Mellon notices.
 1.18 06-Apr-1999  pk Fix a pasto in copyright text which has been procreating like rabbits..
 1.17 25-Mar-1999  mrg branches: 1.17.2;
remove opt_uvm.h
 1.16 22-Mar-1999  eeh Flush D$ on bypass accesses.
 1.15 28-Feb-1999  eeh Fix up alignment issues dumping physical memory.
 1.14 12-Feb-1999  mrg add a proto for print_dtbl
 1.13 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.12 27-Nov-1998  eeh Improve page table printing.
 1.11 24-Nov-1998  mrg include db_interface.h, remove unused variable & add proto for db_uvmhistdump.
 1.10 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.9 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.8 09-Sep-1998  eeh Make `machine phys' increment its address.
 1.7 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.6 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.5 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.4 27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 04-Jul-1998  jonathan branches: 1.2.2;
defopt DDB.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.17.2.2 12-Apr-1999  pk branches: 1.17.2.2.2;
Pullup copyright text corrections.
 1.17.2.1 07-Apr-1999  pk Pull up from trunk: copyright text warts.
 1.17.2.2.2.3 02-Aug-1999  thorpej Update from trunk.
 1.17.2.2.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.17.2.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.21.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.4.1 15-Nov-1999  fvdl Sync with -current
 1.22.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.22.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.22.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.22.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.22.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.22.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.32.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.34.2.2 31-Jul-2000  mrg pull up 1.37 (approved by thorpej:
>Cast pointer to `u_long' (not `long') for correct results.
 1.34.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.55.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.55.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.60.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.60.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.60.2.1 03-Aug-2001  lukem update to -current
 1.61.6.8 29-Dec-2002  thorpej Sync with HEAD.
 1.61.6.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.61.6.6 20-Jun-2002  nathanw Catch up to -current.
 1.61.6.5 28-Feb-2002  nathanw Catch up to -current.
 1.61.6.4 08-Jan-2002  petrov db_proc_cmd: deal with with curproc=0
 1.61.6.3 04-Jan-2002  eeh Cleanup.
 1.61.6.2 03-Jan-2002  petrov make kernel compile
 1.61.6.1 31-Jul-2001  petrov file db_interface.c was added on branch nathanw_sa on 2002-01-03 06:42:34 +0000
 1.64.2.1 15-Jul-2002  gehenna catch up with -current.
 1.69.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.69.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.69.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.69.2.1 03-Aug-2004  skrll Sync with HEAD
 1.77.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.80.4.1 02-Nov-2005  yamt sync with head.
 1.80.2.8 17-Mar-2008  yamt sync with head.
 1.80.2.7 04-Feb-2008  yamt sync with head.
 1.80.2.6 15-Nov-2007  yamt sync with head.
 1.80.2.5 27-Oct-2007  yamt sync with head.
 1.80.2.4 03-Sep-2007  yamt sync with head.
 1.80.2.3 26-Feb-2007  yamt sync with head.
 1.80.2.2 30-Dec-2006  yamt sync with head.
 1.80.2.1 21-Jun-2006  yamt sync with head.
 1.83.2.3 01-Mar-2006  yamt sync with head.
 1.83.2.2 18-Feb-2006  yamt sync with head.
 1.83.2.1 01-Feb-2006  yamt sync with head.
 1.84.4.2 01-Jun-2006  kardel Sync with head.
 1.84.4.1 22-Apr-2006  simonb Sync with head.
 1.84.2.1 09-Sep-2006  rpaulo sync with head
 1.86.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.86.2.2 14-Sep-2006  yamt sync with head.
 1.86.2.1 24-May-2006  yamt sync with head.
 1.87.8.1 18-Nov-2006  ad Sync with head.
 1.89.2.1 22-Oct-2006  yamt sync with head
 1.93.4.3 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.93.4.2 12-Mar-2007  rmind Sync with HEAD.
 1.93.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.96.10.2 03-Oct-2007  garbled Sync with HEAD
 1.96.10.1 22-May-2007  matt Update to HEAD.
 1.96.4.1 11-Jul-2007  mjf Sync with head.
 1.96.2.3 03-Dec-2007  ad Sync with HEAD.
 1.96.2.2 09-Oct-2007  ad Sync with head.
 1.96.2.1 27-May-2007  ad Sync with head.
 1.97.10.2 23-Mar-2008  matt sync with HEAD
 1.97.10.1 06-Nov-2007  matt sync with HEAD
 1.97.8.2 06-Nov-2007  joerg Sync with HEAD.
 1.97.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.101.2.1 06-Oct-2007  yamt sync with head.
 1.103.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.105.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.106.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.106.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.106.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.106.2.1 24-Mar-2008  keiichi sync with head.
 1.111.10.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.111.10.1 19-Oct-2008  haad Sync with HEAD.
 1.111.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.111.4.2 11-Mar-2010  yamt sync with head
 1.111.4.1 04-May-2009  yamt sync with head.
 1.112.4.1 27-Nov-2008  snj Pull up following revision(s) (requested by nakayama in ticket #131):
sys/arch/sparc64/sparc64/db_disasm.c: revision 1.15
sys/arch/sparc64/sparc64/db_trace.c: revision 1.41
sys/arch/sparc64/sparc64/db_interface.c: revision 1.113
sys/ddb/db_command.c: revision 1.124
sys/arch/sparc64/include/db_machdep.h: revision 1.26
Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.112.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.112.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.116.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.121.2.2 27-May-2010  uebayasi Fix build.
 1.121.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.124.2.2 21-Apr-2011  rmind sync with head
 1.124.2.1 05-Mar-2011  rmind sync with head
 1.126.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.129.6.1 24-Feb-2012  mrg sync to -current.
 1.129.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.129.2.2 23-Jan-2013  yamt sync with head
 1.129.2.1 17-Apr-2012  yamt sync with head
 1.130.2.3 03-Dec-2017  jdolecek update from HEAD
 1.130.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.130.2.1 25-Feb-2013  tls resync with head
 1.131.2.1 18-May-2014  rmind sync with head
 1.132.6.1 29-May-2016  skrll Sync with HEAD
 1.133.18.1 10-Jun-2019  christos Sync with HEAD
 1.133.16.1 18-Jan-2019  pgoyette Synch with HEAD
 1.135.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 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.2 10-Mar-2020  christos branches: 1.2.4;
Don't provide things that don't make sense in userland. We don't provide
access to registers crash(8)...
 1.1 18-Feb-2012  christos branches: 1.1.2; 1.1.4; 1.1.44;
Move the ddb registers and empty command table into a separate file, like
other archs do for the benefit of crash.
 1.1.44.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.4.2 17-Apr-2012  yamt sync with head
 1.1.4.1 18-Feb-2012  yamt file db_machdep.c was added on branch yamt-pagecache on 2012-04-17 00:06:56 +0000
 1.1.2.2 24-Feb-2012  mrg sync to -current.
 1.1.2.1 18-Feb-2012  mrg file db_machdep.c was added on branch jmcneill-usbmp on 2012-02-24 09:11:35 +0000
 1.2.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 02-Mar-2015  nakayama prom_printf converts "\n" to "\r\n" internally, so omit "\r".
 1.2 23-Feb-2010  mrg branches: 1.2.2; 1.2.6; 1.2.24; 1.2.42;
change print_dtlb() and print_itlb() to take (tlb_size, tlb_selectbits).
for cheetah, print the 3 dtlb's and 2 itlb's.

now "mach dtlb" and "mach itlb" work for cheetah.
 1.1 22-Feb-2010  mrg move {dump,print}_[id]tlb() into a separate file.
 1.2.42.1 06-Apr-2015  skrll Sync with HEAD
 1.2.24.1 03-Dec-2017  jdolecek update from HEAD
 1.2.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.2.6.1 23-Feb-2010  uebayasi file db_tlb_access.S was added on branch uebayasi-xip on 2010-04-30 14:39:52 +0000
 1.2.2.2 11-Mar-2010  yamt sync with head
 1.2.2.1 23-Feb-2010  yamt file db_tlb_access.S was added on branch yamt-nfs-mp on 2010-03-11 15:03:01 +0000
 1.57 24-Jan-2023  riastradh sparc64/db_trace.c: Don't dereference; use db_read_bytes.

Makes crash(8) and ddb match, and avoids crashing in ddb when you
feed in a bad lwp pointer!
 1.56 24-Jan-2023  riastradh sparc64/db_trace.c: Nix trailing whitespace.

No functional change intended.
 1.55 31-May-2020  martin branches: 1.55.20;
Avoid using excessive kernel stack.
XXX maybe we should unite all "static proc_t" and "static lwp_t" in ddb
into one global each?
 1.54 10-Mar-2020  christos Don't provide things that don't make sense in userland. We don't provide
access to registers crash(8)...
 1.53 22-May-2019  martin Add missing include to fix the crash(8) build, from Tobias Ulmer, PR port-sparc64/54221
 1.52 22-May-2019  martin Fix previous and use the original patch from PR port-sparc64/54221
instead (XXX should fix comments in param.h)
 1.51 22-May-2019  martin Relax test for valid stack frame address (now that we have multiple kernel
stacks since ... a long time). Just test for a valid kernel VA, using
the same test as for "pc".
Very close to a patch suggested by Tobias Ulmer in PR port-sparc64/54221.
 1.50 04-Mar-2013  christos branches: 1.50.30; 1.50.38;
make traces work from crash(8)
 1.49 12-Feb-2012  matt branches: 1.49.6;
Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.48 20-Jun-2011  nakayama branches: 1.48.2; 1.48.6;
Remove frame32 hack with using the same trick in netbsd32_machdep.c.
 1.47 15-Apr-2011  mrg branches: 1.47.2;
remove a tray empty line.
 1.46 13-Apr-2011  mrg port to userspace. needs <stdbool.h>, <sys/cpu.h>. delete unused
ULOAD(). implement KLOAD() in terms of db_read_bytes() in userspace.
can't use proc_find_raw() in userspace; disable this functionality
for now. use db_printf().
 1.45 13-Apr-2011  mrg apply s/TRUE/true/; s/FALSE/false/;. needed for userland.
 1.44 01-Jul-2010  rmind branches: 1.44.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.43 21-Nov-2009  rmind branches: 1.43.2; 1.43.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.42 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.41 25-Nov-2008  nakayama Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.40 02-Jul-2008  rmind branches: 1.40.2; 1.40.4; 1.40.6;
Remove proc_representative_lwp(), use a simple LIST_FIRST() instead.
OK by <ad>.
 1.39 04-Mar-2007  christos branches: 1.39.40; 1.39.44; 1.39.46; 1.39.48;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.38 22-Feb-2007  matt More boolean_t -> bool
 1.37 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.36 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.35 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.34 13-Sep-2006  mrg branches: 1.34.6;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.33 06-Sep-2006  ad branches: 1.33.2;
Use p_find(addr, PFIND_LOCKED) in case the proclist_lock is held.
 1.32 19-Jun-2006  hannken db_stack_trace_print(): Enable backtrace with pid argument.

Approved by: Martin Husemann <martin@netbsd.org>
 1.31 11-Feb-2006  cdi branches: 1.31.2; 1.31.8; 1.31.10;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.30 11-Dec-2005  christos branches: 1.30.2; 1.30.4; 1.30.6;
merge ktrace-lwp.
 1.29 01-Jun-2005  jdc branches: 1.29.2;
Add const (catching up with additions to MI ddb code).
 1.28 30-May-2005  martin Adapt to constification.
 1.27 15-Jul-2003  lukem __KERNEL_RCSID()
 1.26 18-Jan-2003  thorpej branches: 1.26.2;
Merge the nathanw_sa branch.
 1.25 16-May-2002  eeh Correctly print out all out regs in the trapframe.
 1.24 14-May-2002  eeh branches: 1.24.2;
Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.23 10-Jul-2001  eeh branches: 1.23.2; 1.23.8;
Fix a 32-bit warning.
 1.22 07-Jul-2001  eeh Also handle FPU registers.
 1.21 03-Jan-2001  pk * Apply proper cast for 32 -> 64 bit pointer argument conversion.
* Since probeget() isn't geared up to deal with _arbitrary_ memory fault
types (and doesn't work at all when called from an interrupt context),
add explicit sanity checks on a stack frame's contents before use
(XXX - needs revisiting).
 1.20 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.19 28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.18 28-Sep-2000  eeh Cannot distinguish kernel and user addresses any more.
 1.17 28-Jul-2000  eeh Make 64-bit stack traces look prettier.
 1.16 24-Jun-2000  eeh Printing out %pc values should now be safe.
 1.15 02-Jun-2000  eeh branches: 1.15.2;
db_stack_trace_cmd -> db_stack_trace_print
 1.14 26-May-2000  jhawk branches: 1.14.2;
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.13 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.12 06-Apr-2000  mrg avoid some more compiler warnings, and fix a couple of errors.
 1.11 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.10 06-Nov-1999  eeh Explicitly use 64-bit types.
 1.9 12-Apr-1999  pk branches: 1.9.2; 1.9.4; 1.9.8;
Quote "AS IS" as in the majority of Carnegy Mellon notices.
 1.8 06-Apr-1999  pk Fix a pasto in copyright text which has been procreating like rabbits..
 1.7 08-Oct-1998  eeh branches: 1.7.6;
Fix more syscall32 and signal breakage.
 1.6 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.5 11-Sep-1998  eeh Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.
 1.4 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.3 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.7.6.2 12-Apr-1999  pk branches: 1.7.6.2.2;
Pullup copyright text corrections.
 1.7.6.1 07-Apr-1999  pk Pull up from trunk: copyright text warts.
 1.7.6.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.4.1 15-Nov-1999  fvdl Sync with -current
 1.9.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.9.2.2 08-Dec-2000  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.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.2.3 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.15.2.2 31-Jul-2000  mrg pull up 1.17 (approved by thorpej):
>Make 64-bit stack traces look prettier.
 1.15.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.23.8.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.23.8.4 20-Jun-2002  nathanw Catch up to -current.
 1.23.8.3 04-Jan-2002  eeh Cleanup.
 1.23.8.2 03-Jan-2002  petrov make kernel compile
 1.23.8.1 10-Jul-2001  petrov file db_trace.c was added on branch nathanw_sa on 2002-01-03 06:42:34 +0000
 1.23.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.23.2.1 10-Jul-2001  jdolecek file db_trace.c was added on branch kqueue on 2002-06-23 17:42:16 +0000
 1.24.2.1 30-May-2002  gehenna Catch up with -current.
 1.26.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.26.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.2.1 03-Aug-2004  skrll Sync with HEAD
 1.29.2.4 03-Sep-2007  yamt sync with head.
 1.29.2.3 26-Feb-2007  yamt sync with head.
 1.29.2.2 30-Dec-2006  yamt sync with head.
 1.29.2.1 21-Jun-2006  yamt 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.10.1 13-Jul-2006  gdamore Merge from HEAD.
 1.31.8.1 22-Jun-2006  chap Complete a sync sys/ with head.
 1.31.2.2 14-Sep-2006  yamt sync with head.
 1.31.2.1 26-Jun-2006  yamt sync with head.
 1.33.2.1 18-Nov-2006  ad Sync with head.
 1.34.6.2 12-Mar-2007  rmind Sync with HEAD.
 1.34.6.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.39.48.1 03-Jul-2008  simonb Sync with head.
 1.39.46.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.39.44.3 11-Aug-2010  yamt sync with head.
 1.39.44.2 11-Mar-2010  yamt sync with head
 1.39.44.1 04-May-2009  yamt sync with head.
 1.39.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.39.40.1 28-Sep-2008  mjf Sync with HEAD.
 1.40.6.1 27-Nov-2008  snj Pull up following revision(s) (requested by nakayama in ticket #131):
sys/arch/sparc64/sparc64/db_disasm.c: revision 1.15
sys/arch/sparc64/sparc64/db_trace.c: revision 1.41
sys/arch/sparc64/sparc64/db_interface.c: revision 1.113
sys/ddb/db_command.c: revision 1.124
sys/arch/sparc64/include/db_machdep.h: revision 1.26
Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.40.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.40.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.43.4.2 21-Apr-2011  rmind sync with head
 1.43.4.1 03-Jul-2010  rmind sync with head
 1.43.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.44.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.47.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.48.6.1 18-Feb-2012  mrg merge to -current.
 1.48.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.48.2.1 17-Apr-2012  yamt sync with head
 1.49.6.1 23-Jun-2013  tls resync from head
 1.50.38.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.50.38.1 10-Jun-2019  christos Sync with HEAD
 1.50.30.1 31-May-2019  msaitoh Pull up following revision(s) (requested by martin in ticket #1274):
sys/arch/sparc64/sparc64/db_trace.c: revision 1.51
sys/arch/sparc64/sparc64/db_trace.c: revision 1.52
sys/arch/sparc64/sparc64/db_trace.c: revision 1.53
Relax test for valid stack frame address (now that we have multiple kernel
stacks since ... a long time). Just test for a valid kernel VA, using
the same test as for "pc".
Very close to a patch suggested by Tobias Ulmer in PR port-sparc64/54221.
Fix previous and use the original patch from PR port-sparc64/54221
instead (XXX should fix comments in param.h)
Add missing include to fix the crash(8) build, from Tobias Ulmer, PR port-sparc64/54221
 1.55.20.1 20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #883):

sys/arch/sparc64/sparc64/db_trace.c: revision 1.56
sys/arch/sparc64/sparc64/db_trace.c: revision 1.57

sparc64/db_trace.c: Nix trailing whitespace.
No functional change intended.

sparc64/db_trace.c: Don't dereference; use db_read_bytes.

Makes crash(8) and ddb match, and avoids crashing in ddb when you
feed in a bad lwp pointer!
 1.20 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.19 09-Nov-2003  martin bzero/bcopy -> memset/memcpy
 1.18 15-Jul-2003  lukem __KERNEL_RCSID()
 1.17 10-May-2003  thorpej branches: 1.17.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.16 02-May-2003  dsl Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
 1.15 05-Mar-2002  simonb Don't cast argument to ffs() to long.
Per discussion on port-alpha, noticed by Robert Elz.
 1.14 19-Feb-2002  wiz strategy should have an 'r'. Inspired by similar change in OpenBSD.
 1.13 17-Dec-2000  pk branches: 1.13.2; 1.13.4; 1.13.8;
Pull over revision 1.23 from sparc:

Fake a label only if it appears to be blank, and if so use RAW_PART
instead of 0.
 1.12 20-Nov-2000  chs 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.11 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.10 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.9 30-Mar-2000  tsutsui Remove register declarations.
 1.8 07-Mar-2000  tsutsui Use DISKPART/DISKMINOR/DISKUNIT instead of dkpart/dkminor/dkunit.
 1.7 18-Jan-2000  thorpej Use b_cylinder as defined in sys/buf.h
 1.6 14-Jan-2000  pk Remove old-style boot device recognition.
 1.5 04-Jun-1999  mrg branches: 1.5.2; 1.5.8;
GC dead code. add support for PCI and IDE boot device detection, plus hme ethernet.
should probably deal with be and qe, etc.
 1.4 05-Sep-1998  pk branches: 1.4.8;
#include <sys/dev/sbus/sbusvar.h>
 1.3 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.2 20-Jun-1998  mrg moved <machine/sun_disklabel.h> to <dev/sun/disklabel.h>
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.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.5.2.3 05-Jan-2001  bouyer Sync with HEAD
 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.13.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.13.8.1 28-Feb-2002  nathanw Catch up to -current.
 1.13.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.13.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.17.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.20 14-Mar-2008  nakayama branches: 1.20.2; 1.20.4;
Improve FPU state save/clear like x86, idea from OpenBSD.
 1.19 04-Mar-2007  christos branches: 1.19.20; 1.19.36; 1.19.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 10-May-2006  skrll branches: 1.18.14;
Fix a bunch of cast lvalues.
 1.17 20-Feb-2006  cdi branches: 1.17.2; 1.17.4; 1.17.6;
Use ANSI-style function definitions and declarations.
 1.16 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.15 24-Dec-2005  perry branches: 1.15.2; 1.15.4; 1.15.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 31-May-2005  christos branches: 1.13.2;
- sprinkle const
- avoid shadowed variables
 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 29-Sep-2002  chs remove some vestigial FPU and cache code that's not need on ultrasparcs.
misc tidiness.
 1.9 18-Apr-2002  eeh Don't include cpuvar.h.
 1.8 29-Jun-2001  eeh branches: 1.8.2; 1.8.8;
Handle saving and restoring the fpstate properly.
(Are these functions ever called?)
 1.7 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.6 06-Apr-2000  mrg add some more casts to shut up gcc.
 1.5 06-Nov-1999  eeh Explicitly use 64-bit types.
 1.4 24-Nov-1998  mrg branches: 1.4.10; 1.4.12; 1.4.16;
do not start comments inside comments.
 1.3 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 05-Sep-1998  christos Assign copyright to TNF.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.12.1 15-Nov-1999  fvdl Sync with -current
 1.4.10.2 08-Dec-2000  bouyer Sync with HEAD.
 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.8.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.8.8.5 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.8.8.4 20-Jun-2002  nathanw Catch up to -current.
 1.8.8.3 04-Jan-2002  eeh Cleanup.
 1.8.8.2 03-Jan-2002  petrov make kernel compile
 1.8.8.1 29-Jun-2001  petrov file emul.c was added on branch nathanw_sa on 2002-01-03 06:42:34 +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 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 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.13.2.3 17-Mar-2008  yamt sync with head.
 1.13.2.2 03-Sep-2007  yamt sync with head.
 1.13.2.1 21-Jun-2006  yamt sync with head.
 1.15.6.2 01-Jun-2006  kardel 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.15.2.2 01-Mar-2006  yamt sync with head.
 1.15.2.1 18-Feb-2006  yamt sync with head.
 1.17.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.17.4.1 11-May-2006  elad sync with head
 1.17.2.1 24-May-2006  yamt sync with head.
 1.18.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.40.2 02-Jun-2008  mjf Sync with HEAD.
 1.19.40.1 03-Apr-2008  mjf Sync with HEAD.
 1.19.36.1 24-Mar-2008  keiichi sync with head.
 1.19.20.1 23-Mar-2008  matt 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.26 27-Jan-2003  martin More old cruft to nuke from orbit. This has been replaced by genassym.cf
a long time ago.
 1.25 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.24 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.23 14-May-2002  eeh Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.22 22-Oct-2001  mrg branches: 1.22.4;
clean up for fd changes.
 1.21 05-Oct-2001  eeh Remove bsd_openprom.h, which is only for compatibility with the sparc port.
 1.20 08-Aug-2001  eeh branches: 1.20.2;
Add some useful mbuf fields.
 1.19 01-Aug-2000  eeh branches: 1.19.4;
Add UVM_PAGEIDLE_ZERO.
 1.18 14-Jul-2000  eeh Move some macro definitions out of genassym and into locore.s
 1.17 03-Jul-2000  eeh Prevent interrupts from being posted if they are active and deprecate polled
interrupts. This seems to eliminate the spurious interrupts.
 1.16 02-Jul-2000  eeh Clean up interrupt handling some more.
 1.15 30-Jun-2000  eeh Fix interrupt delivery on UltraSPARC IIi machines.
 1.14 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.13 19-Jun-2000  eeh branches: 1.13.2;
Have separate data and text segments, make text read-only.
 1.12 30-Dec-1999  eeh branches: 1.12.2;
Add proc->md->fpstate and GSR to fpstate.
 1.11 06-Nov-1999  eeh Explicitly use 64-bit types.
 1.10 24-Mar-1999  mrg branches: 1.10.8; 1.10.10; 1.10.14;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.9 28-Feb-1999  eeh Use block load/store in pmap_zero_page()/pmap_copy_page().
 1.8 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.7 17-Sep-1998  thorpej SYS_sigreturn -> SYS___sigreturn14.
 1.6 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.5 06-Sep-1998  eeh 32-bit fixup.
 1.4 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.10.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.10.10.1 15-Nov-1999  fvdl Sync with -current
 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.12.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.2.3 18-Oct-2000  tv Add patch [eeh]:
Add include of <vm/vm.h> for use by locore pullups to follow.
 1.13.2.2 07-Aug-2000  mrg pull up 1.19 (approved by thorpej):
>Add UVM_PAGEIDLE_ZERO.
 1.13.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.19.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.19.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.19.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.20.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.22.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.22.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.22.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.22.4.2 04-Jan-2002  eeh Cleanup.
 1.22.4.1 22-Oct-2001  eeh file genassym.c was added on branch nathanw_sa on 2002-01-04 19:12:28 +0000
 1.85 03-Apr-2021  palle Improve cpu_idle() by allowing a platform specific implementaion (same logic as the sparc implementation) - currently only used by sun4v
 1.84 17-Feb-2020  skrll branches: 1.84.6; 1.84.8;
G/C LS{SLEEP,RUN,ONPROC}

LWP status manipulation was moved out of assembly long ago.
 1.83 08-Jan-2020  ad Hopefully fix some problems seen with MP support on non-x86, in particular
where curcpu() is defined as curlwp->l_cpu:

- mi_switch(): undo the ~2007ish optimisation to unlock curlwp before
calling cpu_switchto(). It's not safe to let other actors mess with the
LWP (in particular l->l_cpu) while it's still context switching. This
removes l->l_ctxswtch.

- Move the LP_RUNNING flag into l->l_flag and rename to LW_RUNNING since
it's now covered by the LWP's lock.

- Ditch lwp_exit_switchaway() and just call mi_switch() instead. Everything
is in cache anyway so it wasn't buying much by trying to avoid saving old
state. This means cpu_switchto() will never be called with prevlwp ==
NULL.

- Remove some KERNEL_LOCK handling which hasn't been needed for years.
 1.82 23-Nov-2019  ad branches: 1.82.2;
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.81 10-Feb-2017  palle branches: 1.81.14;
sun4v: Added handling of trap type 0x034 (address alignment error) + fixed typo mmfsa -> mmufsa. Verified for both sun4u and sun4v using qemu.
 1.80 27-Jan-2017  palle sun4v: implement missing handling of itsb traps 0x008 and 0x009. Based on code from OpenBSD. Tested using qemu.
 1.79 17-May-2016  palle branches: 1.79.2; 1.79.4;
sun4v: Implement missng MMU protection trap handling - mostly from OpenBSD
 1.78 16-May-2016  palle Avoid assembler-specific defines by using the export keyword in genassym.cf instead
 1.77 10-May-2016  palle sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.76 01-Apr-2015  palle sun4v: Implement handling of cpu_mondo trap - from OpenBSD - tested using the Legion simulator
 1.75 24-Sep-2014  palle branches: 1.75.2;
sun4v: add code to enable startup of secondary cpus on both sun4u and sun4v systems - ok martin@
 1.74 04-Sep-2014  palle sun4v: All cpus must be setup with a TSB descriptor, so pmap_setup_tsb_sun4v() must take a pointer to the TSB descriptor
 1.73 21-Feb-2014  palle 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.72 26-Jan-2014  palle sun4v: Add handling of spill/fill and dtsb miss traps (with a XXX to be handled later)
 1.71 11-Jan-2014  palle No need to make CI_MMFSA depend on SUN4V since the ci_mmfsa field is always present in the cpu_info struct now
 1.70 11-Jan-2014  nakayama Uncomment ifdef/endif and tabify.
 1.69 07-Jan-2014  palle sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
 1.68 28-Dec-2013  nakayama CI_UPAID has been renamed to CI_CPUID.
 1.67 27-Dec-2013  palle a) make the hunt through the cpus list more generic b) sun4v: ensure that the interrupt stack is mapped permanently and the TSB is setup properly - parts from OpenBSD. OK martin@
 1.66 20-Jul-2011  macallan branches: 1.66.2; 1.66.12; 1.66.16;
add per ivec event counters
 1.65 18-Jun-2011  nakayama Add fast softint(9) support for sparc64.

Reviewed on port-sparc64.
 1.64 14-Jan-2011  rmind branches: 1.64.6;
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.63 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.62 10-Dec-2009  rmind branches: 1.62.4;
Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.61 25-Nov-2009  mrg s/L_ADDR/L_PCB/, requested by rmind.
 1.60 20-Sep-2008  tsutsui Remove advertising clause for UCB in various genassym.cf files,
which were derived from genassym.c in 4.4BSD-Lite2 (or 386BSD).
Closes PR misc/39573. Approved by martin@.
 1.59 06-Aug-2008  martin Remove a few components of struct lwp that we do not touch any more.
 1.58 02-May-2008  martin branches: 1.58.2; 1.58.6;
Move TNF licenses to 2 clause form
 1.57 22-Apr-2008  nakayama branches: 1.57.2;
include "opt_multiprocessor.h"
 1.56 25-Mar-2008  martin branches: 1.56.2;
Remove unused symbol
 1.55 17-Mar-2008  nakayama Make schedintr interrupt handler per-CPU.
While there rename tickintr interrupt handler and share initialization
code with schedintr.
 1.54 14-Mar-2008  nakayama Improve IPI handling:
- make IPI takes two arguments.
- add IPI event counters per-CPU.
- implement IPI functions which were missing or broken.
- insert DELAY while halting primary CPU in IPI handler.
 1.53 02-Mar-2008  nakayama - make interrupt pending list per-CPU.
- make tickintr() MP-safe.
- remove unused port-sparc derived interrupt code.

Ok by martin@.
 1.52 28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.51 22-Feb-2008  martin Get rid of the IPI simple_lock.
 1.50 09-Dec-2007  martin branches: 1.50.6; 1.50.10;
Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.
 1.49 17-Oct-2007  garbled branches: 1.49.4; 1.49.6;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.48 11-Sep-2007  martin Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.
 1.47 09-Sep-2007  martin Make cpufrequency and friends per cpu values.
Prepare a hz tick interrupt on secondary CPUs via %tick, but do not
enable it yet, as it breaks ddb.
 1.46 25-Aug-2007  martin branches: 1.46.2;
Remove INITSTACK completely - at the time we used to switch to it, we
already have access to all of lwp0 and it's uarea - so we can switch
to the correct lwp0 stack easily before calling main.
 1.45 20-May-2007  martin branches: 1.45.4; 1.45.8;
Simplify tf_tstate setting when leaving for userland initially - I seem
to have confused the if with the else case of the previous C code.
Funny that it worked at all.
 1.44 20-May-2007  martin Remove special case handling for userland lwps from cpu_lwp_fork, instead
do it in lwp_trampoline when we first return to userland.
 1.43 19-May-2007  martin page_idle_zero is now checked in MI code
 1.42 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.41 13-Sep-2006  mrg branches: 1.41.6; 1.41.10; 1.41.12; 1.41.18;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.40 27-Jan-2006  cdi branches: 1.40.6; 1.40.18;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.39 11-Dec-2005  christos branches: 1.39.2;
merge ktrace-lwp.
 1.38 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.37 03-Dec-2004  chs branches: 1.37.12;
remove cache_flush_virt() and PADDRT, they're no longer used.
allocate a stack frame for blast_dcache() when profiling so it shows up.
in dcache_flush_page(), use a stride of 32 instead of 16 to match the
cache line size. correct various comments.
 1.36 26-Mar-2004  petrov Use want_resched from cpu_info area.
 1.35 23-Mar-2004  martin Replace intrcnts by evcnts. XXX - needs slight tweaking for MULTIPROCESSOR.
 1.34 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.33 06-Jan-2004  martin Implement restartable atomic sequences (RAS) for sparc64.
 1.32 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.31 26-Oct-2003  christos Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.
 1.30 03-Apr-2003  martin branches: 1.30.2;
Provide PAGE_SIZE to assembler source.
 1.29 31-Jan-2003  martin Make the pmap count resident/wired mappings on the fly instead of
walking the page tables whenever this information is needed.

Add an option PMAP_COUNT_DEBUG to assert the new counts and the
page table walk agree.

The old solution had very bad performance impact, for example
by the high CPU load when running top(1).

Thanks to Simon Burge for pointing at the cause of the problem and
to Valeriy E. Ushakov for optimizing my simple minded assembler code.
 1.28 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.27 26-Sep-2002  martin Remove include of <sys/map.h>, since it's gone now (and wasn't used
here anyway).
 1.26 14-May-2002  eeh Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.25 22-Oct-2001  mrg branches: 1.25.4; 1.25.8;
clean up for fd changes.
 1.24 05-Oct-2001  eeh Remove bsd_openprom.h, which is only for compatibility with the sparc port.
 1.23 08-Aug-2001  eeh branches: 1.23.2;
Add some useful mbuf fields.
 1.22 01-Aug-2000  eeh branches: 1.22.4;
Add UVM_PAGEIDLE_ZERO.
 1.21 24-Jul-2000  pk Define UVM_PAGE_IDLE_ZERO.
 1.20 14-Jul-2000  eeh Move some macro definitions out of genassym and into locore.s
 1.19 03-Jul-2000  eeh Prevent interrupts from being posted if they are active and deprecate polled
interrupts. This seems to eliminate the spurious interrupts.
 1.18 02-Jul-2000  eeh Clean up interrupt handling some more.
 1.17 30-Jun-2000  eeh Fix interrupt delivery on UltraSPARC IIi machines.
 1.16 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.15 19-Jun-2000  eeh branches: 1.15.2;
Have separate data and text segments, make text read-only.
 1.14 26-May-2000  thorpej branches: 1.14.2;
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.13 30-Dec-1999  eeh Add proc->md->fpstate and GSR to fpstate.
 1.12 06-Nov-1999  eeh Explicitly use 64-bit types.
 1.11 26-Mar-1999  eeh branches: 1.11.8; 1.11.10; 1.11.14;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.10 22-Mar-1999  eeh Add FS_SIZE.
 1.9 28-Feb-1999  eeh Use block load/store in pmap_zero_page()/pmap_copy_page().
 1.8 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.7 17-Sep-1998  thorpej SYS_sigreturn -> SYS___sigreturn14.
 1.6 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.5 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 05-Sep-1998  christos Assign copyright to TNF.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 17-Jul-1998  eeh branches: 1.2.2;
Make this work for a change.
 1.1 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.2.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.11.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.10.1 15-Nov-1999  fvdl Sync with -current
 1.11.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.14.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.2.3 18-Oct-2000  tv Add patch [eeh]:
Add include of <vm/vm.h> for use by locore pullups to follow.
 1.15.2.2 07-Aug-2000  mrg pull up 1.22 (approved by thorpej):
>Add UVM_PAGEIDLE_ZERO.
 1.15.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.22.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.22.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.22.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.22.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.23.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.25.8.3 22-Mar-2002  thorpej def __MUTEX_PRIVATE
 1.25.8.2 22-Mar-2002  thorpej Handle MUTEX_DEBUG.
 1.25.8.1 19-Mar-2002  thorpej First draft of mutex and rwlock implementation for sparc64.
 1.25.4.6 18-Oct-2002  nathanw Catch up to -current.
 1.25.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.25.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.25.4.3 04-Jan-2002  eeh Cleanup.
 1.25.4.2 03-Jan-2002  petrov make kernel compile
 1.25.4.1 22-Oct-2001  petrov file genassym.cf was added on branch nathanw_sa on 2002-01-03 06:42:34 +0000
 1.30.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.30.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.30.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.30.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.30.2.1 03-Aug-2004  skrll Sync with HEAD
 1.37.12.7 17-Mar-2008  yamt sync with head.
 1.37.12.6 27-Feb-2008  yamt sync with head.
 1.37.12.5 21-Jan-2008  yamt sync with head
 1.37.12.4 27-Oct-2007  yamt sync with head.
 1.37.12.3 03-Sep-2007  yamt sync with head.
 1.37.12.2 30-Dec-2006  yamt sync with head.
 1.37.12.1 21-Jun-2006  yamt sync with head.
 1.39.2.1 01-Feb-2006  yamt sync with head.
 1.40.18.1 18-Nov-2006  ad Sync with head.
 1.40.6.1 14-Sep-2006  yamt sync with head.
 1.41.18.2 03-Oct-2007  garbled Sync with HEAD
 1.41.18.1 22-May-2007  matt Update to HEAD.
 1.41.12.1 11-Jul-2007  mjf Sync with head.
 1.41.10.2 09-Oct-2007  ad Sync with head.
 1.41.10.1 27-May-2007  ad Sync with head.
 1.41.6.1 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.45.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.45.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.45.4.2 10-Sep-2007  skrll Sync with HEAD.
 1.45.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.46.2.3 23-Mar-2008  matt sync with HEAD
 1.46.2.2 09-Jan-2008  matt sync with HEAD
 1.46.2.1 06-Nov-2007  matt sync with HEAD
 1.49.6.1 11-Dec-2007  yamt sync with head.
 1.49.4.1 26-Dec-2007  ad Sync with head.
 1.50.10.3 28-Sep-2008  mjf Sync with HEAD.
 1.50.10.2 02-Jun-2008  mjf Sync with HEAD.
 1.50.10.1 03-Apr-2008  mjf Sync with HEAD.
 1.50.6.1 24-Mar-2008  keiichi sync with head.
 1.56.2.1 18-May-2008  yamt sync with head.
 1.57.2.3 11-Mar-2010  yamt sync with head
 1.57.2.2 04-May-2009  yamt sync with head.
 1.57.2.1 16-May-2008  yamt sync with head.
 1.58.6.1 19-Oct-2008  haad Sync with HEAD.
 1.58.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.58.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.62.4.1 05-Mar-2011  rmind sync with head
 1.64.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.66.16.1 18-May-2014  rmind sync with head
 1.66.12.2 03-Dec-2017  jdolecek update from HEAD
 1.66.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.66.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.75.2.4 28-Aug-2017  skrll Sync with HEAD
 1.75.2.3 05-Feb-2017  skrll Sync with HEAD
 1.75.2.2 29-May-2016  skrll Sync with HEAD
 1.75.2.1 06-Apr-2015  skrll Sync with HEAD
 1.79.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.79.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.81.14.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.82.2.2 29-Feb-2020  ad Sync with head.
 1.82.2.1 17-Jan-2020  ad Sync with head.
 1.84.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.84.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.5 27-Apr-2021  palle sun4v: add missing method to set hypervisor api version + add defintion for the interrupt hypervisor api group (to be used)
 1.4 08-Jun-2014  palle branches: 1.4.4; 1.4.46;
sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.3 08-Dec-2013  palle branches: 1.3.2; 1.3.4; 1.3.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.2 07-Dec-2013  palle Added missing $ to sun4v sypervisor API
 1.1 07-Dec-2013  palle sun4v hypervisor API - from OpenBSD
 1.3.6.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.6.1 08-Dec-2013  yamt file hvcall.S was added on branch yamt-pagecache on 2014-05-22 11:40:10 +0000
 1.3.4.2 18-May-2014  rmind sync with head
 1.3.4.1 08-Dec-2013  rmind file hvcall.S was added on branch rmind-smpnet on 2014-05-18 17:45:26 +0000
 1.3.2.1 10-Aug-2014  tls Rebase.
 1.4.46.1 13-May-2021  thorpej Sync with HEAD.
 1.4.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.4.1 08-Jun-2014  tls file hvcall.S was added on branch tls-maxphys on 2014-08-20 00:03:25 +0000
 1.9 03-Feb-2008  martin Adjust assembler in_cksum code to new signature and re-enable it.
 1.8 11-Feb-2006  cdi branches: 1.8.44; 1.8.50;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.7 24-Dec-2005  perry branches: 1.7.2; 1.7.4; 1.7.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 13-Oct-2003  agc branches: 1.5.16;
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.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 15-Jul-2003  lukem __KERNEL_RCSID()
 1.2 21-Jan-2002  eeh branches: 1.2.16;
More 32-bit cleanup.
 1.1 10-Aug-2001  eeh branches: 1.1.2; 1.1.8;
Add an optimized in4_cksum().
 1.1.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.8.1 10-Aug-2001  nathanw file in4_cksum.c was added on branch nathanw_sa on 2002-02-28 04:12:16 +0000
 1.1.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.1.2.1 10-Aug-2001  thorpej file in4_cksum.c was added on branch kqueue on 2001-08-25 06:15:56 +0000
 1.2.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.16.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.2 04-Feb-2008  yamt sync with head.
 1.5.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.7.2.1 18-Feb-2006  yamt sync with head.
 1.8.50.1 18-Feb-2008  mjf Sync with HEAD.
 1.8.44.1 23-Mar-2008  matt sync with HEAD
 1.6 03-Feb-2008  martin Adjust assembler in_cksum code to new signature and re-enable it.
 1.5 21-Jan-2002  eeh branches: 1.5.32; 1.5.94; 1.5.100;
More 32-bit cleanup.
 1.4 16-Jan-2002  eeh Fix ILP32 bug.
 1.3 23-Sep-2001  eeh branches: 1.3.4;
32-bit kernels have 32-bit pointers.
 1.2 10-Aug-2001  eeh branches: 1.2.2; 1.2.4;
Add an optimized in4_cksum().
 1.1 08-Aug-2001  eeh Add an optimized assembly in_cksum(). (Why did I do this?)
 1.2.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.2.2.1 10-Aug-2001  thorpej file in_cksum.S was added on branch kqueue on 2001-08-25 06:15:56 +0000
 1.3.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.3.4.1 23-Sep-2001  nathanw file in_cksum.S was added on branch nathanw_sa on 2002-02-28 04:12:16 +0000
 1.5.100.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.94.1 23-Mar-2008  matt sync with HEAD
 1.5.32.1 04-Feb-2008  yamt sync with head.
 1.4 08-Aug-2001  eeh This file is no longer used.
 1.3 29-Nov-1998  mycroft branches: 1.3.24;
Sync with 32-bit SPARC version.
 1.2 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.24.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.2 30-May-2009  martin Remove unused file (merge error?)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.154; 1.1.1.1.168;
Import of sparc64.
 1.1.1.1.168.1 24-Oct-2010  jym Sync with HEAD
 1.1.1.1.154.1 20-Jun-2009  yamt sync with head
 1.72 15-Jan-2024  andvar Fix typos in trap types and one log message.

OpenBSD fixed those over 20 years ago.
 1.71 09-Jan-2022  palle sun4v: enable sun4v_intr_xxx() function previously imported from OpenBSD. Note that the sun4v_intr_devino_to_sysino() function is adapted to match OpenBSD version 1.57 (the introduction of INTR_DEVINO is done in revision 1.58)
 1.70 03-Jul-2021  palle sun4v: add support for hypervisor soft state - from OpenBSD
 1.69 13-May-2016  nakayama branches: 1.69.34;
Interrupt handlers are now allocated by kmem_zalloc(9), so free
them by kmem_free(9).
 1.68 10-May-2016  palle sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.67 11-Aug-2012  mrg branches: 1.67.2; 1.67.16;
add an XXXSMP comment.
 1.66 12-Aug-2011  mrg branches: 1.66.2;
add a DPRINTF() and use it a little.
if DIAGNOSTIC, whine if ih_pending or ih_pil aren't setup. may as
well try to finish converting all the callers this decade...
 1.65 27-Jul-2011  nakayama Don't attach same ivec's event coutner more than once. They are
difficult to distinguish since they are handled by intr_list_handler.
 1.64 20-Jul-2011  macallan add per ivec event counters
 1.63 18-Jun-2011  nakayama Add fast softint(9) support for sparc64.

Reviewed on port-sparc64.
 1.62 03-Dec-2009  mrg branches: 1.62.10;
s/DEBUG/NOT_DEBUG/ on the intr_establish() re-used message.
it triggers all the time on more-modern systems.
 1.61 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.60 18-May-2008  martin branches: 1.60.6;
Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.
 1.59 29-Apr-2008  martin branches: 1.59.2;
Record argument in soft interrupt handler
 1.58 29-Apr-2008  ad Mirror sparc and provide sparc_softintr stuff. There is no functional
change, beyond renaming a function and putting back disestablish/schedule.
PR kern/37540.
 1.57 17-Mar-2008  nakayama branches: 1.57.2; 1.57.4;
Make schedintr interrupt handler per-CPU.
While there rename tickintr interrupt handler and share initialization
code with schedintr.
 1.56 02-Mar-2008  nakayama - make interrupt pending list per-CPU.
- make tickintr() MP-safe.
- remove unused port-sparc derived interrupt code.

Ok by martin@.
 1.55 18-Feb-2008  martin branches: 1.55.2; 1.55.6;
For non-mpsafe interrupt handlers, grab the kernel lock via a biglock
wrapper. Fixes PR port-sparc64/37468.
 1.54 03-Dec-2007  ad Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.53 04-Mar-2007  christos branches: 1.53.2; 1.53.18; 1.53.20; 1.53.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.52 15-Oct-2006  martin branches: 1.52.4;
Missing initializers
 1.51 07-Jun-2006  kardel branches: 1.51.6; 1.51.8;
convert to timecounters (from branch simonb-timecounters)
 1.50 20-Feb-2006  cdi branches: 1.50.2; 1.50.8;
Use ANSI-style function definitions and declarations.
 1.49 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.48 11-Dec-2005  christos branches: 1.48.2; 1.48.4; 1.48.6;
merge ktrace-lwp.
 1.47 09-Nov-2003  martin branches: 1.47.16;
bzero/bcopy -> memset/memcpy
 1.46 01-Oct-2003  petrov remove unused fastvec.
 1.45 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.44 15-Jul-2003  lukem __KERNEL_RCSID()
 1.43 07-Jun-2002  eeh branches: 1.43.6;
Fix yet another inverted comparison.
 1.42 06-May-2002  eeh branches: 1.42.2; 1.42.4;
Only put interrupts into the list for that interrupt level if the handler
is not shared. Otherwise put the shared interrupt dispatcher in the list.
 1.41 25-Sep-2001  eeh branches: 1.41.4;
Change a printf to DEBUG only.
 1.40 02-Sep-2001  eeh branches: 1.40.2;
Add an entry for level-15 interrupts.
 1.39 19-Jul-2001  eeh Small code cleanup.
 1.38 15-Jan-2001  thorpej branches: 1.38.4;
Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
 1.37 04-Dec-2000  fvdl More cast / format cleanup to make this compile cleanly in 32bit mode.
 1.36 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.35 03-Dec-2000  fvdl Make softintr_establish prototype match other ports, avoiding compile
warnings.
 1.34 29-Sep-2000  eeh Only call pcons_dopoll() if there's a pcons device.
 1.33 28-Sep-2000  eeh Poll pcons for input on softints in case someone want to break into the debugger.
 1.32 27-Jul-2000  mrg intr_list_handler() should only take one argument. it ignored the 2nd anyway.
 1.31 03-Jul-2000  eeh Prevent interrupts from being posted if they are active and deprecate polled
interrupts. This seems to eliminate the spurious interrupts.
 1.30 02-Jul-2000  eeh Clean up interrupt handling some more.
 1.29 02-Jul-2000  mrg use bitmask_snprintf().
 1.28 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.27 30-Jun-2000  eeh Fix interrupt delivery on UltraSPARC IIi machines.
 1.26 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.25 08-Jun-2000  eeh branches: 1.25.2;
Allow multiple drivers to share one interrupt vector.
 1.24 02-Jun-2000  eeh New softintr interface.
 1.23 17-May-2000  mrg branches: 1.23.2;
fix || vs. && bug, and clean up some cruft.
 1.22 19-Mar-2000  pk Nuke dead code.
 1.21 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.20 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.19 09-Feb-2000  shin fix include file.

<netinet6/ip6.h> -> <netinet/ip6.h>
 1.18 10-Jan-2000  eeh Add debugger single-stepping and fix interrupt dispatch bugs.
 1.17 06-Nov-1999  eeh Explicitly use 64-bit types.
 1.16 28-Jun-1999  itojun branches: 1.16.2; 1.16.4; 1.16.8;
- 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.15 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.14 30-May-1999  mrg allow the kernel to link with no arp (ether) devices
 1.13 17-Feb-1999  mrg branches: 1.13.4; 1.13.6;
KNF nit.
 1.12 17-Feb-1999  eeh Let's test out vectored interrupts.
 1.11 24-Nov-1998  mrg #if 0 an unused declaration
 1.10 06-Sep-1998  eeh 32-bit fixup.
 1.9 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.8 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.7 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.6 07-Jul-1998  eeh branches: 1.6.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.5 05-Jul-1998  jonathan defopt NATM.
 1.4 05-Jul-1998  jonathan defopt NS, NSIP.
 1.3 05-Jul-1998  jonathan defopt ISO TPIP.
 1.2 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.6.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.13.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.13.6.1 06-Jul-1999  itojun KAME/NetBSD 1.4, SNAP kit 1999/07/05.
NOTE: this branch is just for reference purposes (i.e. for taking cvs diff).
do not touch anything on the branch. actual work must be done on HEAD branch.
 1.13.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.13.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.16.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.4.1 15-Nov-1999  fvdl Sync with -current
 1.16.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.16.2.2 08-Dec-2000  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.23.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.38.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.38.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.38.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.38.4.1 03-Aug-2001  lukem update to -current
 1.40.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.41.4.2 20-Jun-2002  nathanw Catch up to -current.
 1.41.4.1 25-Sep-2001  nathanw file intr.c was added on branch nathanw_sa on 2002-06-20 03:41:29 +0000
 1.42.4.1 19-Jun-2003  grant Pull up revision 1.43 (requested by martin in ticket #1318):

Fix yet another inverted comparison.
 1.42.2.1 15-Jul-2002  gehenna catch up with -current.
 1.43.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.43.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.43.6.1 03-Aug-2004  skrll Sync with HEAD
 1.47.16.6 17-Mar-2008  yamt sync with head.
 1.47.16.5 27-Feb-2008  yamt sync with head.
 1.47.16.4 07-Dec-2007  yamt sync with head
 1.47.16.3 03-Sep-2007  yamt sync with head.
 1.47.16.2 30-Dec-2006  yamt sync with head.
 1.47.16.1 21-Jun-2006  yamt sync with head.
 1.48.6.2 02-Jun-2006  kardel - support timecounters
 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.2 01-Mar-2006  yamt sync with head.
 1.48.2.1 18-Feb-2006  yamt sync with head.
 1.50.8.1 19-Jun-2006  chap Sync with head.
 1.50.2.1 26-Jun-2006  yamt sync with head.
 1.51.8.1 22-Oct-2006  yamt sync with head
 1.51.6.1 18-Nov-2006  ad Sync with head.
 1.52.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.53.26.2 18-Feb-2008  mjf Sync with HEAD.
 1.53.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.53.20.2 23-Mar-2008  matt sync with HEAD
 1.53.20.1 09-Jan-2008  matt sync with HEAD
 1.53.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.53.2.1 03-Dec-2007  ad Sync with HEAD.
 1.55.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.55.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.55.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.55.2.1 24-Mar-2008  keiichi sync with head.
 1.57.4.3 11-Mar-2010  yamt sync with head
 1.57.4.2 04-May-2009  yamt sync with head.
 1.57.4.1 16-May-2008  yamt sync with head.
 1.57.2.2 04-Jun-2008  yamt sync with head
 1.57.2.1 18-May-2008  yamt sync with head.
 1.59.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.60.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.62.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.66.2.1 30-Oct-2012  yamt sync with head
 1.67.16.1 29-May-2016  skrll Sync with HEAD
 1.67.2.1 03-Dec-2017  jdolecek update from HEAD
 1.69.34.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.6 11-Dec-2005  christos branches: 1.6.2; 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 24-Jun-2000  eeh branches: 1.4.24;
Get rid of vaddrs.h.
 1.3 12-Jun-2000  eeh branches: 1.3.2;
Start reorganizing the kernel for MULTIPROCESSOR support.
 1.2 16-Mar-2000  eeh branches: 1.2.2;
Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.4.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.24.1 03-Aug-2004  skrll Sync with HEAD
 1.5.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.6.2.1 18-Feb-2006  yamt sync with head.
 1.57 03-May-2022  andvar fix various typos, mainly s/trasfering/transferring/ and s/theese/these/.
 1.56 30-Jan-2016  palle Fixed typo in sparc64_send_ipi_sun4u(): sun4v -> sun4u
 1.55 04-Jan-2015  palle smp_dcache_flush_page_cpuset(): Avoid run-time check for cpu type/implementation by installing correct function in sparc64_ipi_init()
 1.54 03-Jan-2015  palle smp_tlb_flush_pte(): Avoid run-time check for cpu type/implementation by installing correct function pointer in sparc64_ip_init(). sparc64_send_ipi() is changed to a function pointer as well to avoid run-time checks.
 1.53 05-Nov-2014  nakayama branches: 1.53.2;
Remove more #ifdef SUN4V to make compilable w/o options SUN4V.
 1.52 04-Nov-2014  palle sun4v: Removed a bunch of ifdef SUN4V since the CPU_ISSUN4V already has the necessary logic. Noticed by mrg@
 1.51 02-Nov-2014  palle sun4v: Implement missing sparc64_ipi_dcache_flush_page_xxx() function. ok martin@
 1.50 08-Jun-2014  palle sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.49 19-May-2014  rmind s/cpu_send_ipi/cpu_ipi/
 1.48 19-May-2014  rmind Implement MI IPI interface with cross-call support.
 1.47 08-Nov-2012  nakayama branches: 1.47.10;
Rename ASR_IDSR to ASI_IDSR, which is ASI (Address Space Identifier),
not ASR (Ancillary State Register).
 1.46 04-Jul-2012  jdc branches: 1.46.2;
Appease gcc -Wuninitialized when cross-compiling on amd64. Problem noticed
by Hisashi Fujinaka on current-users.
 1.45 02-Jul-2012  jdc Increase the retry count in sparc64_send_ipi(), and add loops in
mp_pause_cpus() and mp_resume_cpus().
Fixes "RED State Exception" on an 8-way E3500, and allows it to enter and
leave DDB without failing to pause or resume one or more CPU's.
 1.44 12-Feb-2012  matt Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.43 08-Oct-2011  nakayama branches: 1.43.2; 1.43.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.
 1.42 06-Jun-2011  mrg convert dcache_flush_page() into a function pointer. introduce a
sp_dcache_flush_page() to help the smp version.

XXX: probably best to have usI/II and usIII (and nop) of this and
XXX: avoid the need for sp_dcache_flush_page at all.
 1.41 06-Jun-2011  mrg re-implement blast_dcache() and blast_icache() via function pointers so that
we can set these to functions that simply return on sun4us/sun4v systems.

also include some work-in-progress #if 0'ed code to do the same for the
dcache_flush*() functions.


(some of these could probably move into the cpuinfo except that sparc64
systems don't really ever work with mismatches AFAICT.)
 1.40 12-May-2011  mrg branches: 1.40.2;
first steps towards fujitsu SPARC64 support:

- use CPU_IS_USIIIi()
- only apply spitfire erratum #54 on CPU_IS_SPITFIRE() systems (this faults
on SPARC64 cpus)
- sun4us and sun4v systems don't need dcache_flush_page or
blast_dcache ops
 1.39 22-Jun-2010  rmind branches: 1.39.2;
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.38 29-May-2010  martin Add a generic ipi to call arbitrary C functions on another (or all other)
cpu(s). Will be used in the near future by some code Mindaugas is working on.
 1.37 24-May-2010  martin Make C declarations match assembler reality: ipi functions get two arguments
(which most of them (partly) ignore, but anyway).
 1.36 28-Mar-2010  mrg - add a kmutex_t ci_ctx_lock to struct cpu_info, and initialise it in
cpu_pmap_init() and replace pmap_ctx_lock usage with this new ci_ctx_lock

- replace smp_dcache_flush_page_all() with smp_dcache_flush_page_cpuset(),
that flushes only on the set of CPUs not, everyone. add new
dcache_flush_page_cpuset() to flush this page from the D$ only
on the specified set of CPUs.

- add a cpuset to pmap_free_page() and use it when freeing PTE pages
when a pmap is destroyed

- introduce pmap_free_page_noflush(), and use it when we allocated a
page for PTEs but didn't use it and don't need to flush it

- don't bother with pmap_lock in pmap_extract(), the only potential
issue is pseg_get() which is already safe


tested on sb2000, sb2500 and ultra80 with a bunch of various heavy
workloads, and seems to give a clear 1-2% speed up for high-forking /
short lived processes, such as ./configure.
 1.35 08-Mar-2010  mrg branches: 1.35.2;
blast_dcache() SMP friendly:

- blast_dcache() becomes sp_blast_dcache(dcache_size, dcache_line_size)
- new smp_blast_dcache(sparc64_cpuset_t) that blasts the D$ on this cpuset
- sparc64_ipi_blast_dcache() to support the above
- in pmap_remove_all(), when freeing mmu contexts for this pmap, mark
the set of cpus to blast the d$ on as well and convert the
blast_dcache() call into smp_blast_dcache() on the cpus who ran this
pmap, or, sp_blast_dcache(dcache_size, dcache_line_size)
- convert the remaining blast_dcache() in machdep.c to sp_blast_dcache()
- in pmap_destroy()/pmap_remove_all() take the pmap_lock() always since
we assert it is held always.

with these changes, NFS builds on the U60 seem to be stable now, and
the USIII machines also can often complete a single build.sh run now,
diskful or diskless.


reviewed by mlelstv and partially by martin, tested by martin and myself,
with some ideas from chuq as well.
 1.34 24-Feb-2010  mrg when handing back page table pages to UVM, flush them from the dcache
on all CPUs.

idea from skrll@, and makes my disk-based SB2000 stable.

tested on U60, SB2000 and SB2500.
 1.33 24-Feb-2010  mrg fix MULTIPROCESSOR build for previous.
 1.32 24-Feb-2010  mrg - re-introduce sp_tlb_flush_pte() and sp_tlb_flush_all() that call
the right USI/USIII version.
- define tlb_flush_pte() in terms of sp_tlb_flush_pte() for the
!MULTIPROCESSOR case

this centralises some CPU_IS_USIII_UP() tests.
 1.31 20-Feb-2010  martin Select the shutdown method for secondary CPUs by available firmware
methods, not properties of the CPU.
Inspired by OpenSolaris, pointed out by eeh.
 1.30 02-Feb-2010  mrg branches: 1.30.2;
- split sp_tlb_flush_pte() and switchtoctx() into sp_tlb_flush_pte_us()/
sp_tlb_flush_pte_usiii() and switchtoctx_us()/switchtoctx_usiii() and
implement the latter while i'm here. it works ... sometimes i think,
but also sometimes panics/hangs.
- fix a comment in sparc64_ipi_flush_pte_usiii()
 1.29 01-Feb-2010  mrg - sp_tlb_flush_all() becomes sp_tlb_flush_all_us() and sp_tlb_flush_all_usiii()
- sparc64_ipi_flush_pte() becomes sparc64_ipi_flush_pte_us() and
sparc64_ipi_flush_pte_usiii()
- add some commented out code to disable interrupts and raise the traplevel
in sparc64_ipi_flush_pte_usiii()
- cache_flush_phys() was missing a little of code in the cheetah case
 1.28 01-Feb-2010  mrg add some macros to check cpu type:
GETVER_CPU_IMPL()
CPU_IS_JALAPENO()
CPU_IS_USIII_UP()
and use them in a couple places to choose the right method/index
 1.27 01-Feb-2010  mrg - add a PDB_CTX_FLUSHALL debug type to pmap.c, and also log the cpu_number()
in a bunch more cases

- make sparc64_ipi_halt_thiscpu() and sparc64_ipi_pause_thiscpu() return void,
their callers never checked anyway.

- remove prototypes for sparc64_ipi_flush_ctx() and sparc64_ipi_flush_all(),
there are no such functions
 1.26 15-Jan-2010  nakayama UltraSPARC-IIIi CPUs select the BUSY/NACK pair in the interrupt
vector dispatch status register based on the lower two bits of the
ITID.

From OpenBSD and details are described in the section 10.4.3 of
UltraSPARC IIIi Processor User's Manual.
 1.25 30-Nov-2009  mrg delete some no longer used code:
- smp_tlb_flush_ctx()
- smp_tlb_flush_all()
- sparc64_ipi_flush_ctx()
- sparc64_ipi_flush_all()
- sp_tlb_flush_ctx()
 1.24 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.23 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.22 31-May-2008  nakayama branches: 1.22.6; 1.22.8; 1.22.12; 1.22.16;
No need to wait on primary CPU in sparc64_ipi_halt_thiscpu with recent
openfirmware_exit changes.
 1.21 28-Apr-2008  martin branches: 1.21.2;
Remove clause 3 and 4 from TNF licenses
 1.20 03-Apr-2008  nakayama branches: 1.20.2; 1.20.4;
Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.
 1.19 27-Mar-2008  martin Fix a panic message and bump the number of retries untill we manage to
send an IPI a bit up again.
 1.18 27-Mar-2008  martin Get rid of delay() while waiting for IPI results; limit the waiting
time via the cycle counter. Suggested by macallan.
 1.17 22-Mar-2008  nakayama Insert a delay with enabling interrupts to avoid deadlocks
when sending IPI is failed.
 1.16 20-Mar-2008  nakayama Use proper ASI macro.
 1.15 14-Mar-2008  nakayama Improve IPI handling:
- make IPI takes two arguments.
- add IPI event counters per-CPU.
- implement IPI functions which were missing or broken.
- insert DELAY while halting primary CPU in IPI handler.
 1.14 02-Mar-2008  martin Make ddb's "mach cpu" command do the right thing: run ddb on the requested
cpu. There is a tiny bit of cheating involved, but I assume we won't run
parallel + recursive ddb scripts to play towers of hanoi.

This fixes the wrong prompt, and (more importantly) makes things like
"mach dtlb" display the registers of the right MMU.
 1.13 22-Feb-2008  martin Get rid of the IPI simple_lock.
 1.12 26-Jan-2008  nakayama branches: 1.12.2; 1.12.6;
Fix include.
 1.11 15-Jan-2008  martin Rename cpuset_t for now to sparc64_cpuset_t, to avoid a name clash with
<sys/pset.h>. Mid-term we should probably convert to the MI cpuset_t.
 1.10 17-Oct-2007  garbled branches: 1.10.2; 1.10.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.9 11-Sep-2007  martin Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.
 1.8 07-Oct-2006  rjs branches: 1.8.8; 1.8.16; 1.8.26; 1.8.28;
Make it build without debugger.
 1.7 03-Oct-2006  mrg need a (u_long) in the middle to go from 64 bit value to pointer value.
 1.6 18-Sep-2006  mrg remove some prototypes moved to cpu.h. de-static those functions.
 1.5 13-Sep-2006  mrg branches: 1.5.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.4 20-Feb-2006  cdi branches: 1.4.2; 1.4.14;
Use ANSI-style function definitions and declarations.
 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 14-Mar-2004  chs branches: 1.1.4; 1.1.18;
checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.1.18.8 24-Mar-2008  yamt sync with head.
 1.1.18.7 17-Mar-2008  yamt sync with head.
 1.1.18.6 27-Feb-2008  yamt sync with head.
 1.1.18.5 04-Feb-2008  yamt sync with head.
 1.1.18.4 21-Jan-2008  yamt sync with head
 1.1.18.3 27-Oct-2007  yamt sync with head.
 1.1.18.2 30-Dec-2006  yamt sync with head.
 1.1.18.1 21-Jun-2006  yamt 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 14-Mar-2004  skrll file ipifuncs.c was added on branch ktrace-lwp on 2004-08-03 10:41:35 +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 01-Mar-2006  yamt sync with head.
 1.4.14.1 18-Nov-2006  ad Sync with head.
 1.4.2.1 14-Sep-2006  yamt sync with head.
 1.5.2.1 22-Oct-2006  yamt sync with head
 1.8.28.2 23-Mar-2008  matt sync with HEAD
 1.8.28.1 06-Nov-2007  matt sync with HEAD
 1.8.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.8.16.1 03-Oct-2007  garbled Sync with HEAD
 1.8.8.1 09-Oct-2007  ad Sync with head.
 1.10.8.1 19-Jan-2008  bouyer Sync with HEAD
 1.10.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.12.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.12.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.12.2.1 24-Mar-2008  keiichi sync with head.
 1.20.4.5 11-Aug-2010  yamt sync with head.
 1.20.4.4 11-Mar-2010  yamt sync with head
 1.20.4.3 20-Jun-2009  yamt 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.2 04-Jun-2008  yamt sync with head
 1.20.2.1 18-May-2008  yamt sync with head.
 1.21.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.22.16.1 21-Apr-2010  matt sync to netbsd-5
 1.22.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.22.8.1 17-Mar-2010  snj Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
properly handle flushes in all cpus as necessary
 1.22.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.30.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.30.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.35.2.4 12-Jun-2011  rmind sync with head
 1.35.2.3 31-May-2011  rmind sync with head
 1.35.2.2 03-Jul-2010  rmind sync with head
 1.35.2.1 30-May-2010  rmind sync with head
 1.39.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.40.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.43.6.1 18-Feb-2012  mrg merge to -current.
 1.43.2.3 16-Jan-2013  yamt sync with (a bit old) head
 1.43.2.2 30-Oct-2012  yamt sync with head
 1.43.2.1 17-Apr-2012  yamt sync with head
 1.46.2.3 03-Dec-2017  jdolecek update from HEAD
 1.46.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.47.10.1 10-Aug-2014  tls Rebase.
 1.53.2.2 19-Mar-2016  skrll Sync with HEAD
 1.53.2.1 06-Apr-2015  skrll Sync with HEAD
 1.15 23-May-2011  rmind kgdb_acc: use mutex since pm_lock was converted to it.
 1.14 18-Mar-2009  cegger branches: 1.14.4; 1.14.6;
Ansify function definitions w/o arguments. Generated with sed.
 1.13 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.12 11-Jan-2009  cegger branches: 1.12.2;
adaption for making kgdb_dev a dev_t
 1.11 28-Apr-2008  martin branches: 1.11.8;
Remove clause 3 and 4 from TNF licenses
 1.10 04-Mar-2007  christos branches: 1.10.40; 1.10.42; 1.10.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 07-Oct-2006  rjs branches: 1.9.4;
Allow kernel to build with KGDB enabled.
 1.8 13-Sep-2006  mrg branches: 1.8.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.7 11-Feb-2006  cdi branches: 1.7.2; 1.7.14;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.6 24-Dec-2005  perry branches: 1.6.2; 1.6.4; 1.6.6;
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 15-Jul-2003  lukem __KERNEL_RCSID()
 1.2 19-Jun-2003  agc branches: 1.2.2;
Make this compile.
 1.1 18-May-2003  martin Make kernels with options KGDB at least compile.
Still needs some work to make it working.
 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.16.3 03-Sep-2007  yamt sync with head.
 1.4.16.2 30-Dec-2006  yamt sync with head.
 1.4.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.6.2.1 18-Feb-2006  yamt sync with head.
 1.7.14.1 18-Nov-2006  ad Sync with head.
 1.7.2.1 14-Sep-2006  yamt sync with head.
 1.8.2.1 22-Oct-2006  yamt sync with head
 1.9.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.44.2 04-May-2009  yamt sync with head.
 1.10.44.1 16-May-2008  yamt sync with head.
 1.10.42.1 18-May-2008  yamt sync with head.
 1.10.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.10.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.11.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.12.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.14.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.4.1 31-May-2011  rmind sync with head
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Import of sparc64.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.18 19-Oct-2006  martin Remove unsued file
 1.17 11-Feb-2006  cdi branches: 1.17.14; 1.17.16;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.16 11-Dec-2005  christos branches: 1.16.2; 1.16.4; 1.16.6;
merge ktrace-lwp.
 1.15 13-Feb-2004  wiz branches: 1.15.16;
Uppercase CPU, plural is CPUs.
 1.14 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 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 15-Jul-2003  lukem __KERNEL_RCSID()
 1.11 01-Apr-2003  thorpej branches: 1.11.2;
Use PAGE_SIZE rather than NBPG.
 1.10 21-Jan-2003  martin Rename the DIV0 traps to avoid confusion with the usage on the sparc
port: T_IDIV0 is the hardware trap generated on integer division by
zero, T_DIV0 is the software trap used to signal the same event.

This makes 32 bit kernels able to run sparc code with the v7 multiply/
divide library, as well as with the v8 one.
 1.9 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.8 23-Aug-2002  thorpej CPU_ISSUN4OR4C -> CPU_ISSUN4 || CPU_ISSUN4C
 1.7 20-Nov-2001  lukem branches: 1.7.8;
- 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.6 16-Sep-2001  wiz branches: 1.6.4;
Spell 'occurred' with two 'r's.
 1.5 30-May-2001  lukem branches: 1.5.2; 1.5.4;
add missing #include "opt_kgdb.h"
 1.4 29-Jun-2000  mrg branches: 1.4.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 05-Sep-1998  eeh branches: 1.3.12;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.3.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.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.5.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.4.4 27-Aug-2002  nathanw Catch up to -current.
 1.6.4.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.6.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.6.4.1 16-Sep-2001  nathanw file kgdb_stub.c was added on branch nathanw_sa on 2002-01-08 00:28:01 +0000
 1.7.8.1 31-Aug-2002  gehenna catch up with -current.
 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.15.16.2 30-Dec-2006  yamt sync with head.
 1.15.16.1 21-Jun-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.16.2.1 18-Feb-2006  yamt sync with head.
 1.17.16.1 22-Oct-2006  yamt sync with head
 1.17.14.1 18-Nov-2006  ad Sync with head.
 1.8 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.7 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.6 29-Aug-2016  martin The target of the OLO10 relocation is the simd13 field of the instruction,
so use a 13 bit target mask.
Fixes PR kern/51436 (I broke this myself in rev 1.4)
 1.5 01-Feb-2014  nakayama branches: 1.5.4; 1.5.6; 1.5.8; 1.5.12;
Follow rev. 1.54, 1.55 of libexec/ld.elf_so/arch/sparc64/mdreloc.c.
 1.4 02-May-2010  martin branches: 1.4.8; 1.4.14; 1.4.18; 1.4.20; 1.4.22; 1.4.28;
Fix R_SPARC_OLO10 relocations.
XXX this whole code does not look like it would have a chance to work on
32bit kernels, but I can't test right now.
 1.3 20-May-2009  jnemeth branches: 1.3.2; 1.3.4;
keep up with changes subr_kobj.c
 1.2 28-Apr-2008  martin 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;
Linker bits for sparc64.
XXX Does not handle 32-bit kernels.
 1.1.18.3 11-Aug-2010  yamt sync with head.
 1.1.18.2 20-Jun-2009  yamt sync with head
 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:07 +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:33 +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:49:07 +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:28 +0000
 1.3.4.1 30-May-2010  rmind sync with head
 1.3.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.4.28.1 24-Sep-2016  bouyer Pull up following revision(s) (requested by martin in ticket #1405):
sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.5
sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6
Follow rev. 1.54, 1.55 of libexec/ld.elf_so/arch/sparc64/mdreloc.c.
The target of the OLO10 relocation is the simd13 field of the instruction,
so use a 13 bit target mask.
Fixes PR kern/51436 (I broke this myself in rev 1.4)
 1.4.22.1 18-May-2014  rmind sync with head
 1.4.20.1 24-Sep-2016  bouyer Pull up following revision(s) (requested by martin in ticket #1405):
sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.5
sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6
Follow rev. 1.54, 1.55 of libexec/ld.elf_so/arch/sparc64/mdreloc.c.
The target of the OLO10 relocation is the simd13 field of the instruction,
so use a 13 bit target mask.
Fixes PR kern/51436 (I broke this myself in rev 1.4)
 1.4.18.2 03-Dec-2017  jdolecek update from HEAD
 1.4.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.14.1 24-Sep-2016  bouyer Pull up following revision(s) (requested by martin in ticket #1405):
sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.5
sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6
Follow rev. 1.54, 1.55 of libexec/ld.elf_so/arch/sparc64/mdreloc.c.
The target of the OLO10 relocation is the simd13 field of the instruction,
so use a 13 bit target mask.
Fixes PR kern/51436 (I broke this myself in rev 1.4)
 1.4.8.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.12.1 18-Jan-2017  skrll Sync with netbsd-5
 1.5.8.1 10-Sep-2016  snj Pull up following revision(s) (requested by martin in ticket #1248):
sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6
The target of the OLO10 relocation is the simd13 field of the instruction,
so use a 13 bit target mask.
Fixes PR kern/51436 (I broke this myself in rev 1.4)
 1.5.6.1 05-Oct-2016  skrll Sync with HEAD
 1.5.4.1 10-Sep-2016  snj Pull up following revision(s) (requested by martin in ticket #1248):
sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6
The target of the OLO10 relocation is the simd13 field of the instruction,
so use a 13 bit target mask.
Fixes PR kern/51436 (I broke this myself in rev 1.4)
 1.13 20-Feb-2023  riastradh sparc64: Rename internal barrier macros to be clearer.

No functional change intended.
 1.12 20-Feb-2023  riastradh sparc64: Add missing LoadStore ordering for mutex_enter stub.

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.11 06-Apr-2022  riastradh branches: 1.11.4;
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.10 25-Aug-2021  thorpej G/C _lock_cas(); it is no longer needed (kern_mutex.c uses atomic_cas_ulong()
with appropriate memory barriers).
 1.9 28-Apr-2013  nakayama branches: 1.9.40;
Use macros in machine/asm.h instead of locally defined, and
introduce CASPTRA for casxa/casa.
 1.8 25-May-2008  chs branches: 1.8.32; 1.8.42;
enable profiling of assembly functions.
 1.7 28-Apr-2008  martin branches: 1.7.2;
Remove clause 3 and 4 from TNF licenses
 1.6 21-Feb-2007  martin branches: 1.6.42; 1.6.44; 1.6.46;
Minor cosmetic changes and optimizations.
 1.5 21-Feb-2007  martin Get rid of unused (thus always zero) "curlwp" variable hidden in assembler
code (C code always uses a cpuinfo based macro).
 1.4 21-Feb-2007  martin Fix CAS success check
 1.3 20-Feb-2007  martin Minor optimizations and cosmetics, thanks to uwe for suggestions
 1.2 09-Feb-2007  ad branches: 1.2.2;
Merge newlock2 to head.
 1.1 19-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 11-Jan-2007  ad Checkpoint work in progress.
 1.1.36.1 29-Dec-2006  ad Checkpoint work in progress.
 1.1.18.1 26-Feb-2007  yamt sync with head.
 1.1.2.2 22-Mar-2002  thorpej Handle MUTEX_DEBUG.
 1.1.2.1 19-Mar-2002  thorpej First draft of mutex and rwlock implementation for sparc64.
 1.2.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.6.46.2 04-May-2009  yamt sync with head.
 1.6.46.1 16-May-2008  yamt sync with head.
 1.6.44.2 04-Jun-2008  yamt sync with head
 1.6.44.1 18-May-2008  yamt sync with head.
 1.6.42.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.8.42.1 23-Jun-2013  tls resync from head
 1.8.32.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.40.1 02-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #1891):

sys/arch/sparc64/sparc64/lock_stubs.s: revision 1.12

sparc64: Add missing LoadStore ordering for mutex_enter stub.
 1.11.4.1 20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #874):

sys/arch/sparc64/sparc64/lock_stubs.s: revision 1.12

sparc64: Add missing LoadStore ordering for mutex_enter stub.
 1.438 04-Nov-2025  palle sun4v: pcbspill should handle scenarios where %otherwin > 1

Now the pcbspill and pcbspill_other functions are basically the same and
could be merged into one common function at some point in time.

With this commit we get a bit further, but still has issues with incorrect
contents in registers upon returning to user space from time to time.
 1.437 04-Nov-2025  palle Add missing comment termination
 1.436 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.435 29-Apr-2025  martin branches: 1.435.2;
PR 59307: fix longjmp(9) for sparc64 too (there is only a single arg,
return value from setjmp is always 1).
 1.434 17-Feb-2024  palle branches: 1.434.2;
Ensure that the size of the stack is properly specified (2*USPACE) so it matches the allocation of stack pages done in pmap_bootstrap(). If this is not properly in sync, then the stack pointer may end up in the redzone right before the stack causing mmu faults. This issue has been observed on a T2000 (sun4v) system while probing the devices (pci/ebus/com) during bootstrap
 1.433 01-Mar-2023  riastradh sparc64: Optimization: Omit needless membar when triggering softint.

When we are triggering a softint, it can't already hold any mutexes.
So any path to mutex_exit(mtx) must go via mutex_enter(mtx), which is
always done with atomic r/m/w, and we need not issue any explicit
barrier between ci->ci_curlwp = softlwp and a potential load of
mtx->mtx_owner in mutex_exit.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.432 23-Feb-2023  riastradh sparc64: Add missing barriers in cpu_switchto.

Details in comments.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.431 05-Jul-2022  andvar branches: 1.431.4;
fix various typos in comments.
 1.430 27-Jun-2022  andvar fix various typos in comments.
 1.429 22-May-2022  andvar fix various small typos, mainly in comments.
 1.428 16-May-2022  mrg try to handle ultrasparc III* "fast ecc error" traps.

i had a sunblade 2500 reset with this trap recently, and the
manual says it should have been recoverable. in particular,
the US IIIv2 manual says in section 12.4.4.2 that the i-cache
won't see this data ever (so nothing needed there), and that
the d-cache needs to be disabled, and all the entries flushed,
and then re-enabled.

tested with a "trap 0x70" from kernel space, that trap.c
converted the "0x170" back to "0x70" (with an ADVANCE). this
code not commited.
 1.427 03-Apr-2021  palle Improve cpu_idle() by allowing a platform specific implementaion (same logic as the sparc implementation) - currently only used by sun4v
 1.426 30-Mar-2021  palle sun4v: handle spill trap properly when trap level is 1 and otherwin is non-zero - ensure that all windows are spilled to the pcb like the sun4u winfixsave code path
 1.425 22-Feb-2021  palle branches: 1.425.2;
sun4v: handle spill normal user traps properly when current trap level is 1 - registers are spilled to the PA of the stack to avoid further mmu-related traps, since sun4v only has 2 trap levels
 1.424 20-Dec-2020  palle sun4v: add comment in sun4v_tl1_ptbl_miss code path - no functional change
 1.423 08-Jan-2020  skrll branches: 1.423.6;
oldlwp is always non-NULL in cpu_switchto so remove the test for NULL.
 1.422 08-Jan-2020  ad Hopefully fix some problems seen with MP support on non-x86, in particular
where curcpu() is defined as curlwp->l_cpu:

- mi_switch(): undo the ~2007ish optimisation to unlock curlwp before
calling cpu_switchto(). It's not safe to let other actors mess with the
LWP (in particular l->l_cpu) while it's still context switching. This
removes l->l_ctxswtch.

- Move the LP_RUNNING flag into l->l_flag and rename to LW_RUNNING since
it's now covered by the LWP's lock.

- Ditch lwp_exit_switchaway() and just call mi_switch() instead. Everything
is in cache anyway so it wasn't buying much by trying to avoid saving old
state. This means cpu_switchto() will never be called with prevlwp ==
NULL.

- Remove some KERNEL_LOCK handling which hasn't been needed for years.
 1.421 18-Jul-2019  palle branches: 1.421.2; 1.421.4;
sun4v: added some missing comments to the code in pcbspill
 1.420 07-Apr-2019  mrg make trap 0x70 a TRAP() not UTRAP(). we should be able to handle
fast ECC error as a normal trap, and i saw this once a few years
ago but it never repeated so i haven't been able to test this.
 1.419 08-Feb-2019  palle sun4v: Improve comment for next_stick_init() - no functional changes
 1.418 08-Feb-2019  palle sun4v: initialize %stickcmpr properly when establishing interrupt - fixes issue seen on newer sun4v/SPARC-T5 system where the interrupt never fires.
 1.417 08-Feb-2019  palle sun4v: introduce macros for handling spill traps from userlevevel @ traplevel 1 (from OpenBSD) - spill traps at level 1 from userspace now works better
 1.416 08-Feb-2019  palle sun4v: add comment documenting the contents of the %g2 register - no functional changes
 1.415 04-Nov-2018  palle Ensure that the 64-bit condition codes are used instead of the 32-bit condition codes. ok martin@
 1.414 26-May-2018  palle branches: 1.414.2;
next_stick() - fix typy in comment: tick->stick
 1.413 11-Apr-2018  palle sun4v: handle MMU-related traps properly when they occur at trap level 1. This fixes issues when user-level LWPs access the user-level stack
 1.412 26-Aug-2017  palle branches: 1.412.2;
sun4v: Avoid touching the %tick_cmpr register which is not present on never systems (Oracle SPARC Architecture 2011 and beyond). Based on code from OpenBSD locore.s revision 1.177. Tested on both sun4u (qemu and USIII) and sun4v (qemu and T5-2). ok martin@
 1.411 06-May-2017  palle branches: 1.411.2;
sun4v: The %ver register is not available on sun4v - use GET_MAXCWP introduced in rev. 1.361. Verified using qemu (sun4u and sun4v) and on real sun4v hw (t2000)
 1.410 18-Apr-2017  palle branches: 1.410.2;
sun4v: Add handling of trap 0x06c @ trap level 1 - based on code from OpenBSD, but slightly adapted to NetBSD. verified using qemu
 1.409 19-Feb-2017  palle sun4v: rft_user needs special handling (a manual fill) since the restore instruction may cause the number of trap levels to exceed the maximum for sun4v - inspired by code from the the openbsd rft_user code path - verified using qemu for both sun4u and sun4v
 1.408 10-Feb-2017  palle sun4v: Added handling of trap type 0x034 (address alignment error) + fixed typo mmfsa -> mmufsa. Verified for both sun4u and sun4v using qemu.
 1.407 30-Jan-2017  palle sun4v: Hook up syscall handling to the trap table. Verified using qemu for both sun4u and sun4v.
 1.406 27-Jan-2017  palle sun4v: implement missing handling of itsb traps 0x008 and 0x009. Based on code from OpenBSD. Tested using qemu.
 1.405 07-Jan-2017  palle branches: 1.405.2;
sun4v: slowtrap() now selects normal globals properly on both sun4u and sun4v platforms. Verified using qemu for both sun4u and sun4v systems
 1.404 05-Jan-2017  palle sun4v: TRAP_SETUP() updated to set mmu context id properly for both sun4v and sun4u platforms. Verified using qemu for both sun4u and sun4v systems
 1.403 04-Jan-2017  palle sun4v: make debugging kernel bringup a bit easier by using the slowtrap code path for currently unhandled trap level 1 trap entries 0x00-0x23 and 0x28-0x30
 1.402 29-Dec-2016  palle sun4v: make debugging kernel bringup a bit easier by using the slowtrap code path for currently unhandled trap level 1 trap entries 0x32-0x7f
 1.401 20-Sep-2016  nakayama Fix RAS for 32-bit kernels. trapframe is always 64-bit.
 1.400 23-Aug-2016  palle sun4v: rework sun4v_datatrap so it works properly when running on a T2-based system like T5120 - for some reason %tl is 0 when entering sun4v_datatrap causing a crash (sir instruction), so ignore the %tl value for now upon entry to sun4v_datatrap - with this fix both T1 and T2 based systems reach the same point - hangs in rft_user after the init process is started
 1.399 18-Jul-2016  palle sun4v: handle device interrupts properly - both legacy (sysino) and cookies
 1.398 04-Jun-2016  palle branches: 1.398.2;
sun4v: rtf_user now uses macros GET_MMU_CONTEXTID and SET_MMU_CONTEXTID. Tested on sun4u (QEMU) and sun4v (T2000). Parts from OpenBSD.
 1.397 18-May-2016  nakayama Decrement %tl in trap handler not to make it zero unconditionally
for the nested trap, and remove useless mov.
 1.396 17-May-2016  palle sun4v: Implement missng MMU protection trap handling - mostly from OpenBSD
 1.395 16-May-2016  palle Avoid assembler-specific defines by using the export keyword in genassym.cf instead
 1.394 15-May-2016  nakayama %g1 is not preserved across function call, so load it before
return_from_trap.
 1.393 13-May-2016  palle sun4v: add missing implementation of sun4v_datatrap_tl0 so data_access_fault() is called - mostly from OpenBSD
 1.392 13-May-2016  nakayama - ci_paddr is always 64-bit.
- intrlev is array of pointer.
- ih_ack is pointer.
 1.391 10-May-2016  palle sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.390 09-Mar-2016  nakayama 32-bit kernels use 32-bit stack.
 1.389 03-Mar-2016  palle sun4v: rft_kernel should pay attention to the number of register windows that can be restored. We cannot rely on fill traps to occur, since sun4v only has two trap levels available in privileged mode. Based on code from OpenBSD. ok martin@
 1.388 14-Feb-2016  palle sun4v: add breakpoint trap entry to the sun4v trap table
 1.387 03-Feb-2016  palle sun4v: extend dmmu_set_secondary_context() to handle both sun4u and sun4v. ok martin@
 1.386 06-Nov-2015  martin Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:

Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.

which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.

Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
 1.385 05-Nov-2015  martin Most of the time return_from_trap already got called with tf->tf_tstate
loaded in register %g1 - make it so for two more callers and remove
the reload of that value.
 1.384 05-Apr-2015  palle sun4v: Ensure that the TTEs CP and CV bits are the same (both set) for the primary cpu and secondary cpus INTSTACK mappings
 1.383 01-Apr-2015  palle sun4v: Implement handling of cpu_mondo trap - from OpenBSD - tested using the Legion simulator
 1.382 04-Mar-2015  palle sun4v: revert some of the logic introduced in revision 1.378 - flushw is not necessary on sun4v (OpenBSD patches the flushw instruction to a nop instruction) - with these changes the kernel reaches cpu_boot_secondary_processors() when running in the Legion simulator (crashes due to missing handling of cpu_mondo_trap)
 1.381 02-Mar-2015  nakayama prom_printf converts "\n" to "\r\n" internally, so omit "\r".
 1.380 02-Mar-2015  nakayama PANICSTACK is a pointer itself, not a pointer to pointer.
 1.379 02-Mar-2015  nakayama Use panic stack temporarily for calling prom_printf in a trap
handler.

It seems that openfirmware cannot handle over 4GB pointers, and
stack pointers may point to over 4GB since VA layout was rearranged
by rev 1.33 of vmparam.h. Therefore, use panic stack to avoid
panicking in OF_write used by prom_printf.
 1.378 23-Feb-2015  palle sun4v: sparc_interupt - ensure that the trap level and globals level are the same when the flushw instruction is issued - othwise warnings occur when using the sun4v Legion simulator.
 1.377 26-Oct-2014  palle branches: 1.377.2;
sun4v: Create CLEANWIN0 and CLEANWIN1 macros for handling clean window traps on both sun4u and sun4u (based on the original code inlined in the sun4u trap table). Update trap tables accordingly for both sun4u and sun4v. Ok martin@
 1.376 24-Oct-2014  nakayama Fix typo in comment.
 1.375 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.374 15-Oct-2014  palle sun4v: fixed bug causing the real address to be incorrectly calculated as zero
 1.373 24-Sep-2014  palle sun4v: add code to enable startup of secondary cpus on both sun4u and sun4v systems - ok martin@
 1.372 04-Sep-2014  palle sun4v: All cpus must be setup with a TSB descriptor, so pmap_setup_tsb_sun4v() must take a pointer to the TSB descriptor
 1.371 31-Aug-2014  palle sun4v: Split the NORMAL_GLOBALS and ALTERNATE_GLOBALS macros to _SUN4U and _SUN4V variants. Rework the return_from_trap logic to use the new variants so it is possible to use a global register as scratch register.
 1.370 14-Aug-2014  nakayama Add missing delay slot in DEBUG kernel.
 1.369 30-Jul-2014  palle branches: 1.369.2;
Fix ALTERNATE_GLOBALS so it at least works on sun4u - using a scratch register is not a good idea...
 1.368 27-Jul-2014  palle sun4v: Introduce a new macro ALTERNATE_GLOBALS (matching NORMAL_GLOBALS). Two new helper macros ENABLE_INTERRUPTS and DISABLE_INTERRUPTS are also created. With these changes the GENERIC.UP kernel will reach rootmount on sun4v systems - ok martin@
 1.367 26-Jul-2014  palle Improved the NORMAL_GLOBALS macro in the sun4u case, so only the relevant bit (AG) in %pstate is affected - ok martin@
 1.366 24-Jul-2014  palle sun4v: add missing spill/fill handling for trap level 1 + cosmetic changes to comments for trap level 0 entries
 1.365 19-Jul-2014  palle sun4v: Introduce a NORMAL_GLOBALS macro - first used in sparc_interrupt - other relevant uses will be handled as the sun4v work is progressesing - ok martin@
 1.364 16-Jul-2014  palle sun4v: Introduce SET_MMU_CONTEXTID macro for setting the mmu context id on both sun4u and sun4v
 1.363 13-Jul-2014  palle sun4v: add interrupt handling to sun4v trap table
 1.362 13-Jul-2014  palle Bugfix: add missing cmp instruction to GET_MAXCWP macro
 1.361 30-Jun-2014  palle sun4v: The maximum number of register windows is a constant and thus not available via the %ver register (sun4u only). Introduce a macro GET_MAXCWP that handles this, so cpu_switchto() works properly on sun4v. Other relevant reference to %ver can be adapted to use GET_MAXCWP as the sun4v port progresses. OK martin@
 1.360 31-May-2014  palle sun4v: added missing dtsb miss handling for trap level 1 - with this update the kernel now reaches configure() on sun4v systems
 1.359 30-May-2014  palle Remove debugging code introduced by accident in locore.s revision 1.357
 1.358 05-May-2014  palle sun4v: the trap base address should be assigned to %l1 so %tba is properly setup later in the code - now the kernel gets as far as printing the copyright disclaimer, kernel version and total and available memory before crashing
 1.357 21-Apr-2014  palle sun4v: Update comment: modified -> access
 1.356 21-Feb-2014  palle branches: 1.356.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.355 31-Jan-2014  tsutsui defined(LKM) -> defined(MODULAR)
 1.354 26-Jan-2014  palle sun4v: Add handling of spill/fill and dtsb miss traps (with a XXX to be handled later)
 1.353 07-Jan-2014  palle sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
 1.352 29-Dec-2013  nakayama Make buildable w/o options SUN4V.
 1.351 27-Dec-2013  palle a) make the hunt through the cpus list more generic b) sun4v: ensure that the interrupt stack is mapped permanently and the TSB is setup properly - parts from OpenBSD. OK martin@
 1.350 06-Dec-2013  nakayama Increase an interrupt depth only in the case of hardware interrupts,
and remove the ci_idepth trick in softint_fastintr.

Fixes the following diagnostic panic reported in port-sparc64.

panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file
"../../../../kern/subr_xcall.c", line 351
 1.349 24-May-2013  nakayama branches: 1.349.2;
Disable interrupts after calling data_access_error as with
data_access_fault.
 1.348 28-Apr-2013  nakayama Use macros in machine/asm.h instead of locally defined, and
introduce CASPTRA for casxa/casa.
 1.347 23-Jan-2013  martin Fix sparc64_ipi_ccall by adding proper trap setup.
Fixes xcall(9) problems, as exposed by pserialize(9). Noticed by
J. Hannken-Illjes, cause pointed out by Takeshi Nakayama.
 1.346 23-Jan-2013  martin Sligthly clean up the (by default unused) #ifdef TRAPS_USE_IG
 1.345 10-Nov-2012  nakayama Revise comment.
 1.344 10-Nov-2012  nakayama Use macro instead of magic number.
 1.343 09-Nov-2012  nakayama Make setstick() and getstick() to inline functions.
 1.342 08-Nov-2012  macallan use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.341 17-Mar-2012  mrg branches: 1.341.2;
port the corrected ECC error handling code from freebsd. i noticed my U10
took one of these and then hang. it shouldn't hang, there's a 'sir' here that
doesn't seem to reset properly. oh well.

tested by simulated a trap via 'ta 0x10' and considering that the same, but
it hasn't been tested against a real ECC error yet.
 1.340 03-Mar-2012  nakayama Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".

gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).

Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
 1.339 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.338 04-Sep-2011  nakayama branches: 1.338.2; 1.338.6; 1.338.8;
ih_pil is an interrupt level, not an interrupt mask.
 1.337 27-Jul-2011  nakayama ivec is assigned to hardware, so count its event counter up in
interrupt_vector, not in softint, and do some optimization.
 1.336 20-Jul-2011  macallan add per ivec event counters
 1.335 12-Jul-2011  mrg rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.334 18-Jun-2011  nakayama Add fast softint(9) support for sparc64.

Reviewed on port-sparc64.
 1.333 12-May-2011  mrg branches: 1.333.2;
first steps towards fujitsu SPARC64 support:

- SPARC64 systems have interrupts with upto 14 bits set, but we only look
at the first 11 bits. trim non IPI interrupts to 11 bits
 1.332 20-Dec-2010  matt branches: 1.332.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.331 10-Jul-2010  nakayama Clear the upper word explicitly before combining two 32-bit values to 64-bit
on 32-bit kernels.
 1.330 23-May-2010  martin Split copy related functions out of locore.s into copy.S, move functions
only needed on multiprocessors into mp_subr.S.
 1.329 17-May-2010  martin Simplify primary CPU startup slightly by using the fact that our cpuinfo's
curpcb pointer points to the uarea/pcb of lwp0 and by remembering the pointer
to this cpuinfo, thus avoiding a few CPUINFO_VA references.
 1.328 20-Mar-2010  chs fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.327 10-Mar-2010  mrg branches: 1.327.2;
XXX: workaround we'd like to remove when pmap / uvm locking is cleaned up:

- rename pseg_get() and pseg_set() to pseg_get_real() and pseg_set_real().
- if USE_LOCKSAFE_PSEG_GETSET is defined, which it current is by default,
define pseg_[gs]et() in terms of functions that take a new pseg_lock
mutex at IPL_VM while calling into the real functions.

this seems to avoid the pseg_set() crashes we've seen:
1 - spare needed, when pseg_get() just worked for this pmap
2 - the 2rd ldxa via ASI_PHYS_CACHED in pseg_set() loads garbage
into %o4, and causes the 3rd ldxa to fault
 1.326 08-Mar-2010  mrg blast_dcache() SMP friendly:

- blast_dcache() becomes sp_blast_dcache(dcache_size, dcache_line_size)
- new smp_blast_dcache(sparc64_cpuset_t) that blasts the D$ on this cpuset
- sparc64_ipi_blast_dcache() to support the above
- in pmap_remove_all(), when freeing mmu contexts for this pmap, mark
the set of cpus to blast the d$ on as well and convert the
blast_dcache() call into smp_blast_dcache() on the cpus who ran this
pmap, or, sp_blast_dcache(dcache_size, dcache_line_size)
- convert the remaining blast_dcache() in machdep.c to sp_blast_dcache()
- in pmap_destroy()/pmap_remove_all() take the pmap_lock() always since
we assert it is held always.

with these changes, NFS builds on the U60 seem to be stable now, and
the USIII machines also can often complete a single build.sh run now,
diskful or diskless.


reviewed by mlelstv and partially by martin, tested by martin and myself,
with some ideas from chuq as well.
 1.325 07-Mar-2010  mrg need _ALIGN in locore.h as well, for DEBUG kernels.
 1.324 07-Mar-2010  mrg gas has supported SPARC ".empty" for a long while; get rid of an
ancient workaround.
 1.323 06-Mar-2010  mrg move the memcpy/memset implementations out into their own file, with the
block copy versions as well. move some of the definitions in locore.s
into a new locore.h.

locore.s is almost 2000 lines shorter with this change.
 1.322 04-Mar-2010  mrg - in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.
 1.321 24-Feb-2010  mrg when handing back page table pages to UVM, flush them from the dcache
on all CPUs.

idea from skrll@, and makes my disk-based SB2000 stable.

tested on U60, SB2000 and SB2500.
 1.320 24-Feb-2010  mrg - re-introduce sp_tlb_flush_pte() and sp_tlb_flush_all() that call
the right USI/USIII version.
- define tlb_flush_pte() in terms of sp_tlb_flush_pte() for the
!MULTIPROCESSOR case

this centralises some CPU_IS_USIII_UP() tests.
 1.319 22-Feb-2010  mrg move {dump,print}_[id]tlb() into a separate file.
 1.318 22-Feb-2010  mrg - store the maximum [id]cache size / line size for each cpu

- remove patch_kernel() since it isn't necessary and has been patching
the wrong thing in general.

- implement USIII versions of blast_icache(), dcache_flush_page() and
cache_flush_phys(). use the newly recorded cache size/line sizes.

- in winfixsave, flush the D$ with the right size index and ops. this
kills one of the wrong tag->inval patches.

- for blast_dcache(), use the newly recorded dcache_size/line_size.

- for blast_icache(), use the newly recorded cache size/line sizes.
for the USIII verison, disable the I$ while writing to ASI_ICACHE_TAG.


these changes removed several hard coded cache sizes values, some very
wrong kernel patching, and seem to make the current failure modes for
USIII less common, but not gone.
 1.317 15-Feb-2010  mrg - don't flush 32-bit entries for 64-bit code, it does not seem to be
necessary. #define TLB_FLUSH_LOWVA to turn it back on.
- remove the #if 0'd code in sparc64_ipi_flush_pte_usiii(), i have
verified that it is not required.
- add a missing membar #Sync to sp_tlb_flush_pte_usiii().
 1.316 15-Feb-2010  nakayama Fix linker error of GENERIC32 kernel.
 1.315 15-Feb-2010  mrg use TLB_SIZE_SPITFIRE in a couple of places, and note that the
{print,dump}_[id]tlb() versions are currently spitfire specific.
 1.314 15-Feb-2010  mrg introduce a new patch_kernel() and call it from the end of bootstrap().
use it to patch up TLB flush instructions that don't match for USI/II
and later. we can also hopefully use this to make GENERIC.MP minimally
expensive on single CPU machines as well.

this is the last piece needed to get GENERIC/GENERIC.MP to boot on the
USIII* machines.

idea and some initial code from openbsd.
 1.313 13-Feb-2010  mrg remove KTR support. it's never been a working part of netbsd src tree.
 1.312 09-Feb-2010  wiz Fix typo in comment.
 1.311 06-Feb-2010  mrg branches: 1.311.2;
- properly map the schizo interrupt registers, so we can use the normal
virtual mappings to access them.
- with the above fxied, kill SCHIZO_BUS_SPACE_BROKEN, and introduce
an options CHEETAH for now, that disables the SPITFIRE code in locore.
- merge schizo_init() into schizo_attach() and clean up the softc a bit.


with this we are only one more step away from GENERIC booting on USIII
machines.
 1.310 02-Feb-2010  mrg - split sp_tlb_flush_pte() and switchtoctx() into sp_tlb_flush_pte_us()/
sp_tlb_flush_pte_usiii() and switchtoctx_us()/switchtoctx_usiii() and
implement the latter while i'm here. it works ... sometimes i think,
but also sometimes panics/hangs.
- fix a comment in sparc64_ipi_flush_pte_usiii()
 1.309 02-Feb-2010  mrg for now, reduce a few #ifdef SPITFIRE cases by introducing a new
ASI_DCACHE_TAG_OR_INV that is either ASI_DCACHE_{TAG,_INVALIDATE}.

increase the common code in cache_flush_phys().
 1.308 01-Feb-2010  mrg - sp_tlb_flush_all() becomes sp_tlb_flush_all_us() and sp_tlb_flush_all_usiii()
- sparc64_ipi_flush_pte() becomes sparc64_ipi_flush_pte_us() and
sparc64_ipi_flush_pte_usiii()
- add some commented out code to disable interrupts and raise the traplevel
in sparc64_ipi_flush_pte_usiii()
- cache_flush_phys() was missing a little of code in the cheetah case
 1.307 01-Feb-2010  mrg for USIII, use the new "tlb demap all" operation in sp_tlb_flush_all()
 1.306 01-Feb-2010  mrg remove unused icache_flush_page() implementation.
 1.305 23-Jan-2010  mrg remove the final uses of DATA_START.

now we can remove the 16KB space reserved at the start of the data segment,
and i now understand why i wrote this now removed comment 3.5 years ago:
"this shouldn't be needed... but kernel usually hangs without it"
 1.304 23-Jan-2010  mrg remove most of the code that writes debugging info DATA_START + offset.
 1.303 23-Jan-2010  mrg remove CHKPT() macro and uses. it's likely wrong in SMP land and probably should
be replaced with KTR-style uses if necessary.
 1.302 23-Jan-2010  mrg fix a comment.
 1.301 10-Dec-2009  rmind Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.300 05-Dec-2009  mrg - adjust the PA mask to the 43 bits supported by USIII.
- rework the spitfire/cheetah cache_flush_phys() to avoid several #ifdefs
- add a membar #Sync after sparc64_ipi_drop_fpstate (probably unnecessary)
 1.299 30-Nov-2009  nakayama sp_tlb_flush_pte for cheetah:
- restore interrupts properly in case of %tl > 0.
 1.298 30-Nov-2009  mrg stablize UP USIII support by blocking interrupts around sp_tlb_flush_pte()
i was seeing stack corruption while taking an interrupt in this function.

get USIII SMP mostly working by implementing the cheetah version of
sparc64_ipi_flush_pte().


SMP support is still not entirely stable. i can reproducably get a:

panic: fpusave_lwp ipi didn't

while running build.sh, when an awk process is exiting. other simple
heavy work loads do not crash for me right now.
 1.297 30-Nov-2009  mrg delete some no longer used code:
- smp_tlb_flush_ctx()
- smp_tlb_flush_all()
- sparc64_ipi_flush_ctx()
- sparc64_ipi_flush_all()
- sp_tlb_flush_ctx()
 1.296 29-Nov-2009  nakayama - calculate end PA correctly.
- wrap more spitfire specific (flushing I$) code.
- fix inverted #if condition for flushing I$ (and restore ASI_ICACHE_TAG).
 1.295 28-Nov-2009  mrg implement enough code to get SB2000/SB2500 booting to multiuser. does
not last long if you use it, but an idle machine has stayed up 10 hours.

- for the !SPITFIRE case, use ASI_DCACHE_INVALIDATE instead of
ASI_DCACHE_TAG when clearing tlb entries. from openbsd.

- convert some comment "! Not yet" into "WRITEME", so that attempting
to build a USIII MULTIPROCESSOR kernel fails to build until the code
is written.

- add some more WRITEME's for the above.

- implement a !SPITFIRE version of sp_tlb_flush_all(). since there are
no spare regs, for now just always increase %tl around this call. (we
could maybe store a token in %o3 along with the saved %pstate info.)
 1.294 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.293 25-Nov-2009  mrg s/L_ADDR/L_PCB/, requested by rmind.
 1.292 17-Oct-2009  nakayama Wrap unused code with #if 0 which is called from #if 0'ed code.
 1.291 30-May-2009  martin cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.290 18-May-2009  nakayama Remove random() from locore.s since it is in libkern.
 1.289 16-May-2009  nakayama Remove clear %tick in locore.s since it is cleared at cpu_initclocks() in
clock.c.
 1.288 15-Dec-2008  mrg restore some old "intrdebug" code, but leave it under NOT_DEBUG. most
of it works, but one that prints func/arg for each handler is not very
stable...

for now, while schizo bus space pointer accesses aren't working, add
a SCHIZO_BUS_SPACE_BROKEN option so you can build a kernel with schizo.

with this, and the prior schizo interrupt fix, you can now fail to run
/sbin/init!
 1.287 09-Dec-2008  martin Get rid of get_maxctx() - it doesn't work on newer cpus and we will have
to find a better way for (some) sun4v machines - all sun4u use 13 bit
contexts anyway.
 1.286 30-Oct-2008  nakayama branches: 1.286.2; 1.286.6;
Wrap more code specific to USE_BLOCK_STORE_LOAD.
 1.285 05-Oct-2008  nakayama branches: 1.285.2;
- in flushing cache, use 32 as increment/decrement value to match the
cache line size.
- remove useless restore of %asi.
- remove nop in delay slot if we can.
 1.284 10-Jul-2008  nakayama Use proper CCR.
 1.283 10-Jul-2008  nakayama sparc64_ipi_save_fpstate:
- use primary MMU context for consistency with other trap/interrupt handlers.

sparc64_ipi_save_fpstate, savefpstate:
- avoid storing fp registers as we can.

sparc64_ipi_save_fpstate, savefpstate, loadfpstate:
- remove unaligned case since buffers allocated with pool_cache are ensured
64-byte aligned.

Ok by martin@.
 1.282 02-Jul-2008  nakayama branches: 1.282.2;
UltraSPARCs don't have floating point queue, and reading %fq regsiter
will cause illegal instruction trap. So remove the code handling them.
 1.281 29-Jun-2008  nakayama Wrap IPI calls with #ifdef MULTIPROCESSOR.
 1.280 14-Jun-2008  nakayama Close unterminated comment.
Fix unexpected behavior in case of loadfpstate from unaligned buffer.
 1.279 31-May-2008  nakayama branches: 1.279.2;
openfirmware_exit:
- disable interrupts with %pstate.
- prepare 64-bit stack and enable 64-bit addresses for 32-bit SMP kernels.
 1.278 16-Apr-2008  nakayama branches: 1.278.2; 1.278.4; 1.278.6;
Disable TRAPSTATS which was accidentally enabled when yamt-idlelwp branch
was merged.

Ok by martin@.
 1.277 14-Apr-2008  nakayama Remove sparc64_ipi_sync_tick.

Since we can use counter-timer as timecounter instead of %tick on SMP kernel,
it is not necessary to sync all CPUs %tick registers.
 1.276 14-Apr-2008  nakayama Add workaround for BB_ERRATA_1 on writing to TICK_CMPR register in
next_tick(). If writing to TICK_CMPR fails, we lose hardclock interrupt
on secondary CPUs.

About BB_ERRATA_1 from comment in OpenSolaris:

/*
* Writes to the TICK_COMPARE register sometimes fail on blackbird modules.
* The failure occurs only when the following instruction decodes to wr or
* wrpr. The workaround is to immediately follow writes to TICK_COMPARE
* with a read, thus stalling the pipe and keeping following instructions
* from causing data corruption. Aligning to a quadword will ensure these
* two instructions are not split due to i$ misses.
*/
 1.275 28-Mar-2008  nakayama Don't read fplwp content in delay slot for considering the case fplwp was
modifiled.

Reported by Chris Ross on port-sparc64.
 1.274 20-Mar-2008  nakayama - remove disabling interrupt in IPI.
- unused VA bits in MMU demap is 13 bits, not 12 bits.
 1.273 18-Mar-2008  nakayama Fix a race when increment an interrupt level event counter.
 1.272 17-Mar-2008  nakayama Fix a race condition in IPI handlers of save/drop fpstate, from OpenBSD.
Reported and tested by martin@.
 1.271 17-Mar-2008  nakayama Make schedintr interrupt handler per-CPU.
While there rename tickintr interrupt handler and share initialization
code with schedintr.
 1.270 14-Mar-2008  nakayama Improve IPI handling:
- make IPI takes two arguments.
- add IPI event counters per-CPU.
- implement IPI functions which were missing or broken.
- insert DELAY while halting primary CPU in IPI handler.
 1.269 02-Mar-2008  nakayama - make interrupt pending list per-CPU.
- make tickintr() MP-safe.
- remove unused port-sparc derived interrupt code.

Ok by martin@.
 1.268 02-Mar-2008  nakayama Don't get IPI handler argument (from bogus address), and ack IRQ twice.
 1.267 28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.266 26-Jan-2008  nakayama branches: 1.266.2; 1.266.6;
Fix for 32-bit kernels.
 1.265 15-Jan-2008  skrll Store a sensbile PCB_PC value in snapshot - the return point.

This helps gdb somewhat.

OK'd by martin.
 1.264 14-Jan-2008  martin Fix register name typo/copy&pasto - %g6 is not %o6/%sp.
From OpenBSD.
 1.263 06-Jan-2008  martin Load the next cpu_info pointer with LDPTR instead of ld.
 1.262 09-Dec-2007  martin branches: 1.262.2;
Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.
 1.261 22-Oct-2007  martin branches: 1.261.2; 1.261.4; 1.261.6;
Remove an unused .globl declaration
 1.260 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.259 09-Sep-2007  martin branches: 1.259.4;
Make cpufrequency and friends per cpu values.
Prepare a hz tick interrupt on secondary CPUs via %tick, but do not
enable it yet, as it breaks ddb.
 1.258 09-Sep-2007  martin Do not ACK IPIs before we finished loading all arguments.
 1.257 06-Sep-2007  martin Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.
 1.256 25-Aug-2007  martin branches: 1.256.2;
Remove INITSTACK completely - at the time we used to switch to it, we
already have access to all of lwp0 and it's uarea - so we can switch
to the correct lwp0 stack easily before calling main.
 1.255 25-Aug-2007  martin When exiting to OF, use the interrupt stack instead of INITSTACK
 1.254 25-Aug-2007  martin Rework cpu_mp_startup slightly:
- temporarily use the cpu's interrupt stack untill we are ready
to access non-OF-based mappings, then directly switch to the cpu's
idlelwp's uarea stack
- disable interrupts untill we are ready to call C code
 1.253 13-Aug-2007  macallan remove two restore without matching save
 1.252 06-Jul-2007  martin branches: 1.252.4; 1.252.8;
A few nits for 32bit SMP kernels, noticed by mrg.
While there, simplify the fpstate IPIs a bit.
 1.251 05-Jul-2007  martin sparc64_ipi_save_fpstate is not a leaf function - create a full grown
stack frame.
 1.250 28-May-2007  mrg clean up cpu_switchto() a little - no need to flushw or membar
excessively. optimise an rdpr. tested by tnn.
 1.249 23-May-2007  martin Fix a stupid bug in the save_fpstate ipi, which caused overwriting of
struct lwp of the lwp owning the fpu. Fix clearing the fplwp - %o0 will
not survive the call to savefpstate - duh!
 1.248 20-May-2007  martin Simplify tf_tstate setting when leaving for userland initially - I seem
to have confused the if with the else case of the previous C code.
Funny that it worked at all.
 1.247 20-May-2007  martin cpu_switchto() has to return it's first arg, always. This differs from
my reading of the documentation, but helps in the real world and seems
to be what other ports do.
 1.246 20-May-2007  martin Remove special case handling for userland lwps from cpu_lwp_fork, instead
do it in lwp_trampoline when we first return to userland.
 1.245 19-May-2007  martin cpu_idle is a leaf function, so we better "return from leaf".
Use return value from cpu_switchto for previous lwp in lwp_trampoline.
Also shamelessly steal a comment from uwe written for sparc that explains
all this.
Thanks to tnn, mrg, and uwe for helping to debug this.
 1.244 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.243 22-Feb-2007  martin branches: 1.243.4; 1.243.6; 1.243.12;
uvm.page_idle_zero now is a bool, not a 32bit value any more.
 1.242 21-Feb-2007  mrg shave 9 insns off the tsb setup in cpu_initialize & cpu_mp_startup.
 1.241 21-Feb-2007  martin Get rid of unused (thus always zero) "curlwp" variable hidden in assembler
code (C code always uses a cpuinfo based macro).
 1.240 18-Feb-2007  martin Make use of another call delay slot, pointed out by uwe.
 1.239 18-Feb-2007  martin Make use of a call delay slot and avoid a bogus EMPTY.
Spotted by Juergen Hannken-Illjes, with input from Andrew Doran and
Valeriy E. Ushakov.
 1.238 18-Feb-2007  martin Whitespace cosmetics
 1.237 18-Feb-2007  martin Backout previous: EMPTY was misused
 1.236 18-Feb-2007  martin Make EMPTY expand to nop with gas, as it is used to mark empty branch
delay slots.
 1.235 15-Feb-2007  martin branches: 1.235.2;
Fix obvious copy&pasto in SCHED_DEBUG register usage.
 1.234 09-Feb-2007  ad Merge newlock2 to head.
 1.233 25-Dec-2006  wiz Spell "relevant" correctly. From Zafer Aydogan.
 1.232 25-Oct-2006  mrg branches: 1.232.2; 1.232.4;
- note that __idle_u should go away but doing so breaks things
- fix several comments to reality
- clean up the #ifdef NO_VCACHE code slightly
- use call instead of set/jmpl
- remove a couple of unnecessary stores to curlwp
 1.231 18-Oct-2006  rjs Clean up some comments. Cosmetic change to use correct structure
offset names.

Optimize out two instructions from sparc64_ipi_save_fpstate and
sparc64_ipi_drop_fpstate.
 1.230 17-Oct-2006  mrg allocate 128KB (as opposed to 64KB) per-cpu, and place the interrupt
stack, cpu_info structure, panicstack, idle uarea and normal kernel
stack in here. the idle uarea and kernel stack are in the 2nd 64KB
page. the interrupt stack and cpu_info structure are as the same
place in the 1st 64KB page, and the panicstack grows down from the
top of this page. update comments in param.h to suit (XXX: a lot
of these constants should move to a header file that will not pollute
the name space so much.) map these pages identically between
cpu_initialise() and cpu_mp_startup(), and deal with the two 64KB
pages in pmap_extract(). keep an unmapped 64KB page between them.

don't initialise the unused "ci_eintstack" member of the cpu_info
structure

use constants to initialise many addresses in the cpu_info structure,
consolidating these assignments from cpu0 and cpu>0

delete u0/estack0/panicstack from locore.s

clean up some wrong comments in locore.s

fix a 32bit-only bug in cpu_mp_startup().

delete 'u0' entirely.


this fixes recent random lossage seen on port-sparc64: processes
stuck in RUN state, data faults, and hangs.
 1.229 04-Oct-2006  mrg use call instead of set/jmpl. add an entry point for idle that expects
sched_lock to be unlocked, and use this for non-boot cpu's. complete a
comment describing how registers in idle_switch are expected to be set.
 1.228 03-Oct-2006  mrg use the same SAVE_LOCALS_INS definition for 32 bit and 64 bit kernels.
refactor TRAP_SETUP() a little between these two versions to be more alike.
 1.227 03-Oct-2006  mrg use the correct size/type for MP variables (pointers and longs).

a 32 bit MULTIPROCESSOR kernel now builds (and crashes quickly.)
 1.226 03-Oct-2006  mrg in the 64bit version of SAVE_LOCAL_INS, s/BIAS/STKB/ to allow future
sharing of the 32 and 64 bit versions of the {TRAP,INTR}_SETUP macros.
 1.225 19-Sep-2006  mrg - remove some way old FP setup/teardown code
- put the block memcpy/memset inside #ifdef USE_BLOCK_STORE_LOAD which
is (now) defined.

no functional change, same .o is generated.
 1.224 19-Sep-2006  mrg re-order the changes in rev 1.217 to give registers a little bit of
time to settle between usage, like it was before hand.
 1.223 19-Sep-2006  mrg - remove a wrong comment.
- add a new entry point for idle called idle_switch that is called by
cpu_switch() in the MP case when sched_whichqs is zero, properly
setting up the idle stack. from petrov@ via martin@.
 1.222 19-Sep-2006  mrg rework interrupt_vector() slightly:
- for the IPI case, avoid loading the address of intrlev into %g3
- remove some NOT_DEBUG code
- load the interrupt argument #2 in the delay slot

this removes 2 nops during interrupt processing for the normal
case, and an additional 2 ALU instructions for IPIs
 1.221 18-Sep-2006  mrg - sparc64_ipi_halt(): we shouldn't return from sparc64_ipi_halt_thiscpu()
so replace a branch with a 'sir'
- in #if 0 code, in sparc64_ipi_flush_pte() and sparc64_ipi_flush_ctx()
save/restore the out registers that the sp_tlb_flush_xxx() versions
around calling them
- in sp_tlb_flush_pte() and sp_tlb_flush_ctx(), replace global register
usage with out registers so that we don't clobber the (alternate)
global registers when these are called from IPI context
 1.220 18-Sep-2006  mrg - remove an extra 'sir' that followed one in a macro
- add some named labels to some spill/fill handlers
- remove 2 unused strings
 1.219 18-Sep-2006  martin branches: 1.219.2;
Lazy FPU handling for the MULTIPROCESSOR case
 1.218 16-Sep-2006  nakayama From OpenBSD:
- reload %fprs for checking it again.
- use symbolic names for checking in %fprs.

revision 1.51
date: 2005/07/18 14:50:11; author: deraadt; state: Exp; lines: +2 -1
cache a copy of the fprs so we know what fp restore we should do after

revision 1.50
date: 2005/07/14 01:46:13; author: deraadt; state: Exp; lines: +4 -4
use symbolic names for checking in %fprs, as above
 1.217 16-Sep-2006  nakayama Fix a couple of %y register save/restore errors, inspired from OpenBSD.

revision 1.44
date: 2004/04/23 04:18:17; author: marc; state: Exp; lines: +5 -4

fix a couple of %y register save/restore errors
1) don't save %y in a register that is later used before restoring %y
2) always restore %y after calling a signal handler
tested by drahn@, OK pval
 1.216 15-Sep-2006  martin Do not bother to save fpu state when we are about to get rid of it.
 1.215 13-Sep-2006  mrg SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.214 09-Sep-2006  mrg significant clean up effort, largely from petrov@ via martin@.

- fix a bunch of comments for proc->lwp
- remove old TRAPTRACE, NOT_DEBUG, etc. code that has bit-rotted
- put some older DEBUG code under NOT_DEBUG
- add a bunch of new debugging/tracing code ("KTR") that depends on
other changes not yet present.
 1.213 14-May-2006  elad branches: 1.213.6; 1.213.8;
integrate kauth.
 1.212 12-May-2006  skrll Fix some comments.
 1.211 09-May-2006  rjs Load CPCB in cpu_mp_startup.
 1.210 11-Feb-2006  cdi branches: 1.210.2; 1.210.4; 1.210.6;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.209 27-Jan-2006  cdi branches: 1.209.2; 1.209.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.208 12-Jan-2006  cdi Fix a typo: %g0 should be used instead of %o0 when initializing FPU in dostart:
and cpu_mp_startup:, %o0 is not even initialized at this point.
 1.207 11-Dec-2005  christos branches: 1.207.2;
merge ktrace-lwp.
 1.206 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.205 31-May-2005  chs branches: 1.205.2;
remove vestigal {,e}intr{names,cnt} symbols now that vmstat doesn't need them.
 1.204 12-Feb-2005  chs branches: 1.204.4; 1.204.6; 1.204.8;
in sparc_interrupt(), wait to enable interrupts until just before calling
the handler and disable them again right after the handler returns.
we don't want another hardware interrupt coming in while we're mucking
with the list pointers. also, clear the intrhand's ih_pending pointer
before calling the handler rather than after, so that if another interrupt
comes in while the handler is running, we can put the intrhand back on
the list so it will be called again.

in send_softint(), disable interrupts via %pstate instead of %pil, so that
hardware interrupts at higher levels are blocked while we manipulate the
intrpending list. also, if the intrhand already has ih_pending set,
don't bother poking the SET_SOFTINT register again, since being on the list
implies that there is already a softint pending in the hardware.

these appear to fix PR 21750 (the "sleep forever" problem).

while I'm here, remove more vestiges of the !INTRLIST softint stuff
(code and comments). and in sparc64_ipi_flush_all(), interrupts are
already disabled so we don't need to fiddle with %pstate.
 1.203 30-Jan-2005  martin Remove the no long usefull variants selected by undefining INTRLIST and
INTR_INTERLOCK to improve readability. Same object code generated as before.
 1.202 16-Jan-2005  chs branches: 1.202.2;
use ENTRY_NOPROFILE() for various entry points,
stack traces work better that way.
 1.201 03-Dec-2004  chs branches: 1.201.4;
remove cache_flush_virt() and PADDRT, they're no longer used.
allocate a stack frame for blast_dcache() when profiling so it shows up.
in dcache_flush_page(), use a stride of 32 instead of 16 to match the
cache line size. correct various comments.
 1.200 08-Nov-2004  petrov Don't compile sparc64_ipi functions when UP.
 1.199 25-Oct-2004  martin No need to clear %o1 when returning a 64 bit integer from pseg_get if we
are compiling for a 64 bit kernel.
 1.198 24-Jul-2004  nakayama Change interrupt pending list end value to -1, to avoid linking an
interrupt handler twice.

It may fix "sleep forever" bug.
 1.197 09-Apr-2004  petrov Clean-up unused defines and variables.
 1.196 26-Mar-2004  petrov branches: 1.196.2;
Use want_resched from cpu_info area.
 1.195 23-Mar-2004  martin Replace intrcnts by evcnts. XXX - needs slight tweaking for MULTIPROCESSOR.
 1.194 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.193 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.192 19-Jan-2004  martin Rename switchexit to cpu_exit and g/c the old C implementation of cpu_exit.
 1.191 18-Jan-2004  martin Support RAS for 32bit kernels too.
 1.190 16-Jan-2004  martin In proc_trampoline don't bother to clear condition codes in the trap
frame, since we no longer rely on this.
While there fix a few comments.
 1.189 08-Jan-2004  martin Minor cleanup
 1.188 06-Jan-2004  martin Implement restartable atomic sequences (RAS) for sparc64.
 1.187 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.186 04-Jan-2004  jdolecek update to recent changes - exit2() doesn't exist anymore and the
exit path always calls lwp_exit2()
pointed out Martin Husemann
 1.185 02-Dec-2003  martin Minor cleanup: remove unused code, sync a comment with current reality.
 1.184 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 1.183 24-Nov-2003  cdi Call 'proc_trampoline_mp' from 'proc_trampoline' in a multiprocessor
configuration. Fix process locking. Approved by petrov@.
 1.182 20-Nov-2003  petrov Remove nwindows calculation, it's not used. Set l_cpu in cpu_switch.
 1.181 09-Nov-2003  martin Get rid of bcopy/bzero.
 1.180 26-Oct-2003  christos Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.
 1.179 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.178 08-Jul-2003  cdi traceit: don't use %g7 as it is to become curcpu() register. Add comments.
 1.177 18-May-2003  martin branches: 1.177.2;
Make kernels with options KGDB at least compile.
Still needs some work to make it working.
 1.176 29-Apr-2003  nakayama Use BLOCK_ALIGN rather than BLOCK_SIZE for aligning a pointer.
 1.175 27-Apr-2003  ragge Preserve the symbol table in the LKM || KSYMS cases also.
 1.174 04-Apr-2003  petrov use branch slot in pmap_copy_page.
 1.173 24-Mar-2003  nakayama Divide `set' instruction in delay slot (from OpenBSD change to rev 1.30).
 1.172 10-Feb-2003  martin Remove some #if 0 code and a few XXX marked membars w/o proper
justification for their existence.
 1.171 09-Feb-2003  martin Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.
 1.170 05-Feb-2003  nakayama Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.

This should fix PR port-sparc64/18452.
(approved by martin)
 1.169 04-Feb-2003  martin Fix return value of pseg_set, which I accidently broke in rev. 1.164.

Fix register names in comment and shave off another register (hint
from uwe).
 1.168 01-Feb-2003  martin Rearrange register usage in pseg_set a bit and shave off %g4.
 1.167 01-Feb-2003  martin Remove a few #ifdef _LP64 by using STPTR/LDPTR macros.
Thanks to Matthew Green for the pointer.
 1.166 31-Jan-2003  martin Apply leaf procedure optimization to pseg_set (again).
 1.165 31-Jan-2003  martin Make the pmap count resident/wired mappings on the fly instead of
walking the page tables whenever this information is needed.

Add an option PMAP_COUNT_DEBUG to assert the new counts and the
page table walk agree.

The old solution had very bad performance impact, for example
by the high CPU load when running top(1).

Thanks to Simon Burge for pointing at the cause of the problem and
to Valeriy E. Ushakov for optimizing my simple minded assembler code.
 1.164 27-Jan-2003  martin Remove unused function pseg_find (which looked quite similar to
pseg_get anyway).
 1.163 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.162 16-Jan-2003  petrov Move dump_dtlb back under DDB.
 1.161 15-Jan-2003  chs fix two bugs in my last pmap rework:
- in tlb_flush_all(), don't skip TLB entries with the high bit on,
I was confused about which MMU register it was using. it's also fine
to use the last hardware context.
- in pmap_create(), don't allocate a hardware context for the new pmap.
it's unnecessary, and when this would cause us to recycle all the contexts,
it would result in the current process's context being set to 0
(ie. the kernel's context). the current process could then return to
userspace without going through the context-switch code (and thus without
having a hardware context reallocated). this would lead to user mappings
being entered in the kernel's context later, causing all sorts of trouble.
add some assertions to catch this kind of thing.
 1.160 25-Dec-2002  petrov new function dump_itlb.
 1.159 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.158 18-Jul-2002  wiz Spell 'should' correctly.
 1.157 07-Jun-2002  eeh Shave 10% off the time needed to flush the D$ through a bit of instruction
reordering.
 1.156 05-Jun-2002  eeh Handle improperly aligned stack pointers more cleanly.
 1.155 04-Jun-2002  eeh Fix the fork trampoline to properly use the supplied tstate.
 1.154 31-May-2002  thorpej Make this work with an ISO C preprocessor.
 1.153 14-May-2002  eeh branches: 1.153.2; 1.153.4;
Only save locals and ins in trapframes for DEBUG kernels.
 1.152 04-May-2002  kleink Add some comments to the CPP conditionals controlling the trap macro
definitions, to ease navigation somewhat.
 1.151 16-Apr-2002  eeh Make lots of routines profile-friendly and get rid of some cruft.
 1.150 21-Mar-2002  petrov Not needed debug stuff deleted.
 1.149 16-Mar-2002  mrg tell newer binutils that our use of %g2 and %g3 is OK here.
 1.148 15-Mar-2002  eeh Cleanup MMU initialization to prevent hangs.
 1.147 09-Feb-2002  eeh branches: 1.147.4;
Fix microsecond calculation in microtime.
 1.146 07-Feb-2002  eeh Fix register allocation in microtime().
 1.145 29-Jan-2002  eeh Shift the UPAID in the correct direction.
 1.144 17-Jan-2002  eeh Be more tolerant of unaligned stack pointers.
 1.143 17-Jan-2002  eeh Enable block insns in bcopy and bzero.
 1.142 16-Jan-2002  eeh In bcopy use 32-bit comparisons in 32-bit kernels.
 1.141 16-Jan-2002  eeh Use correct calculation for the trapframe in softtrap for ILP32.
 1.140 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.139 14-Sep-2001  thorpej branches: 1.139.4;
Don't declare intrhand[] here -- that's taken care of in intr.c.
 1.138 30-Aug-2001  eeh branches: 1.138.2;
Preliminary UltraSPARC III suport (not enabled yet).
 1.137 13-Aug-2001  jdolecek g/c _remque()/_insque(); use the C version in libkern
 1.136 09-Aug-2001  eeh Fix context masking lossage caused by last version.
 1.135 08-Aug-2001  eeh Clean up the trap code to handle the changes cause by supporting non-faulting
accesses. Also change the parameter order so trap frames are easy to find.
 1.134 07-Aug-2001  eeh Make sure C code always has ASI_PRIMARY_NOFAULT in the %asi register so
the compiler will be happy if it ever starts generating speculative loads.
 1.133 05-Aug-2001  eeh Add support for non-faulting loads and optimize MMU miss handling paths.
 1.132 02-Aug-2001  eeh Fix bcopy.
 1.131 02-Aug-2001  eeh Sync bzero w/libc version.
 1.130 01-Aug-2001  eeh Integrate fixes from userland memset.
 1.129 31-Jul-2001  eeh Code cleanup and optimization.
 1.128 23-Jul-2001  eeh Get rid of some debug code that really isn't all that useful any more.
 1.127 19-Jul-2001  eeh Do ignore unregistered interrupts instead of faulting.
 1.126 16-Jul-2001  eeh Make bcopy a 32-bit friendly.
 1.125 11-Jul-2001  eeh Fix problems booting 32-bit kernels and dispatching level-15 interrupts.
 1.124 08-Jul-2001  eeh branches: 1.124.2;
Code cleanup. Add block_disable to let you turn on block set/copy routines.
 1.123 05-Jul-2001  eeh New block bzero and bcopy.
 1.122 04-Jul-2001  eeh Replace old bcopy with a much faster version.
 1.121 01-Jul-2001  martin Disable axidently enabled debug code to make -current compile again.
 1.120 30-Jun-2001  eeh Use a newer version (still disabled) of block bcopy.
 1.119 30-Jun-2001  eeh Fixup fpu save restore, get rid of some unused copy functions, and add
a new bcopy.
 1.118 21-Jun-2001  eeh Allow multiple 4MB pages for both kernel text and kernel data.

Note: DEBUG checks will not allow accesses to the hole between
text and data segments, so you may need to update programs that
use libkvm before relocating the start of kernel data.
 1.117 06-Jun-2001  mrg extract the netbsd32, sunos, 32 bit svr4 and 64 bit svr4 sigcode out into
separate files, so that compat lkms can link with them as well.
 1.116 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.115 25-Apr-2001  simonb Spell occurred correctly.
 1.114 09-Apr-2001  eeh Interrupt latency fix from sparc port. (Hm. One insn instead of 5).
 1.113 07-Mar-2001  eeh Fix inverted preprocessor logic. (Spotted by Charles.)
 1.112 21-Feb-2001  eeh branches: 1.112.2;
Add support for 64-bit SVR4 (Solaris 8) binaries.
 1.111 10-Feb-2001  pk Fix conditional for svr4 compat inclusion.
 1.110 05-Feb-2001  eeh Add signal trampoline for 64-bit svr4 emulations.
 1.109 31-Dec-2000  eeh Make INCR() atomic.
 1.108 29-Dec-2000  eeh pseg_get tells us whether it really needed that spare page after all.
 1.107 07-Dec-2000  eeh Fixup calculating where fpstate should be saved in the signal trampoline
code so it doesn't overwrite something important like the registers.
 1.106 09-Nov-2000  eeh Fix ILP32 bug in probe_get().
 1.105 22-Oct-2000  pk Restore revision 1.102.

I hope it sticks this time..
 1.104 20-Oct-2000  eeh Fix hang in 32-bit kernels caused by relocation of KERNBASE.
 1.103 04-Oct-2000  eeh Fix interrupt lossage problem and some cosmetic changes.
 1.102 01-Oct-2000  pk cpu_initialize: global registers aren't preserved across calls to
prom_printf(), so replace %g3 with %l7 (which isn't used despite
the `usage' comment).

Also, clean up white-space turds.
 1.101 29-Sep-2000  eeh This seems to fix the interrupt lossage of non-debug kernels.
 1.100 28-Sep-2000  eeh Fix INTR_SETUP() to properly distinguish kernel and user addresses.

Make microtime() return the correct time on %tick machines.

Re-enable debug stuff in dostart for now to detect kernel mapping issues.
 1.99 25-Sep-2000  pk Missing `#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)'
 1.98 17-Sep-2000  eeh Make the improved %tick changes work with machines that use the counter-timer
for the clock.
 1.97 12-Sep-2000  eeh Fix new version of microtime.
 1.96 11-Sep-2000  eeh (Hopefully) fix clock skew on machines that us %tick for the clock (UIIi).
 1.95 31-Aug-2000  eeh Use casx instead of stx to change entries in the page table trees.
 1.94 23-Aug-2000  eeh Update the scheduler to the new locking scheme.
 1.93 10-Aug-2000  eeh Fix signal delivery.
 1.92 02-Aug-2000  eeh Get kernel profiling to work. Now if only gprof worked....
 1.91 01-Aug-2000  eeh Overhaul cache flush code and coredump code.
 1.90 25-Jul-2000  pk Re-instate a couple of delay slot NOPs marked `XXX spitfire bug?'
 1.89 24-Jul-2000  mycroft Optimization to pmap_zero_page(): we only need to use the first 16 FP regs,
as in bzero().
 1.88 24-Jul-2000  mycroft Fix a whitespace glitch.
 1.87 24-Jul-2000  mycroft Pull in the bzero() changes from libc for real, with a couple of kernel-
specific hacks:
* Make the bias handling depend on STKB, so it switches correctly for 32-bit
kernels.
* Use the 32-bit stw/ld for 32-bit kernels.
* Add a few `-STKB's that were missed in the previous change.
 1.86 24-Jul-2000  pk Cosmetic & readability:
- local label cleanup in interrupt handling code;
- in debugging sections when testing `intrdebug': use a unique
local label (97) to enhanced clarity;
- comment-out unused code;
- kill a bug as the satisfying result of doing all of the above.
 1.85 24-Jul-2000  eeh Fix stack issues in bzero.
 1.84 24-Jul-2000  mycroft Revert the previous change for now. I don't have time to debug it tonight.
 1.83 23-Jul-2000  mycroft Copy bzero change from libc.
 1.82 20-Jul-2000  pk Since `intrcnt' points to an array of long ints, reserve the appropriate
amount of space depending on _LP64. Provide macros to load/store signed
and unsigned long ints.

Also, make the `intrcnt' and `intrpending' arrays 16 entries long, as on
sparc/v9 interrupt #15 is just a regular interrupt.
 1.81 19-Jul-2000  eeh Fix merge problem.
 1.80 19-Jul-2000  eeh Disable interrupt interlock using ih->ih_pending field. Seems to cause
more problems than it solves.
 1.79 19-Jul-2000  eeh Miscellaneous cleanup.
 1.78 18-Jul-2000  pk Correct args usage comment in probeget.
Whitespace cleanup.
 1.77 18-Jul-2000  pk probeget: 9 -> 0x9
 1.76 18-Jul-2000  pk If `ih_pending' is set simply return from the trap, don't schedule another
soft interrupt.
 1.75 18-Jul-2000  pk openfirmware: don't lower %pil
 1.74 17-Jul-2000  pk Kill typos in interrupt code.
 1.73 17-Jul-2000  pk probeget: do the same song and dance as ld*a() macros in ctlreg.h do.
 1.72 14-Jul-2000  eeh Move some macro definitions out of genassym and into locore.s
 1.71 08-Jul-2000  mrg backout part of previous: turn off intrdebug, and another debug message
 1.70 07-Jul-2000  pk Changes for readability:
- #define LP64 dependent STACKFRAME macro once
- use a LOAD_ASCIZ macro for setting up the format string
for debug messages.
 1.69 07-Jul-2000  eeh Temporary fix to prevent the clock from stopping on UIIi machines.
 1.68 03-Jul-2000  eeh Prevent interrupts from being posted if they are active and deprecate polled
interrupts. This seems to eliminate the spurious interrupts.
 1.67 02-Jul-2000  eeh Clean up interrupt handling some more.
 1.66 30-Jun-2000  eeh Fix interrupt delivery on UltraSPARC IIi machines.
 1.65 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.64 24-Jun-2000  eeh More VM cleanup:

Move the cpu_info structure above the interrupt stack so it won't
get corrupted if the stack overflows.

Flush the D$ before and after all MMU bypass accesses since the
D$ latches all of those.
 1.63 23-Jun-2000  eeh Make probeget() and probeset() really work for a change.
 1.62 19-Jun-2000  eeh branches: 1.62.2;
Have separate data and text segments, make text read-only.
 1.61 12-Jun-2000  eeh Start reorganizing the kernel for MULTIPROCESSOR support.
 1.60 31-May-2000  thorpej Add a comment about needing to initialize p_cpu when multiple
processors are supported.
 1.59 26-May-2000  thorpej branches: 1.59.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.58 26-May-2000  thorpej Don't set `runtime' here; it's done at the end of mi_switch().
cvS: ----------------------------------------------------------------------
 1.57 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.56 22-Apr-2000  eeh If we trap due to a bad kernel stack, try to switch to the interrupt strack
before breaking into the debugger.
 1.55 18-Apr-2000  eeh Prevent the system from getting watchdog reset by returning directly to user
mode if restoring the user window traps. Also reduce the time we run with
%tl>0.
 1.54 13-Apr-2000  eeh Apparently gas 2.9.5 (don't ask) does not like to add values to %lo()
directives so move the additions inside %lo() to make it happy.
Hopefully this won't break older versions.
 1.53 10-Apr-2000  mrg - fix a speeling error
- rename some numbered labels to be a bit less confusing.
- remove dead code
- fix a debug error message (argh!)
 1.52 10-Apr-2000  pk Get a kernel without DDB to build.
 1.51 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.50 16-Jan-2000  eeh Interrupt handlers return zero if they didn't handle the interrupt.
 1.49 10-Jan-2000  eeh Add debugger single-stepping and fix interrupt dispatch bugs.
 1.48 30-Dec-1999  eeh Lots of changes:

remove ffs()
add bzero that uses block store insns
save %gsr to fpstate
revert to physical accesses for pmap_zero_page so we don't
have conflicting page mappings
general cleanup.
 1.47 06-Nov-1999  eeh Handle zero length properly in copyinstr() copyoutstr() and copystr().
 1.46 11-Oct-1999  eeh branches: 1.46.2; 1.46.4;
Update to post 1.4.
 1.45 05-Oct-1999  eeh branches: 1.45.2;
Make broken versions of gas happy by using sethi/or instead of set for
(negative) addresses.
 1.44 17-Sep-1999  thorpej Centralize the declaration and clearing of `cold'.
 1.43 18-Jul-1999  eeh More fun with pmap.
 1.42 21-Jun-1999  eeh Improve TRAPTRACE. Add FLTRACE that only tracks MMU faults.
 1.41 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.40 05-Jun-1999  mrg update a commit slightly.
 1.39 30-May-1999  eeh Add code to support using %tick as the system clock if no "counter-timer" node
is found.
 1.38 09-May-1999  eeh Fixup non-DEBUG kernels.
 1.37 29-Apr-1999  christos Add sunos_sigcode (32 bit only)
 1.36 26-Mar-1999  eeh branches: 1.36.4;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.35 25-Mar-1999  mrg clean and up make compile
 1.34 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.33 22-Mar-1999  eeh Need to set up the pointers properly for partial FPU register stores.
 1.32 22-Mar-1999  eeh Flush D$ on bypass accesses.
 1.31 28-Feb-1999  eeh Use block load/store in pmap_zero_page()/pmap_copy_page().
 1.30 17-Feb-1999  eeh Let's test out vectored interrupts.
 1.29 15-Feb-1999  hubertf RCS ID police
 1.28 11-Feb-1999  mrg fix a comment pasto.
 1.27 11-Jan-1999  eeh Finally fixed 64-bit signal trampoline.
 1.26 10-Jan-1999  eeh Handle the symbol table properly in a 32-bit kernel that was booted from a
64-bit bootloader.
 1.25 09-Jan-1999  eeh More signal fixup.
 1.24 26-Nov-1998  mycroft Sync kcopy() with 32-bit SPARC version.
 1.23 16-Nov-1998  eeh Fixup the last broken bits of the signal handling code.
 1.22 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.21 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.20 17-Sep-1998  thorpej SYS_sigreturn -> SYS___sigreturn14.
 1.19 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.18 11-Sep-1998  eeh Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.
 1.17 09-Sep-1998  eeh Don't use %tick for microtime on 32-bit kernels -- breaks gettimeofday.
 1.16 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.15 07-Sep-1998  eeh Fix data corruption problem caused by broken debug code.
 1.14 07-Sep-1998  eeh Add new 64-bit trap vectors.
 1.13 06-Sep-1998  eeh 32-bit fixup.
 1.12 06-Sep-1998  eeh Disable some debug stuff.
 1.11 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.10 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.9 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.8 29-Aug-1998  eeh Some more 64-bit-ification.
 1.7 27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.6 26-Aug-1998  mrg panicstack: is needed outside of DEBUG. use _C_LABEL, and printf not db_printf (incase no ddb!)
 1.5 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.4 07-Jul-1998  eeh branches: 1.4.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.3 04-Jul-1998  jonathan defopt DDB.
 1.2 26-Jun-1998  thorpej defopt COMPAT_SVR4
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.2.3 09-Aug-1998  eeh General pmap and debug cleanup. Added PMAP_NEW support, but it doesn't work too well yet.
 1.4.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.4.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.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.45.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.46.4.1 15-Nov-1999  fvdl Sync with -current
 1.46.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.46.2.6 12-Mar-2001  bouyer Sync with HEAD.
 1.46.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.46.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.46.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.46.2.2 22-Nov-2000  bouyer Sync with HEAD.
 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.59.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.62.2.8 20-Oct-2000  tv Pullup 1.104 by patch [eeh]:
Fix hang in 32-bit kernels caused by relocation of KERNBASE.
 1.62.2.7 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.62.2.6 26-Aug-2000  mrg pull up 1.93. approved by thorpej
>Fix signal delivery.
 1.62.2.5 07-Aug-2000  mrg pull up 1.92 (approved by thorpej):
>Get kernel profiling to work. Now if only gprof worked....
 1.62.2.4 07-Aug-2000  mrg pull up 1.91 (approved by thorpej):
>Overhaul cache flush code and coredump code.
 1.62.2.3 31-Jul-2000  mrg pull up 1.75 .. 1.82, 1.86 & 1.90 (approved by thorpej):
1.75
>If `ih_pending' is set simply return from the trap, don't schedule another
>soft interrupt.
1.76
>probeget: 9 -> 0x9
1.77
>Correct args usage comment in probeget.
1.78
>Whitespace cleanup.
1.79
>Miscellaneous cleanup.
1.80
>Disable interrupt interlock using ih->ih_pending field. Seems to cause
>more problems than it solves.
1.81
>Fix merge problem.
1.82
>Since `intrcnt' points to an array of long ints, reserve the appropriate
>amount of space depending on _LP64. Provide macros to load/store signed
>and unsigned long ints.
>
>Also, make the `intrcnt' and `intrpending' arrays 16 entries long, as on
>sparc/v9 interrupt #15 is just a regular interrupt.
1.86
>Cosmetic & readability:
> - local label cleanup in interrupt handling code;
> - in debugging sections when testing `intrdebug': use a unique
> local label (97) to enhanced clarity;
> - comment-out unused code;
> - kill a bug as the satisfying result of doing all of the above.
1.90
>Re-instate a couple of delay slot NOPs marked `XXX spitfire bug?'
 1.62.2.2 27-Jul-2000  mycroft Approved by thorpej:
Fix bugs in bzero(), and many stack bias problems.

syssrc/sys/arch/sparc64/sparc64/locore.s 1.82 -> 1.85
syssrc/sys/arch/sparc64/sparc64/locore.s 1.86 -> 1.89
(Part of 1.85 omitted, since it's not related.)
 1.62.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.112.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.112.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.124.2.9 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.124.2.8 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.124.2.7 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.124.2.6 16-Mar-2002  jdolecek Catch up with -current.
 1.124.2.5 11-Feb-2002  jdolecek Sync w/ -current.
 1.124.2.4 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.124.2.3 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.124.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.124.2.1 03-Aug-2001  lukem update to -current
 1.138.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.139.4.19 17-Jan-2003  thorpej Sync with HEAD.
 1.139.4.18 15-Jan-2003  thorpej Sync with HEAD.
 1.139.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.139.4.16 29-Dec-2002  thorpej Sync with HEAD.
 1.139.4.15 18-Oct-2002  nathanw Catch up to -current.
 1.139.4.14 28-Aug-2002  petrov cpu_preempt fix, adjust pc/npc in syscall, use T_AST for cpu_preempt.
 1.139.4.13 01-Aug-2002  nathanw Catch up to -current.
 1.139.4.12 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.139.4.11 20-Jun-2002  nathanw Catch up to -current.
 1.139.4.10 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.139.4.9 28-Feb-2002  nathanw Catch up to -current.
 1.139.4.8 08-Jan-2002  nathanw Catch up to -current.
 1.139.4.7 04-Jan-2002  eeh Implement upcalls and cpu_preempt().
 1.139.4.6 04-Jan-2002  eeh Cleanup.
 1.139.4.5 04-Jan-2002  petrov old stuff(single-threaded) works
 1.139.4.4 04-Jan-2002  petrov more bits to SA
 1.139.4.3 03-Jan-2002  petrov sync again
 1.139.4.2 03-Jan-2002  petrov make kernel compile
 1.139.4.1 14-Sep-2001  petrov file locore.s was added on branch nathanw_sa on 2002-01-03 06:42:35 +0000
 1.147.4.1 19-Mar-2002  thorpej Provide storage for proc0.
 1.153.4.6 13-Aug-2004  jmc Pullup rev 1.198 (requested by nakayama in ticket #1727)

Change interrupt pending list end value to -1, to avoid linking an
interrupt handler twice.
 1.153.4.5 24-Jun-2003  grant Pull up revision 1.173 (requested by nakayama in ticket #1330):

Divide `set' instruction in delay slot (from OpenBSD change to rev
1.30).
 1.153.4.4 24-Jun-2003  grant Pull up revision 1.169 (requested by nakayama in ticket #1329):

Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.
 1.153.4.3 06-Jun-2002  lukem Pull up revision 1.156 (requested by eeh in ticket #183):
Handle improperly aligned stack pointers more cleanly.
 1.153.4.2 06-Jun-2002  lukem Pull up revision 1.155 (requested by eeh in ticket #181):
Fix the fork trampoline to properly use the supplied tstate.
 1.153.4.1 06-Jun-2002  lukem Pull up revision 1.154 (requested by lukem in ticket #187):
Make this work with an ISO C preprocessor.
 1.153.2.2 21-Jul-2002  gehenna catch up with -current.
 1.153.2.1 15-Jul-2002  gehenna catch up with -current.
 1.177.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.177.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.177.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.177.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.177.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.177.2.3 14-Nov-2004  skrll Sync with HEAD.
 1.177.2.2 02-Nov-2004  skrll Sync with HEAD.
 1.177.2.1 03-Aug-2004  skrll Sync with HEAD
 1.196.2.3 03-Oct-2006  tron Pull up following revision(s) (requested by nakayama in ticket #10695):
sys/arch/sparc64/sparc64/locore.s: revision 1.217 via patch
sys/arch/sparc64/sparc64/locore.s: revision 1.218 via patch
Fix a couple of %y register save/restore errors, inspired from OpenBSD.
revision 1.44
date: 2004/04/23 04:18:17; author: marc; state: Exp; lines: +5 -4
fix a couple of %y register save/restore errors
1) don't save %y in a register that is later used before restoring %y
2) always restore %y after calling a signal handler
tested by drahn@, OK pval
From OpenBSD:
- reload %fprs for checking it again.
- use symbolic names for checking in %fprs.
revision 1.51
date: 2005/07/18 14:50:11; author: deraadt; state: Exp; lines: +2 -1
cache a copy of the fprs so we know what fp restore we should do after
revision 1.50
date: 2005/07/14 01:46:13; author: deraadt; state: Exp; lines: +4 -4
use symbolic names for checking in %fprs, as above
 1.196.2.2 01-May-2005  tron Apply patch (requested by martin in ticket #1487):
Various changes from NetBSD-current, revisions 1.197 to 1.204.
Interrupt and soft-interrupt handling changes that appear to fix
the "sleep forever" problem (PR port-sparc64/21750).
 1.196.2.1 25-Jul-2004  tron branches: 1.196.2.1.2;
Pull up revision 1.198 (requested by nakayama in ticket #711):
Change interrupt pending list end value to -1, to avoid linking an
interrupt handler twice.
It may fix "sleep forever" bug.
 1.196.2.1.2.2 03-Oct-2006  tron Pull up following revision(s) (requested by nakayama in ticket #10695):
sys/arch/sparc64/sparc64/locore.s: revision 1.217 via patch
sys/arch/sparc64/sparc64/locore.s: revision 1.218 via patch
Fix a couple of %y register save/restore errors, inspired from OpenBSD.
revision 1.44
date: 2004/04/23 04:18:17; author: marc; state: Exp; lines: +5 -4
fix a couple of %y register save/restore errors
1) don't save %y in a register that is later used before restoring %y
2) always restore %y after calling a signal handler
tested by drahn@, OK pval
From OpenBSD:
- reload %fprs for checking it again.
- use symbolic names for checking in %fprs.
revision 1.51
date: 2005/07/18 14:50:11; author: deraadt; state: Exp; lines: +2 -1
cache a copy of the fprs so we know what fp restore we should do after
revision 1.50
date: 2005/07/14 01:46:13; author: deraadt; state: Exp; lines: +4 -4
use symbolic names for checking in %fprs, as above
 1.196.2.1.2.1 01-May-2005  tron branches: 1.196.2.1.2.1.2;
Apply patch (requested by martin in ticket #1487):
Various changes from NetBSD-current, revisions 1.197 to 1.204.
Interrupt and soft-interrupt handling changes that appear to fix
the "sleep forever" problem (PR port-sparc64/21750).
 1.196.2.1.2.1.2.1 03-Oct-2006  tron Pull up following revision(s) (requested by nakayama in ticket #10695):
sys/arch/sparc64/sparc64/locore.s: revision 1.217 via patch
sys/arch/sparc64/sparc64/locore.s: revision 1.218 via patch
Fix a couple of %y register save/restore errors, inspired from OpenBSD.
revision 1.44
date: 2004/04/23 04:18:17; author: marc; state: Exp; lines: +5 -4
fix a couple of %y register save/restore errors
1) don't save %y in a register that is later used before restoring %y
2) always restore %y after calling a signal handler
tested by drahn@, OK pval
From OpenBSD:
- reload %fprs for checking it again.
- use symbolic names for checking in %fprs.
revision 1.51
date: 2005/07/18 14:50:11; author: deraadt; state: Exp; lines: +2 -1
cache a copy of the fprs so we know what fp restore we should do after
revision 1.50
date: 2005/07/14 01:46:13; author: deraadt; state: Exp; lines: +4 -4
use symbolic names for checking in %fprs, as above
 1.201.4.1 29-Apr-2005  kent sync with -current
 1.202.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.202.2.1 12-Feb-2005  yamt sync with head.
 1.204.8.2 06-Jul-2008  bouyer Pull up following revision(s) (requested by nakayama in ticket #1940):
sys/arch/sparc64/sparc64/locore.s: revision 1.280
Close unterminated comment.
Fix unexpected behavior in case of loadfpstate from unaligned buffer.
 1.204.8.1 06-Nov-2006  tron Pull up following revision(s) (requested by nakayama in ticket #1517):
sys/arch/sparc64/sparc64/locore.s: revision 1.217 via patch
sys/arch/sparc64/sparc64/locore.s: revision 1.218 via patch
Fix a couple of %y register save/restore errors, inspired from OpenBSD.
revision 1.44
date: 2004/04/23 04:18:17; author: marc; state: Exp; lines: +5 -4
fix a couple of %y register save/restore errors
1) don't save %y in a register that is later used before restoring %y
2) always restore %y after calling a signal handler
tested by drahn@, OK pval
From OpenBSD:
- reload %fprs for checking it again.
- use symbolic names for checking in %fprs.
revision 1.51
date: 2005/07/18 14:50:11; author: deraadt; state: Exp; lines: +2 -1
cache a copy of the fprs so we know what fp restore we should do after
revision 1.50
date: 2005/07/14 01:46:13; author: deraadt; state: Exp; lines: +4 -4
use symbolic names for checking in %fprs, as above
 1.204.6.2 06-Jul-2008  bouyer Pull up following revision(s) (requested by nakayama in ticket #1940):
sys/arch/sparc64/sparc64/locore.s: revision 1.280
Close unterminated comment.
Fix unexpected behavior in case of loadfpstate from unaligned buffer.
 1.204.6.1 06-Nov-2006  tron Pull up following revision(s) (requested by nakayama in ticket #1517):
sys/arch/sparc64/sparc64/locore.s: revision 1.217 via patch
sys/arch/sparc64/sparc64/locore.s: revision 1.218 via patch
Fix a couple of %y register save/restore errors, inspired from OpenBSD.
revision 1.44
date: 2004/04/23 04:18:17; author: marc; state: Exp; lines: +5 -4
fix a couple of %y register save/restore errors
1) don't save %y in a register that is later used before restoring %y
2) always restore %y after calling a signal handler
tested by drahn@, OK pval
From OpenBSD:
- reload %fprs for checking it again.
- use symbolic names for checking in %fprs.
revision 1.51
date: 2005/07/18 14:50:11; author: deraadt; state: Exp; lines: +2 -1
cache a copy of the fprs so we know what fp restore we should do after
revision 1.50
date: 2005/07/14 01:46:13; author: deraadt; state: Exp; lines: +4 -4
use symbolic names for checking in %fprs, as above
 1.204.4.2 06-Jul-2008  bouyer Pull up following revision(s) (requested by nakayama in ticket #1940):
sys/arch/sparc64/sparc64/locore.s: revision 1.280
Close unterminated comment.
Fix unexpected behavior in case of loadfpstate from unaligned buffer.
 1.204.4.1 06-Nov-2006  tron Pull up following revision(s) (requested by nakayama in ticket #1517):
sys/arch/sparc64/sparc64/locore.s: revision 1.217 via patch
sys/arch/sparc64/sparc64/locore.s: revision 1.218 via patch
Fix a couple of %y register save/restore errors, inspired from OpenBSD.
revision 1.44
date: 2004/04/23 04:18:17; author: marc; state: Exp; lines: +5 -4
fix a couple of %y register save/restore errors
1) don't save %y in a register that is later used before restoring %y
2) always restore %y after calling a signal handler
tested by drahn@, OK pval
From OpenBSD:
- reload %fprs for checking it again.
- use symbolic names for checking in %fprs.
revision 1.51
date: 2005/07/18 14:50:11; author: deraadt; state: Exp; lines: +2 -1
cache a copy of the fprs so we know what fp restore we should do after
revision 1.50
date: 2005/07/14 01:46:13; author: deraadt; state: Exp; lines: +4 -4
use symbolic names for checking in %fprs, as above
 1.205.2.9 24-Mar-2008  yamt sync with head.
 1.205.2.8 17-Mar-2008  yamt sync with head.
 1.205.2.7 04-Feb-2008  yamt sync with head.
 1.205.2.6 21-Jan-2008  yamt sync with head
 1.205.2.5 27-Oct-2007  yamt sync with head.
 1.205.2.4 03-Sep-2007  yamt sync with head.
 1.205.2.3 26-Feb-2007  yamt sync with head.
 1.205.2.2 30-Dec-2006  yamt sync with head.
 1.205.2.1 21-Jun-2006  yamt sync with head.
 1.207.2.3 18-Feb-2006  yamt sync with head.
 1.207.2.2 01-Feb-2006  yamt sync with head.
 1.207.2.1 15-Jan-2006  yamt sync with head.
 1.209.4.2 01-Jun-2006  kardel Sync with head.
 1.209.4.1 22-Apr-2006  simonb Sync with head.
 1.209.2.1 09-Sep-2006  rpaulo sync with head
 1.210.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.210.4.1 11-May-2006  elad sync with head
 1.210.2.2 14-Sep-2006  yamt sync with head.
 1.210.2.1 24-May-2006  yamt sync with head.
 1.213.8.4 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.213.8.3 12-Jan-2007  ad Sync with head.
 1.213.8.2 11-Jan-2007  ad Checkpoint work in progress.
 1.213.8.1 18-Nov-2006  ad Sync with head.
 1.213.6.1 22-Sep-2006  riz Pull up following revision(s) (requested by nakayama in ticket #169):
sys/arch/sparc64/sparc64/locore.s: revision 1.217
sys/arch/sparc64/sparc64/locore.s: revision 1.218
Fix a couple of %y register save/restore errors, inspired from OpenBSD.
revision 1.44
date: 2004/04/23 04:18:17; author: marc; state: Exp; lines: +5 -4
fix a couple of %y register save/restore errors
1) don't save %y in a register that is later used before restoring %y
2) always restore %y after calling a signal handler
tested by drahn@, OK pval
From OpenBSD:
- reload %fprs for checking it again.
- use symbolic names for checking in %fprs.
revision 1.51
date: 2005/07/18 14:50:11; author: deraadt; state: Exp; lines: +2 -1
cache a copy of the fprs so we know what fp restore we should do after
revision 1.50
date: 2005/07/14 01:46:13; author: deraadt; state: Exp; lines: +4 -4
use symbolic names for checking in %fprs, as above
 1.219.2.3 10-Dec-2006  yamt sync with head.
 1.219.2.2 22-Oct-2006  yamt sync with head
 1.219.2.1 18-Sep-2006  yamt file locore.s was added on branch yamt-splraiseipl on 2006-10-22 06:05:11 +0000
 1.232.4.4 04-Sep-2008  skrll Sync with netbsd-4.
 1.232.4.3 15-Jan-2008  skrll Apply a change from -current:

Store a sensbile PCB_PC value in snapshot - the return point.

This helps gdb somewhat.

OK'd by martin.
 1.232.4.2 06-Jan-2008  wrstuden Catch up to netbsd-4.0 release.
 1.232.4.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.232.2.6 17-Mar-2012  bouyer Pull up following revision(s) via patch (requested by nakayama in ticket #1443):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.232.2.5 25-Sep-2008  bouyer Pull up following revision(s) (requested by martin in ticket #945):
sys/arch/sparc64/sparc64/locore.s: revision 1.261
Remove an unused .globl declaration
 1.232.2.4 16-Sep-2008  bouyer Sync with the following revisions (requested by skrll in ticket #1196):
gnu/dist/gdb removed
gnu/usr.bin/gdb53 removed
distrib/cats/instkernel/Makefile 1.14.6.1
gnu/dist/gdb6/bfd/config.bfd 1.3.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.c 1.1.1.2.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/Makefile.in 1.2.2.1.2.2
gnu/dist/gdb6/gdb/alpha-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alpha-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/alphabsd-nat.h 1.1.2.1
gnu/dist/gdb6/gdb/alphabsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphanbsd-nat.c 1.1.2.1
gnu/dist/gdb6/gdb/alphanbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64nbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/amd64nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/arm-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/armbsd-tdep.c 1.1.2.1
gnu/dist/gdb6/gdb/armnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/armnbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure.ac 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/m68kbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/mipsnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/nbsd-thread.c 1.1.2.3
gnu/dist/gdb6/gdb/ppcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/ppcnbsd-tdep.c 1.3.6.1
gnu/dist/gdb6/gdb/sh-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/shnbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/shnbsd-tdep.c 1.1.1.2.6.4
gnu/dist/gdb6/gdb/shnbsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc64nbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/sparcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/tramp-frame.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/vaxbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/config/alpha/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/arm/nbsd.mt 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/arm/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/i386/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/m68k/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/mips/nbsd.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/powerpc/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/sh/nbsd.mh 1.1.1.1.6.2
gnu/dist/gdb6/gdb/config/sh/tm-nbsd.h 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/vax/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/opcodes/configure 1.1.1.2.6.1
gnu/dist/gdb6/opcodes/configure.in 1.1.1.2.6.1
gnu/usr.bin/Makefile 1.126.4.1
gnu/usr.bin/gdb6/arch/alpha/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/alpha/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/init.c 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/nm.h 1.2.6.1
gnu/usr.bin/gdb6/arch/arm/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/arm/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/defs.mk 1.1.6.3
gnu/usr.bin/gdb6/arch/armeb/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/i386/defs.mk 1.4.4.1
gnu/usr.bin/gdb6/arch/i386/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68k/defs.mk 1.1.4.1
gnu/usr.bin/gdb6/arch/m68k/init.c 1.1.4.1
gnu/usr.bin/gdb6/arch/mipseb/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/mipseb/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/mipseb/init.c 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/config.h 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/defs.mk 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/init.c 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/tm.h 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/version.c 1.2.6.2
gnu/usr.bin/gdb6/arch/powerpc/defs.mk 1.3.6.1
gnu/usr.bin/gdb6/arch/powerpc/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/sh3eb/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3eb/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3eb/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3eb/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3el/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3el/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3el/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sparc/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/sparc64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc64/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/x86_64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/x86_64/init.c 1.1.6.1
gnu/usr.bin/gdb6/bfd/arch/armeb/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/vax/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/gdb/Makefile 1.5.2.1.2.2
gnu/usr.bin/gdb6/gdbtui/Makefile 1.2.6.1
gnu/usr.bin/gdb6/libiberty/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/sim/arch/mipseb/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/defs.mk 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/defs.mk 1.1.2.1
lib/libkvm/kvm_sparc64.c 1.10.18.2
lib/libpthread/pthread.c 1.48.6.4
lib/libpthread/pthread_barrier.c 1.6.18.1
lib/libpthread/pthread_cond.c 1.18.12.2
lib/libpthread/pthread_debug.h 1.8.18.1
lib/libpthread/pthread_int.h 1.34.4.5
lib/libpthread/pthread_lock.c 1.14.6.1
lib/libpthread/pthread_mutex.c 1.22.4.2
lib/libpthread/pthread_run.c 1.18.12.4
lib/libpthread/pthread_rwlock.c 1.13.6.2
lib/libpthread/pthread_sa.c 1.37.6.5
lib/libpthread/pthread_sig.c 1.47.4.8
lib/libpthread/pthread_sleep.c 1.7.6.2
lib/libpthread/sem.c 1.9.6.2
lib/libpthread/arch/sh3/pthread_md.h 1.3.6.1
regress/lib/libpthread/resolv/Makefile 1.1.12.1
regress/lib/libpthread/sigrunning/Makefile 1.1.2.1
regress/lib/libpthread/sigrunning/sigrunning.c 1.1.2.1
share/mk/bsd.own.mk 1.489.4.3
sys/arch/amd64/amd64/locore.S 1.18.14.1
sys/arch/amd64/amd64/machdep.c 1.44.2.3.2.1
sys/arch/amd64/conf/kern.ldscript 1.1.70.1
sys/arch/cats/conf/Makefile.cats.inc 1.17.30.1
sys/arch/shark/conf/Makefile.shark.inc 1.6.30.1
sys/arch/sparc64/conf/kern.ldscript 1.7.26.2
sys/arch/sparc64/conf/kern32.ldscript 1.6.26.2
sys/arch/sparc64/include/kcore.h 1.4.92.2
sys/arch/sparc64/sparc64/locore.s 1.232.4.4
sys/arch/sparc64/sparc64/machdep.c 1.193.4.3
sys/arch/sparc64/sparc64/pmap.c 1.184.2.1.2.4
sys/conf/newvers.sh 1.42.26.2
sys/kern/kern_sa.c 1.87.4.11
sys/kern/kern_synch.c 1.173.4.2
sys/sys/savar.h 1.20.10.2
tools/gdb/Makefile 1.9.4.1
tools/gdb/mknative-gdb 1.1.6.1

pullup the wrstuden-fixsa CVS branch to netbsd-4:
toolchain/35540 - GDB 6 support for pthreads.
port-sparc64/37534 - ktrace firefox gives
kernel trap 30: data access expection
GDB changes:
- delete gdb53
- enable gdb6 on all architectures
- add support for amd64 crash dumps
- add support for sparc64 crash dumps
- add support for /proc pid to executable filename for all archs
- enable thread support for all architectures
- add a note section to kernels to all platforms
- support detection/unwinding of signals for most architectures.
- Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT on sh3.
- Apply fix from binutils-current so that sparc gdb can be cross built
on a 64bit host.
SA/pthread changes:
Pre-allocate memory needed for event delivery. Eliminates dropped
interrupts under load.
Deliver intra-process signals to running threads
Eliminate some deadlock scenarios
Fix intra-process signal delivery when delivering to a thread waiting
for signals. Makes afs work again!
 1.232.2.3 06-Jul-2008  bouyer Pull up following revision(s) (requested by nakayama in ticket #1159):
sys/arch/sparc64/sparc64/locore.s: revision 1.280
Close unterminated comment.
Fix unexpected behavior in case of loadfpstate from unaligned buffer.
 1.232.2.2 29-Oct-2007  pavel branches: 1.232.2.2.4;
Pull up patch (requested by martin in ticket #944):
sys/arch/sparc64/sparc64/locore.s: patch
Avoid undefined symbol "time" in sparc64 kernels causing savecore confusion.
 1.232.2.1 29-Aug-2007  liamjfoy Pull up the following (requested by martin in ticket #849):

fix per-cpu mapping of cpuinfo/kernel stack on
sparc64 to not use the same physical page.
 1.232.2.2.4.2 17-Mar-2012  bouyer Pull up following revision(s) via patch (requested by nakayama in ticket #1443):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.232.2.2.4.1 06-Jul-2008  bouyer Pull up following revision(s) (requested by nakayama in ticket #1159):
sys/arch/sparc64/sparc64/locore.s: revision 1.280
Close unterminated comment.
Fix unexpected behavior in case of loadfpstate from unaligned buffer.
 1.235.2.5 01-May-2007  martin cpu_switchto does not need to deal with ci_want_resched any more
 1.235.2.4 01-May-2007  martin Ooops - PCB_PC and PCB_SP are 64bit values, even in 32bit kernels. So
backout that part of the previous change. Pointed out by mrg.
 1.235.2.3 29-Apr-2007  martin In cpu_switchto() save the state to the lwp passed as first arg, not
curlwp (probably does not make a difference).
Explicitly return the previous curlwp (instead of, pretty much hidden,
the first arg) - does not make a difference for current callers, but
let's try to be correct here.
While here, handle a few 32bit kernel nits.
 1.235.2.2 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.235.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.243.12.3 03-Oct-2007  garbled Sync with HEAD
 1.243.12.2 26-Jun-2007  garbled Sync with HEAD.
 1.243.12.1 22-May-2007  matt Update to HEAD.
 1.243.6.1 11-Jul-2007  mjf Sync with head.
 1.243.4.6 03-Dec-2007  ad Sync with HEAD.
 1.243.4.5 09-Oct-2007  ad Sync with head.
 1.243.4.4 20-Aug-2007  ad Sync with HEAD.
 1.243.4.3 15-Jul-2007  ad Sync with head.
 1.243.4.2 09-Jun-2007  ad Sync with head.
 1.243.4.1 27-May-2007  ad Sync with head.
 1.252.8.4 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.252.8.3 02-Oct-2007  joerg Sync with HEAD.
 1.252.8.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.252.8.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.252.4.3 10-Sep-2007  skrll Sync with HEAD.
 1.252.4.2 03-Sep-2007  skrll Sync with HEAD.
 1.252.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.256.2.3 23-Mar-2008  matt sync with HEAD
 1.256.2.2 09-Jan-2008  matt sync with HEAD
 1.256.2.1 06-Nov-2007  matt sync with HEAD
 1.259.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.261.6.1 11-Dec-2007  yamt sync with head.
 1.261.4.1 26-Dec-2007  ad Sync with head.
 1.261.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.262.2.2 19-Jan-2008  bouyer Sync with HEAD
 1.262.2.1 08-Jan-2008  bouyer Sync with HEAD
 1.266.6.7 17-Jan-2009  mjf Sync with HEAD.
 1.266.6.6 05-Oct-2008  mjf Sync with HEAD.
 1.266.6.5 28-Sep-2008  mjf Sync with HEAD.
 1.266.6.4 02-Jul-2008  mjf Sync with HEAD.
 1.266.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.266.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.266.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.266.2.1 24-Mar-2008  keiichi sync with head.
 1.278.6.3 10-Oct-2008  skrll Sync with HEAD.
 1.278.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.278.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.278.4.4 11-Aug-2010  yamt sync with head.
 1.278.4.3 11-Mar-2010  yamt sync with head
 1.278.4.2 20-Jun-2009  yamt sync with head
 1.278.4.1 04-May-2009  yamt sync with head.
 1.278.2.2 17-Jun-2008  yamt sync with head.
 1.278.2.1 04-Jun-2008  yamt sync with head
 1.279.2.3 18-Jul-2008  simonb Sync with head.
 1.279.2.2 03-Jul-2008  simonb Sync with head.
 1.279.2.1 18-Jun-2008  simonb Sync with head.
 1.282.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.282.2.1 19-Oct-2008  haad Sync with HEAD.
 1.285.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.286.6.2 17-Mar-2012  bouyer Pull up following revision(s) (requested by nakayama in ticket #1736):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.286.6.1 05-Jun-2009  snj branches: 1.286.6.1.2;
Pull up following revision(s) (requested by martin in ticket #786):
sys/arch/sparc64/include/cpu.h: revision 1.86
sys/arch/sparc64/sparc64/locore.s: revision 1.291
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.89
cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.286.6.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.286.2.3 17-Mar-2012  bouyer Pull up following revision(s) (requested by nakayama in ticket #1736):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.286.2.2 17-Mar-2010  snj branches: 1.286.2.2.2;
Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
properly handle flushes in all cpus as necessary
 1.286.2.1 05-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #786):
sys/arch/sparc64/include/cpu.h: revision 1.86
sys/arch/sparc64/sparc64/locore.s: revision 1.291
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.89
cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.286.2.2.2.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by nakayama in ticket #1736):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
 1.311.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.311.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.327.2.3 31-May-2011  rmind sync with head
 1.327.2.2 05-Mar-2011  rmind sync with head
 1.327.2.1 30-May-2010  rmind sync with head
 1.332.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.333.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.338.8.8 24-Sep-2016  bouyer Pull up following revision(s) (requested by nakayama in ticket #1408):
sys/arch/sparc64/sparc64/locore.s: revision 1.401
Fix RAS for 32-bit kernels. trapframe is always 64-bit.
 1.338.8.7 15-Nov-2015  bouyer Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.338.8.6 24-Mar-2015  snj Pull up following revision(s) (requested by nakayama in ticket #1265):
sys/arch/sparc64/sparc64/locore.s: revision 1.380
PANICSTACK is a pointer itself, not a pointer to pointer.
 1.338.8.5 14-Dec-2013  bouyer Pull up following revision(s) (requested by nakayama in ticket #994):
sys/arch/sparc64/sparc64/locore.s: revision 1.350
Increase an interrupt depth only in the case of hardware interrupts,
and remove the ci_idepth trick in softint_fastintr.
Fixes the following diagnostic panic reported in port-sparc64.
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file
"../../../../kern/subr_xcall.c", line 351
 1.338.8.4 08-Feb-2013  riz branches: 1.338.8.4.2;
Pull up following revision(s) (requested by martin in ticket #797):
sys/arch/sparc64/sparc64/locore.s: revision 1.347
sys/arch/sparc64/sparc64/mp_subr.S: revision 1.4
Fix sparc64_ipi_ccall by adding proper trap setup.
Fixes xcall(9) problems, as exposed by pserialize(9). Noticed by
J. Hannken-Illjes, cause pointed out by Takeshi Nakayama.
 1.338.8.3 23-Nov-2012  riz Pull up following revision(s) (requested by macallan in ticket #695):
sys/arch/sparc64/include/cpu.h: revision 1.99
sys/arch/sparc64/sparc64/cpu.c: revision 1.103
sys/arch/sparc64/include/psl.h: revision 1.50
sys/arch/sparc64/sparc64/clock.c: revision 1.107
sys/arch/sparc64/include/ctlreg.h: revision 1.57
sys/arch/sparc64/sparc64/locore.s: revision 1.342
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.338.8.2 21-Mar-2012  riz branches: 1.338.8.2.4;
Pull up following revision(s) (requested by mrg in ticket #131):
sys/arch/sparc64/sparc64/trap.c: revision 1.170
sys/arch/sparc64/sparc64/trap.c: revision 1.171
sys/arch/sparc64/sparc64/locore.s: revision 1.341
port the corrected ECC error handling code from freebsd. i noticed my U10
took one of these and then hang. it shouldn't hang, there's a 'sir' here that
doesn't seem to reset properly. oh well.
tested by simulated a trap via 'ta 0x10' and considering that the same, but
it hasn't been tested against a real ECC error yet.
count ECC corrected traps with evcnt(9).
 1.338.8.1 05-Mar-2012  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #85):
sys/arch/sparc64/sparc64/locore.s: revision 1.340
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
sys/arch/sparc64/conf/files.sparc64: revision 1.138

Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
 1.338.8.4.2.3 24-Sep-2016  bouyer Pull up following revision(s) (requested by nakayama in ticket #1408):
sys/arch/sparc64/sparc64/locore.s: revision 1.401
Fix RAS for 32-bit kernels. trapframe is always 64-bit.
 1.338.8.4.2.2 15-Nov-2015  bouyer Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.338.8.4.2.1 14-Dec-2013  bouyer Pull up following revision(s) (requested by nakayama in ticket #994):
sys/arch/sparc64/sparc64/locore.s: revision 1.350
Increase an interrupt depth only in the case of hardware interrupts,
and remove the ci_idepth trick in softint_fastintr.
Fixes the following diagnostic panic reported in port-sparc64.
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file
"../../../../kern/subr_xcall.c", line 351
 1.338.8.2.4.3 24-Sep-2016  bouyer Pull up following revision(s) (requested by nakayama in ticket #1408):
sys/arch/sparc64/sparc64/locore.s: revision 1.401
Fix RAS for 32-bit kernels. trapframe is always 64-bit.
 1.338.8.2.4.2 15-Nov-2015  bouyer Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.338.8.2.4.1 14-Dec-2013  bouyer Pull up following revision(s) (requested by nakayama in ticket #994):
sys/arch/sparc64/sparc64/locore.s: revision 1.350
Increase an interrupt depth only in the case of hardware interrupts,
and remove the ci_idepth trick in softint_fastintr.
Fixes the following diagnostic panic reported in port-sparc64.
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file
"../../../../kern/subr_xcall.c", line 351
 1.338.6.5 05-Apr-2012  mrg sync to latest -current.
 1.338.6.4 06-Mar-2012  mrg sync to -current
 1.338.6.3 06-Mar-2012  mrg sync to -current
 1.338.6.2 04-Mar-2012  mrg sync to latest -current.
 1.338.6.1 24-Feb-2012  mrg sync to -current.
 1.338.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.338.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.338.2.1 17-Apr-2012  yamt sync with head
 1.341.2.5 03-Dec-2017  jdolecek update from HEAD
 1.341.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.341.2.3 23-Jun-2013  tls resync from head
 1.341.2.2 25-Feb-2013  tls resync with head
 1.341.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.349.2.1 18-May-2014  rmind sync with head
 1.356.2.1 10-Aug-2014  tls Rebase.
 1.369.2.4 25-Sep-2016  bouyer Pull up following revision(s) (requested by nakayama in ticket #1257):
sys/arch/sparc64/sparc64/locore.s: revision 1.401
Fix RAS for 32-bit kernels. trapframe is always 64-bit.
 1.369.2.3 16-Nov-2015  msaitoh branches: 1.369.2.3.2;
Pull up following revision(s) (requested by martin in ticket #1028):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
- Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
- Fix kmem_free() size mismatch
- Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.369.2.2 09-Mar-2015  snj branches: 1.369.2.2.2;
Pull up following revision(s) (requested by nakayama in ticket #568):
sys/arch/sparc64/sparc64/locore.s: revision 1.379, 1.380
Use panic stack temporarily for calling prom_printf in a trap
handler.
It seems that openfirmware cannot handle over 4GB pointers, and
stack pointers may point to over 4GB since VA layout was rearranged
by rev 1.33 of vmparam.h. Therefore, use panic stack to avoid
panicking in OF_write used by prom_printf.
--
PANICSTACK is a pointer itself, not a pointer to pointer.
 1.369.2.1 14-Aug-2014  martin Pull up following revision(s) (requested by nakayama in ticket #14):
sys/arch/sparc64/sparc64/locore.s: revision 1.370
Add missing delay slot in DEBUG kernel.
 1.369.2.3.2.1 18-Jan-2017  skrll Sync with netbsd-5
 1.369.2.2.2.2 25-Sep-2016  bouyer Pull up following revision(s) (requested by nakayama in ticket #1257):
sys/arch/sparc64/sparc64/locore.s: revision 1.401
Fix RAS for 32-bit kernels. trapframe is always 64-bit.
 1.369.2.2.2.1 16-Nov-2015  msaitoh Pull up following revision(s) (requested by martin in ticket #1028):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
- Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
- Fix kmem_free() size mismatch
- Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.377.2.8 28-Aug-2017  skrll Sync with HEAD
 1.377.2.7 05-Feb-2017  skrll Sync with HEAD
 1.377.2.6 05-Oct-2016  skrll Sync with HEAD
 1.377.2.5 09-Jul-2016  skrll Sync with HEAD
 1.377.2.4 29-May-2016  skrll Sync with HEAD
 1.377.2.3 19-Mar-2016  skrll Sync with HEAD
 1.377.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.377.2.1 06-Apr-2015  skrll Sync with HEAD
 1.398.2.5 26-Apr-2017  pgoyette Sync with HEAD
 1.398.2.4 20-Mar-2017  pgoyette Sync with HEAD
 1.398.2.3 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.398.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.398.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.405.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.410.2.1 11-May-2017  pgoyette Sync with HEAD
 1.411.2.1 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.412.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.412.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.412.2.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.414.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.414.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.414.2.1 10-Jun-2019  christos Sync with HEAD
 1.421.4.1 17-Jan-2020  ad Sync with head.
 1.421.2.2 19-Oct-2025  martin Pull up following revision(s) (requested by riastradh in ticket #60):

sys/arch/sparc/sparc/locore.s: revision 1.287
share/man/man9/Makefile: revision 1.475
sys/arch/mips/mips/cpu_subr.c: revision 1.65
sys/arch/mips/mips/cpu_subr.c: revision 1.66
sys/arch/amd64/amd64/cpufunc.S: revision 1.70
sys/arch/hppa/hppa/support.S: revision 1.9
sys/arch/alpha/alpha/locore.s: revision 1.145
share/man/man9/paravirt_membar_sync.9: revision 1.1
sys/arch/sparc64/sparc64/locore.s: revision 1.436
distrib/sets/lists/comp/mi: revision 1.2499
sys/arch/i386/i386/cpufunc.S: revision 1.54
sys/sys/paravirt_membar.h: revision 1.1
sys/arch/arm/arm/cpu_subr.c: revision 1.6
(all via patch)

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

mips: Fix asm arch options in new paravirt_membar_sync.
Need to explicitly enable mips2 (MIPS-II) instructions in order to
use sync. Fixes:
/tmp/ccxgOmXc.s: Assembler messages:
/tmp/ccxgOmXc.s:3576: Error: opcode not supported on this processor: mips1 (mips1) `sync'
--- cpu_subr.o ---
*** Failed target: cpu_subr.o

PR kern/59618: occasional virtio block device lock ups/hangs
 1.421.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.423.6.2 03-Apr-2021  thorpej Sync with HEAD.
 1.423.6.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.425.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.431.4.2 19-Oct-2025  martin Pull up following revision(s) (requested by riastradh in ticket #60):

sys/arch/sparc/sparc/locore.s: revision 1.287
share/man/man9/Makefile: revision 1.475
sys/arch/mips/mips/cpu_subr.c: revision 1.65
sys/arch/mips/mips/cpu_subr.c: revision 1.66
sys/arch/amd64/amd64/cpufunc.S: revision 1.70
common/lib/libc/arch/i386/atomic/atomic.S: revision 1.38
common/lib/libc/arch/sparc/atomic/membar_ops.S: revision 1.9
sys/arch/hppa/hppa/support.S: revision 1.9
sys/arch/alpha/alpha/locore.s: revision 1.145
share/man/man9/paravirt_membar_sync.9: revision 1.1
sys/arch/sparc64/sparc64/locore.s: revision 1.436
distrib/sets/lists/comp/mi: revision 1.2499
sys/arch/i386/i386/cpufunc.S: revision 1.54
common/lib/libc/arch/sparc64/atomic/membar_ops.S: revision 1.10
sys/sys/paravirt_membar.h: revision 1.1
sys/arch/arm/arm/cpu_subr.c: revision 1.6
common/lib/libc/arch/x86_64/atomic/atomic.S: revision 1.32
(all via patch)

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

mips: Fix asm arch options in new paravirt_membar_sync.
Need to explicitly enable mips2 (MIPS-II) instructions in order to
use sync. Fixes:
/tmp/ccxgOmXc.s: Assembler messages:
/tmp/ccxgOmXc.s:3576: Error: opcode not supported on this processor: mips1 (mips1) `sync'
--- cpu_subr.o ---
*** Failed target: cpu_subr.o

PR kern/59618: occasional virtio block device lock ups/hangs
 1.431.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.434.2.1 02-Aug-2025  perseant Sync with HEAD
 1.435.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by riastradh in ticket #60):

sys/arch/sparc/sparc/locore.s: revision 1.287
share/man/man9/Makefile: revision 1.475
sys/arch/mips/mips/cpu_subr.c: revision 1.65
sys/arch/riscv/riscv/cpu_subr.c: revision 1.6
sys/arch/mips/mips/cpu_subr.c: revision 1.66
sys/arch/amd64/amd64/cpufunc.S: revision 1.70
common/lib/libc/arch/i386/atomic/atomic.S: revision 1.38
common/lib/libc/arch/sparc/atomic/membar_ops.S: revision 1.9
sys/arch/hppa/hppa/support.S: revision 1.9
sys/arch/alpha/alpha/locore.s: revision 1.145
share/man/man9/paravirt_membar_sync.9: revision 1.1
sys/arch/sparc64/sparc64/locore.s: revision 1.436
distrib/sets/lists/comp/mi: revision 1.2499
sys/arch/i386/i386/cpufunc.S: revision 1.54
common/lib/libc/arch/sparc64/atomic/membar_ops.S: revision 1.10
sys/sys/paravirt_membar.h: revision 1.1
sys/arch/arm/arm/cpu_subr.c: revision 1.6
sys/arch/virt68k/virt68k/locore.s: revision 1.17
common/lib/libc/arch/x86_64/atomic/atomic.S: revision 1.32

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

mips: Fix asm arch options in new paravirt_membar_sync.
Need to explicitly enable mips2 (MIPS-II) instructions in order to
use sync. Fixes:
/tmp/ccxgOmXc.s: Assembler messages:
/tmp/ccxgOmXc.s:3576: Error: opcode not supported on this processor: mips1 (mips1) `sync'
--- cpu_subr.o ---
*** Failed target: cpu_subr.o

PR kern/59618: occasional virtio block device lock ups/hangs
 1.3 08-Dec-2002  martin Follow the sparc port and use the MI versions of setrunqueue and
remrunqueue.
 1.2 26-May-2000  thorpej branches: 1.2.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.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.12.7 11-Dec-2002  thorpej Sync with HEAD.
 1.2.12.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.2.12.5 10-May-2002  petrov clean-up.
 1.2.12.4 09-Jan-2002  eeh Revert to some of the old scheduler code.
 1.2.12.3 04-Jan-2002  eeh Cleanup.
 1.2.12.2 04-Jan-2002  petrov more bits to SA
 1.2.12.1 03-Jan-2002  petrov make kernel compile
 1.308 05-Mar-2024  thorpej Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.
 1.307 04-Oct-2023  ad Eliminate l->l_ncsw and l->l_nivcsw. From memory think they were added
before we had per-LWP struct rusage; the same is now tracked there.
 1.306 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.305 26-Jul-2022  andvar s/functin/function/ in copy pasted comment.
 1.304 26-Dec-2021  riastradh sys: Skip suspendsched on cpu_reboot if we're in ddb.

If we're in ddb, the scheduler and all other CPUs are quiesced
anyway. But suspendsched will try to take an adaptive lock, which
causes it to crash and re-enter ddb, which isn't very useful for
rebooting.
 1.303 11-Sep-2021  riastradh ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.
 1.302 07-Sep-2021  riastradh Revert "ksyms: Use pserialize(9) for kernel access to ksyms."
 1.301 07-Sep-2021  riastradh ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.
 1.300 09-Aug-2021  andvar s/aligment/alignment/ + one more typo fix in comments.
 1.299 04-Jan-2021  thorpej malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.
 1.298 11-Jun-2020  ad branches: 1.298.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.297 31-Dec-2019  ad Rename uvm_free() -> uvm_availmem().
 1.296 21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.295 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.294 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.293 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.292 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.291 07-Jan-2019  martin When writing a kernel core dump, display the countdown w/o timestamps.
 1.290 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.289 27-Nov-2018  maxv Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.288 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.287 04-Nov-2016  macallan branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well
 1.286 04-Nov-2016  macallan add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE
 1.285 07-Jul-2016  msaitoh branches: 1.285.2;
KNF. Remove extra spaces. No functional change.
 1.284 13-May-2016  nakayama Use newly introduced intrhand_alloc().
 1.283 22-Nov-2015  martin remove all MD uses of suword(), replace by copyout()
 1.282 11-Jun-2015  palle sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@
 1.281 15-Mar-2015  nakayama Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.
 1.280 28-Oct-2014  nakayama branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).
 1.279 21-Sep-2014  christos fix leak
 1.278 14-Jul-2014  nakayama branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.
 1.277 13-May-2014  palle Use proper SYSCTL_DESCR() macro
 1.276 13-May-2014  palle get_vis() now handles sun4v (VIS 1 and VIS 2)
 1.275 25-Jan-2014  christos branches: 1.275.2;
__USING_TOPDOWN_VM is gone.
 1.274 14-Dec-2013  nakayama Remove duplicate/unused declarations.
 1.273 14-Nov-2013  martin Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.
 1.272 04-Feb-2013  macallan branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up
 1.271 08-Dec-2012  kiyohara Not FALLTHROUGH.
 1.270 13-Sep-2012  martin Adapt for _UC_TLSBASE
 1.269 28-Jul-2012  matt branches: 1.269.2;
Remove declartions of physmem
 1.268 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.267 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.266 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.265 06-Feb-2012  martin branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng
 1.264 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.263 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.262 08-Oct-2011  nakayama branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.
 1.261 17-Jul-2011  dyoung Switch sparc and sparc64 to new-style <sys/bus.h>.
 1.260 02-Jul-2011  mrg redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.
 1.259 01-Jul-2011  mrg use the right variables for the fp and pc, and avoid array bounds
violations.
 1.258 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.257 01-Jun-2011  mrg convert stackdump() to look up symbols rather than dumping raw %pc values.
 1.256 04-Mar-2011  joerg branches: 1.256.2;
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.255 14-Jan-2011  rmind branches: 1.255.2; 1.255.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.254 26-Jun-2010  skrll Remove unused cbit.
 1.253 08-May-2010  mrg remove pmap_update() calls on the kernel_pmap -- they do nothign.
 1.252 04-Mar-2010  mrg branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.
 1.251 08-Feb-2010  joerg 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.250 07-Dec-2009  nakayama branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".
 1.249 02-Dec-2009  nakayama In calculating initial tstate, cast to 64-bit first to avoid sign extension.
 1.248 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.247 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.246 24-Oct-2009  nakayama Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.
 1.245 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.244 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.243 26-Jun-2009  dyoung During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------
 1.242 21-May-2009  jnemeth pull in <sys/module.h>
 1.241 21-May-2009  jnemeth add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something
 1.240 19-May-2009  dyoung Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().
 1.239 18-May-2009  dyoung Make waittime static so that I know nothing else is using it.
 1.238 18-May-2009  dyoung Remove 'register' qualifier from several variables. The object
file did not change.
 1.237 16-May-2009  nakayama Use membar_sync() instead of inline asm.
 1.236 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.235 21-Jan-2009  martin branches: 1.235.2;
Adapt to major()/minor() return value type changes.
 1.234 11-Jan-2009  nakayama Make this compile.
 1.233 15-Dec-2008  mrg some minor KNF and also DPRINTF pm_flags in sparc_bus_map().
 1.232 13-Dec-2008  mrg DPRINTF() the new protection in sparc_bus_map()
 1.231 10-Dec-2008  mrg clean up and use __func__ in sparc_bus_map() debug messages.
 1.230 25-Nov-2008  ad dumpsys: don't spew numbers into the log.
 1.229 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.228 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.227 15-Oct-2008  wrstuden branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.
 1.226 10-Jul-2008  nakayama Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.
 1.225 02-Jul-2008  ad branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.
 1.224 04-Jun-2008  ad branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.223 20-May-2008  nakayama Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.
 1.222 18-May-2008  martin Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.
 1.221 28-Apr-2008  martin branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses
 1.220 24-Apr-2008  ad branches: 1.220.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.219 09-Apr-2008  nakayama branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.
 1.218 03-Apr-2008  nakayama Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.
 1.217 14-Mar-2008  nakayama Improve FPU state save/clear like x86, idea from OpenBSD.
 1.216 22-Feb-2008  martin Get rid of the IPI simple_lock.
 1.215 16-Jan-2008  skrll branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.
 1.214 14-Jan-2008  mrg implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...
 1.213 06-Jan-2008  martin argh, I did not intend to remove all declarations of physmem.
 1.212 06-Jan-2008  martin Remove superflouse extern decls.
 1.211 09-Dec-2007  martin branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.
 1.210 09-Dec-2007  martin Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.
 1.209 17-Oct-2007  garbled branches: 1.209.2; 1.209.4; 1.209.6;
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.208 09-Oct-2007  martin Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.
 1.207 01-Oct-2007  martin No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.
 1.206 01-Oct-2007  martin Fix printf format.
 1.205 30-Sep-2007  martin Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.
 1.204 30-Sep-2007  martin Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.
 1.203 30-Sep-2007  martin When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.
 1.202 11-Sep-2007  martin branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.
 1.201 06-Sep-2007  martin Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.
 1.200 09-Jul-2007  ad branches: 1.200.4; 1.200.8; 1.200.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.199 08-Jul-2007  pooka 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.198 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.197 04-Mar-2007  christos branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.
 1.196 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.195 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.194 09-Feb-2007  ad branches: 1.194.2;
Merge newlock2 to head.
 1.193 24-Nov-2006  christos branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.
 1.192 22-Oct-2006  pooka constify in cpu_setmcontext()
 1.191 05-Oct-2006  chs add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).
 1.190 13-Sep-2006  mrg branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.189 03-Sep-2006  gdamore branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.
 1.188 01-Sep-2006  mrg s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.
 1.187 10-Jun-2006  rjs branches: 1.187.4;
Add opt_multiprocessor.h.
 1.186 20-Feb-2006  cdi branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.
 1.185 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.184 27-Jan-2006  cdi branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.183 11-Dec-2005  christos branches: 1.183.2;
merge ktrace-lwp.
 1.182 27-Oct-2005  martin Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork
 1.181 31-May-2005  christos branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables
 1.180 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.179 09-Mar-2005  matt 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.178 04-Mar-2005  scw Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473
 1.177 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.176 17-Jan-2005  martin branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.
 1.175 28-Nov-2004  thorpej branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811
 1.174 13-Nov-2004  grant tweak an error message.
 1.173 08-Nov-2004  kleink In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.
 1.172 31-Oct-2004  martin When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.
 1.171 02-Jul-2004  petrov _bus_dmamap_load_mbuf: check and process pmap_extract failure.
 1.170 30-Jun-2004  pk Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.
 1.169 28-Jun-2004  pk Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.
 1.168 28-Jun-2004  pk Add openprom range property to the bus space tag.
 1.167 20-May-2004  martin We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.
 1.166 20-May-2004  petrov ifdef protection for sparc64_ipi_ function calls.
 1.165 24-Mar-2004  atatat branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.164 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.163 19-Jan-2004  martin Add missing paranthesis. Fixes PR 24144.
 1.162 18-Jan-2004  martin Support RAS for 32bit kernels too.
 1.161 06-Jan-2004  martin Implement restartable atomic sequences (RAS) for sparc64.
 1.160 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.159 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.158 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 1.157 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.156 09-Nov-2003  martin bzero/bcopy -> memset/memcpy
 1.155 30-Oct-2003  matt Make this compile with 32bit kernels.
 1.154 28-Oct-2003  hannken Get rid of uninitialized variable.
 1.153 28-Oct-2003  christos eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.
 1.152 27-Oct-2003  christos eliminate buildcontext, and fix siginfo delivery.
 1.151 26-Oct-2003  christos Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.
 1.150 21-Oct-2003  petrov Don't use NULL for integer.
 1.149 18-Oct-2003  petrov cpu_getmcontext: get fsr from correct place.
 1.148 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.147 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.146 15-Jul-2003  lukem __KERNEL_RCSID()
 1.145 29-Jun-2003  fvdl branches: 1.145.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.144 29-Jun-2003  martin struct proc * -> struct lwp *
 1.143 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.142 17-May-2003  nakayama Avoid strict-alias warnings in gcc 3.3.
 1.141 10-May-2003  martin Convert a few home-grown if()... Debugger() sequences into real panics.
 1.140 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.139 09-Feb-2003  martin Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.
 1.138 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.137 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.136 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.135 10-Dec-2002  pk bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.134 27-Nov-2002  pk Sync machdep sysctls with sparc.
 1.133 16-Oct-2002  martin Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.
 1.132 16-Oct-2002  martin Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.
 1.131 29-Sep-2002  martin Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.
 1.130 29-Sep-2002  martin Indentation nit.
 1.129 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.128 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.127 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.126 19-Sep-2002  ragge Do not include <sys/clist.h>, it's not used in NetBSD at all.
 1.125 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.124 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.123 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.122 12-Jun-2002  eeh Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>
 1.121 04-Jun-2002  eeh Clear the P_32 flag when exec-ing native binaries.
 1.120 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.119 20-Mar-2002  eeh branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.118 20-Mar-2002  christos kill remaining PS_STRINGS instances.
 1.117 15-Mar-2002  eeh Get PCI working with the new bus_space*.
 1.116 14-Mar-2002  eeh bus_type_t has gone away.
 1.115 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.114 14-Feb-2002  chs allow writing to write-only mappings. fixes PR 3493.
 1.113 07-Feb-2002  eeh Make bus_space_barrier() an inline instead of a function vector.
 1.112 24-Sep-2001  eeh branches: 1.112.4;
Change bus_space_mmap() signature to the official one.
 1.111 15-Sep-2001  eeh Only drop into the debuger if SDB_DDB is set.
 1.110 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.109 24-Aug-2001  chs branches: 1.109.2;
use pmap_k* for buffer cache pages.
 1.108 24-Jul-2001  eeh Use OF routines instead of internal ones.
 1.107 19-Jul-2001  eeh Make bus_space_debug default to off.
 1.106 02-Jun-2001  chs branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.105 26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.104 09-May-2001  kleink In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.
 1.103 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.102 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.101 11-Feb-2001  eeh branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.
 1.100 23-Jan-2001  martin Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.
 1.99 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.98 15-Jan-2001  eeh Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().
 1.97 12-Jan-2001  pk Implement bus_space_subregion().
 1.96 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.95 21-Dec-2000  eeh Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.
 1.94 06-Dec-2000  mrg fix warnings in DEBUG & DIAGNSTIC code.
 1.93 04-Dec-2000  fvdl Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.
 1.92 04-Dec-2000  eeh Fix uninitialized variable bug and code cleanup.
 1.91 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.90 28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.89 16-Sep-2000  eeh Add bus_space*stream*() methods. I hope they work.
 1.88 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.87 11-Sep-2000  eeh Don't take protection faults on I/O pages.
 1.86 01-Aug-2000  eeh `mem' is now a pointer, not an array. Fixes kernel coredumps.
 1.85 01-Aug-2000  eeh Overhaul cache flush code and coredump code.
 1.84 28-Jul-2000  eeh Don't dump if there's no address space reserved for it.
 1.83 27-Jul-2000  mrg delete unused variable.
 1.82 18-Jul-2000  mrg #if 0 some dumpsys() debugging messages
 1.81 14-Jul-2000  eeh Make 64-bit stack tracebacks look decent.
 1.80 14-Jul-2000  pk Cast physmem to u_int64_t before applying ctob().
 1.79 11-Jul-2000  eeh Add UltraSPARC III specific flag bit. Currently ignored.
 1.78 10-Jul-2000  eeh Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.
 1.77 09-Jul-2000  eeh Grab and use the memory model info from the flags in the ELF header.
 1.76 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.75 07-Jul-2000  eeh Handle bus_dma aligment properly.
 1.74 30-Jun-2000  eeh Fix interrupt delivery on UltraSPARC IIi machines.
 1.73 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.72 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.71 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.70 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.69 24-Jun-2000  eeh Remove a couple of references to vaddrs.h that slipped through.
 1.68 18-Jun-2000  mrg branches: 1.68.2;
back out part of previous.
 1.67 18-Jun-2000  mrg give BSDB_MAP a value. add a shushing cast.
 1.66 12-Jun-2000  eeh Start reorganizing the kernel for MULTIPROCESSOR support.
 1.65 12-Jun-2000  mrg clean up cruft.
 1.64 08-Jun-2000  eeh Allow for cacheable device maps (in case there's some RAM out there).
 1.63 02-Jun-2000  eeh Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).
 1.62 26-May-2000  thorpej branches: 1.62.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.61 24-May-2000  eeh If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.
 1.60 22-Apr-2000  mrg whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.59 22-Apr-2000  mrg clean up mdallocsys().
 1.58 10-Apr-2000  pk Get a kernel without DDB to build.
 1.57 06-Apr-2000  mrg - #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.
 1.56 19-Jan-2000  thorpej Move callout initialization to a single location; no need to duplicate
that code all over the place.
 1.55 04-Dec-1999  ragge CL* discarding.
 1.54 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.53 08-Nov-1999  eeh Implement sysctl machdep.booted_kernel.
 1.52 06-Nov-1999  eeh Explicitly use 32-bit and 64-bit types.
 1.51 11-Oct-1999  eeh branches: 1.51.2; 1.51.4;
Update to post 1.4.
 1.50 17-Sep-1999  thorpej branches: 1.50.2;
Centralize the declaration and clearing of `cold'.
 1.49 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.48 21-Jun-1999  eeh Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.
 1.47 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.46 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.45 05-Jun-1999  eeh Fix things up so they compile again.
 1.44 05-Jun-1999  mrg if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.
 1.43 31-May-1999  eeh Garbage collect.
 1.42 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.41 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.40 22-May-1999  eeh Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()
 1.39 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.38 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.37 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.36 01-Apr-1999  thorpej branches: 1.36.2;
Don't call configure() from cpu_startup().
 1.35 28-Mar-1999  eeh Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().
 1.34 28-Mar-1999  eeh Fix ref counting.
 1.33 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.32 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.31 27-Feb-1999  scottr defopt BUFCACHE and BUFPAGES.
 1.30 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.29 16-Jan-1999  chuck MNN is no longer optional, remove dead code
 1.28 10-Jan-1999  eeh Support little-endian bus mappings.
 1.27 09-Jan-1999  thorpej Garbage-collect `mbutl'.
 1.26 03-Jan-1999  eeh More signal handling fixups.
 1.25 18-Dec-1998  drochner COMPAT_xxx option review: add missing opt_compat_netbsd.h
 1.24 24-Nov-1998  mrg move now unsed variable under #ifdef NOT_DEBUG
 1.23 22-Nov-1998  eeh Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.
 1.22 16-Nov-1998  eeh Fixup the last broken bits of the signal handling code.
 1.21 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.20 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.19 06-Oct-1998  thorpej Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.
 1.18 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.17 17-Sep-1998  thorpej Make the signal code look a bit more like the 32-bit SPARC port's.
 1.16 13-Sep-1998  eeh Looks like something else changed in signal land.
 1.15 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.14 13-Sep-1998  mycroft Fix pasto.
 1.13 13-Sep-1998  mycroft Update these for signal handling changes.
XXX Not tested yet.
 1.12 11-Sep-1998  eeh Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.
 1.11 07-Sep-1998  eeh Misc. cleanup.
 1.10 06-Sep-1998  eeh 32-bit fixup.
 1.9 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.8 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.7 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.6 29-Aug-1998  eeh Some more 64-bit-ification.
 1.5 23-Aug-1998  eeh Remove dvma_mapin() and other cruft.
 1.4 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.3 07-Jul-1998  eeh branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.2 25-Jun-1998  thorpej defopt COMPAT_SUNOS
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.2.3 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.3.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.3.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.36.2.1 16-Apr-1999  chs branches: 1.36.2.1.2;
pull up 1.36 -> 1.37:
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.36.2.1.2.3 02-Aug-1999  thorpej Update from trunk.
 1.36.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.36.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.50.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.51.4.1 15-Nov-1999  fvdl Sync with -current
 1.51.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.51.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.51.2.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.51.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.51.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.51.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.62.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.68.2.8 15-May-2001  he Pull up revision 1.97 (requested by martin):
Implement bus_space_subregion(), makes pciide work.
 1.68.2.7 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.68.2.6 17-Oct-2000  tv Pullup 1.89 [eeh]:
Add bus_space*stream*() methods.
 1.68.2.5 07-Aug-2000  mrg pull up 1.86 (approved by thorpej):
>`mem' is now a pointer, not an array. Fixes kernel coredumps.
 1.68.2.4 07-Aug-2000  mrg pull up 1.85 (approved by thorpej):
>Overhaul cache flush code and coredump code.
 1.68.2.3 31-Jul-2000  mrg pull up 1.84 (approved by thorpej):
>Don't dump if there's no address space reserved for it.
 1.68.2.2 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.68.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.101.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.101.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.106.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.106.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.106.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.106.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.106.2.4 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.106.2.3 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.106.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.106.2.1 03-Aug-2001  lukem update to -current
 1.109.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.112.4.24 05-Jan-2003  thorpej Correction from uwe: Reserve a C call frame on the stack, not a
register window.
 1.112.4.23 05-Jan-2003  thorpej Invoke the upcall trampoline directly, rather than going through
sigcode, and make it look more like the 32-bit sparc version.
 1.112.4.22 11-Dec-2002  thorpej Sync with HEAD.
 1.112.4.21 04-Dec-2002  martin Make 32bit kernels compile (and more or less work with SA).
Patch from Nick Hudson.
 1.112.4.20 03-Dec-2002  martin Use trapframe64 instead of trapframe to be more friendly to 32bit kernel
compiles.
 1.112.4.19 18-Oct-2002  nathanw Catch up to -current.
 1.112.4.18 17-Sep-2002  nathanw Catch up to -current.
 1.112.4.17 27-Aug-2002  nathanw Catch up to -current.
 1.112.4.16 24-Aug-2002  petrov make it run.
 1.112.4.15 23-Aug-2002  petrov sync
 1.112.4.14 01-Aug-2002  nathanw Catch up to -current.
 1.112.4.13 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.112.4.12 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.112.4.11 20-Jun-2002  nathanw Catch up to -current.
 1.112.4.10 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.112.4.9 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.112.4.8 28-Feb-2002  nathanw Catch up to -current.
 1.112.4.7 04-Jan-2002  eeh Implement upcalls and cpu_preempt().
 1.112.4.6 04-Jan-2002  eeh Cleanup.
 1.112.4.5 04-Jan-2002  petrov more bits to SA
 1.112.4.4 03-Jan-2002  petrov sync again
 1.112.4.3 03-Jan-2002  petrov make kernel compile
 1.112.4.2 17-Nov-2001  martin Sparc64 *context routines, from Klaus Klein.
 1.112.4.1 24-Sep-2001  martin file machdep.c was added on branch nathanw_sa on 2001-11-17 12:24:20 +0000
 1.119.6.4 22-Nov-2002  tron Pull up rev 1.131 and 1.133 via patch (requested by martin in ticket #917):
Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.
Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.
 1.119.6.3 08-Nov-2002  tron Pull up revision 1.132 (requested by martin in ticket #916):
Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.
 1.119.6.2 13-Jun-2002  lukem Pull up revision 1.122 (requested by eeh in ticket #258):
Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>
 1.119.6.1 05-Jun-2002  lukem Pull up revision 1.121 (requested by eeh in ticket #156):
Clear the P_32 flag when exec-ing native binaries.
 1.119.4.4 31-Aug-2002  gehenna catch up with -current.
 1.119.4.3 17-Jul-2002  gehenna catch up with -current.
 1.119.4.2 15-Jul-2002  gehenna catch up with -current.
 1.119.4.1 17-May-2002  gehenna Replace the access to devsw table and the hard-coded major with devsw API.
 1.145.2.12 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.145.2.11 01-Apr-2005  skrll Sync with HEAD.
 1.145.2.10 08-Mar-2005  skrll Sync with HEAD.
 1.145.2.9 04-Feb-2005  skrll Sync with HEAD.
 1.145.2.8 17-Jan-2005  skrll Sync with HEAD.
 1.145.2.7 18-Dec-2004  skrll Sync with HEAD.
 1.145.2.6 14-Nov-2004  skrll Sync with HEAD.
 1.145.2.5 02-Nov-2004  skrll Sync with HEAD.
 1.145.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.145.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.145.2.2 03-Aug-2004  skrll Sync with HEAD
 1.145.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.165.4.1 20-Mar-2005  tron Pull up revision 1.177 (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.165.2.1 20-Mar-2005  tron Pull up revision 1.177 (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.175.4.1 29-Apr-2005  kent sync with -current
 1.176.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.176.2.1 12-Feb-2005  yamt sync with head.
 1.181.4.1 02-Nov-2005  yamt sync with head.
 1.181.2.8 17-Mar-2008  yamt sync with head.
 1.181.2.7 27-Feb-2008  yamt sync with head.
 1.181.2.6 21-Jan-2008  yamt sync with head
 1.181.2.5 27-Oct-2007  yamt sync with head.
 1.181.2.4 03-Sep-2007  yamt sync with head.
 1.181.2.3 26-Feb-2007  yamt sync with head.
 1.181.2.2 30-Dec-2006  yamt sync with head.
 1.181.2.1 21-Jun-2006  yamt sync with head.
 1.183.2.3 01-Mar-2006  yamt sync with head.
 1.183.2.2 18-Feb-2006  yamt sync with head.
 1.183.2.1 01-Feb-2006  yamt sync with head.
 1.184.4.1 22-Apr-2006  simonb Sync with head.
 1.184.2.1 09-Sep-2006  rpaulo sync with head
 1.186.8.1 19-Jun-2006  chap Sync with head.
 1.186.2.3 14-Sep-2006  yamt sync with head.
 1.186.2.2 03-Sep-2006  yamt sync with head.
 1.186.2.1 26-Jun-2006  yamt sync with head.
 1.187.4.1 03-Sep-2006  riz Pull up following revision(s) (requested by mrg in ticket #109):
sys/arch/sparc64/sparc64/machdep.c: revision 1.188
sys/arch/sparc64/dev/iommu.c: revision 1.80
s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.
 1.189.2.4 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.189.2.3 12-Jan-2007  ad Sync with head.
 1.189.2.2 11-Jan-2007  ad Checkpoint work in progress.
 1.189.2.1 18-Nov-2006  ad Sync with head.
 1.190.2.2 10-Dec-2006  yamt sync with head.
 1.190.2.1 22-Oct-2006  yamt sync with head
 1.193.4.3 15-Jan-2008  skrll Create a dumppcb in dumpsys for gdb.
 1.193.4.2 29-Oct-2007  wrstuden Catch up with 4.0 RC3
 1.193.4.1 01-Oct-2007  wrstuden Catch up with netbsd-4-9-RC2
 1.193.2.3 16-Sep-2008  bouyer Sync with the following revisions (requested by skrll in ticket #1196):
gnu/dist/gdb removed
gnu/usr.bin/gdb53 removed
distrib/cats/instkernel/Makefile 1.14.6.1
gnu/dist/gdb6/bfd/config.bfd 1.3.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.c 1.1.1.2.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/Makefile.in 1.2.2.1.2.2
gnu/dist/gdb6/gdb/alpha-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alpha-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/alphabsd-nat.h 1.1.2.1
gnu/dist/gdb6/gdb/alphabsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphanbsd-nat.c 1.1.2.1
gnu/dist/gdb6/gdb/alphanbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64nbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/amd64nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/arm-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/armbsd-tdep.c 1.1.2.1
gnu/dist/gdb6/gdb/armnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/armnbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure.ac 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/m68kbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/mipsnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/nbsd-thread.c 1.1.2.3
gnu/dist/gdb6/gdb/ppcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/ppcnbsd-tdep.c 1.3.6.1
gnu/dist/gdb6/gdb/sh-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/shnbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/shnbsd-tdep.c 1.1.1.2.6.4
gnu/dist/gdb6/gdb/shnbsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc64nbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/sparcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/tramp-frame.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/vaxbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/config/alpha/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/arm/nbsd.mt 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/arm/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/i386/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/m68k/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/mips/nbsd.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/powerpc/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/sh/nbsd.mh 1.1.1.1.6.2
gnu/dist/gdb6/gdb/config/sh/tm-nbsd.h 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/vax/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/opcodes/configure 1.1.1.2.6.1
gnu/dist/gdb6/opcodes/configure.in 1.1.1.2.6.1
gnu/usr.bin/Makefile 1.126.4.1
gnu/usr.bin/gdb6/arch/alpha/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/alpha/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/init.c 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/nm.h 1.2.6.1
gnu/usr.bin/gdb6/arch/arm/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/arm/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/defs.mk 1.1.6.3
gnu/usr.bin/gdb6/arch/armeb/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/i386/defs.mk 1.4.4.1
gnu/usr.bin/gdb6/arch/i386/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68k/defs.mk 1.1.4.1
gnu/usr.bin/gdb6/arch/m68k/init.c 1.1.4.1
gnu/usr.bin/gdb6/arch/mipseb/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/mipseb/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/mipseb/init.c 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/config.h 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/defs.mk 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/init.c 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/tm.h 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/version.c 1.2.6.2
gnu/usr.bin/gdb6/arch/powerpc/defs.mk 1.3.6.1
gnu/usr.bin/gdb6/arch/powerpc/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/sh3eb/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3eb/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3eb/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3eb/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3el/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3el/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3el/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sparc/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/sparc64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc64/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/x86_64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/x86_64/init.c 1.1.6.1
gnu/usr.bin/gdb6/bfd/arch/armeb/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/vax/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/gdb/Makefile 1.5.2.1.2.2
gnu/usr.bin/gdb6/gdbtui/Makefile 1.2.6.1
gnu/usr.bin/gdb6/libiberty/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/sim/arch/mipseb/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/defs.mk 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/defs.mk 1.1.2.1
lib/libkvm/kvm_sparc64.c 1.10.18.2
lib/libpthread/pthread.c 1.48.6.4
lib/libpthread/pthread_barrier.c 1.6.18.1
lib/libpthread/pthread_cond.c 1.18.12.2
lib/libpthread/pthread_debug.h 1.8.18.1
lib/libpthread/pthread_int.h 1.34.4.5
lib/libpthread/pthread_lock.c 1.14.6.1
lib/libpthread/pthread_mutex.c 1.22.4.2
lib/libpthread/pthread_run.c 1.18.12.4
lib/libpthread/pthread_rwlock.c 1.13.6.2
lib/libpthread/pthread_sa.c 1.37.6.5
lib/libpthread/pthread_sig.c 1.47.4.8
lib/libpthread/pthread_sleep.c 1.7.6.2
lib/libpthread/sem.c 1.9.6.2
lib/libpthread/arch/sh3/pthread_md.h 1.3.6.1
regress/lib/libpthread/resolv/Makefile 1.1.12.1
regress/lib/libpthread/sigrunning/Makefile 1.1.2.1
regress/lib/libpthread/sigrunning/sigrunning.c 1.1.2.1
share/mk/bsd.own.mk 1.489.4.3
sys/arch/amd64/amd64/locore.S 1.18.14.1
sys/arch/amd64/amd64/machdep.c 1.44.2.3.2.1
sys/arch/amd64/conf/kern.ldscript 1.1.70.1
sys/arch/cats/conf/Makefile.cats.inc 1.17.30.1
sys/arch/shark/conf/Makefile.shark.inc 1.6.30.1
sys/arch/sparc64/conf/kern.ldscript 1.7.26.2
sys/arch/sparc64/conf/kern32.ldscript 1.6.26.2
sys/arch/sparc64/include/kcore.h 1.4.92.2
sys/arch/sparc64/sparc64/locore.s 1.232.4.4
sys/arch/sparc64/sparc64/machdep.c 1.193.4.3
sys/arch/sparc64/sparc64/pmap.c 1.184.2.1.2.4
sys/conf/newvers.sh 1.42.26.2
sys/kern/kern_sa.c 1.87.4.11
sys/kern/kern_synch.c 1.173.4.2
sys/sys/savar.h 1.20.10.2
tools/gdb/Makefile 1.9.4.1
tools/gdb/mknative-gdb 1.1.6.1

pullup the wrstuden-fixsa CVS branch to netbsd-4:
toolchain/35540 - GDB 6 support for pthreads.
port-sparc64/37534 - ktrace firefox gives
kernel trap 30: data access expection
GDB changes:
- delete gdb53
- enable gdb6 on all architectures
- add support for amd64 crash dumps
- add support for sparc64 crash dumps
- add support for /proc pid to executable filename for all archs
- enable thread support for all architectures
- add a note section to kernels to all platforms
- support detection/unwinding of signals for most architectures.
- Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT on sh3.
- Apply fix from binutils-current so that sparc gdb can be cross built
on a 64bit host.
SA/pthread changes:
Pre-allocate memory needed for event delivery. Eliminates dropped
interrupts under load.
Deliver intra-process signals to running threads
Eliminate some deadlock scenarios
Fix intra-process signal delivery when delivering to a thread waiting
for signals. Makes afs work again!
 1.193.2.2 04-Oct-2007  pavel Pull up following revision (requested by martin in ticket #913):
sys/arch/sparc64/sparc64/machdep.c: revision 1.206 (via patch)
Fix printf format.
 1.193.2.1 30-Sep-2007  xtraeme Pull up following revision(s) (requested by martin in ticket #911):
sys/arch/sparc64/sparc64/machdep.c: revision 1.203 (via patch)

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.
 1.194.2.3 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.194.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.194.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.197.10.3 16-Oct-2007  garbled Sync with HEAD
 1.197.10.2 03-Oct-2007  garbled Sync with HEAD
 1.197.10.1 22-May-2007  matt Update to HEAD.
 1.197.4.1 11-Jul-2007  mjf Sync with head.
 1.197.2.4 12-Oct-2007  ad Sync with head.
 1.197.2.3 09-Oct-2007  ad Sync with head.
 1.197.2.2 15-Jul-2007  ad Sync with head.
 1.197.2.1 27-May-2007  ad Sync with head.
 1.200.10.3 23-Mar-2008  matt sync with HEAD
 1.200.10.2 09-Jan-2008  matt sync with HEAD
 1.200.10.1 06-Nov-2007  matt sync with HEAD
 1.200.8.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.200.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.200.4.1 10-Sep-2007  skrll Sync with HEAD.
 1.202.2.2 14-Oct-2007  yamt sync with head.
 1.202.2.1 06-Oct-2007  yamt sync with head.
 1.209.6.1 11-Dec-2007  yamt sync with head.
 1.209.4.1 26-Dec-2007  ad Sync with head.
 1.209.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.211.2.1 19-Jan-2008  bouyer Sync with HEAD
 1.215.6.6 17-Jan-2009  mjf Sync with HEAD.
 1.215.6.5 28-Sep-2008  mjf Sync with HEAD.
 1.215.6.4 02-Jul-2008  mjf Sync with HEAD.
 1.215.6.3 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.215.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.215.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.215.2.1 24-Mar-2008  keiichi sync with head.
 1.219.2.3 17-Jun-2008  yamt sync with head.
 1.219.2.2 04-Jun-2008  yamt sync with head
 1.219.2.1 18-May-2008  yamt sync with head.
 1.220.2.8 11-Aug-2010  yamt sync with head.
 1.220.2.7 11-Mar-2010  yamt sync with head
 1.220.2.6 19-Aug-2009  yamt sync with head.
 1.220.2.5 18-Jul-2009  yamt sync with head.
 1.220.2.4 20-Jun-2009  yamt sync with head
 1.220.2.3 16-May-2009  yamt sync with head
 1.220.2.2 04-May-2009  yamt sync with head.
 1.220.2.1 16-May-2008  yamt sync with head.
 1.221.2.6 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.221.2.5 27-Jun-2008  wrstuden LP_SA_SWITCHING -> LW_SA_SWITCHING. Since we set the flag on threads
that may not be us, we need to use l_flag and lock, not l_pflag.
 1.221.2.4 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.221.2.3 22-Jun-2008  wrstuden Re-add cpu_upcall() and page fault code. i386 kernels now compile.
They don't boot, but that seems to be a consequence of current from the
day this branch was started.
 1.221.2.2 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.221.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.224.2.2 18-Jul-2008  simonb Sync with head.
 1.224.2.1 03-Jul-2008  simonb Sync with head.
 1.225.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.225.2.1 19-Oct-2008  haad Sync with HEAD.
 1.227.4.2 17-Mar-2010  snj Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
properly handle flushes in all cpus as necessary
 1.227.4.1 02-Feb-2009  snj branches: 1.227.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.227.4.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.227.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.227.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.227.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.235.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.250.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.250.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.252.2.7 12-Jun-2011  rmind sync with head
 1.252.2.6 05-Mar-2011  rmind sync with head
 1.252.2.5 03-Jul-2010  rmind sync with head
 1.252.2.4 30-May-2010  rmind sync with head
 1.252.2.3 25-Apr-2010  rmind A round of compile and other fixes to previous.
 1.252.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.252.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.255.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.255.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.256.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.262.6.3 02-Jun-2012  mrg sync to latest -current.
 1.262.6.2 24-Feb-2012  mrg sync to -current.
 1.262.6.1 18-Feb-2012  mrg merge to -current.
 1.262.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.262.2.4 16-Jan-2013  yamt sync with (a bit old) head
 1.262.2.3 30-Oct-2012  yamt sync with head
 1.262.2.2 23-May-2012  yamt sync with head.
 1.262.2.1 17-Apr-2012  yamt sync with head
 1.265.2.2 09-Nov-2014  msaitoh Pull up following revision(s) (requested by nakayama in ticket #1176):
sys/arch/sparc64/sparc64/machdep.c: revision 1.280
sys/arch/sparc64/sparc64/machdep.c: revision 1.274
Remove duplicate/unused declarations.
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).
 1.265.2.1 21-May-2012  riz branches: 1.265.2.1.4; 1.265.2.1.6;
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.265.2.1.6.1 09-Nov-2014  msaitoh Pull up following revision(s) (requested by nakayama in ticket #1176):
sys/arch/sparc64/sparc64/machdep.c: revision 1.280
sys/arch/sparc64/sparc64/machdep.c: revision 1.274
Remove duplicate/unused declarations.
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).
 1.265.2.1.4.1 09-Nov-2014  msaitoh Pull up following revision(s) (requested by nakayama in ticket #1176):
sys/arch/sparc64/sparc64/machdep.c: revision 1.280
sys/arch/sparc64/sparc64/machdep.c: revision 1.274
Remove duplicate/unused declarations.
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).
 1.269.2.4 03-Dec-2017  jdolecek update from HEAD
 1.269.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.269.2.2 25-Feb-2013  tls resync with head
 1.269.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.272.2.1 18-May-2014  rmind sync with head
 1.275.2.1 10-Aug-2014  tls Rebase.
 1.278.2.4 30-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1677):

sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.278.2.3 21-Mar-2015  snj branches: 1.278.2.3.2; 1.278.2.3.6;
Pull up following revision(s) (requested by nakayama in ticket #628):
sys/arch/sparc64/sparc64/autoconf.c: revision 1.202
sys/arch/sparc64/sparc64/machdep.c: revision 1.281
Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.
This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.
 1.278.2.2 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.278.2.1 30-Oct-2014  martin Pull up following revision(s) (requested by nakayama in ticket #168):
sys/arch/sparc64/sparc64/machdep.c: revision 1.280
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).
 1.278.2.3.6.1 30-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1677):

sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.278.2.3.2.1 30-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1677):

sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.280.2.5 05-Dec-2016  skrll Sync with HEAD
 1.280.2.4 29-May-2016  skrll Sync with HEAD
 1.280.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.280.2.2 22-Sep-2015  skrll Sync with HEAD
 1.280.2.1 06-Apr-2015  skrll Sync with HEAD
 1.285.2.3 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.285.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.285.2.1 20-Jul-2016  pgoyette Adapt the machine/arch dependent code to the new {b,c}devsw reference
counting.

XXX Most of these will require testing by someone other than myself, as
I have a limited selection of hardware!
 1.287.16.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.287.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.287.16.1 10-Jun-2019  christos Sync with HEAD
 1.287.14.3 18-Jan-2019  pgoyette Synch with HEAD
 1.287.14.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.287.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.287.8.1 27-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1173):
sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/riscv/riscv/sig_machdep.c: revision 1.2
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.287.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.298.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.7 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.6 07-Sep-2015  uebayasi branches: 1.6.16;
Fix size_t/psize_t confusion. Fix build.
 1.5 06-Sep-2015  martin On SUN4V make the mdesc data available early in pmap_bootstrap, so we
can set up the uvm page colors correctly.
Based on code from palle@.
 1.4 22-Mar-2015  palle branches: 1.4.2;
sun4v: added new function mdesc_name_by_idx() for retrieving the name of a node
 1.3 19-Jan-2015  palle sun4v: Add two new functions to the mdesc api: mdesc_find_node_by_idx() and mdesc_next_node()
 1.2 11-Jan-2015  palle sun4v: hv_mach_desc() needs a buffer length of zero to return the actual length - this also fixes the failing sparc GENERIC_SUN4U build
 1.1 10-Jan-2015  palle sun4v: add hypervisor machine description (mdesc) functions - from OpenBSD
 1.4.2.3 22-Sep-2015  skrll Sync with HEAD
 1.4.2.2 06-Apr-2015  skrll Sync with HEAD
 1.4.2.1 22-Mar-2015  skrll file mdesc.c was added on branch nick-nhusb on 2015-04-06 15:18:03 +0000
 1.6.16.2 03-Dec-2017  jdolecek update from HEAD
 1.6.16.1 07-Sep-2015  jdolecek file mdesc.c was added on branch tls-maxphys on 2017-12-03 11:36:45 +0000
 1.37 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.36 08-Feb-2011  rmind branches: 1.36.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.35 14-Mar-2009  dsl branches: 1.35.4; 1.35.6; 1.35.8;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.34 04-Mar-2007  christos branches: 1.34.40; 1.34.44; 1.34.52; 1.34.58;
fix fallout from caddr_t changes.
 1.33 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.32 15-Oct-2006  martin branches: 1.32.4;
Missing initializer
 1.31 11-Dec-2005  christos branches: 1.31.20; 1.31.22;
merge ktrace-lwp.
 1.30 09-Nov-2003  martin branches: 1.30.16;
bzero/bcopy -> memset/memcpy
 1.29 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.28 15-Jul-2003  lukem __KERNEL_RCSID()
 1.27 29-Jun-2003  fvdl branches: 1.27.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.26 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.25 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.24 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 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 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.21 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.20 27-Feb-2002  christos branches: 1.20.8;
- Use DEV_ constants, instead of documenting the numbers!
- Delete cdev_decl(mm); where appropriate, and other hand-crufting [hi powerpc!]
 1.19 10-Sep-2001  chris branches: 1.19.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.18 24-Apr-2001  thorpej branches: 1.18.2; 1.18.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.17 18-Nov-2000  mrg branches: 1.17.2;
s/register//
 1.16 17-Nov-2000  mrg pull over from sparc port's mem.c:
>revision 1.26
>date: 2000/11/13 15:31:44; author: pk; state: Exp; lines: +10 -1
>Detect "EOF" conditions on the memory-special files.
 1.15 27-Jul-2000  mrg fix warnings.
 1.14 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 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.12 24-Jun-2000  eeh Get rid of vaddrs.h.
 1.11 19-Jun-2000  eeh branches: 1.11.2;
Have separate data and text segments, make text read-only.
 1.10 04-Dec-1999  ragge branches: 1.10.2;
CL* discarding.
 1.9 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.8 27-Mar-1999  mycroft branches: 1.8.8; 1.8.10; 1.8.14;
Oops; vm_offset_t -> vaddr_t.
 1.7 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.6 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.5 10-Feb-1999  kleink Use of casts as lvalues is a GNU C extension; rearrange slightly.
 1.4 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.2.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.8.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.10.1 15-Nov-1999  fvdl Sync with -current
 1.8.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.8.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.11.2.2 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.11.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.17.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.18.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.18.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.18.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.18.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.18.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.19.4.6 11-Nov-2002  nathanw Catch up to -current
 1.19.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.19.4.4 17-Sep-2002  nathanw Catch up to -current.
 1.19.4.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.19.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.19.4.1 10-Sep-2001  nathanw file mem.c was added on branch nathanw_sa on 2002-02-28 04:12:18 +0000
 1.20.8.1 17-May-2002  gehenna Add the character device switch.
 1.27.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.27.2.2 03-Aug-2004  skrll Sync with HEAD
 1.27.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.30.16.3 03-Sep-2007  yamt sync with head.
 1.30.16.2 30-Dec-2006  yamt sync with head.
 1.30.16.1 21-Jun-2006  yamt sync with head.
 1.31.22.1 22-Oct-2006  yamt sync with head
 1.31.20.1 18-Nov-2006  ad Sync with head.
 1.32.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.34.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.34.44.1 04-May-2009  yamt sync with head.
 1.34.40.1 29-Mar-2008  mjf Add a mem_init() function for each architecture that requests a device
node for /dev/mem, /dev/null, /dev/zero, etc.

This will disappear when I move this code (and others) to be a
pseudo-device. When we have machine-independent mem code this will all be
unnecessary anyway.
 1.35.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.35.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.35.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.36.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.4 17-Mar-2013  christos now in common/lib/libc/arch/sparc64/string
 1.3 12-Jul-2011  mrg branches: 1.3.2; 1.3.12;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.2 07-Mar-2010  mrg branches: 1.2.2; 1.2.6;
gas has supported SPARC ".empty" for a long while; get rid of an
ancient workaround.
 1.1 06-Mar-2010  mrg move the memcpy/memset implementations out into their own file, with the
block copy versions as well. move some of the definitions in locore.s
into a new locore.h.

locore.s is almost 2000 lines shorter with this change.
 1.2.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.2.6.1 07-Mar-2010  uebayasi file memcpyset.s was added on branch uebayasi-xip on 2010-04-30 14:39:53 +0000
 1.2.2.2 11-Mar-2010  yamt sync with head
 1.2.2.1 07-Mar-2010  yamt file memcpyset.s was added on branch yamt-nfs-mp on 2010-03-11 15:03:01 +0000
 1.3.12.1 23-Jun-2013  tls resync from head
 1.3.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.3 18-Jul-2000  mrg kill dead files.
 1.2 05-Sep-1998  eeh branches: 1.2.12; 1.2.22;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.22.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.2.12.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 18-Jul-2000  mrg kill dead files.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.24;
Import of sparc64.
 1.1.1.1.24.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.10 16-May-2016  palle Avoid assembler-specific defines by using the export keyword in genassym.cf instead
 1.9 15-Jun-2015  martin Slightly optimize the ITLB usage on secondary processors
 1.8 02-Nov-2014  palle branches: 1.8.2;
sun4v: Implement missing sparc64_ipi_dcache_flush_page_xxx() function. ok martin@
 1.7 24-Sep-2014  palle sun4v: add code to enable startup of secondary cpus on both sun4u and sun4v systems - ok martin@
 1.6 08-Jun-2014  palle branches: 1.6.2;
sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.5 28-Apr-2013  nakayama branches: 1.5.8;
Use macros in machine/asm.h instead of locally defined, and
introduce CASPTRA for casxa/casa.
 1.4 23-Jan-2013  martin Fix sparc64_ipi_ccall by adding proper trap setup.
Fixes xcall(9) problems, as exposed by pserialize(9). Noticed by
J. Hannken-Illjes, cause pointed out by Takeshi Nakayama.
 1.3 12-Jul-2011  mrg branches: 1.3.2; 1.3.8; 1.3.12;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.2 29-May-2010  martin branches: 1.2.2; 1.2.4; 1.2.6;
Add a generic ipi to call arbitrary C functions on another (or all other)
cpu(s). Will be used in the near future by some code Mindaugas is working on.
 1.1 23-May-2010  martin Split copy related functions out of locore.s into copy.S, move functions
only needed on multiprocessors into mp_subr.S.
 1.2.6.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.2.6.1 29-May-2010  uebayasi file mp_subr.S was added on branch uebayasi-xip on 2010-08-17 06:45:20 +0000
 1.2.4.2 11-Aug-2010  yamt sync with head.
 1.2.4.1 29-May-2010  yamt file mp_subr.S was added on branch yamt-nfs-mp on 2010-08-11 22:52:48 +0000
 1.2.2.2 30-May-2010  rmind sync with head
 1.2.2.1 29-May-2010  rmind file mp_subr.S was added on branch rmind-uvmplock on 2010-05-30 05:17:09 +0000
 1.3.12.4 03-Dec-2017  jdolecek update from HEAD
 1.3.12.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.12.2 23-Jun-2013  tls resync from head
 1.3.12.1 25-Feb-2013  tls resync with head
 1.3.8.1 08-Feb-2013  riz Pull up following revision(s) (requested by martin in ticket #797):
sys/arch/sparc64/sparc64/locore.s: revision 1.347
sys/arch/sparc64/sparc64/mp_subr.S: revision 1.4
Fix sparc64_ipi_ccall by adding proper trap setup.
Fixes xcall(9) problems, as exposed by pserialize(9). Noticed by
J. Hannken-Illjes, cause pointed out by Takeshi Nakayama.
 1.3.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.5.8.1 10-Aug-2014  tls Rebase.
 1.6.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.8.2.2 29-May-2016  skrll Sync with HEAD
 1.8.2.1 22-Sep-2015  skrll Sync with HEAD
 1.117 06-Nov-2021  thorpej COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.
 1.116 27-Oct-2021  thorpej Use the signal trampoline version constants from <sys/signal.h>.
 1.115 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.114 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.113 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.112 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.111 27-Nov-2018  maxv Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.110 19-Oct-2016  skrll branches: 1.110.8; 1.110.14; 1.110.16;
PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.109 26-Nov-2015  martin branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.
 1.108 22-Nov-2015  martin Use NETBSD32PTR32I() for pointer-to-32bit value conversion, requested
by mrg.
 1.107 22-Nov-2015  martin remove all MD uses of suword(), replace by copyout()
 1.106 07-Nov-2015  martin Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.105 07-Nov-2015  martin Fix kmem_free() size mismatch
 1.104 31-Oct-2015  nakayama Remove #define SUN4U since machine/frame.h doesn't check SUN4U anymore.
 1.103 07-Mar-2014  nakayama branches: 1.103.4; 1.103.6; 1.103.8;
Mark as __diagused to variables used only in KASSERT.
 1.102 04-Jan-2014  dsl 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.101 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.100 14-Sep-2013  martin Remove unused variable
 1.99 13-Sep-2012  martin branches: 1.99.2;
Adapt for _UC_TLSBASE
 1.98 21-May-2012  martin branches: 1.98.2;
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.97 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.96 12-Feb-2012  matt branches: 1.96.2;
Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.95 04-Mar-2011  joerg branches: 1.95.4; 1.95.8;
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.94 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.93 14-Jan-2011  rmind branches: 1.93.2; 1.93.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.92 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.91 10-Dec-2009  matt branches: 1.91.2; 1.91.4;
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.90 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.89 18-Aug-2009  macallan we need sys/exec_aout.h here
CV: Enter Log. Lines beginning with `CVS:' are removed automatically
 1.88 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.87 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.86 12-Nov-2008  ad branches: 1.86.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.85 15-Oct-2008  wrstuden branches: 1.85.2;
Merge wrstuden-revivesa into HEAD.
 1.84 06-Aug-2008  martin We need socketvar.h now for struct sockopt.
 1.83 10-Jul-2008  nakayama Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.
 1.82 29-Jun-2008  nakayama branches: 1.82.2;
Constify initfpstate, and omit initialization for .fs_qsize.
 1.81 29-May-2008  mrg branches: 1.81.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.80 21-May-2008  ad Remove unneeded playing about with kernel_lock.
 1.79 24-Apr-2008  ad branches: 1.79.2; 1.79.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.78 09-Apr-2008  nakayama branches: 1.78.2;
Remove kernel locks around malloc introduced when I added SMP support.
 1.77 21-Mar-2008  ad Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.76 14-Mar-2008  nakayama Improve FPU state save/clear like x86, idea from OpenBSD.
 1.75 25-Feb-2008  nakayama process_read_fpregs(), process_write_fpregs():
- move common code before checking 32-bit mode or 64-bit mode.

process_read_fpregs(), netbsd32_process_read_fpregs():
- copy out %fsr.

process_write_fpregs():
- don't copy in fregs if l->l_md.md_fpstate == NULL.
 1.74 20-Dec-2007  dsl branches: 1.74.2; 1.74.6;
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.73 17-Oct-2007  garbled branches: 1.73.4; 1.73.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.72 08-Jul-2007  pooka branches: 1.72.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.71 16-Mar-2007  dsl branches: 1.71.4;
Use NETBSD32PTR64() and NETBSD32PTR32() throughout.
 1.70 04-Mar-2007  christos branches: 1.70.2; 1.70.4; 1.70.6;
fix fallout from caddr_t changes.
 1.69 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.68 19-Feb-2007  cube Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.
 1.67 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.66 09-Feb-2007  ad branches: 1.66.2;
Merge newlock2 to head.
 1.65 21-Nov-2006  christos adjust limits takes struct proc again.
 1.64 21-Nov-2006  christos From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.
 1.63 22-Oct-2006  mrg don't drop const in cpu_setmcontext32().
 1.62 17-Jul-2006  martin branches: 1.62.4; 1.62.6;
Back out previous - it apparently was not even compile tested.
 1.61 15-Jul-2006  gdamore Remove unused memp. Fixes coverity CID 3713 from run 61.
 1.60 11-May-2006  mrg native_sigset13_to_sigset()'s first argument is a sigset13_t *.
 1.59 29-Mar-2006  cube 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.58 14-Mar-2006  cube branches: 1.58.2;
Add the sparc64 MD bits to get usable coredumps for COMPAT_NETBSD32
binaries.
 1.57 11-Feb-2006  cdi branches: 1.57.2; 1.57.4;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.56 24-Dec-2005  perry branches: 1.56.2; 1.56.4; 1.56.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.55 11-Dec-2005  christos merge ktrace-lwp.
 1.54 27-Oct-2005  martin Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork
 1.53 24-Sep-2005  christos branches: 1.53.2;
need compat/sys/signfo.h
 1.52 13-Sep-2005  christos compat reorg.
 1.51 11-Jul-2005  martin Make sure we get the SUN4U version of the sparc frame.h defines.
(Otherwise frame32 is undefined and compilation of the netbsd32 lkm
fails.)
 1.50 10-Jul-2005  martin Add siginfo based signal delivery.
 1.49 03-Jul-2005  cube branches: 1.49.2;
Constify machine32 and machine_arch32.
 1.48 03-Jul-2005  cube Make COMPAT_NETBSD32 emulate hw.machine. While it might seem wrong to do
so, it introduces breakage because a lot of applications make assumptions
from its value. It's especially bad in the sparc64 case, where 64-bits
instructions can be used in 32-bits addressing mode. However, there are
other means to know the capabilities of the CPU.
 1.47 10-Jun-2005  matt 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.46 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.45 26-Mar-2005  fvdl Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.44 08-Nov-2004  kleink branches: 1.44.4; 1.44.6; 1.44.10;
From machdep.c:
revision 1.173
date: 2004/11/08 16:11:02; author: kleink; state: Exp; lines: +3 -3
In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.
 1.43 17-Sep-2004  skrll 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.42 15-Jan-2004  mrg begin to implement some ifreq ioctls... long long way to go.
 1.41 09-Nov-2003  martin bzero/bcopy -> memset/memcpy
 1.40 26-Oct-2003  christos Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.
 1.39 21-Oct-2003  fvdl Fix NULL assignment to an integer field.
 1.38 14-Oct-2003  christos Make COMPAT_NETBSD32 compile again (untested)
 1.37 28-Sep-2003  martin Ansify and add missing include.
 1.36 26-Sep-2003  christos catch up with const sigset_t
 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  martin struct proc * -> struct lwp *
 1.32 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.31 16-Apr-2003  dsl change 'data' arg of fo_ioctl to void * to match file.h
 1.30 09-Feb-2003  martin Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.
 1.29 24-Jan-2003  nakayama fix kernel build error, such a configs w/o kbd, ms.
(approved by martin)
 1.28 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.27 02-Nov-2002  mrg make compat_13_netbsd32_sigreturn() and netbsd32___sigreturn14() almost identical.
 1.26 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.25 07-Jul-2002  fvdl netbsd32_sysarch moved here.
 1.24 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.23 14-Jun-2002  eeh Provide the correct architecture for HW_MACHINE_ARCH so things like
"sysctl -p" can tell they are in 32-bit land.
 1.22 20-Mar-2002  christos branches: 1.22.4; 1.22.6;
kill remaining PS_STRINGS instances.
 1.21 03-Jan-2002  mrg clean up
 1.20 03-Jan-2002  mrg move sparc specific ioctl handling (fb & openprom) into arch/sparc64.
 1.19 08-Dec-2001  thorpej Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
 1.18 21-Sep-2001  thorpej branches: 1.18.4;
More sunos32 fallout.
 1.17 30-Jun-2001  eeh branches: 1.17.2; 1.17.4;
Handle proper saving of the fpstate.
 1.16 07-Jun-2001  mrg move ev_out32() here.
 1.15 06-Jun-2001  mrg set the coredump32 hook. make LKM friendly.
 1.14 09-May-2001  kleink Sync with native emul: rename sc_tstate to sc_psr.
 1.13 09-May-2001  kleink Make restoring the PSR ICC bits really work in __sigreturn14().
 1.12 12-Feb-2001  mrg branches: 1.12.2;
type cleanups.
 1.11 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.10 28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.9 01-Aug-2000  eeh Cleanup trapframe and TSTATE handling.
 1.8 09-Jul-2000  mrg remove unused variable.
 1.7 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 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.5 30-Dec-1999  eeh branches: 1.5.4;
Update COMPAT_NETBSD32 stuff.
 1.4 06-Nov-1999  eeh Explicitly use 32-bit and 64-bit types.
 1.3 11-Oct-1999  eeh branches: 1.3.2; 1.3.4;
Update to post 1.4.
 1.2 25-Mar-1999  mrg branches: 1.2.8;
clean and up make compile
 1.1 25-Mar-1999  mrg move sparc32 MD bits here.
 1.2.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.3 12-Mar-2001  bouyer Sync with HEAD.
 1.3.2.2 05-Jan-2001  bouyer Sync with HEAD
 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.4.4 09-May-2001  he Pull up revision 1.13 (requested by kleink):
Restore PSR ICC bits correctly from sigcontext.
 1.5.4.3 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.5.4.2 07-Aug-2000  mrg pull up 1.9 (approved by thorpej):
>Cleanup trapframe and TSTATE handling.
 1.5.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.12.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.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.17.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.17.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.4.13 11-Nov-2002  nathanw Catch up to -current
 1.18.4.12 18-Oct-2002  nathanw Catch up to -current.
 1.18.4.11 23-Aug-2002  petrov sync
 1.18.4.10 01-Aug-2002  nathanw Catch up to -current.
 1.18.4.9 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.18.4.8 20-Jun-2002  nathanw Catch up to -current.
 1.18.4.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.18.4.6 11-Jan-2002  nathanw More catchup.
 1.18.4.5 08-Jan-2002  nathanw Catch up to -current.
 1.18.4.4 04-Jan-2002  eeh Implement upcalls and cpu_preempt().
 1.18.4.3 04-Jan-2002  eeh Cleanup.
 1.18.4.2 17-Nov-2001  martin Sparc64 *context routines, from Klaus Klein.
 1.18.4.1 21-Sep-2001  martin file netbsd32_machdep.c was added on branch nathanw_sa on 2001-11-17 12:24:20 +0000
 1.22.6.1 15-Jun-2002  lukem Pull up revision 1.23 (requested by eeh in ticket #275):
Provide the correct architecture for HW_MACHINE_ARCH so things like
"sysctl -p" can tell they are in 32-bit land.
 1.22.4.2 17-Jul-2002  gehenna catch up with -current.
 1.22.4.1 15-Jul-2002  gehenna catch up with -current.
 1.34.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.34.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.34.2.5 14-Nov-2004  skrll Sync with HEAD.
 1.34.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.34.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.34.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.34.2.1 03-Aug-2004  skrll Sync with HEAD
 1.44.10.3 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.44.10.2 13-Jul-2005  tron Pull up revision 1.51 (requested by martin in ticket #585):
Make sure we get the SUN4U version of the sparc frame.h defines.
(Otherwise frame32 is undefined and compilation of the netbsd32 lkm
fails.)
 1.44.10.1 11-Jul-2005  tron Pull up revision 1.50 (requested by martin in ticket #571):
Add siginfo based signal delivery.
 1.44.6.1 26-Mar-2005  yamt sync with head.
 1.44.4.1 29-Apr-2005  kent sync with -current
 1.49.2.8 24-Mar-2008  yamt sync with head.
 1.49.2.7 17-Mar-2008  yamt sync with head.
 1.49.2.6 27-Feb-2008  yamt sync with head.
 1.49.2.5 21-Jan-2008  yamt sync with head
 1.49.2.4 03-Sep-2007  yamt sync with head.
 1.49.2.3 26-Feb-2007  yamt sync with head.
 1.49.2.2 30-Dec-2006  yamt sync with head.
 1.49.2.1 21-Jun-2006  yamt sync with head.
 1.53.2.1 02-Nov-2005  yamt sync with head.
 1.56.6.2 01-Jun-2006  kardel Sync with head.
 1.56.6.1 22-Apr-2006  simonb Sync with head.
 1.56.4.1 09-Sep-2006  rpaulo sync with head
 1.56.2.1 18-Feb-2006  yamt sync with head.
 1.57.4.2 11-May-2006  elad sync with head
 1.57.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.57.2.2 24-May-2006  yamt sync with head.
 1.57.2.1 01-Apr-2006  yamt sync with head.
 1.58.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.58.2.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.62.6.1 10-Dec-2006  yamt sync with head.
 1.62.4.4 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.62.4.3 12-Jan-2007  ad Sync with head.
 1.62.4.2 11-Jan-2007  ad Checkpoint work in progress.
 1.62.4.1 18-Nov-2006  ad Sync with head.
 1.66.2.3 24-Mar-2007  yamt sync with head.
 1.66.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.66.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.70.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.70.4.1 11-Jul-2007  mjf Sync with head.
 1.70.2.2 15-Jul-2007  ad Sync with head.
 1.70.2.1 10-Apr-2007  ad Sync with head.
 1.71.4.1 03-Oct-2007  garbled Sync with HEAD
 1.72.10.3 23-Mar-2008  matt sync with HEAD
 1.72.10.2 09-Jan-2008  matt sync with HEAD
 1.72.10.1 06-Nov-2007  matt sync with HEAD
 1.73.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.73.4.1 26-Dec-2007  ad Sync with head.
 1.74.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.74.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.74.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.74.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.74.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.74.2.1 24-Mar-2008  keiichi sync with head.
 1.78.2.2 04-Jun-2008  yamt sync with head
 1.78.2.1 18-May-2008  yamt sync with head.
 1.79.4.6 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.79.4.5 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.79.4.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.79.4.3 23-May-2008  wrstuden Re-add userret hook. Add a new define, SA_NO_USERRET, which
indicates that upcall support should NOT be included. Add this
for all non-netbsd emulations. They will never be SA apps, so
let's make the invarient pretty blatant.

NetBSD code should include both sys/sa.h and sys/savar.h.
 1.79.4.2 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.79.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.79.2.4 11-Aug-2010  yamt sync with head.
 1.79.2.3 11-Mar-2010  yamt sync with head
 1.79.2.2 19-Aug-2009  yamt sync with head.
 1.79.2.1 04-May-2009  yamt sync with head.
 1.81.2.2 18-Jul-2008  simonb Sync with head.
 1.81.2.1 03-Jul-2008  simonb Sync with head.
 1.82.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.82.2.1 19-Oct-2008  haad Sync with HEAD.
 1.85.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.85.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.86.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.91.4.2 05-Mar-2011  rmind sync with head
 1.91.4.1 30-May-2010  rmind sync with head
 1.91.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.93.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.93.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.95.8.3 02-Jun-2012  mrg sync to latest -current.
 1.95.8.2 24-Feb-2012  mrg sync to -current.
 1.95.8.1 18-Feb-2012  mrg merge to -current.
 1.95.4.4 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.95.4.3 30-Oct-2012  yamt sync with head
 1.95.4.2 23-May-2012  yamt sync with head.
 1.95.4.1 17-Apr-2012  yamt sync with head
 1.96.2.2 15-Nov-2015  bouyer Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.96.2.1 21-May-2012  riz branches: 1.96.2.1.4; 1.96.2.1.6;
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.96.2.1.6.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.96.2.1.4.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.98.2.3 03-Dec-2017  jdolecek update from HEAD
 1.98.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.98.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.99.2.1 18-May-2014  rmind sync with head
 1.103.8.2 30-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1677):

sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.103.8.1 16-Nov-2015  msaitoh Pull up following revision(s) (requested by martin in ticket #1028):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
- Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
- Fix kmem_free() size mismatch
- Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.103.6.2 05-Dec-2016  skrll Sync with HEAD
 1.103.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.103.4.2 30-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1677):

sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.103.4.1 16-Nov-2015  msaitoh branches: 1.103.4.1.4;
Pull up following revision(s) (requested by martin in ticket #1028):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
- Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
- Fix kmem_free() size mismatch
- Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.103.4.1.4.1 30-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1677):

sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.109.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.110.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.110.16.1 10-Jun-2019  christos Sync with HEAD
 1.110.14.8 25-Jan-2019  pgoyette Move the netbsd32_machine32_hook into the main kernel with most of
the other hooks.

Although this hook might better belong in compat/netbsd32/ code,
there are some machines without a netbsd32 module (for example, i386
and sgimips) which still have consumers/users of this hook. :(
 1.110.14.7 24-Jan-2019  pgoyette Rework placement of the new netbsd32_machine32_hook
 1.110.14.6 24-Jan-2019  pgoyette Replace weak symbol definition for machine32 with a hook. Our in-kernel
linker doesn't handle weak symbols, so this prevented us from loading the
compat_linux32 module.

XXX There don't seem to be any other consumers of machine32 (nor does
XXX there seem to be any consumers of machine_arch32), even though it
XXX is defined for aarch64, arm32, and riscv).
 1.110.14.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.110.14.4 21-Jan-2019  pgoyette No need to declare the hook_call() function for void hooks. So
remove and simplify.
 1.110.14.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.110.14.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.110.14.1 30-Sep-2018  pgoyette Split sparc64/netbsd32_machdep.c into pieces specific to versions _13
and _16

XXX Somehow this has broken compat_sunos - must investigate further
 1.110.8.1 27-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1173):
sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/riscv/riscv/sig_machdep.c: revision 1.2
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.5 14-Dec-2023  andvar Use console_debugger() vs Debugger() which allows to avoid #ifdef DDB blocks.

From uwe@
 1.4 13-Dec-2023  andvar Add #ifdef DDB blocks around Debugger(); calls to make kernel build without DDB.
 1.3 30-Jan-2019  hannken branches: 1.3.4;
Make this compile with "options DEBUG".
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 30-Sep-2018  pgoyette branches: 1.1.2;
file netbsd32_machdep_13.c was initially added on branch pgoyette-compat.
 1.1.2.2 02-Oct-2018  pgoyette Remove conditional compilation based on COMPAT_SUNOS - just update the
sf_scp field regardless. We've previously removed the comparison that
checks if a lwp's emul is emul_sunos, so now we can also remove the
include for "opt_sunos.h"
 1.1.2.1 30-Sep-2018  pgoyette Split sparc64/netbsd32_machdep.c into pieces specific to versions _13
and _16

XXX Somehow this has broken compat_sunos - must investigate further
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 30-Jan-2019  christos file netbsd32_machdep_13.c was added on branch phil-wifi on 2019-06-10 22:06:48 +0000
 1.6 06-Nov-2021  thorpej COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.
 1.5 27-Oct-2021  thorpej Use the signal trampoline version constants from <sys/signal.h>.
 1.4 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.3 01-Mar-2019  pgoyette branches: 1.3.4;
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.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 30-Sep-2018  pgoyette branches: 1.1.2;
file netbsd32_machdep_16.c was initially added on branch pgoyette-compat.
 1.1.2.6 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.5 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.1.2.4 01-Jan-2019  pgoyette Bring in some fixes from HEAD to address a couple of build breaks (in
i386 ipmi driver and sun2 rump tests). Also fix a 'resolve conflict'
from previous commit in sparc64

With this, I am able to successfully build 66 out of 67 architectures
(the same architectures as handled by the releng build server. The
only exception is evbarm64 which has a strange build failure during
the installcd step - the same failure occurs on HEAD. It seems to be
something in the build itself, perhaps a difference between handling
of -O vs -M (MAKEOBJDIR vs MAKEOBJDIRPREFIX).
 1.1.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.2.2 02-Oct-2018  pgoyette Remove conditional compilation based on COMPAT_SUNOS - just update the
sf_scp field regardless. We've previously removed the comparison that
checks if a lwp's emul is emul_sunos, so now we can also remove the
include for "opt_sunos.h"
 1.1.2.1 30-Sep-2018  pgoyette Split sparc64/netbsd32_machdep.c into pieces specific to versions _13
and _16

XXX Somehow this has broken compat_sunos - must investigate further
 1.3.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 01-Mar-2019  christos file netbsd32_machdep_16.c was added on branch phil-wifi on 2019-06-10 22:06:48 +0000
 1.6 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.5 10-Nov-2007  dsl branches: 1.5.14; 1.5.16; 1.5.18; 1.5.20;
Constants for system call number now start NETBSD32_SYS_
netbsd32 for sprac64 builds again.
 1.4 11-Dec-2005  christos branches: 1.4.30; 1.4.48; 1.4.50; 1.4.54; 1.4.56;
merge ktrace-lwp.
 1.3 14-Oct-2003  christos branches: 1.3.16;
Make COMPAT_NETBSD32 compile again (untested)
 1.2 05-May-2002  thorpej branches: 1.2.10;
Add .register directives to appease newer gas.
 1.1 06-Jun-2001  mrg branches: 1.1.2; 1.1.4; 1.1.10;
extract the netbsd32, sunos, 32 bit svr4 and 64 bit svr4 sigcode out into
separate files, so that compat lkms can link with them as well.
 1.1.10.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.10.1 06-Jun-2001  nathanw file netbsd32_sigcode.s was added on branch nathanw_sa on 2002-06-20 03:41:33 +0000
 1.1.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.1 21-Jun-2001  nathanw Catch up to -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 15-Nov-2007  yamt sync with head.
 1.4.56.1 19-Nov-2007  mjf Sync with HEAD.
 1.4.54.1 13-Nov-2007  bouyer Sync with HEAD
 1.4.50.1 09-Jan-2008  matt sync with HEAD
 1.4.48.1 11-Nov-2007  joerg Sync with HEAD.
 1.4.30.1 03-Dec-2007  ad Sync with HEAD.
 1.5.20.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5.18.1 04-May-2009  yamt sync with head.
 1.5.16.1 04-Jun-2008  yamt sync with head
 1.5.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.51 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.50 17-Mar-2022  andvar revert broken to borken, it is used spelling in BSD and "tastes better that way".
 1.49 16-Mar-2022  andvar s/paniced/panicked/ and s/borken/broken/ in comments.
 1.48 10-Jan-2022  palle sun4v: add function to retrieve hypervisor api version
 1.47 03-Jul-2021  palle sun4v: add support for hypervisor soft state - from OpenBSD
 1.46 07-Jul-2016  msaitoh branches: 1.46.34;
KNF. Remove extra spaces. No functional change.
 1.45 30-Dec-2015  jdc Restrict the check for fully specified interrupts to machines with psycho
controllers only, and adjust comments to note this.

See also the mail thread starting at:
http://mail-index.NetBSD.org/port-sparc64/2015/12/03/msg002488.html
 1.44 02-Mar-2015  nakayama prom_printf converts "\n" to "\r\n" internally, so omit "\r".
 1.43 06-Sep-2014  palle branches: 1.43.2;
sun4v: New function prom_startcpu_by_cpuid() necessary for starting cpus on sun4v
 1.42 04-May-2014  martin branches: 1.42.2; 1.42.4;
The OF_test_method() function takes an instance handle, not a phandle,
and returns 0 on success.
Pointed out by Mark Cave-Ayland.
 1.41 07-Jan-2014  palle branches: 1.41.2;
sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
 1.40 09-Jul-2013  martin Make dubious code that skips a few interrupts hardcoded print a verbose
message asking the user to mail us details. This will also alarm us
should the strange test sometimes in the future trigger eroneously
on newer hardware.
 1.39 08-Jul-2013  mhitch Changes from OpenBSD to OF_mapintr(). Adds support for PCIe. My Ultra 45
now can install from the CD, I can access USB flash drives, and the onboard
bge interfaces now work. Tested on some other machines by jdc.
 1.38 17-Jul-2011  joerg branches: 1.38.2; 1.38.12; 1.38.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.37 20-Feb-2010  martin Select the shutdown method for secondary CPUs by available firmware
methods, not properties of the CPU.
Inspired by OpenSolaris, pointed out by eeh.
 1.36 26-Nov-2009  mrg branches: 1.36.2;
report the old -> new interrupt mapping when swizzling. minor KNF.
 1.35 18-May-2009  nakayama Using OpenFirmware calls properly about 64-bit physical address handling.
Old code trancate a physical address to 32-bit width. Idea from OpenBSD.
 1.34 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.33 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.32 13-Dec-2008  mrg branches: 1.32.2;
if the "interrupt-map-mask" property is larger than the static 100 int
array, dynamically allocate the desired size and try again.

fixes crashes in OF_mapintr() when there are 102 entries.
 1.31 03-Oct-2006  mrg branches: 1.31.52; 1.31.56; 1.31.64;
need an extra (u_long) to convert a 32 bit pointer to a cell_t.
 1.30 10-Jun-2006  rjs branches: 1.30.6; 1.30.8;
Add opt_multiprocessor.h.
 1.29 11-Feb-2006  cdi branches: 1.29.2; 1.29.8;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.28 11-Dec-2005  christos branches: 1.28.2; 1.28.4; 1.28.6;
merge ktrace-lwp.
 1.27 31-May-2005  christos branches: 1.27.2;
- sprinkle const
- avoid shadowed variables
 1.26 11-Feb-2005  simonb White space nit- don't put a space before/after increment/decrement
operators.
 1.25 18-Jun-2004  martin branches: 1.25.4; 1.25.6;
Fix small glitches to make SMP kernels compile again.
 1.24 02-Jun-2004  martin From Peter Eisch: do not try to recover msgbuf on E450s, it fails just
like on E250s.
 1.23 21-Mar-2004  pk OF_stdin() and OF_stdout() are obsolete.
 1.22 21-Mar-2004  pk Drop prom_printf() + some other unused stuff.
 1.21 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.20 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.19 21-Oct-2003  petrov Don't assign/compare integer and NULL.
 1.18 08-Sep-2003  petrov OF_mapintr: swizzle interrupt for PCI bridges,
don't process OBP interrupts, return error if interrupt is not mapped.
 1.17 15-Jul-2003  lukem __KERNEL_RCSID()
 1.16 20-Jul-2001  eeh branches: 1.16.6; 1.16.22;
PCI overhaul.
 1.15 21-Jun-2001  eeh branches: 1.15.2;
Be a bit more consistent about returning errors.
 1.14 11-Sep-2000  eeh Fix some sign extension bugs.
 1.13 28-Aug-2000  eeh Fix E250 identification.
 1.12 24-Aug-2000  eeh Add workaround for E250s.
 1.11 26-Jun-2000  pk prom_claim_phys: it appears one result argument too many was specified.
Now we can return the actual result of the call rather than merely
reflecting the input.
 1.10 26-Jun-2000  pk prom_claim_phys: set `align' parameter to 0 (meaning: get the chunk at the
specified address).
 1.9 19-May-2000  eeh branches: 1.9.4;
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.8 22-May-1999  eeh branches: 1.8.2;
Fix OF_stdin() to return "stdin" not "stdout" so we really can get console input.
 1.7 10-Jan-1999  mrg branches: 1.7.4;
KNF nits i have sat on for too long.
 1.6 09-Jan-1999  eeh Properly check address returned by OBP for errors in prom_map_msgbuf().
 1.5 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.4 27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.3 23-Aug-1998  eeh Work on 32-bit cleanup.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.7.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.4.2 17-Oct-2000  tv Pullup 1.10-1.14 [eeh]:
Fix some sign extension bugs.
 1.9.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.15.2.1 03-Aug-2001  lukem update to -current
 1.16.22.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.22.4 15-Feb-2005  skrll Sync with HEAD.
 1.16.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.22.1 03-Aug-2004  skrll Sync with HEAD
 1.16.6.2 20-Jul-2001  eeh PCI overhaul.
 1.16.6.1 20-Jul-2001  eeh file ofw_machdep.c was added on branch nathanw_sa on 2001-07-20 00:07:15 +0000
 1.25.6.1 12-Feb-2005  yamt sync with head.
 1.25.4.1 29-Apr-2005  kent sync with -current
 1.27.2.2 30-Dec-2006  yamt sync with head.
 1.27.2.1 21-Jun-2006  yamt sync with head.
 1.28.6.1 22-Apr-2006  simonb Sync with head.
 1.28.4.1 09-Sep-2006  rpaulo sync with head
 1.28.2.1 18-Feb-2006  yamt sync with head.
 1.29.8.1 19-Jun-2006  chap Sync with head.
 1.29.2.1 26-Jun-2006  yamt sync with head.
 1.30.8.1 22-Oct-2006  yamt sync with head
 1.30.6.1 18-Nov-2006  ad Sync with head.
 1.31.64.2 28-Apr-2009  skrll Sync with HEAD.
 1.31.64.1 19-Jan-2009  skrll Sync with HEAD.
 1.31.56.3 11-Mar-2010  yamt sync with head
 1.31.56.2 20-Jun-2009  yamt sync with head
 1.31.56.1 04-May-2009  yamt sync with head.
 1.31.52.1 17-Jan-2009  mjf Sync with HEAD.
 1.32.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.36.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.38.16.2 18-May-2014  rmind sync with head
 1.38.16.1 28-Aug-2013  rmind sync with head
 1.38.12.2 03-Dec-2017  jdolecek update from HEAD
 1.38.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.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.2.1 10-Aug-2014  tls Rebase.
 1.42.4.1 26-Jan-2016  riz Pull up following revision(s) (requested by jdc in ticket #1069):
sys/arch/sparc64/sparc64/ofw_machdep.c: revision 1.45
Restrict the check for fully specified interrupts to machines with psycho
controllers only, and adjust comments to note this.
See also the mail thread starting at:
http://mail-index.NetBSD.org/port-sparc64/2015/12/03/msg002488.html
 1.42.2.1 26-Jan-2016  riz Pull up following revision(s) (requested by jdc in ticket #1069):
sys/arch/sparc64/sparc64/ofw_machdep.c: revision 1.45
Restrict the check for fully specified interrupts to machines with psycho
controllers only, and adjust comments to note this.
See also the mail thread starting at:
http://mail-index.NetBSD.org/port-sparc64/2015/12/03/msg002488.html
 1.43.2.3 09-Jul-2016  skrll Sync with HEAD
 1.43.2.2 19-Mar-2016  skrll Sync with HEAD
 1.43.2.1 06-Apr-2015  skrll Sync with HEAD
 1.46.34.1 01-Aug-2021  thorpej Sync with HEAD.
 1.9 19-Sep-2025  thorpej Fix think-o in previous; the handle is needed in the envctrl case
(when passed-in node != 0).
 1.8 18-Sep-2025  thorpej In the "i2c-child-devices" array, don't pass in a "cookie" and "cookietype".
Instead, just create the appropriate devhandle and pass that along as a
data object.
 1.7 23-Dec-2020  jdc branches: 1.7.4; 1.7.14;
Add GPIO pin alert definitions for the E250.
Note, that the front panel also applies to the E450.
 1.6 29-Oct-2020  jdc branches: 1.6.2;
Add information about GPIO pin assignments and drive bays in the E250 and
v240. Consolidate common code for v210/v240 and E250.
Modify the GPIO pin names to include a type (currently LED or INDICATOR)
which we can then handle in the driver.
 1.5 25-Oct-2020  jdc Don't release the last reference to the "i2c-child-devices" dictionary in
the v210/v240 patches.
Fixes missing i2c devices there (pointed out by macallan@).
While here, add debug to show when we create the dictionary.
 1.4 24-Oct-2020  jdc Add E250 i2c devices missing from the OFW tree.
Normalise the spelling of "temperature".
 1.3 23-Oct-2020  jdc Add missing prop_object_release() to the E250/E450 patches.
Use the recently added (in r1.2) functions for SPARCle i2c devices too.
Simplify adding "compatible" entries and handle cases where there is none.
 1.2 23-Oct-2020  jdc Move E250 and E450 i2c patches from dev/pcfiic_ebus.c to sparc64/ofw_patch.c.
They are now co-located with the other OFW patch routines.
New i2c devices are created for E250/E450 and v210/v240, so create new
functions to avoid duplicate code.
 1.1 16-Oct-2020  jdc Move OFW patching routines into their own file.
 1.6.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.7.14.8 13-Sep-2021  thorpej Move the i2c enumeration helpers to their own header file to detangle
it from reliance on "iic" being configured into the kernel.
 1.7.14.7 12-Sep-2021  thorpej - add_i2c_devices(): because we're matching on phandle path, we can be
visited multiple times for the same phandle (once for the controller,
once for the "iic" bus instances, which inherit's the controller's
phandle). Detect this and avoid allocating a redundant i2c_fixup_container.
- sparc64_device_tree_fixup(): this is called before machine_model[] is
initialized, so don't make any permanent decisions until it has been.
 1.7.14.6 12-Sep-2021  thorpej Fix dum-dum pointer mistake.
 1.7.14.5 11-Sep-2021  thorpej Add a devhandle_subclass() helper function to simplify the common case
and use it. Improve some comments.
 1.7.14.4 11-Sep-2021  thorpej No longer need to fixup the devhandle for the "pmu" i2c bus node,
since of_i2c_enumerate_devices() now handles it.
 1.7.14.3 11-Sep-2021  thorpej Re-factor the code in sandpoint and sparc64 that enumerates a static
table of i2c device entries into something sharable.
 1.7.14.2 10-Sep-2021  thorpej Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones
that remain as XXX.
 1.7.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.7.4.3 16-May-2021  thorpej - i2c_fixup_enumerate_devices(): handle getting a NULL "compatible"
property.
- sparcle_smbus_fixup(): remove bogus place-holder compatible properties
for the SPD entries.
 1.7.4.2 15-May-2021  thorpej Fix the path to the E450 envctrl DT node. Thanks, he@!
 1.7.4.1 15-May-2021  thorpej - Move all of the stuff-missing-from-OFW-device-tree stuff into a
new function sparc64_device_tree_fixup(), and call it from
device_register().
- sparc64_device_tree_fixup() is table-driven, selecting the table
based on the machine_model. It can appy "dtnode" fixups (by matching
the device's OFW path) and "special" fixups, which are especially
useful when a property needs to be added to another device that happens
to not be in the OFW device tree.
- Implement enumeration of missing-from-OFW-device-tree i2c devices
by "sub-classing" the controller's device handle, intercepting the
"i2c-enumerate-devices" device call. We let the "super" first
enumerate any i2c devices that are in the OFW device tree, and then
enumerate our own additions after that is done. i2c additions are
provided by the machine_model fixup tables.
 1.4 29-Oct-2020  jdc branches: 1.4.6; 1.4.16;
Add information about GPIO pin assignments and drive bays in the E250 and
v240. Consolidate common code for v210/v240 and E250.
Modify the GPIO pin names to include a type (currently LED or INDICATOR)
which we can then handle in the driver.
 1.3 23-Oct-2020  jdc Move E250 and E450 i2c patches from dev/pcfiic_ebus.c to sparc64/ofw_patch.c.
They are now co-located with the other OFW patch routines.
New i2c devices are created for E250/E450 and v210/v240, so create new
functions to avoid duplicate code.
 1.2 17-Oct-2020  jdc Avoid declaring autoconf_debug twice when building with DEBUG.
Pointed out by palle@ - thanks!
 1.1 16-Oct-2020  jdc Move OFW patching routines into their own file.
 1.4.16.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.4.6.1 15-May-2021  thorpej - Move all of the stuff-missing-from-OFW-device-tree stuff into a
new function sparc64_device_tree_fixup(), and call it from
device_register().
- sparc64_device_tree_fixup() is table-driven, selecting the table
based on the machine_model. It can appy "dtnode" fixups (by matching
the device's OFW path) and "special" fixups, which are especially
useful when a property needs to be added to another device that happens
to not be in the OFW device tree.
- Implement enumeration of missing-from-OFW-device-tree i2c devices
by "sub-classing" the controller's device handle, intercepting the
"i2c-enumerate-devices" device call. We let the "super" first
enumerate any i2c devices that are in the OFW device tree, and then
enumerate our own additions after that is done. i2c additions are
provided by the machine_model fixup tables.
 1.19 21-Mar-2004  pk Reach over to the sparc openfirm & openprom implementation.
 1.18 12-Jan-2004  petrov Fix 32bit kernel build, pointed by Juergen Hannken-Illjes.
 1.17 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.16 15-Jul-2003  lukem __KERNEL_RCSID()
 1.15 05-Oct-2001  eeh branches: 1.15.4; 1.15.20;
Make OF_interpret() handle input and output arguments.
 1.14 24-Sep-2001  wiz 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.13 21-Jun-2001  eeh branches: 1.13.2; 1.13.4;
Be a bit more consistent about returning errors.
 1.12 30-May-2001  mrg use _KERNEL_OPT
 1.11 18-Nov-2000  mrg branches: 1.11.2;
sync with sparc port. add support for OF_setprop(), OF_nextprop(),
OF_interpret() and OF_milliseconds().
 1.10 12-Jun-2000  eeh Fix OF_val2sym and OF_sym2val.
 1.9 06-Apr-2000  mrg branches: 1.9.2;
add some more casts to shut up gcc.
 1.8 31-Oct-1999  mrg make this compile in the absense of DDB.
 1.7 24-Nov-1998  mrg branches: 1.7.10; 1.7.12; 1.7.14;
bring a prom_printf prototype into scope.
 1.6 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.5 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.4 23-Aug-1998  eeh Work on 32-bit cleanup.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.7.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.12.1 15-Nov-1999  fvdl Sync with -current
 1.7.10.2 22-Nov-2000  bouyer Sync with HEAD.
 1.7.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.11.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.13.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.13.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.13.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.20.1 03-Aug-2004  skrll Sync with HEAD
 1.15.4.2 05-Oct-2001  eeh Make OF_interpret() handle input and output arguments.
 1.15.4.1 05-Oct-2001  eeh file openfirm.c was added on branch nathanw_sa on 2001-10-05 21:52:44 +0000
 1.17 21-Mar-2004  pk Reach over to the sparc openfirm & openprom implementation.
 1.16 19-Mar-2004  pk Use prom_getoptionsnode().
 1.15 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.14 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.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 15-Jul-2003  lukem __KERNEL_RCSID()
 1.11 29-Jun-2003  fvdl branches: 1.11.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.10 29-Jun-2003  martin struct proc * -> struct lwp *
 1.9 17-May-2003  nakayama Avoid strict-alias warnings in gcc 3.3.
 1.8 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.7 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.6 10-Jan-2002  briggs branches: 1.6.8;
Add OPIOCFINDDEVICE to match dev/ofw/openfirmio.[ch].
 1.5 10-Jan-2002  briggs In OPIOCNEXTPROP: if we are at the last property, set the buffer length to
0 instead of setting it to an uninitialized value (len).
 1.4 10-Jan-2002  briggs Use nextsibling() and firstchild() instead of (unset) promvec.
 1.3 26-Sep-2001  eeh branches: 1.3.4;
getprop* -> PROM_getprop*
 1.2 18-Nov-2000  mrg branches: 1.2.2; 1.2.4;
use OpenFirmware, not prom version 0, operations. eeprom(8) works now.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 22-Nov-2000  bouyer Sync with HEAD.
 1.2.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.2.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.2.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.4.5 11-Nov-2002  nathanw Catch up to -current
 1.3.4.4 17-Sep-2002  nathanw Catch up to -current.
 1.3.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.3.4.2 11-Jan-2002  nathanw More catchup.
 1.3.4.1 26-Sep-2001  nathanw file openprom.c was added on branch nathanw_sa on 2002-01-11 23:38:46 +0000
 1.6.8.1 17-May-2002  gehenna Add device switch.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.319 09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.318 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.317 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.316 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.315 06-Apr-2022  riastradh sparc64/pmap: Nix trailing whitespace.
 1.314 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.313 01-Jan-2022  hannken Remove an "#ifdef DIAGNOSTIC", KASSERT() always conumes its expression.
 1.312 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.311 15-Dec-2019  ad Merge from yamt-pagecache:

- do gang lookup of pages using radixtree.
- remove now unused uvm_object::uo_memq and vm_page::listq.queue.
 1.310 10-Jan-2019  mrg - move pmap_ctx() macro into pmap.h instead of duplicating it.
- fix description of some mach ddb commands.
 1.309 29-Nov-2018  palle sun4v: fix incorrect calculation of phys addr for the mdesc - now the virtual-devices can (again) be detected (worked previously...)
 1.308 27-Jan-2018  chs branches: 1.308.2; 1.308.4;
apply the change from arch/x86/x86/pmap.c rev. 1.266 commitid vZRjvmxG7YTHLOfA:

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them. If we are replacing an existing mapping,
reuse the pv structure where possible.

This implements the requirement that pmap_enter(PMAP_CANFAIL) must not fail
when replacing an existing mapping with the first mapping of a new page,
which is an unintended consequence of the changes from the rmind-uvmplock
branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries. This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before. It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706 on the remaining platforms where
this problem existed.
 1.307 10-Feb-2017  palle branches: 1.307.6;
sun4v: Added handling of trap type 0x034 (address alignment error) + fixed typo mmfsa -> mmufsa. Verified for both sun4u and sun4v using qemu.
 1.306 28-Dec-2016  martin branches: 1.306.2;
Rename the "flush" macro to "sparc_flush_icache", the former is way too
generic for a macro name.
 1.305 22-Dec-2016  cherry switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.
 1.304 04-Nov-2016  macallan add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE
 1.303 07-Jul-2016  msaitoh branches: 1.303.2;
KNF. Remove extra spaces. No functional change.
 1.302 17-Apr-2016  martin Move the SMP-disabled hack for SUN4V a bit earlier
 1.301 03-Feb-2016  palle sun4v: extend dmmu_set_secondary_context() to handle both sun4u and sun4v. ok martin@
 1.300 27-Nov-2015  joerg Left-shift of negative values is UB.
 1.299 08-Sep-2015  nakayama Fix build w/o options SUN4V.

mdesc_get_len() and mdesc_init() are used outside of #ifdef SUN4V,
and eliminated by optimization if SUN4V isn't defined.
 1.298 06-Sep-2015  nakayama Use <machine/*.h> instead of <sparc64/*.h> for consistency.
 1.297 06-Sep-2015  martin On SUN4V make the mdesc data available early in pmap_bootstrap, so we
can set up the uvm page colors correctly.
Based on code from palle@.
 1.296 15-Jun-2015  martin Slightly optimize the ITLB usage on secondary processors
 1.295 14-Jun-2015  martin 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.
 1.294 16-Apr-2015  mrg make some DEBUG code in pmap_clear_reference() UP-only
 1.293 05-Apr-2015  palle sun4v: Ensure that the W (Write) bit is not present in the TTEs unless for the data mapping. This way the permanent mappings for the primary cpu done by ofwboot are the same as the permanent mappings for the secondary cpus done by the kernel. This should fix an issue when booting the kernel on a T2 based system (T5120).
 1.292 04-Nov-2014  palle branches: 1.292.2;
sun4v: Removed a bunch of ifdef SUN4V since the CPU_ISSUN4V already has the necessary logic. Noticed by mrg@
 1.291 30-Oct-2014  palle sun4v: ensure that the X (eXecute) bit is set in the TTE
 1.290 04-Sep-2014  palle sun4v: All cpus must be setup with a TSB descriptor, so pmap_setup_tsb_sun4v() must take a pointer to the TSB descriptor
 1.289 10-Jul-2014  jdc branches: 1.289.2;
Increase maximum MSGBUFSIZE to 248k.
While here, remove 2 sparc(32)-only entries (from mrg@).
 1.288 05-Jun-2014  palle sun4v: note missing handling in pmap_calculate_colors()
 1.287 21-May-2014  palle Removed duplicate call to prom_map_phys()
 1.286 09-Jan-2014  palle branches: 1.286.2;
Coding style fixes (whitespace) - no functional changes
 1.285 07-Jan-2014  palle sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
 1.284 28-Dec-2013  nakayama Make 32-bit kernel buildable again.
 1.283 27-Dec-2013  palle a) make the hunt through the cpus list more generic b) sun4v: ensure that the interrupt stack is mapped permanently and the TSB is setup properly - parts from OpenBSD. OK martin@
 1.282 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.281 11-Sep-2013  martin Disallow MAP_FIXED mmap's in the sparc64 VA hole (XXX - need to deal with
different variants of the hole for different CPU types)
 1.280 25-Jan-2013  hannken branches: 1.280.2;
Update the DEBUG section at the tail of pmap_clear_modify().

Nothing prevents page modification after the modify bit was
cleared but before the DEBUG section checks pmap_is_modified(),
so remove this check.

For the same reason "modified" and "changed" may differ, so only
check "modified" implies "changed" here.

Ok: Matthew Green <mrg@netbsd.org>
 1.279 03-Jan-2013  martin Rearange VA layout for 64 bit kernels, as suggested by Lars Heidieker:
move the dynamic kernel memory past 4GB (basically unlimiting it) and
use the now freed address range past kernel data upto 2GB for modules.
 1.278 25-Mar-2012  mrg branches: 1.278.2;
reduce the #ifdef DEBUG usage by using the optimiser.
 1.277 18-Mar-2012  mrg take the pmap_lock in pmap_protect().

hopefully this will avoid a problem in pmap_clear_reference()
detecting a reference remaining at the end.

when we remove most/all pmap_lock uses we probably need to remove
this check entirely, but for now this seems better.
 1.276 06-Feb-2012  martin Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng
 1.275 12-Jul-2011  mrg branches: 1.275.2; 1.275.6;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.274 18-Jun-2011  nakayama Add fast softint(9) support for sparc64.

Reviewed on port-sparc64.
 1.273 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.272 06-Jun-2011  mrg re-implement blast_dcache() and blast_icache() via function pointers so that
we can set these to functions that simply return on sun4us/sun4v systems.

also include some work-in-progress #if 0'ed code to do the same for the
dcache_flush*() functions.


(some of these could probably move into the cpuinfo except that sparc64
systems don't really ever work with mismatches AFAICT.)
 1.271 12-May-2011  mrg branches: 1.271.2;
first steps towards fujitsu SPARC64 support:

- use cputyp when writing the kernel core
 1.270 24-Feb-2011  mrg blast_dcache() does the right thing for MP or !MP, so just use it.
 1.269 12-Nov-2010  uebayasi branches: 1.269.2; 1.269.4;
Put VM_PAGE_TO_MD() definition in one place. No functional changes.
 1.268 02-Nov-2010  uebayasi Oops, fix build !DIAGNOSTICS again.
 1.267 02-Nov-2010  uebayasi Fix DIAGNOSTIC build. Pointed out by Juergen Hannken-Illjes.
 1.266 30-Oct-2010  uebayasi Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional
changes.
 1.265 29-Jul-2010  hannken Add vm page flag PG_MARKER and use it to tag dummy marker pages
in genfs_do_putpages() and uao_put().
Use 'v_uobj.uo_npages' to check for an empty memq.
Put some assertions where these marker pages may not appear.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
 1.264 18-May-2010  mrg move the mutex_init() for ci_ctx_lock inside cpu_attach() so that
we don't try to mutex_init() before lockdebug is available.

fixes LOCKDEBUG crashes at startup (for USII systems.)
 1.263 30-Mar-2010  mrg fix a KASSERT() in the previous. add a couple of comments.
 1.262 28-Mar-2010  mrg - add a kmutex_t ci_ctx_lock to struct cpu_info, and initialise it in
cpu_pmap_init() and replace pmap_ctx_lock usage with this new ci_ctx_lock

- replace smp_dcache_flush_page_all() with smp_dcache_flush_page_cpuset(),
that flushes only on the set of CPUs not, everyone. add new
dcache_flush_page_cpuset() to flush this page from the D$ only
on the specified set of CPUs.

- add a cpuset to pmap_free_page() and use it when freeing PTE pages
when a pmap is destroyed

- introduce pmap_free_page_noflush(), and use it when we allocated a
page for PTEs but didn't use it and don't need to flush it

- don't bother with pmap_lock in pmap_extract(), the only potential
issue is pseg_get() which is already safe


tested on sb2000, sb2500 and ultra80 with a bunch of various heavy
workloads, and seems to give a clear 1-2% speed up for high-forking /
short lived processes, such as ./configure.
 1.261 21-Mar-2010  mrg since pmap_activate/pmap_deactivate need to not block, but the rest of
pmap is OK, add a new IPL_VM pmap_ctx_lock that is held while allocating
or freeing a context, and revert pmap_lock back to IPL_NONE.

i considered a per-cpu context lock, but that would require locking
each active CPUs lock in turn in pmap_remove_all() and pmap_destroy().


thanks to ad for explaining how these parts interact.
 1.260 20-Mar-2010  mrg convert pmap_lock into an IPL_VM lock, and avoid calling
KASSERT(!mutex_owned(&pmap_lock)) since that's no longer valid.

this fixes hangs on 4-core machines like the U80.

tested on U80, SB2500 and SB2000.


XXX: my initial attempts to replace pseg_lock with this new equivalent
XXX: lock hang in pmap_bootstrap it seems.. but this should be able
XXX: to go away now.
 1.259 10-Mar-2010  mrg branches: 1.259.2;
XXX: workaround we'd like to remove when pmap / uvm locking is cleaned up:

- rename pseg_get() and pseg_set() to pseg_get_real() and pseg_set_real().
- if USE_LOCKSAFE_PSEG_GETSET is defined, which it current is by default,
define pseg_[gs]et() in terms of functions that take a new pseg_lock
mutex at IPL_VM while calling into the real functions.

this seems to avoid the pseg_set() crashes we've seen:
1 - spare needed, when pseg_get() just worked for this pmap
2 - the 2rd ldxa via ASI_PHYS_CACHED in pseg_set() loads garbage
into %o4, and causes the 3rd ldxa to fault
 1.258 08-Mar-2010  mrg blast_dcache() SMP friendly:

- blast_dcache() becomes sp_blast_dcache(dcache_size, dcache_line_size)
- new smp_blast_dcache(sparc64_cpuset_t) that blasts the D$ on this cpuset
- sparc64_ipi_blast_dcache() to support the above
- in pmap_remove_all(), when freeing mmu contexts for this pmap, mark
the set of cpus to blast the d$ on as well and convert the
blast_dcache() call into smp_blast_dcache() on the cpus who ran this
pmap, or, sp_blast_dcache(dcache_size, dcache_line_size)
- convert the remaining blast_dcache() in machdep.c to sp_blast_dcache()
- in pmap_destroy()/pmap_remove_all() take the pmap_lock() always since
we assert it is held always.

with these changes, NFS builds on the U60 seem to be stable now, and
the USIII machines also can often complete a single build.sh run now,
diskful or diskless.


reviewed by mlelstv and partially by martin, tested by martin and myself,
with some ideas from chuq as well.
 1.257 06-Mar-2010  mrg clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.256 04-Mar-2010  mrg avoid a build error in the previous for !DEBUG kernels.
 1.255 04-Mar-2010  mrg - in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.
 1.254 24-Feb-2010  mrg check for TLB_V bit for valid tte entries, not against zero.
KASSERT() the 3rd call to pseg_get() in pmap_page_cache() like the other 2.
 1.253 24-Feb-2010  mrg when handing back page table pages to UVM, flush them from the dcache
on all CPUs.

idea from skrll@, and makes my disk-based SB2000 stable.

tested on U60, SB2000 and SB2500.
 1.252 24-Feb-2010  mrg - re-introduce sp_tlb_flush_pte() and sp_tlb_flush_all() that call
the right USI/USIII version.
- define tlb_flush_pte() in terms of sp_tlb_flush_pte() for the
!MULTIPROCESSOR case

this centralises some CPU_IS_USIII_UP() tests.
 1.251 13-Feb-2010  mrg in pmap_growkernel(), make sure we only mutex_exit() if we mutex_enter()ed.
 1.250 05-Feb-2010  martin branches: 1.250.2;
Avoid taking a (not yet) initialized mutex early during bootstrap.
 1.249 02-Feb-2010  mrg - split sp_tlb_flush_pte() and switchtoctx() into sp_tlb_flush_pte_us()/
sp_tlb_flush_pte_usiii() and switchtoctx_us()/switchtoctx_usiii() and
implement the latter while i'm here. it works ... sometimes i think,
but also sometimes panics/hangs.
- fix a comment in sparc64_ipi_flush_pte_usiii()
 1.248 01-Feb-2010  mrg - sp_tlb_flush_all() becomes sp_tlb_flush_all_us() and sp_tlb_flush_all_usiii()
- sparc64_ipi_flush_pte() becomes sparc64_ipi_flush_pte_us() and
sparc64_ipi_flush_pte_usiii()
- add some commented out code to disable interrupts and raise the traplevel
in sparc64_ipi_flush_pte_usiii()
- cache_flush_phys() was missing a little of code in the cheetah case
 1.247 01-Feb-2010  mrg - add a PDB_CTX_FLUSHALL debug type to pmap.c, and also log the cpu_number()
in a bunch more cases

- make sparc64_ipi_halt_thiscpu() and sparc64_ipi_pause_thiscpu() return void,
their callers never checked anyway.

- remove prototypes for sparc64_ipi_flush_ctx() and sparc64_ipi_flush_all(),
there are no such functions
 1.246 10-Jan-2010  skrll s/cpu_switch/cpu_switchto/ in comment.
 1.245 05-Dec-2009  mrg from openbsd:
>Don't use u_int to store a 64-bit address. Found with help from miod.
>Makes a Sun Fire V490 boot without spending ages in bus_dmamem_alloc(9).
 1.244 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.243 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.242 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.241 26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.240 24-Oct-2009  nakayama Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.
 1.239 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.238 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.237 09-Aug-2009  martin Fix misplaced #endif, from Henning Petersen in PR port-sparc64/41856
 1.236 21-Apr-2009  cegger change pmap flags argument from int to u_int.
discussed with christos@ on source-changes-d@
 1.235 18-Mar-2009  cegger bcopy -> memcpy
 1.234 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.233 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.232 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.231 10-Dec-2008  pooka branches: 1.231.2;
Make kernel_pmap_ptr a const. Requested by steve_martin.
 1.230 10-Dec-2008  martin Backout previous - Matt, you probably did a partial update and didn't
pick up the sys/uvm changes.
 1.229 10-Dec-2008  mrg fix sparc64 build: provide pmap_kernel(), re-provide pmap_t.

fixes builds for my U60.
 1.228 09-Dec-2008  martin Get rid of get_maxctx() - it doesn't work on newer cpus and we will have
to find a better way for (some) sun4v machines - all sun4u use 13 bit
contexts anyway.
 1.227 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.226 22-Nov-2008  spz pmap_is_referenced_locked() is relevant for non-MULTIPROCESSOR systems too,
says martin@
 1.225 18-Oct-2008  nakayama branches: 1.225.2; 1.225.4;
- fix corner case bugs.
- avoid unnecessary write backs.
- remove meaningless local variable usages.
 1.224 13-Oct-2008  nakayama Avoid local include.
 1.223 06-Oct-2008  nakayama Conform previous commit to KNF, pointed out by ad@.
 1.222 05-Oct-2008  nakayama pmap_cache: use BLOCK_SIZE as alignment.
pmap_pv_cache: use large size groups (PR_LARGECACHE) like x86.
 1.221 23-Sep-2008  martin pmap_is_modified() and pmap_is_referenced(): when we don't find a cached
positive answer in the list head, make sure to aquire pmap_lock before
traversing the pv list (and update the cache in head).
Fixes a diagnostic debugger call reported by Havard Eidnes.
 1.220 27-Aug-2008  martin Turn a printf into a DEB
 1.219 17-Jun-2008  ad branches: 1.219.2;
Use UVM_OBJ_INIT/DESTROY.
 1.218 04-Jun-2008  ad branches: 1.218.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.217 13-Apr-2008  ad branches: 1.217.2; 1.217.4; 1.217.6;
Don't allocate or free pv_entry_t with pmap_lock held. Requested by martin@.
Untested.
 1.216 28-Mar-2008  martin Now that we have per-cpu-contexts, checking the context on the local cpu
to find out if a pmap is on some mmu does not realy work any more.
 1.215 25-Mar-2008  martin Make the debug message that triggered in PR 38297 slightly more verbose
 1.214 22-Mar-2008  nakayama Add more assertion.
 1.213 22-Mar-2008  nakayama Lock also on freeing own context, and add assertion.
 1.212 14-Mar-2008  nakayama Complete per-CPU TSBs and MMU contexts changes.
 1.211 02-Mar-2008  nakayama - make interrupt pending list per-CPU.
- make tickintr() MP-safe.
- remove unused port-sparc derived interrupt code.

Ok by martin@.
 1.210 28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.209 18-Jan-2008  martin branches: 1.209.2; 1.209.6;
Extend the MD kernel core header, so that crashdumps record enough
information to recover all per-cpu mappings. This provides access to
the interrupt stack for example.
 1.208 08-Jan-2008  ad pmap_destroy: cast return of atomic_dec_uint_nv to (int) to avoid leaking
pmaps. The refcount can be zero due to pmap_remove_all. Problem found by
tnn@.
 1.207 06-Jan-2008  martin Remove superflouse extern decls.
 1.206 06-Jan-2008  martin Move the mutex_init of pmap_lock even later into pmap_init().
This makes LOCKDEBUG kernels work again.
 1.205 06-Jan-2008  martin We can not mutex_init() before setting up the per-CPU mappings needed
by curcpu() - a LOCKDEBUG kernel will die otherwise.
 1.204 05-Jan-2008  ad Don't need sys/lock.h
 1.203 02-Jan-2008  ad Merge vmlocking2 to head.
 1.202 09-Dec-2007  martin branches: 1.202.2;
Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.
 1.201 05-Nov-2007  martin branches: 1.201.2; 1.201.4; 1.201.6;
Extend the sparc64 cpu kcore segment so that it records all kernel mappings
done via locked 4 MB pages. The old format could only record physically
continous kernel text mappings.
For compatibility reasons, just extend the structure and fill in all the
old fields as well.
 1.200 04-Nov-2007  martin cosmetics: use the "extern char ..[]" idiom for linker supplied addresses.
 1.199 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.198 01-Oct-2007  martin branches: 1.198.2;
On second thought: a valid mapping is a valid mapping, period.
No need to special case the kernel pmap here.
 1.197 30-Sep-2007  martin Add support to pmap_extract() for kernal mappings with PA 0.
 1.196 11-Sep-2007  martin branches: 1.196.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.
 1.195 06-Sep-2007  martin Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.
 1.194 06-Sep-2007  martin Do not call smp_tlb_flush_all() on every pmap_update() - it is too big
a hammer and papers over other problems. We need to revisit this and
fix it correctly soon.
 1.193 25-Aug-2007  martin branches: 1.193.2;
Remove INITSTACK completely - at the time we used to switch to it, we
already have access to all of lwp0 and it's uarea - so we can switch
to the correct lwp0 stack easily before calling main.
 1.192 16-Aug-2007  rjs Explicitly use trapframe64 instead of trapframe.
 1.191 14-Aug-2007  martin Complete initialization of lwp0 in pmap_bootstrap()
 1.190 23-May-2007  martin branches: 1.190.4; 1.190.8;
In pmap_kenter_pa honour VM_PROT_EXECUTE - otherwise LKMs are not mapped
executable.
Fixes PR port-sparc64/36376.
 1.189 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.188 30-Mar-2007  martin branches: 1.188.4;
When invalidating a context, make sure to flush user windows upfront.
Do not set the DMMU secondary context to 0 (that would be kernel), and
add a few required membars after switching the secondary dmmu context.

This avoids SIRs caused by double kernel_data_faults, caused by spills
of obsolete user windows after the context for that user pmap is gone.
 1.187 12-Mar-2007  ad branches: 1.187.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.186 04-Mar-2007  christos branches: 1.186.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.185 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.184 24-Nov-2006  wiz branches: 1.184.2; 1.184.4;
s/existance/existence/, from Zafer.
 1.183 24-Oct-2006  martin In the INTSTACK and KSTACK_VA special case treatment in pmap_exctract,
do not add the offset to the result - the calculated PA is the right
value - not the start of the page as in the other cases.
This fixes DMA to kernel stack, and avoids "fabricating a geometry"
warnings.
 1.182 22-Oct-2006  mrg correct a debug statement.
 1.181 20-Oct-2006  mrg avoid yet another GCC uninitialised warning at -O3.
 1.180 18-Oct-2006  martin Ooops, array initialization for the page size map differs in DEBUG and
other kernels - hide details in a macro.
Pointed out by Matthias Scheler.
 1.179 18-Oct-2006  martin Initializers
 1.178 17-Oct-2006  mrg allocate 128KB (as opposed to 64KB) per-cpu, and place the interrupt
stack, cpu_info structure, panicstack, idle uarea and normal kernel
stack in here. the idle uarea and kernel stack are in the 2nd 64KB
page. the interrupt stack and cpu_info structure are as the same
place in the 1st 64KB page, and the panicstack grows down from the
top of this page. update comments in param.h to suit (XXX: a lot
of these constants should move to a header file that will not pollute
the name space so much.) map these pages identically between
cpu_initialise() and cpu_mp_startup(), and deal with the two 64KB
pages in pmap_extract(). keep an unmapped 64KB page between them.

don't initialise the unused "ci_eintstack" member of the cpu_info
structure

use constants to initialise many addresses in the cpu_info structure,
consolidating these assignments from cpu0 and cpu>0

delete u0/estack0/panicstack from locore.s

clean up some wrong comments in locore.s

fix a 32bit-only bug in cpu_mp_startup().

delete 'u0' entirely.


this fixes recent random lossage seen on port-sparc64: processes
stuck in RUN state, data faults, and hangs.
 1.177 15-Oct-2006  martin Make -Wextra save
 1.176 03-Oct-2006  mrg redo previous: print these int64_t with PRIx64.
 1.175 03-Oct-2006  mrg in pmap_mp_init(), tag & data are 64 bit int's, print them as such.
also, fix up some comments and function names.
 1.174 18-Sep-2006  mrg pmap_bootstrap() gets a bit of SMP help:
- initialise bootcpu->ci_{cpcb,initstack}/proc0paddr from the
idle u area.
pmap_extract():
- make this work on the kernel interrupt stack as well

both of these are from petrov@ via martin@.

pmap_update(): XXX mark the MULTIPROCESSOR call to smp_tlb_flush_all().
 1.173 13-Sep-2006  mrg branches: 1.173.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.172 10-Jun-2006  rjs branches: 1.172.6;
Add opt_multiprocessor.h.
 1.171 20-Feb-2006  cdi branches: 1.171.2; 1.171.8;
Use ANSI-style function definitions and declarations.
 1.170 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.169 31-Jan-2006  nakayama branches: 1.169.2; 1.169.4;
Fix the new ofwboot boot problem with kernels where .text segment is smaller
than 4MB.

Unless this fix, boot failed with the message as below.

| panic: pmap_kextract: Address 0x1400000 is not from kernel space.
| Data segment is too small?
 1.168 27-Jan-2006  cdi Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.167 12-Jan-2006  cdi Fix 'memsize' value. pmap_bootstrap() calculates it as a PROM property
length but it is expected to contain a number of available memory regions
(e.g. in pmap_dumpsize() and pmap_dumpmmu()).
 1.166 24-Dec-2005  perry branches: 1.166.2;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.165 11-Dec-2005  christos merge ktrace-lwp.
 1.164 16-Jun-2005  briggs branches: 1.164.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.163 01-Jun-2005  jdc Add const (catching up with additions to MI ddb code).
 1.162 31-May-2005  christos - sprinkle const
- avoid shadowed variables
 1.161 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.160 22-Feb-2005  martin Cleanup: the PG_SZ macro was buggy (pointed out by Tim Newsham).
It was only used by (the also buggy/not ready for prime time) PMAP_PAGE_SIZE,
which in turn only was used in one place.

Get rid of all this and hardcode the result at the single place of use.
 1.159 03-Dec-2004  chs branches: 1.159.4; 1.159.6;
remove dead code and other minor cleaning.
 1.158 01-Dec-2004  martin Better return value checking for pseg_get/pseg_set. Turn Debugger() calls
into proper panics and sprinkle some KASSERTs. Closes PR 27288.
 1.157 01-Dec-2004  chs do the invalidation of the (virtually-addressed) L1 cache in pmap_remove_all()
(ie. just before we skip the per-page cache invalidations while tearing down
each context) instead of just before we recycle all the contexts in ctx_alloc().
the latter is not good enough since a (physically tagged) L1 cache line is
valid for all contexts, not just the one that was used to instantiate it.
fixes PRs 24126, 25669 and 27730.
 1.156 21-Mar-2004  pk branches: 1.156.2; 1.156.4;
Mostly switch to promlib interface. Postpone the use of prom_makememarr()
since the sparc64 memory range properties aren't compatible yet.

Fix pmap_calculate_colors() in the process.
 1.155 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.154 12-Feb-2004  chs pmap_activate() on pmap_kernel() should be a no-op.
needed for now while exiting processes "borrow" vmspace0,
but it's reasonable to check anyway.
 1.153 09-Jan-2004  chs make sure we free the context for the pmap in pmap_destroy().
this usually isn't necessary since we freed it earlier in pmap_remove_all(),
but since uvmspace_free() is now called in the context of the exiting
process, a new context might be allocated if uvm_unmap_detach() decides
to sleep (since cpu_switch() will allocate a new context when it switches
back to the exiting process).
 1.152 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.151 03-Dec-2003  petrov Use pmap_get_page return code instead, remove unused pmap_stats,
delete incorrect KASSERT in pmap_kenter_pa.
 1.150 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 1.149 09-Nov-2003  martin bzero/bcopy -> memset/memcpy
 1.148 26-Oct-2003  christos Fix uninitialized variable warning.
 1.147 21-Oct-2003  kleink Don't use NULL in integer-type assignments/comparisons.
 1.146 21-Oct-2003  petrov don't assign/compare integer and NULL.
 1.145 12-Oct-2003  chs cache_flush_virt() is buggy, just use blast_dcache() instead.
this should fix PR 23093.
 1.144 26-Sep-2003  chs in pmap_enter(), invalidate the TSBs before pre-loading the new values,
since we only pre-load one and the other one could be stale.
also, remove the bogus dcache_flush_page() from pmap_clear_modify() again,
since the problem it was intended to mask seems to have disappeared.
 1.143 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.142 15-Jul-2003  lukem __KERNEL_RCSID()
 1.141 17-May-2003  nakayama branches: 1.141.2;
Avoid strict-alias warnings in gcc 3.3.
 1.140 13-May-2003  martin Backout previous, it was apparently ovelooked when backing out the
change in other places.
 1.139 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.138 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.137 30-Mar-2003  thorpej Add some braces to make a block of code a bit easier to read.
 1.136 11-Mar-2003  martin Band aid - the infamous dcache_flush_page change independently suggested
by Andrey Petrov and Jason Thorpje (AFAIK).

This is a hack that covers some symptoms while we have no idea where
the real problem is. Anyway, since this avoids random data corruption
we better be safe and have this in-tree until the problem is solved the
right way.
 1.135 31-Jan-2003  martin Make the pmap count resident/wired mappings on the fly instead of
walking the page tables whenever this information is needed.

Add an option PMAP_COUNT_DEBUG to assert the new counts and the
page table walk agree.

The old solution had very bad performance impact, for example
by the high CPU load when running top(1).

Thanks to Simon Burge for pointing at the cause of the problem and
to Valeriy E. Ushakov for optimizing my simple minded assembler code.
 1.134 27-Jan-2003  martin Remove #if 0'd pmap_zero_page and pmap_copy_page, which are now
implemented in assembler in locore.s.
 1.133 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.132 15-Jan-2003  chs fix two bugs in my last pmap rework:
- in tlb_flush_all(), don't skip TLB entries with the high bit on,
I was confused about which MMU register it was using. it's also fine
to use the last hardware context.
- in pmap_create(), don't allocate a hardware context for the new pmap.
it's unnecessary, and when this would cause us to recycle all the contexts,
it would result in the current process's context being set to 0
(ie. the kernel's context). the current process could then return to
userspace without going through the context-switch code (and thus without
having a hardware context reallocated). this would lead to user mappings
being entered in the kernel's context later, causing all sorts of trouble.
add some assertions to catch this kind of thing.
 1.131 06-Jan-2003  wiz writable, not writeable.
 1.130 11-Nov-2002  chs remove some leftover debug code.
 1.129 01-Oct-2002  provos more trailing \r cleanup; pointed out by wiz
 1.128 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.127 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.126 03-Sep-2002  chs add back some cache flushes that are actually necessary.
any time we remove all access to a given virtual page,
we must invalidate the (write-through) L1 dcache.
pmap_remove() still had it, but pmap_kremove(), pmap_clear_reference()
and pmap_page_protect(VM_PROT_NONE) didn't and needed it.
fixes PR 18040.
 1.125 12-Aug-2002  mrg general clean up. should not affect anything. (this is part of a patch
from eeh to reduce frivolous cache flushes.)
 1.124 24-Jun-2002  eeh Fix compilation problems in DEBUG code.
 1.123 21-Jun-2002  eeh Use paddr_t for avail_start and avail_end so we can handle machines with
RAM above the 2GB mark.
 1.122 11-Jun-2002  eeh Do not truncate the kernel pmap physical address to an `int' before
sticking it in the context lookup table. Fixes a booting issue on
Netra T1125s.
 1.121 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.120 18-May-2002  eeh branches: 1.120.2;
Fix inverted comparison. We only wan to flush the I$ on *userland* executable
mappings.
 1.119 18-Apr-2002  eeh branches: 1.119.2;
Cleanup a bit and get rid of unnecessary cache flushes.
 1.118 14-Mar-2002  eeh Make pmap_protect() on wired mappings DTRT. Needed to toggle write protection
on the clock registers.
 1.117 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.116 27-Feb-2002  pk Calling pmap_zero_page() (in #if DEBUG section) from pmap_bootstrap() hangs
an E250; comment it out.
 1.115 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.114 02-Jan-2002  chs pmap_page_protect(VM_PROT_NONE) must remove all mappings in the PV list,
even if they are wired. we need to be able to remove all mappings to
pages that are being freed due to (eg.) file truncation.
 1.113 28-Sep-2001  chs branches: 1.113.4;
don't depend on other headers to include sys/proc.h for us.
 1.112 23-Sep-2001  chs implement pmap_wired_count().
 1.111 21-Sep-2001  eeh Clean up page allocations.
 1.110 18-Sep-2001  chs in pmap_clear_modify(), we need to clear the TLB_W bit (ie. the hardware
write-enable bit) to re-enable modify-bit emulation even if we're doing HWREF.
 1.109 15-Sep-2001  eeh Fix locking problem.
 1.108 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.107 31-Aug-2001  eeh branches: 1.107.2;
Change data segment size calculations so we don't need to resize if the
bootloader did it for us.
 1.106 09-Aug-2001  eeh pmap_kenter_pa() always creates privileged mappings.
No need to enter a no-fault mapping any more.
 1.105 31-Jul-2001  eeh Dump some enums that make lint unhappy and we never really use anyway.
 1.104 24-Jul-2001  wiz s/accellerate/accelerate/
 1.103 12-Jul-2001  eeh Set up proper cache colors.
 1.102 11-Jul-2001  eeh Fix math calculating the number of pages the kernel takes up.
Add some more asserts.
 1.101 05-Jul-2001  toshii branches: 1.101.2;
Fix typo. s/extention/extension/
 1.100 03-Jul-2001  chs change pmap_extract() to deal with unmapped addresses.
remove some unnecessary checks for unmanaged pages.
 1.99 21-Jun-2001  eeh Prevent a hang if trying to pmap_protect a page with wired mappings.
 1.98 21-Jun-2001  eeh Allow multiple 4MB pages for both kernel text and kernel data.

Note: DEBUG checks will not allow accesses to the hole between
text and data segments, so you may need to update programs that
use libkvm before relocating the start of kernel data.
 1.97 26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.96 17-May-2001  chs the call to uvm_km_valloc() in pmap_init() can end up triggering a call to
pmap_growkernel() on large memory machines. at this point we've already
called uvm_page_init(), so we can no longer use uvm_page_physget().
but the flag we use to decide whether to use uvm_page_physget() vs.
uvm_pagealloc() is only set at the end of pmap_init(), so we use
uvm_page_physget() anyway. switch to using uvm.page_init_done to decide
how to allocate pages, since that's the real indicator of when we have to
change methods.
 1.95 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.94 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.93 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.92 15-Mar-2001  chs eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.91 22-Jan-2001  eeh branches: 1.91.2;
Only panic if we can't allocate a PT page for the kernel pmap.
 1.90 14-Jan-2001  thorpej splimp() -> splvm()
 1.89 14-Jan-2001  thorpej splpmap() -> splvm()
 1.88 03-Jan-2001  eeh Fix faults caused by incorrect cacheing information in the pv_entry.
 1.87 30-Dec-2000  mjacob more missing #ifdef DEBUG goop
 1.86 29-Dec-2000  eeh Fix LOCKDEBUG issues.
 1.85 18-Dec-2000  mrg s/%qx/%llx/
 1.84 17-Dec-2000  pk Fix printf() pointer formats & make them work with a 32-bit compiler.
 1.83 10-Dec-2000  eeh Zero proc 0 stack pages so the pcb is cleared out before use.
 1.82 06-Dec-2000  mrg fix warnings in DEBUG & DIAGNSTIC code.
 1.81 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.80 01-Dec-2000  eeh Don't allow pmap_collect() to run on the kernel pmap since it will
undo the work of pmap_growkernel().
 1.79 10-Nov-2000  mrg remove unused variable
 1.78 02-Nov-2000  eeh pmap_growkernel() needs to return the new end of kernel.
 1.77 29-Oct-2000  eeh Add pmap_growkernel().
 1.76 19-Oct-2000  mrg #if 0 unused code.
 1.75 27-Sep-2000  eeh Add -V and -D bootflags to print out debug info in pmap_bootstrap() and
a fix for non-DEBUG kernels.
 1.74 12-Sep-2000  eeh This really does seem to fix the ref/mod issues. (Yeah, like were did we hear that before?)
 1.73 11-Sep-2000  eeh Add locking to pmap operations and support multiple physical memory segments.
 1.72 30-Aug-2000  soren Typo.
 1.71 02-Aug-2000  eeh PDB_BOOT and PDB_BOOT1 should not be the same value.
 1.70 01-Aug-2000  eeh Overhaul cache flush code and coredump code.
 1.69 31-Jul-2000  mrg define BDPRINTF in the !DEBUG case to nothing. PR#10688.
 1.68 27-Jul-2000  mrg fix warnings.
 1.67 18-Jul-2000  pk address casts: long -> u_long
 1.66 15-Jul-2000  eeh #ifdef BOOT_DEBUG --> BDPRINTF(PDB_BOOT, (...))
 1.65 14-Jul-2000  pk Back out previous for now; it requires a system wide prototype change.
 1.64 14-Jul-2000  pk Make `physmem' an `unsigned int', so it can properly represent large memory
configurations.
 1.63 30-Jun-2000  eeh Reserve a page for dumping the kernel.
 1.62 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.61 26-Jun-2000  pk We want prom_claim_phys() to return the address passed into it.
 1.60 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.59 25-Jun-2000  mrg <vm/vm_pageout.h> is already empty; kill it totally.
 1.58 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.57 24-Jun-2000  eeh More VM cleanup:

Move the cpu_info structure above the interrupt stack so it won't
get corrupted if the stack overflows.

Flush the D$ before and after all MMU bypass accesses since the
D$ latches all of those.
 1.56 19-Jun-2000  eeh branches: 1.56.2;
Have separate data and text segments, make text read-only.
 1.55 15-Jun-2000  mrg fix a couple of errors in the previous. from eeh.
 1.54 12-Jun-2000  eeh Start reorganizing the kernel for MULTIPROCESSOR support.
 1.53 17-May-2000  mrg branches: 1.53.2;
fix another warning.
 1.52 22-Apr-2000  mrg s#\b#\n# so an error message appears correctly.
 1.51 14-Apr-2000  mrg two more compiler warnings killed.
 1.50 08-Apr-2000  mrg add casts to stop gcc complaining
 1.49 06-Apr-2000  mrg add some more casts to shut up gcc.
 1.48 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.47 30-Dec-1999  eeh Mark page table pages as wired rather than busy.
 1.46 14-Nov-1999  eeh Change one more instance of `access_type' to `flags' in pmap_enter().
 1.45 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.44 12-Sep-1999  chs branches: 1.44.2; 1.44.4; 1.44.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.43 18-Jul-1999  eeh More fun with pmap.
 1.42 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.41 21-Jun-1999  eeh Clean this up a little. More later. (Gee, this really is becoming a huge
mess).
 1.40 17-Jun-1999  thorpej pmap_change_wiring() -> pmap_unwire().
 1.39 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.38 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.37 31-May-1999  eeh Garbage collect.
 1.36 30-May-1999  eeh Handle little-endian mapin requests.
 1.35 23-May-1999  mrg KNF nit.
 1.34 09-May-1999  eeh Fixup non-DEBUG kernels.
 1.33 25-Apr-1999  eeh Fix uninitialized variable bug in pmap_enter().
 1.32 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.31 28-Mar-1999  eeh branches: 1.31.2;
Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().
 1.30 28-Mar-1999  eeh Fix ref counting.
 1.29 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.28 26-Mar-1999  eeh COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.27 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.26 22-Mar-1999  eeh Flush D$ on bypass accesses.
 1.25 10-Mar-1999  eeh PMAP_PGARG doesn't do the right thing for us.
 1.24 28-Feb-1999  eeh Use block load/store in pmap_zero_page()/pmap_copy_page().
 1.23 16-Jan-1999  chuck MNN is no longer optional, remove dead code
 1.22 10-Jan-1999  mrg KNF nits i have sat on for too long.
 1.21 27-Nov-1998  eeh Calculate the size of the TSB correctly.
 1.20 24-Nov-1998  mrg #if 0 pv_syncflags as it is not used. avoid comments in comments.
 1.19 22-Nov-1998  mrg fix some warnings, and some not DEBUG problems.
 1.18 22-Nov-1998  eeh Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.
 1.17 22-Nov-1998  eeh ofwboot.elf is now ofwboot.
 1.16 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.15 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.14 09-Sep-1998  eeh Fix problems in global pagewalks.
 1.13 07-Sep-1998  eeh Misc. cleanup.
 1.12 06-Sep-1998  eeh 32-bit fixup.
 1.11 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.10 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.9 30-Aug-1998  eeh Some more 64-bit ification and I think I finally fixed the vref() panic.
 1.8 27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.7 26-Aug-1998  mrg deal with no DDB
 1.6 26-Aug-1998  mrg put pmapdebug usage inside #ifdef DEBUG
 1.5 23-Aug-1998  eeh Added pv_syncflags() (unused) and debug stuff.
 1.4 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.3 08-Jul-1998  thorpej branches: 1.3.2;
Define one page free list, and put all pages on it.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.2.4 09-Aug-1998  eeh General pmap and debug cleanup. Added PMAP_NEW support, but it doesn't work too well yet.
 1.3.2.3 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.3.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.3.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.31.2.1 16-Apr-1999  chs branches: 1.31.2.1.2;
pull up 1.31 -> 1.32:
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.31.2.1.2.3 02-Aug-1999  thorpej Update from trunk.
 1.31.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.31.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.44.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.44.4.1 15-Nov-1999  fvdl Sync with -current
 1.44.2.9 23-Apr-2001  bouyer Sync with HEAD.
 1.44.2.8 27-Mar-2001  bouyer Sync with HEAD.
 1.44.2.7 11-Feb-2001  bouyer Sync with HEAD.
 1.44.2.6 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.44.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.44.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.44.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.44.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.44.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.53.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.56.2.5 02-May-2001  he Apply patch (requested by martin):
Fix build problem without DEBUG defined.
 1.56.2.4 17-Oct-2000  tv Pullup 1.72-1.75 [eeh]:
Add -V and -D bootflags to print out debug info in pmap_bootstrap() and
a fix for non-DEBUG kernels.
 1.56.2.3 07-Aug-2000  mrg pull up 1.70, 1.71 (approved by thorpej):
>Overhaul cache flush code and coredump code.

>PDB_BOOT and PDB_BOOT1 should not be the same value.
 1.56.2.2 31-Jul-2000  mrg pull up 1.67 (approved by thorpej):
>address casts: long -> u_long
 1.56.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.91.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.91.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.101.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.101.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.101.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.101.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.101.2.4 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.101.2.3 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.101.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.101.2.1 03-Aug-2001  lukem update to -current
 1.107.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.113.4.17 15-Jan-2003  thorpej Sync with HEAD.
 1.113.4.16 07-Jan-2003  thorpej Sync with HEAD.
 1.113.4.15 20-Nov-2002  petrov remove extra bits in previous commit.
 1.113.4.14 20-Nov-2002  petrov catch-up lossage fixed.
 1.113.4.13 11-Nov-2002  nathanw Catch up to -current
 1.113.4.12 18-Oct-2002  nathanw Catch up to -current.
 1.113.4.11 06-Sep-2002  petrov Catch up.
 1.113.4.10 13-Aug-2002  nathanw Catch up to -current.
 1.113.4.9 01-Aug-2002  nathanw Catch up to -current.
 1.113.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.113.4.7 20-Jun-2002  nathanw Catch up to -current.
 1.113.4.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.113.4.5 28-Feb-2002  nathanw Catch up to -current.
 1.113.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.113.4.3 04-Jan-2002  eeh Cleanup.
 1.113.4.2 03-Jan-2002  petrov make kernel compile
 1.113.4.1 28-Sep-2001  petrov file pmap.c was added on branch nathanw_sa on 2002-01-03 06:42:36 +0000
 1.119.2.4 31-Aug-2002  gehenna catch up with -current.
 1.119.2.3 17-Jul-2002  gehenna catch up with -current.
 1.119.2.2 15-Jul-2002  gehenna catch up with -current.
 1.119.2.1 30-May-2002  gehenna Catch up with -current.
 1.120.2.5 14-Oct-2003  tron Pull up revision 1.145 via patch (requested by martin in ticket #1522):
cache_flush_virt() is buggy, just use blast_dcache() instead.
this should fix PR 23093.
 1.120.2.4 04-Sep-2002  lukem Pull up rev 1.126 via patch (requested by chuq in ticket #761):
add back some cache flushes that are actually necessary.
any time we remove all access to a given virtual page,
we must invalidate the (write-through) L1 dcache.
pmap_remove() still had it, but pmap_kremove(), pmap_clear_reference()
and pmap_page_protect(VM_PROT_NONE) didn't and needed it.
fixes PR 18040.
 1.120.2.3 24-Jun-2002  lukem Pull up revision 1.124 (requested by eeh in ticket #361):
Fix compilation problems in DEBUG code.
 1.120.2.2 21-Jun-2002  lukem Pull up revision 1.123 (requested by eeh in ticket #339):
Use paddr_t for avail_start and avail_end so we can handle machines with
RAM above the 2GB mark.
 1.120.2.1 12-Jun-2002  lukem Pull up revision 1.122 (requested by eeh in ticket #253):
Do not truncate the kernel pmap physical address to an `int' before
sticking it in the context lookup table. Fixes a booting issue on
Netra T1125s.
 1.141.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.141.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.141.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.141.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.141.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.141.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.141.2.1 03-Aug-2004  skrll Sync with HEAD
 1.156.4.2 07-Jan-2005  jdc Pull up revision 1.158 (requested by martin in ticket #1014).

Better return value checking for pseg_get/pseg_set. Turn Debugger() calls
into proper panics and sprinkle some KASSERTs. Closes PR 27288.
 1.156.4.1 07-Jan-2005  jdc Pull up revision 1.157 (requested by martin in ticket #1013).

do the invalidation of the (virtually-addressed) L1 cache in pmap_remove_all()
(ie. just before we skip the per-page cache invalidations while tearing down
each context) instead of just before we recycle all the contexts in ctx_alloc().
the latter is not good enough since a (physically tagged) L1 cache line is
valid for all contexts, not just the one that was used to instantiate it.
fixes PRs 24126, 25669 and 27730.
 1.156.2.2 07-Jan-2005  jdc Pull up revision 1.158 (requested by martin in ticket #1014).

Better return value checking for pseg_get/pseg_set. Turn Debugger() calls
into proper panics and sprinkle some KASSERTs. Closes PR 27288.
 1.156.2.1 07-Jan-2005  jdc Pull up revision 1.157 (requested by martin in ticket #1013).

do the invalidation of the (virtually-addressed) L1 cache in pmap_remove_all()
(ie. just before we skip the per-page cache invalidations while tearing down
each context) instead of just before we recycle all the contexts in ctx_alloc().
the latter is not good enough since a (physically tagged) L1 cache line is
valid for all contexts, not just the one that was used to instantiate it.
fixes PRs 24126, 25669 and 27730.
 1.159.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.159.6.1 26-Jan-2005  yamt convert arch/sparc64 to new apis.
 1.159.4.1 29-Apr-2005  kent sync with -current
 1.164.2.9 24-Mar-2008  yamt sync with head.
 1.164.2.8 17-Mar-2008  yamt sync with head.
 1.164.2.7 21-Jan-2008  yamt sync with head
 1.164.2.6 15-Nov-2007  yamt sync with head.
 1.164.2.5 27-Oct-2007  yamt sync with head.
 1.164.2.4 03-Sep-2007  yamt sync with head.
 1.164.2.3 26-Feb-2007  yamt sync with head.
 1.164.2.2 30-Dec-2006  yamt sync with head.
 1.164.2.1 21-Jun-2006  yamt sync with head.
 1.166.2.4 01-Mar-2006  yamt sync with head.
 1.166.2.3 18-Feb-2006  yamt sync with head.
 1.166.2.2 01-Feb-2006  yamt sync with head.
 1.166.2.1 15-Jan-2006  yamt sync with head.
 1.169.4.1 22-Apr-2006  simonb Sync with head.
 1.169.2.1 09-Sep-2006  rpaulo sync with head
 1.171.8.1 19-Jun-2006  chap Sync with head.
 1.171.2.2 14-Sep-2006  yamt sync with head.
 1.171.2.1 26-Jun-2006  yamt sync with head.
 1.172.6.2 12-Jan-2007  ad Sync with head.
 1.172.6.1 18-Nov-2006  ad Sync with head.
 1.173.2.2 10-Dec-2006  yamt sync with head.
 1.173.2.1 22-Oct-2006  yamt sync with head
 1.184.4.5 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.184.4.4 02-Apr-2007  rmind Pull up to the branch:
cvs rdiff -r1.42 -r1.43 src/sys/arch/sparc64/include/ctlreg.h
cvs rdiff -r1.187 -r1.188 src/sys/arch/sparc64/sparc64/pmap.c
Requested by mrg@
 1.184.4.3 24-Mar-2007  yamt sync with head.
 1.184.4.2 12-Mar-2007  rmind Sync with HEAD.
 1.184.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.184.2.5 16-Sep-2008  bouyer Sync with the following revisions (requested by skrll in ticket #1196):
gnu/dist/gdb removed
gnu/usr.bin/gdb53 removed
distrib/cats/instkernel/Makefile 1.14.6.1
gnu/dist/gdb6/bfd/config.bfd 1.3.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.c 1.1.1.2.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/Makefile.in 1.2.2.1.2.2
gnu/dist/gdb6/gdb/alpha-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alpha-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/alphabsd-nat.h 1.1.2.1
gnu/dist/gdb6/gdb/alphabsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphanbsd-nat.c 1.1.2.1
gnu/dist/gdb6/gdb/alphanbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64nbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/amd64nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/arm-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/armbsd-tdep.c 1.1.2.1
gnu/dist/gdb6/gdb/armnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/armnbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure.ac 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/m68kbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/mipsnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/nbsd-thread.c 1.1.2.3
gnu/dist/gdb6/gdb/ppcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/ppcnbsd-tdep.c 1.3.6.1
gnu/dist/gdb6/gdb/sh-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/shnbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/shnbsd-tdep.c 1.1.1.2.6.4
gnu/dist/gdb6/gdb/shnbsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc64nbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/sparcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/tramp-frame.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/vaxbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/config/alpha/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/arm/nbsd.mt 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/arm/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/i386/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/m68k/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/mips/nbsd.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/powerpc/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/sh/nbsd.mh 1.1.1.1.6.2
gnu/dist/gdb6/gdb/config/sh/tm-nbsd.h 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/vax/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/opcodes/configure 1.1.1.2.6.1
gnu/dist/gdb6/opcodes/configure.in 1.1.1.2.6.1
gnu/usr.bin/Makefile 1.126.4.1
gnu/usr.bin/gdb6/arch/alpha/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/alpha/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/init.c 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/nm.h 1.2.6.1
gnu/usr.bin/gdb6/arch/arm/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/arm/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/defs.mk 1.1.6.3
gnu/usr.bin/gdb6/arch/armeb/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/i386/defs.mk 1.4.4.1
gnu/usr.bin/gdb6/arch/i386/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68k/defs.mk 1.1.4.1
gnu/usr.bin/gdb6/arch/m68k/init.c 1.1.4.1
gnu/usr.bin/gdb6/arch/mipseb/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/mipseb/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/mipseb/init.c 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/config.h 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/defs.mk 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/init.c 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/tm.h 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/version.c 1.2.6.2
gnu/usr.bin/gdb6/arch/powerpc/defs.mk 1.3.6.1
gnu/usr.bin/gdb6/arch/powerpc/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/sh3eb/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3eb/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3eb/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3eb/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3el/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3el/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3el/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sparc/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/sparc64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc64/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/x86_64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/x86_64/init.c 1.1.6.1
gnu/usr.bin/gdb6/bfd/arch/armeb/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/vax/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/gdb/Makefile 1.5.2.1.2.2
gnu/usr.bin/gdb6/gdbtui/Makefile 1.2.6.1
gnu/usr.bin/gdb6/libiberty/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/sim/arch/mipseb/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/defs.mk 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/defs.mk 1.1.2.1
lib/libkvm/kvm_sparc64.c 1.10.18.2
lib/libpthread/pthread.c 1.48.6.4
lib/libpthread/pthread_barrier.c 1.6.18.1
lib/libpthread/pthread_cond.c 1.18.12.2
lib/libpthread/pthread_debug.h 1.8.18.1
lib/libpthread/pthread_int.h 1.34.4.5
lib/libpthread/pthread_lock.c 1.14.6.1
lib/libpthread/pthread_mutex.c 1.22.4.2
lib/libpthread/pthread_run.c 1.18.12.4
lib/libpthread/pthread_rwlock.c 1.13.6.2
lib/libpthread/pthread_sa.c 1.37.6.5
lib/libpthread/pthread_sig.c 1.47.4.8
lib/libpthread/pthread_sleep.c 1.7.6.2
lib/libpthread/sem.c 1.9.6.2
lib/libpthread/arch/sh3/pthread_md.h 1.3.6.1
regress/lib/libpthread/resolv/Makefile 1.1.12.1
regress/lib/libpthread/sigrunning/Makefile 1.1.2.1
regress/lib/libpthread/sigrunning/sigrunning.c 1.1.2.1
share/mk/bsd.own.mk 1.489.4.3
sys/arch/amd64/amd64/locore.S 1.18.14.1
sys/arch/amd64/amd64/machdep.c 1.44.2.3.2.1
sys/arch/amd64/conf/kern.ldscript 1.1.70.1
sys/arch/cats/conf/Makefile.cats.inc 1.17.30.1
sys/arch/shark/conf/Makefile.shark.inc 1.6.30.1
sys/arch/sparc64/conf/kern.ldscript 1.7.26.2
sys/arch/sparc64/conf/kern32.ldscript 1.6.26.2
sys/arch/sparc64/include/kcore.h 1.4.92.2
sys/arch/sparc64/sparc64/locore.s 1.232.4.4
sys/arch/sparc64/sparc64/machdep.c 1.193.4.3
sys/arch/sparc64/sparc64/pmap.c 1.184.2.1.2.4
sys/conf/newvers.sh 1.42.26.2
sys/kern/kern_sa.c 1.87.4.11
sys/kern/kern_synch.c 1.173.4.2
sys/sys/savar.h 1.20.10.2
tools/gdb/Makefile 1.9.4.1
tools/gdb/mknative-gdb 1.1.6.1

pullup the wrstuden-fixsa CVS branch to netbsd-4:
toolchain/35540 - GDB 6 support for pthreads.
port-sparc64/37534 - ktrace firefox gives
kernel trap 30: data access expection
GDB changes:
- delete gdb53
- enable gdb6 on all architectures
- add support for amd64 crash dumps
- add support for sparc64 crash dumps
- add support for /proc pid to executable filename for all archs
- enable thread support for all architectures
- add a note section to kernels to all platforms
- support detection/unwinding of signals for most architectures.
- Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT on sh3.
- Apply fix from binutils-current so that sparc gdb can be cross built
on a 64bit host.
SA/pthread changes:
Pre-allocate memory needed for event delivery. Eliminates dropped
interrupts under load.
Deliver intra-process signals to running threads
Eliminate some deadlock scenarios
Fix intra-process signal delivery when delivering to a thread waiting
for signals. Makes afs work again!
 1.184.2.4 01-Feb-2008  riz Pull up following revision(s) (requested by martin in ticket #983):
sys/arch/sparc64/include/kcore.h: revision 1.5
lib/libkvm/kvm_sparc64.c: revision 1.11
sys/arch/sparc64/sparc64/pmap.c: revision 1.201
Extend the sparc64 cpu kcore segment so that it records all kernel mappings
done via locked 4 MB pages. The old format could only record physically
continous kernel text mappings.
For compatibility reasons, just extend the structure and fill in all the
old fields as well.
Use the new sparc64 kcore cpu segment extensions to properly map VA/PAs
on kernels with more then 4 MB text/rodata segment.
 1.184.2.3 31-Aug-2007  liamjfoy Pull up following (requested by martin in ticket #854):

Now that we have fixed the per-cpu mappings, adapt pmap_extract() accordingly.
No equivalent change on head, second per-cpu page is not used there any more.
 1.184.2.2 25-May-2007  pavel Pull up following revision(s) (requested by martin in ticket #669):
sys/arch/sparc64/sparc64/pmap.c: revision 1.190
In pmap_kenter_pa honour VM_PROT_EXECUTE - otherwise LKMs are not mapped
executable.
Fixes PR port-sparc64/36376.
 1.184.2.1 31-Mar-2007  bouyer branches: 1.184.2.1.2;
Pull up following revision(s) (requested by martin in ticket #547):
sys/arch/sparc64/sparc64/pmap.c: revision 1.188
sys/arch/sparc64/include/ctlreg.h: revision 1.43
When invalidating a context, make sure to flush user windows upfront.
Do not set the DMMU secondary context to 0 (that would be kernel), and
add a few required membars after switching the secondary dmmu context.
This avoids SIRs caused by double kernel_data_faults, caused by spills
of obsolete user windows after the context for that user pmap is gone.
 1.184.2.1.2.4 18-Jan-2008  skrll Backported version of martin's changes to:

Extend the MD kernel core header, so that crashdumps record enough
information to recover all per-cpu mappings. This provides access to
the interrupt stack for example.
 1.184.2.1.2.3 30-Dec-2007  skrll Apply changes from ticket #983.

Modified Files:
src/sys/arch/sparc64/include: kcore.h
src/sys/arch/sparc64/sparc64: pmap.c

Log Message:
Extend the sparc64 cpu kcore segment so that it records all kernel mappings
done via locked 4 MB pages. The old format could only record physically
continous kernel text mappings.
For compatibility reasons, just extend the structure and fill in all the
old fields as well.

Modified Files:
src/lib/libkvm: kvm_sparc64.c

Log Message:
Use the new sparc64 kcore cpu segment extensions to properly map VA/PAs
on kernels with more then 4 MB text/rodata segment.
 1.184.2.1.2.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.184.2.1.2.1 04-Jun-2007  wrstuden Update to today's netbsd-4.
 1.186.2.6 03-Dec-2007  ad Sync with HEAD.
 1.186.2.5 09-Oct-2007  ad Sync with head.
 1.186.2.4 20-Aug-2007  ad Sync with HEAD.
 1.186.2.3 27-May-2007  ad Sync with head.
 1.186.2.2 10-Apr-2007  ad Sync with head.
 1.186.2.1 13-Mar-2007  ad Sync with head.
 1.187.2.1 11-Jul-2007  mjf Sync with head.
 1.188.4.3 03-Oct-2007  garbled Sync with HEAD
 1.188.4.2 26-Jun-2007  garbled Sync with HEAD.
 1.188.4.1 22-May-2007  matt Update to HEAD.
 1.190.8.5 06-Nov-2007  joerg Sync with HEAD.
 1.190.8.4 04-Nov-2007  jmcneill Sync with HEAD.
 1.190.8.3 02-Oct-2007  joerg Sync with HEAD.
 1.190.8.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.190.8.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.190.4.3 10-Sep-2007  skrll Sync with HEAD.
 1.190.4.2 03-Sep-2007  skrll Sync with HEAD.
 1.190.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.193.2.3 23-Mar-2008  matt sync with HEAD
 1.193.2.2 09-Jan-2008  matt sync with HEAD
 1.193.2.1 06-Nov-2007  matt sync with HEAD
 1.196.2.1 06-Oct-2007  yamt sync with head.
 1.198.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.201.6.1 11-Dec-2007  yamt sync with head.
 1.201.4.2 26-Dec-2007  ad Sync with head.
 1.201.4.1 10-Dec-2007  ad Checkpoint work in progress.
 1.201.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.202.2.3 19-Jan-2008  bouyer Sync with HEAD
 1.202.2.2 08-Jan-2008  bouyer Sync with HEAD
 1.202.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.209.6.7 17-Jan-2009  mjf Sync with HEAD.
 1.209.6.6 05-Oct-2008  mjf Sync with HEAD.
 1.209.6.5 28-Sep-2008  mjf Sync with HEAD.
 1.209.6.4 29-Jun-2008  mjf Sync with HEAD.
 1.209.6.3 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.209.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.209.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.209.2.1 24-Mar-2008  keiichi sync with head.
 1.217.6.3 10-Oct-2008  skrll Sync with HEAD.
 1.217.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.217.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.217.4.4 11-Aug-2010  yamt sync with head.
 1.217.4.3 11-Mar-2010  yamt sync with head
 1.217.4.2 19-Aug-2009  yamt sync with head.
 1.217.4.1 04-May-2009  yamt sync with head.
 1.217.2.1 17-Jun-2008  yamt sync with head.
 1.218.2.1 18-Jun-2008  simonb Sync with head.
 1.219.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.219.2.1 19-Oct-2008  haad Sync with HEAD.
 1.225.4.2 17-Mar-2010  snj Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
properly handle flushes in all cpus as necessary
 1.225.4.1 22-Nov-2008  snj branches: 1.225.4.1.4;
Pull up following revision(s) (requested by spz in ticket #107):
sys/arch/sparc64/sparc64/pmap.c: revision 1.226
pmap_is_referenced_locked() is relevant for non-MULTIPROCESSOR systems too,
says martin@
 1.225.4.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.225.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.225.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.231.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.250.2.7 06-Nov-2010  uebayasi Sync with HEAD.
 1.250.2.6 31-Oct-2010  uebayasi We already have a flag PMAP_NOCACHE. s/PMAP_UNMANAGED/PMAN_NOCACHE/.
Pointed out by Chuck Silvers, thanks.
 1.250.2.5 30-Oct-2010  uebayasi Implement pmap_physload_device(9) to replace xmd(4) MD backend.
Implement pmap_mmap(9) and use it from mem(4) and xmd(4).
 1.250.2.4 17-Aug-2010  uebayasi Sync with HEAD.
 1.250.2.3 30-Apr-2010  uebayasi Sync with HEAD.
 1.250.2.2 27-Apr-2010  uebayasi Support PMAP_UNMANAGED in some pmaps.

(Others should be converted eventually, but no problem while managed
device page is not used.)
 1.250.2.1 25-Feb-2010  uebayasi Use VM_PAGE_TO_MD(). Only compile tested.
 1.259.2.7 12-Jun-2011  rmind sync with head
 1.259.2.6 31-May-2011  rmind sync with head
 1.259.2.5 19-May-2011  rmind Implement sharing of vnode_t::v_interlock amongst vnodes:
- Lock is shared amongst UVM objects using uvm_obj_setlock() or getnewvnode().
- Adjust vnode cache to handle unsharing, add VI_LOCKSHARE flag for that.
- Use sharing in tmpfs and layerfs for underlying object.
- Simplify locking in ubc_fault().
- Sprinkle some asserts.

Discussed with ad@.
 1.259.2.4 11-Apr-2011  mrg don't take pmap_lock in a few places. there's a bunch more work
we can do in here, but i've run with this change for ages.
 1.259.2.3 05-Mar-2011  rmind sync with head
 1.259.2.2 30-May-2010  rmind sync with head
 1.259.2.1 16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.269.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.269.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.271.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.275.6.2 05-Apr-2012  mrg sync to latest -current.
 1.275.6.1 18-Feb-2012  mrg merge to -current.
 1.275.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.275.2.3 23-Jan-2013  yamt sync with head
 1.275.2.2 17-Apr-2012  yamt sync with head
 1.275.2.1 02-Dec-2011  yamt adapt sparc64. compile tested.
 1.278.2.3 03-Dec-2017  jdolecek update from HEAD
 1.278.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.278.2.1 25-Feb-2013  tls resync with head
 1.280.2.1 18-May-2014  rmind sync with head
 1.286.2.1 10-Aug-2014  tls Rebase.
 1.289.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.292.2.9 28-Aug-2017  skrll Sync with HEAD
 1.292.2.8 05-Feb-2017  skrll Sync with HEAD
 1.292.2.7 05-Dec-2016  skrll Sync with HEAD
 1.292.2.6 22-Apr-2016  skrll Sync with HEAD
 1.292.2.5 19-Mar-2016  skrll Sync with HEAD
 1.292.2.4 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.292.2.3 22-Sep-2015  skrll Sync with HEAD
 1.292.2.2 06-Jun-2015  skrll Sync with HEAD
 1.292.2.1 06-Apr-2015  skrll Sync with HEAD
 1.303.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.303.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.303.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.306.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.307.6.1 27-Feb-2018  martin Pull up following revision(s) (requested by mrg in ticket #593):
sys/dev/marvell/mvxpsec.c: revision 1.2
sys/arch/m68k/m68k/pmap_motorola.c: revision 1.70
sys/opencrypto/crypto.c: revision 1.102
sys/arch/sparc64/sparc64/pmap.c: revision 1.308
sys/ufs/chfs/chfs_malloc.c: revision 1.5
sys/arch/powerpc/oea/pmap.c: revision 1.95
sys/sys/pool.h: revision 1.80,1.82
sys/kern/subr_pool.c: revision 1.209-1.216,1.219-1.220
sys/arch/alpha/alpha/pmap.c: revision 1.262
sys/kern/uipc_mbuf.c: revision 1.173
sys/uvm/uvm_fault.c: revision 1.202
sys/sys/mbuf.h: revision 1.172
sys/kern/subr_extent.c: revision 1.86
sys/arch/x86/x86/pmap.c: revision 1.266 (via patch)
sys/dev/dtv/dtv_scatter.c: revision 1.4

Allow only one pending call to a pool's backing allocator at a time.
Candidate fix for problems with hanging after kva fragmentation related
to PR kern/45718.

Proposed on tech-kern:
https://mail-index.NetBSD.org/tech-kern/2017/10/23/msg022472.html
Tested by bouyer@ on i386.

This makes one small change to the semantics of pool_prime and
pool_setlowat: they may fail with EWOULDBLOCK instead of ENOMEM, if
there is a pending call to the backing allocator in another thread but
we are not actually out of memory. That is unlikely because nearly
always these are used during initialization, when the pool is not in
use.

Define the new flag too for previous commit.

pool_grow can now fail even when sleeping is ok. Catch this case in pool_get
and retry.

Assert that pool_get failure happens only with PR_NOWAIT.
This would have caught the mistake I made last week leading to null
pointer dereferences all over the place, a mistake which I evidently
poorly scheduled alongside maxv's change to the panic message on x86
for null pointer dereferences.

Since pr_lock is now used to wait for two things now (PR_GROWING and
PR_WANTED) we need to loop for the condition we wanted.
make the KASSERTMSG/panic strings consistent as '%s: [%s], __func__, wchan'
Handle the ERESTART case from pool_grow()

don't pass 0 to the pool flags
Guess pool_cache_get(pc, 0) means PR_WAITOK here.
Earlier on in the same context we use kmem_alloc(sz, KM_SLEEP).

use PR_WAITOK everywhere.
use PR_NOWAIT.

Don't use 0 for PR_NOWAIT

use PR_NOWAIT instead of 0

panic ex nihilo -- PR_NOWAITing for zerot

Add assertions that either PR_WAITOK or PR_NOWAIT are set.
- fix an assert; we can reach there if we are nowait or limitfail.
- when priming the pool and failing with ERESTART, don't decrement the number
of pages; this avoids the issue of returning an ERESTART when we get to 0,
and is more correct.
- simplify the pool_grow code, and don't wakeup things if we ENOMEM.

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them. This implements the requirement that
pmap_enter(PMAP_CANFAIL) must not fail when replacing an existing
mapping with the first mapping of a new page, which is an unintended
consequence of the changes from the rmind-uvmplock branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries. This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before. It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706, as well as the failing assertion
about "uvm_page_locked_p(old_pg)". (but only on x86, various other platforms
will need their own changes to handle this issue.)
In uvm_fault_upper_enter(), if pmap_enter(PMAP_CANFAIL) fails, assert that
the pmap did not leave around a now-stale pmap mapping for an old page.
If such a pmap mapping still existed after we unlocked the vm_map,
the UVM code would not know later that it would need to lock the
lower layer object while calling the pmap to remove or replace that
stale pmap mapping. See PR 52706 for further details.
hopefully workaround the irregularly "fork fails in init" problem.
if a pool is growing, and the grower is PR_NOWAIT, mark this.
if another caller wants to grow the pool and is also PR_NOWAIT,
busy-wait for the original caller, which should either succeed
or hard-fail fairly quickly.

implement the busy-wait by unlocking and relocking this pools
mutex and returning ERESTART. other methods (such as having
the caller do this) were significantly more code and this hack
is fairly localised.
ok chs@ riastradh@

Don't release the lock in the PR_NOWAIT allocation. Move flags setting
after the acquiring the mutex. (from Tobias Nygren)
apply the change from arch/x86/x86/pmap.c rev. 1.266 commitid vZRjvmxG7YTHLOfA:

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them. If we are replacing an existing mapping,
reuse the pv structure where possible.

This implements the requirement that pmap_enter(PMAP_CANFAIL) must not fail
when replacing an existing mapping with the first mapping of a new page,
which is an unintended consequence of the changes from the rmind-uvmplock
branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries. This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before. It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706 on the remaining platforms where
this problem existed.
 1.308.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.308.4.1 10-Jun-2019  christos Sync with HEAD
 1.308.2.2 18-Jan-2019  pgoyette Synch with HEAD
 1.308.2.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.26 09-Jan-2017  martin Do not use kmem_zalloc() to allocate an FP state - we have a special pool
for that.
 1.25 30-Dec-2016  christos - make fpreg{32,64} actually members of fsstate{32,64}.
- allocate fpstate if we did not have one and we need to write it.
 1.24 04-Jan-2014  dsl branches: 1.24.6; 1.24.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.23 21-Nov-2009  rmind branches: 1.23.12; 1.23.22; 1.23.26;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.22 29-Jun-2008  nakayama Constify initfpstate, and omit initialization for .fs_qsize.
 1.21 25-Feb-2008  nakayama branches: 1.21.4; 1.21.6; 1.21.8;
process_read_fpregs(), process_write_fpregs():
- move common code before checking 32-bit mode or 64-bit mode.

process_read_fpregs(), netbsd32_process_read_fpregs():
- copy out %fsr.

process_write_fpregs():
- don't copy in fregs if l->l_md.md_fpstate == NULL.
 1.20 04-Mar-2007  christos branches: 1.20.20; 1.20.36; 1.20.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 17-Feb-2007  pavel Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

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

Reviewed by Andrew Doran.
 1.18 11-Dec-2005  christos branches: 1.18.26;
merge ktrace-lwp.
 1.17 01-Jun-2005  scw branches: 1.17.2;
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.16 09-Nov-2003  martin bzero/bcopy -> memset/memcpy
 1.15 03-Oct-2003  petrov ansify.
 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 29-Apr-2003  nakayama branches: 1.12.2;
Wrap a 64-bit mode case with #ifdef __arch64__ for 32-bit kernels,
and fix typo in comment.
 1.11 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.10 26-Sep-2000  eeh branches: 1.10.8; 1.10.18;
UltraSPARC machines don't have FP queues. Don't let userland code set them.
It tends to break the FPU emulation code.
 1.9 10-Jan-2000  eeh branches: 1.9.4;
Add debugger single-stepping and fix interrupt dispatch bugs.
 1.8 30-Dec-1999  eeh Update COMPAT_NETBSD32 stuff.
 1.7 06-Nov-1999  eeh Explicitly use 32-bit and 64-bit types.
 1.6 11-Oct-1999  eeh branches: 1.6.2; 1.6.4;
Update to post 1.4.
 1.5 24-Nov-1998  mrg branches: 1.5.10;
remove some dead variables.
 1.4 11-Sep-1998  eeh Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.
 1.3 07-Sep-1998  eeh Misc. cleanup.
 1.2 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.5.10.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.9.4.1 17-Oct-2000  tv Pullup 1.10 [eeh]:
UltraSPARC machines don't have FP queues. Don't let userland code set them.
It tends to break the FPU emulation code.
 1.10.18.1 24-Jun-2003  grant Apply patch (requested by nakayama in ticket #1331):

Wrap a 64-bit mode case with #ifdef __arch64__ for 32-bit kernels,
and fix typo in comment.
 1.10.8.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.10.8.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.10.8.2 04-Jan-2002  eeh Cleanup.
 1.10.8.1 03-Jan-2002  petrov make kernel compile
 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.17.2.3 27-Feb-2008  yamt sync with head.
 1.17.2.2 03-Sep-2007  yamt sync with head.
 1.17.2.1 26-Feb-2007  yamt sync with head.
 1.18.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.18.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.20.40.2 29-Jun-2008  mjf Sync with HEAD.
 1.20.40.1 03-Apr-2008  mjf Sync with HEAD.
 1.20.36.1 24-Mar-2008  keiichi sync with head.
 1.20.20.1 23-Mar-2008  matt sync with HEAD
 1.21.8.1 03-Jul-2008  simonb Sync with head.
 1.21.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.21.4.2 11-Mar-2010  yamt sync with head
 1.21.4.1 04-May-2009  yamt sync with head.
 1.23.26.1 18-May-2014  rmind sync with head
 1.23.22.2 03-Dec-2017  jdolecek update from HEAD
 1.23.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.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.24.10.2 20-Mar-2017  pgoyette Sync with HEAD
 1.24.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.24.6.1 05-Feb-2017  skrll Sync with HEAD
 1.6 05-Apr-2014  christos adjust to new signature; return consistent stuff. 0 is ok -1 is error
 1.5 11-Dec-2005  christos branches: 1.5.112; 1.5.122; 1.5.128;
merge ktrace-lwp.
 1.4 31-May-2005  christos - sprinkle const
- avoid shadowed variables
 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:05 +0000
 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.5.128.1 18-May-2014  rmind sync with head
 1.5.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.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 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.16 01-Jul-2011  dyoung branches: 1.16.54;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.15 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.14 09-Dec-2008  nakayama branches: 1.14.2;
Fix CardBus, PCI-PCI bridge support borked in previous commit.
 1.13 07-Dec-2008  mrg a few clean up/rearrange changes, somewhat inspired from openbsd's
schizo.c:

- rename pp_busnode{} -> spc_busnode{}, and move it to
sparc_pci_chipset{}

- move public pci functions pci_conf_read(), pci_conf_write() and
pci_intr_establish() into psycho.c, renaming them in the process,
and add pointers through sparc_pci_chipset{} to access them.
as part of this, add PDB_INTMAP and PDB_CONF debug options to
psycho.c

- move and rename sparc64 private pci_find_ino() into
sparc_pci_chipset{}, like the above

- update psycho_alloc_chipset() to set the new 4 function members


no functional change intended. XXX: not tested on cardbus.
 1.12 26-Jun-2008  nakayama branches: 1.12.2; 1.12.4;
Ansify and follow the recent cardbus changes:
- split device/softc
- avoid the use of i82365var.h
 1.11 31-May-2008  nakayama branches: 1.11.2;
Change my license to 2 clause.
 1.10 05-Apr-2008  cegger branches: 1.10.2; 1.10.4; 1.10.6;
use aprint_*_dev and device_xname
OK martin
 1.9 11-Feb-2006  cdi branches: 1.9.68;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.8 11-Dec-2005  christos branches: 1.8.2; 1.8.4; 1.8.6;
merge ktrace-lwp.
 1.7 22-Mar-2004  nakayama branches: 1.7.16;
Make it compile again.
 1.6 21-Mar-2004  pk Switch to promlib interface.
 1.5 29-Aug-2003  nakayama Use proper bus number from pci_attach_args instead of (unused) var.
 1.4 17-Jul-2003  nakayama Fix typo in comment.
 1.3 15-Jul-2003  lukem __KERNEL_RCSID()
 1.2 20-Apr-2003  nakayama branches: 1.2.2;
Change a fixup of interrupt number a bit.
 1.1 22-Mar-2003  nakayama PCI-CardBus bridge support for sparc64:
- add MD part of cardbus support.
 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.7.16.1 21-Jun-2006  yamt sync with head.
 1.8.6.1 22-Apr-2006  simonb Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.8.2.1 18-Feb-2006  yamt sync with head.
 1.9.68.3 17-Jan-2009  mjf Sync with HEAD.
 1.9.68.2 29-Jun-2008  mjf Sync with HEAD.
 1.9.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.10.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.10.4.1 04-May-2009  yamt sync with head.
 1.10.2.1 04-Jun-2008  yamt sync with head
 1.11.2.1 27-Jun-2008  simonb Sync with head.
 1.12.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.12.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.12.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.54.1 10-Jun-2019  christos Sync with HEAD
 1.1 06-Jun-2001  mrg branches: 1.1.2; 1.1.10;
extract the netbsd32, sunos, 32 bit svr4 and 64 bit svr4 sigcode out into
separate files, so that compat lkms can link with them as well.
 1.1.10.3 23-Aug-2002  petrov sync
 1.1.10.2 04-Jan-2002  eeh Implement upcalls and cpu_preempt().
 1.1.10.1 06-Jun-2001  eeh file sigcode32.s was added on branch nathanw_sa on 2002-01-04 22:38:56 +0000
 1.1.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.1 09-Jan-1999  eeh Establish a single set of definitions for signal debugging so we don't have
a different one for every emulation.
 1.2 29-Aug-2023  jdc Update the horizontal sync offset based on the Naturetech video timing.
While here, correct the spelling of "Naturetech" in the data.
 1.1 11-Oct-2020  jdc Add a static EDID entry for the Mesostation-999.
Use the same logic as macppc for adding the entry.
 1.1 11-Oct-2020  jdc Add a static EDID entry for the Mesostation-999.
Use the same logic as macppc for adding the entry.
 1.33 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.32 04-Mar-2011  joerg branches: 1.32.14; 1.32.32;
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.31 10-Dec-2009  matt branches: 1.31.4; 1.31.6; 1.31.8;
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.30 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.29 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.28 10-Jul-2008  nakayama branches: 1.28.2; 1.28.8;
Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.
 1.27 29-May-2008  mrg branches: 1.27.2; 1.27.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.26 24-Apr-2008  ad branches: 1.26.2; 1.26.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.25 20-Dec-2007  dsl branches: 1.25.6; 1.25.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.24 04-Mar-2007  christos branches: 1.24.20; 1.24.28; 1.24.32;
fix fallout from caddr_t changes.
 1.23 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.22 18-Feb-2007  hannken Fix typo in last: Pk_32 -> PK_32
 1.21 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.20 09-Feb-2007  ad branches: 1.20.2;
Merge newlock2 to head.
 1.19 11-Feb-2006  cdi branches: 1.19.14;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.18 11-Dec-2005  christos branches: 1.18.2; 1.18.4; 1.18.6;
merge ktrace-lwp.
 1.17 27-Oct-2005  martin Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork
 1.16 13-Sep-2005  christos branches: 1.16.2;
compat reorg.
 1.15 09-Nov-2003  martin branches: 1.15.16;
bzero/bcopy -> memset/memcpy
 1.14 26-Oct-2003  christos Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.
 1.13 21-Oct-2003  kleink Don't use NULL in integer-type assignments/comparisons.
 1.12 26-Sep-2003  christos catch up with const sigset_t
 1.11 15-Jul-2003  lukem __KERNEL_RCSID()
 1.10 24-Jan-2003  nakayama branches: 1.10.2;
fix kernel build error, such a configs w/o kbd, ms.
(approved by martin)
 1.9 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.8 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.7 20-Mar-2002  christos branches: 1.7.4;
kill remaining PS_STRINGS instances.
 1.6 08-Dec-2001  thorpej Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
 1.5 21-Sep-2001  thorpej branches: 1.5.4;
More sunos32 fallout.
 1.4 20-Sep-2001  thorpej Add sunos32_setregs(), thus making sunos32 compile again.
 1.3 05-Jun-2001  mrg branches: 1.3.2; 1.3.4;
use _KERNEL_OPT
 1.2 05-Feb-2001  mrg branches: 1.2.2; 1.2.4;
oops, kill some debugging messages.
 1.1 05-Feb-2001  mrg use sunos32_machdep.c on 64 bit kernels.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 05-Feb-2001  bouyer file sunos32_machdep.c was added on branch thorpej_scsipi on 2001-02-11 19:12:41 +0000
 1.3.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.4.8 23-Aug-2002  petrov sync
 1.5.4.7 01-Aug-2002  nathanw Catch up to -current.
 1.5.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.5.4.5 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.5.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.5.4.2 04-Jan-2002  eeh Cleanup.
 1.5.4.1 21-Sep-2001  eeh file sunos32_machdep.c was added on branch nathanw_sa on 2002-01-04 19:12:32 +0000
 1.7.4.1 17-Jul-2002  gehenna catch up with -current.
 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.15.16.4 21-Jan-2008  yamt sync with head
 1.15.16.3 03-Sep-2007  yamt sync with head.
 1.15.16.2 26-Feb-2007  yamt sync with head.
 1.15.16.1 21-Jun-2006  yamt sync with head.
 1.16.2.1 02-Nov-2005  yamt sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.18.2.1 18-Feb-2006  yamt sync with head.
 1.19.14.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.19.14.1 11-Jan-2007  ad Checkpoint work in progress.
 1.20.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.20.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.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.25.8.2 04-Jun-2008  yamt sync with head
 1.25.8.1 18-May-2008  yamt sync with head.
 1.25.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.25.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.26.4.5 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.26.4.4 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.26.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.26.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.26.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.26.2.2 11-Mar-2010  yamt sync with head
 1.26.2.1 04-May-2009  yamt sync with head.
 1.27.4.1 19-Oct-2008  haad Sync with HEAD.
 1.27.2.1 18-Jul-2008  simonb Sync with head.
 1.28.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.31.8.1 05-Mar-2011  bouyer Sync with HEAD
 1.31.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.31.4.1 05-Mar-2011  rmind sync with head
 1.32.32.1 09-Jul-2016  skrll Sync with HEAD
 1.32.14.1 03-Dec-2017  jdolecek update from HEAD
 1.35 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.34 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.33 22-Nov-2015  martin remove all MD uses of suword(), replace by copyout()
 1.32 27-Nov-2013  mrg branches: 1.32.6;
remove unused variable.
 1.31 21-Nov-2009  rmind branches: 1.31.12; 1.31.22; 1.31.26;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.30 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.29 24-Apr-2008  ad branches: 1.29.2; 1.29.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.28 23-Dec-2007  rjs branches: 1.28.6; 1.28.8;
Fix prototype.
 1.27 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.26 08-Mar-2007  he branches: 1.26.20; 1.26.28; 1.26.32;
Cast to char* and not void* when doing pointer arithmetic.
 1.25 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.24 09-Feb-2007  ad branches: 1.24.2;
Merge newlock2 to head.
 1.23 11-Feb-2006  cdi branches: 1.23.14;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.22 11-Dec-2005  christos branches: 1.22.2; 1.22.4; 1.22.6;
merge ktrace-lwp.
 1.21 14-Sep-2005  he This file also needs <compat/sys/signal.h> and <compat/sys/signalvar.h>
for native_sigset_to_sigset13.
 1.20 30-Oct-2003  matt branches: 1.20.16;
Make this compile with 32bit kernels.
 1.19 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.18 15-Jul-2003  lukem __KERNEL_RCSID()
 1.17 18-Jan-2003  thorpej branches: 1.17.2;
Merge the nathanw_sa branch.
 1.16 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.15 02-Mar-2002  mrg branches: 1.15.6;
check _KERNEL_OPT for opt_ddb.h
 1.14 29-Jan-2001  mrg branches: 1.14.4; 1.14.8;
kill the ad clause in my license.
 1.13 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.12 06-Dec-2000  mrg fix warnings in DEBUG & DIAGNSTIC code.
 1.11 02-Aug-2000  eeh Garbage collection.
 1.10 10-Apr-2000  pk Get a kernel without DDB to build.
 1.9 06-Apr-2000  mrg - #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.
 1.8 06-Nov-1999  eeh Explicitly use 32-bit and 64-bit types.
 1.7 11-Oct-1999  eeh branches: 1.7.2; 1.7.4;
Update to post 1.4.
 1.6 26-Mar-1999  eeh branches: 1.6.8;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.5 16-Nov-1998  eeh Fixup the last broken bits of the signal handling code.
 1.4 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.3 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.2 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.4.1 15-Nov-1999  fvdl Sync with -current
 1.7.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.7.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.7.2.2 08-Dec-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.14.8.5 04-Dec-2002  martin Make 32bit kernels compile (and more or less work with SA).
Patch from Nick Hudson.
 1.14.8.4 01-Aug-2002  nathanw Catch up to -current.
 1.14.8.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.14.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.14.8.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.14.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.14.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.15.6.1 17-Jul-2002  gehenna catch up with -current.
 1.17.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.20.16.4 21-Jan-2008  yamt sync with head
 1.20.16.3 03-Sep-2007  yamt sync with head.
 1.20.16.2 26-Feb-2007  yamt sync with head.
 1.20.16.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.22.2.1 18-Feb-2006  yamt sync with head.
 1.23.14.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.23.14.1 11-Jan-2007  ad Checkpoint work in progress.
 1.24.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.26.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.26.28.1 26-Dec-2007  ad Sync with head.
 1.26.20.1 09-Jan-2008  matt sync with HEAD
 1.28.8.2 04-Jun-2008  yamt sync with head
 1.28.8.1 18-May-2008  yamt sync with head.
 1.28.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.4.4 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.29.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.29.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.29.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.29.2.2 11-Mar-2010  yamt sync with head
 1.29.2.1 04-May-2009  yamt sync with head.
 1.31.26.1 18-May-2014  rmind sync with head
 1.31.22.2 03-Dec-2017  jdolecek update from HEAD
 1.31.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.32.6.2 09-Jul-2016  skrll Sync with HEAD
 1.32.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.2 05-May-2002  thorpej Add .register directives to appease newer gas.
 1.1 06-Jun-2001  mrg branches: 1.1.2; 1.1.4; 1.1.10;
extract the netbsd32, sunos, 32 bit svr4 and 64 bit svr4 sigcode out into
separate files, so that compat lkms can link with them as well.
 1.1.10.4 23-Aug-2002  petrov sync
 1.1.10.3 20-Jun-2002  nathanw Catch up to -current.
 1.1.10.2 04-Jan-2002  eeh Implement upcalls and cpu_preempt().
 1.1.10.1 06-Jun-2001  eeh file sunos_sigcode.s was added on branch nathanw_sa on 2002-01-04 22:38:57 +0000
 1.1.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.42 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.41 16-Sep-2017  martin branches: 1.41.2; 1.41.4;
Redo previous with the proper macros
 1.40 15-Sep-2017  martin Make DEBUG code compile again.
 1.39 26-Nov-2015  martin We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.
 1.38 04-Mar-2011  joerg branches: 1.38.14; 1.38.32;
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.37 10-Dec-2009  matt branches: 1.37.4; 1.37.6; 1.37.8;
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.36 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.35 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.34 28-Apr-2008  martin branches: 1.34.2; 1.34.6; 1.34.8;
Remove clause 3 and 4 from TNF licenses
 1.33 24-Apr-2008  ad branches: 1.33.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.32 22-Dec-2007  yamt branches: 1.32.6; 1.32.8;
use binuptime for l_stime/l_rtime.
 1.31 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.30 17-Oct-2007  garbled branches: 1.30.4; 1.30.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.29 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.28 16-Mar-2007  dsl branches: 1.28.4; 1.28.12; 1.28.14; 1.28.16;
Use NETBSD32PTR64() and NETBSD32PTR32() throughout.
 1.27 04-Mar-2007  christos branches: 1.27.2; 1.27.4; 1.27.6;
fix fallout from caddr_t changes.
 1.26 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.25 09-Feb-2007  ad branches: 1.25.2;
Merge newlock2 to head.
 1.24 07-Jun-2006  kardel branches: 1.24.6;
convert to timecounters (from branch simonb-timecounters)
 1.23 20-Feb-2006  cdi branches: 1.23.2; 1.23.8;
Use ANSI-style function definitions and declarations.
 1.22 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.21 11-Dec-2005  christos branches: 1.21.2; 1.21.4; 1.21.6;
merge ktrace-lwp.
 1.20 26-Mar-2005  fvdl branches: 1.20.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.19 12-Mar-2005  dsl branches: 1.19.2;
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.18 09-Nov-2003  martin branches: 1.18.8; 1.18.10;
bzero/bcopy -> memset/memcpy
 1.17 26-Oct-2003  christos Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.
 1.16 28-Sep-2003  martin Include <compat/netbsd32/netbsd32_exec.h> to get the proper 32bit
sendsig etc. prototypes.
 1.15 26-Sep-2003  christos catch up with const sigset_t
 1.14 10-Aug-2003  martin Avoid intermediate (void*) casts.
Replace aliased pointer magic with shift/mask arithmetic.
 1.13 15-Jul-2003  lukem __KERNEL_RCSID()
 1.12 17-May-2003  nakayama branches: 1.12.2;
Avoid strict-alias warnings in gcc 3.3.
 1.11 23-Jan-2003  matt Fix a missing p to l change.
 1.10 21-Jan-2003  martin Rename the DIV0 traps to avoid confusion with the usage on the sparc
port: T_IDIV0 is the hardware trap generated on integer division by
zero, T_DIV0 is the software trap used to signal the same event.

This makes 32 bit kernels able to run sparc code with the v7 multiply/
divide library, as well as with the v8 one.
 1.9 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.8 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.7 02-Apr-2002  jmc branches: 1.7.2;
Change to native_to_svr4_signo after recent change in
compat/svr4/svr4_signal.h
 1.6 21-Mar-2002  petrov Remove excessive declarations.
 1.5 20-Mar-2002  christos kill remaining PS_STRINGS instances.
 1.4 17-Jun-2001  kleink branches: 1.4.2; 1.4.8;
Save/restore only the FP register file as far as the 32-bit environment
is concerned; in particular, don't overrun the [mu]context.
 1.3 11-May-2001  kleink * Fix remaining 32-bit vs. native pointer problems in data structures;
reviewed by Eduardo.
* Define the size of uc_pad, so ucontext32_t will have the correct size.
 1.2 08-May-2001  kleink One step closer to making ICC/CCR manipulation work.
 1.1 11-Feb-2001  eeh branches: 1.1.2; 1.1.4;
Add support for COMPAT_SVR4_32.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 11-Feb-2001  bouyer file svr4_32_machdep.c was added on branch thorpej_scsipi on 2001-02-11 19:12:42 +0000
 1.4.8.8 23-Aug-2002  petrov sync
 1.4.8.7 01-Aug-2002  nathanw Catch up to -current.
 1.4.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.4.8.5 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.4.8.4 17-Apr-2002  nathanw Catch up to -current.
 1.4.8.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.8.2 04-Jan-2002  eeh Cleanup.
 1.4.8.1 17-Jun-2001  eeh file svr4_32_machdep.c was added on branch nathanw_sa on 2002-01-04 19:12:32 +0000
 1.4.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.1 17-Jul-2002  gehenna catch up with -current.
 1.12.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.18.10.2 26-Mar-2005  yamt sync with head.
 1.18.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.8.1 29-Apr-2005  kent sync with -current
 1.19.2.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.20.2.5 21-Jan-2008  yamt sync with head
 1.20.2.4 27-Oct-2007  yamt sync with head.
 1.20.2.3 03-Sep-2007  yamt sync with head.
 1.20.2.2 26-Feb-2007  yamt sync with head.
 1.20.2.1 21-Jun-2006  yamt sync with head.
 1.21.6.2 02-Jun-2006  kardel - support timecounters
 1.21.6.1 22-Apr-2006  simonb Sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.21.2.2 01-Mar-2006  yamt sync with head.
 1.21.2.1 18-Feb-2006  yamt sync with head.
 1.23.8.1 19-Jun-2006  chap Sync with head.
 1.23.2.1 26-Jun-2006  yamt sync with head.
 1.24.6.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.24.6.1 11-Jan-2007  ad Checkpoint work in progress.
 1.25.2.2 24-Mar-2007  yamt sync with head.
 1.25.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.27.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.27.4.1 11-Jul-2007  mjf Sync with head.
 1.27.2.2 09-Oct-2007  ad Sync with head.
 1.27.2.1 10-Apr-2007  ad Sync with head.
 1.28.16.1 14-Oct-2007  yamt sync with head.
 1.28.14.2 09-Jan-2008  matt sync with HEAD
 1.28.14.1 06-Nov-2007  matt sync with HEAD
 1.28.12.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.28.4.1 16-Oct-2007  garbled Sync with HEAD
 1.30.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.4.1 26-Dec-2007  ad Sync with head.
 1.32.8.1 18-May-2008  yamt sync with head.
 1.32.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.32.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.2.3 11-Mar-2010  yamt sync with head
 1.33.2.2 04-May-2009  yamt sync with head.
 1.33.2.1 16-May-2008  yamt sync with head.
 1.34.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.34.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.34.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.34.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.34.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.37.8.1 05-Mar-2011  bouyer Sync with HEAD
 1.37.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.37.4.1 05-Mar-2011  rmind sync with head
 1.38.32.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.38.14.1 03-Dec-2017  jdolecek update from HEAD
 1.41.4.1 10-Jun-2019  christos Sync with HEAD
 1.41.2.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.3 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.2 05-May-2002  thorpej branches: 1.2.200; 1.2.202;
Add .register directives to appease newer gas.
 1.1 06-Jun-2001  mrg branches: 1.1.2; 1.1.4; 1.1.10;
extract the netbsd32, sunos, 32 bit svr4 and 64 bit svr4 sigcode out into
separate files, so that compat lkms can link with them as well.
 1.1.10.3 20-Jun-2002  nathanw Catch up to -current.
 1.1.10.2 04-Jan-2002  eeh Implement upcalls and cpu_preempt().
 1.1.10.1 06-Jun-2001  eeh file svr4_32_sigcode.s was added on branch nathanw_sa on 2002-01-04 22:38:58 +0000
 1.1.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.202.1 10-Jun-2019  christos Sync with HEAD
 1.2.200.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 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 16-Sep-2017  martin branches: 1.56.2; 1.56.4;
Make debug code compile
 1.55 04-Mar-2011  joerg branches: 1.55.14;
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.54 10-Dec-2009  matt branches: 1.54.4; 1.54.6; 1.54.8;
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.53 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.52 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.51 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.50 28-Apr-2008  martin branches: 1.50.2; 1.50.6; 1.50.8;
Remove clause 3 and 4 from TNF licenses
 1.49 24-Apr-2008  ad branches: 1.49.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.48 22-Dec-2007  yamt branches: 1.48.6; 1.48.8;
use binuptime for l_stime/l_rtime.
 1.47 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.46 17-Oct-2007  garbled branches: 1.46.4; 1.46.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.45 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.44 04-Mar-2007  christos branches: 1.44.2; 1.44.10; 1.44.18; 1.44.20; 1.44.22;
fix fallout from caddr_t changes.
 1.43 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.42 09-Feb-2007  ad branches: 1.42.2;
Merge newlock2 to head.
 1.41 07-Jun-2006  kardel branches: 1.41.6;
convert to timecounters (from branch simonb-timecounters)
 1.40 20-Feb-2006  cdi branches: 1.40.2; 1.40.8;
Use ANSI-style function definitions and declarations.
 1.39 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.38 11-Dec-2005  christos branches: 1.38.2; 1.38.4; 1.38.6;
merge ktrace-lwp.
 1.37 12-Mar-2005  dsl branches: 1.37.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.36 22-Mar-2004  nakayama branches: 1.36.8; 1.36.10;
Truncate values to 32-bit, not 40-bit.
 1.35 09-Nov-2003  martin bzero/bcopy -> memset/memcpy
 1.34 26-Oct-2003  christos Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.
 1.33 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.32 24-Aug-2003  mrg 64 bit number literals need a "ULL" suffix
 1.31 10-Aug-2003  martin Avoid intermediate (void*) casts.
Replace aliased pointer magic with shift/mask arithmetic.
 1.30 15-Jul-2003  lukem __KERNEL_RCSID()
 1.29 17-May-2003  nakayama branches: 1.29.2;
Avoid strict-alias warnings in gcc 3.3.
 1.28 21-Jan-2003  martin Rename the DIV0 traps to avoid confusion with the usage on the sparc
port: T_IDIV0 is the hardware trap generated on integer division by
zero, T_DIV0 is the software trap used to signal the same event.

This makes 32 bit kernels able to run sparc code with the v7 multiply/
divide library, as well as with the v8 one.
 1.27 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.26 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.25 31-Mar-2002  christos branches: 1.25.2;
compat signal array renaming.
 1.24 21-Mar-2002  petrov Remove excessive declarations.
 1.23 20-Mar-2002  christos kill remaining PS_STRINGS instances.
 1.22 25-Aug-2001  mrg branches: 1.22.6;
s/sparc/sparc64/ in a printf()
 1.21 17-Jun-2001  kleink branches: 1.21.2;
Fix context handling for 32-bit environments:
* Really pass PSR ICC bits instead of raw CCR.
* Don't touch ASI and FPRS, which are not part of the 32-bit mcontext.
Also, correct printf conversions in svr4_printmcontext.
 1.20 08-May-2001  kleink While we're here, do SVR4_SPARC_ASI as well.
 1.19 08-May-2001  kleink On v9, greg[0] isn't a TSTATE-in-PSR hack but just CCR.
 1.18 21-Feb-2001  eeh branches: 1.18.2;
Add support for 64-bit SVR4 (Solaris 8) binaries.
 1.17 11-Feb-2001  eeh Add support for COMPAT_SVR4_32.
 1.16 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.15 14-Dec-2000  martin Don't include opt_*.h if compiling as LKM.
 1.14 06-Dec-2000  mrg fix warnings in DEBUG & DIAGNSTIC code.
 1.13 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.12 10-Apr-2000  pk Get a kernel without DDB to build.
 1.11 06-Apr-2000  mrg - #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.
 1.10 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.9 06-Nov-1999  eeh Explicitly use 32-bit and 64-bit types.
 1.8 05-Oct-1999  eeh branches: 1.8.2; 1.8.4; 1.8.8;
Make this compile again.
 1.7 26-Mar-1999  eeh COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.6 21-Jan-1999  christos Move machine independent stuff out of here.
 1.5 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.4 11-Sep-1998  mycroft Update for signal handling changes.
 1.3 11-Sep-1998  eeh Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.
 1.2 05-Sep-1998  christos Assign copyright to TNF.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 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.5 12-Mar-2001  bouyer Sync with HEAD.
 1.8.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.8.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.8.2.2 08-Dec-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.18.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.21.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.21.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.22.6.10 06-Sep-2002  petrov make DEBUG kernel compile.
 1.22.6.9 23-Aug-2002  petrov sync
 1.22.6.8 01-Aug-2002  nathanw Catch up to -current.
 1.22.6.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.22.6.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.22.6.5 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.22.6.4 17-Apr-2002  nathanw Catch up to -current.
 1.22.6.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.22.6.2 04-Jan-2002  eeh Cleanup.
 1.22.6.1 25-Aug-2001  eeh file svr4_machdep.c was added on branch nathanw_sa on 2002-01-04 19:12:32 +0000
 1.25.2.1 17-Jul-2002  gehenna catch up with -current.
 1.29.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.29.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.1 03-Aug-2004  skrll Sync with HEAD
 1.36.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.36.8.1 29-Apr-2005  kent sync with -current
 1.37.4.5 21-Jan-2008  yamt sync with head
 1.37.4.4 27-Oct-2007  yamt sync with head.
 1.37.4.3 03-Sep-2007  yamt sync with head.
 1.37.4.2 26-Feb-2007  yamt sync with head.
 1.37.4.1 21-Jun-2006  yamt sync with head.
 1.38.6.2 02-Jun-2006  kardel - support timecounters
 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.2 01-Mar-2006  yamt sync with head.
 1.38.2.1 18-Feb-2006  yamt sync with head.
 1.40.8.1 19-Jun-2006  chap Sync with head.
 1.40.2.1 26-Jun-2006  yamt sync with head.
 1.41.6.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.41.6.1 11-Jan-2007  ad Checkpoint work in progress.
 1.42.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.44.22.1 14-Oct-2007  yamt sync with head.
 1.44.20.2 09-Jan-2008  matt sync with HEAD
 1.44.20.1 06-Nov-2007  matt sync with HEAD
 1.44.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.44.10.1 16-Oct-2007  garbled Sync with HEAD
 1.44.2.1 09-Oct-2007  ad Sync with head.
 1.46.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.46.4.1 26-Dec-2007  ad Sync with head.
 1.48.8.1 18-May-2008  yamt sync with head.
 1.48.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.48.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.49.2.3 11-Mar-2010  yamt sync with head
 1.49.2.2 04-May-2009  yamt sync with head.
 1.49.2.1 16-May-2008  yamt sync with head.
 1.50.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.50.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.50.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.50.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.50.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.54.8.1 05-Mar-2011  bouyer Sync with HEAD
 1.54.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.54.4.1 05-Mar-2011  rmind sync with head
 1.55.14.1 03-Dec-2017  jdolecek update from HEAD
 1.56.4.1 10-Jun-2019  christos Sync with HEAD
 1.56.2.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.5 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.4 12-Jul-2011  mrg branches: 1.4.52; 1.4.54;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.3 05-May-2002  thorpej Add .register directives to appease newer gas.
 1.2 30-Jun-2001  eeh branches: 1.2.2; 1.2.8;
Fix fpu save/restore code.
 1.1 06-Jun-2001  mrg branches: 1.1.2;
extract the netbsd32, sunos, 32 bit svr4 and 64 bit svr4 sigcode out into
separate files, so that compat lkms can link with them as well.
 1.1.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.8.3 20-Jun-2002  nathanw Catch up to -current.
 1.2.8.2 04-Jan-2002  eeh Implement upcalls and cpu_preempt().
 1.2.8.1 30-Jun-2001  eeh file svr4_sigcode64.s was added on branch nathanw_sa on 2002-01-04 22:38:59 +0000
 1.2.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.54.1 10-Jun-2019  christos Sync with HEAD
 1.4.52.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.2 19-Dec-2000  thorpej This is long since obsolete.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 05-Jan-2001  bouyer Sync with HEAD
 1.9 20-Dec-2007  dsl branches: 1.9.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.8 09-Feb-2007  ad branches: 1.8.24; 1.8.32; 1.8.36;
Merge newlock2 to head.
 1.7 11-Dec-2005  christos branches: 1.7.20;
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 15-Jul-2003  lukem __KERNEL_RCSID()
 1.4 18-Jan-2003  thorpej branches: 1.4.2;
Merge the nathanw_sa branch.
 1.3 13-Dec-2000  jdolecek branches: 1.3.8;
g/c obsolete vtrace(2) stuff
 1.2 19-Jan-1999  thorpej branches: 1.2.8;
No need for <sys/mtio.h>
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.8.1 05-Jan-2001  bouyer Sync with HEAD
 1.3.8.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.3.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.3.8.1 03-Jan-2002  petrov make kernel compile
 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.6.16.2 21-Jan-2008  yamt sync with head
 1.6.16.1 26-Feb-2007  yamt sync with head.
 1.7.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.8.36.1 02-Jan-2008  bouyer Sync with HEAD
 1.8.32.1 26-Dec-2007  ad Sync with head.
 1.8.24.1 09-Jan-2008  matt sync with HEAD
 1.9.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.9.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.49 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.48 06-Apr-2019  kamil 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.47 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.46 09-Nov-2015  christos branches: 1.46.18;
Use PRIx64 and %# requested by phone@
 1.45 09-Nov-2015  christos fix printf formats.
 1.44 06-Nov-2015  martin Add a few assertions to verify non-privileged processor state for userland
and 32bit address mapping for 32bit processes.
 1.43 07-Mar-2014  nakayama branches: 1.43.6;
Mark as __diagused to variables used only in KASSERT.
 1.42 27-Jun-2013  martin branches: 1.42.2;
Simplify with sy_invoke()
 1.41 19-Feb-2012  rmind branches: 1.41.2;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.40 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.39 27-Mar-2011  martin branches: 1.39.4; 1.39.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.38 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.37 23-Apr-2010  rmind branches: 1.37.2;
Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.
 1.36 21-Nov-2009  rmind branches: 1.36.2; 1.36.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.35 21-Oct-2008  ad 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.34 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.33 13-Oct-2008  nakayama Remove unnecessary includes.
 1.32 26-Jun-2008  nakayama branches: 1.32.2;
- remove unused old code.
- avoid use of "<< TSTATE_PSTATE_SHIFT".
 1.31 16-Jun-2008  ad PPWAIT is now in proc::p_lflag.
 1.30 28-Apr-2008  martin branches: 1.30.2; 1.30.4;
Remove clause 3 and 4 from TNF licenses
 1.29 24-Apr-2008  ad branches: 1.29.2;
- 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.28 10-Apr-2008  nakayama branches: 1.28.2;
Remove kernel unlock in startlwp which is probably a leftover of
vmlocking2 merge.

This may fix PR kern/38375.
 1.27 07-Apr-2008  nakayama Remove redundant #ifdef. KASSERT implies option DIAGNOSTIC.
 1.26 25-Mar-2008  martin Count the number of syscalls per cpu, to avoid cache trashing around
uvmexp.syscalls.
I wonder if we should apply the same treatment to uvmexp.{traps,intr,faults}
 1.25 06-Feb-2008  dsl branches: 1.25.6;
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.24 25-Jan-2008  skrll ANSIfy a couple of funcs.
 1.23 05-Jan-2008  dsl Don't pass 'curlwp' into trace_enter() and trace_exit().
 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 15-Aug-2007  ad branches: 1.21.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.20 17-Feb-2007  pavel branches: 1.20.4; 1.20.12; 1.20.16; 1.20.20;
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.19 09-Feb-2007  ad branches: 1.19.2;
Merge newlock2 to head.
 1.18 16-Oct-2006  martin do not test unsigned values for < 0
 1.17 16-Oct-2006  martin Debugger() is only available if we compile with DDB
 1.16 19-Jul-2006  ad branches: 1.16.4; 1.16.6;
- 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.15 07-Mar-2006  thorpej branches: 1.15.2; 1.15.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.14 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.13 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.12 05-Mar-2006  christos branches: 1.12.2;
implement PT_SYSCALL
 1.11 24-Dec-2005  perry branches: 1.11.4; 1.11.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 15-Jul-2005  christos branches: 1.9.6;
propagate martin's fix in the syscall_plain version. It does not make any
sense to print the syscall return part of syscall debug when we did not
print the syscall enter portion.
 1.8 15-Jul-2005  martin Ooops, gcc was right - *ap could have been used uninitialized (when
getargs() failed) - pointed out by Juergen Hannken-Illjes.
 1.7 15-Jul-2005  martin Shutup gcc - it eroneously thinks *ap might be used uninitialized.
 1.6 14-Jul-2005  christos make this compile again.
 1.5 13-Jul-2005  christos Handle the case where systrace is used in 32 bit emulation on a 64 bit system.
In this case, systrace may modify the arguments to the syscall, so we need
to copy them back. Restructuring the code a bit avoids an unnecessary argument
copy loop in the regular case.
 1.4 10-Jul-2005  christos pass the code out of getargs, so that ktracing __syscall using syscalls
works.
 1.3 10-Jul-2005  christos matt asked for his 32<->64 debugging back.
 1.2 10-Jul-2005  christos move some more code out to getargs to match the upcoming sparc.
 1.1 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.9.6.3 12-Nov-2005  skrll ktrsysret takes an lwp pointer. Noted by Christos.
 1.9.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.6.1 15-Jul-2005  skrll file syscall.c was added on branch ktrace-lwp on 2005-11-10 13:59:34 +0000
 1.11.6.1 22-Apr-2006  simonb Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.12.2.3 11-Aug-2006  yamt sync with head
 1.12.2.2 13-Mar-2006  yamt sync with head.
 1.12.2.1 05-Mar-2006  yamt file syscall.c was added on branch yamt-pdpolicy on 2006-03-13 09:07:03 +0000
 1.15.10.8 11-Feb-2008  yamt sync with head.
 1.15.10.7 04-Feb-2008  yamt sync with head.
 1.15.10.6 21-Jan-2008  yamt sync with head
 1.15.10.5 03-Sep-2007  yamt sync with head.
 1.15.10.4 26-Feb-2007  yamt sync with head.
 1.15.10.3 30-Dec-2006  yamt sync with head.
 1.15.10.2 21-Jun-2006  yamt sync with head.
 1.15.10.1 07-Mar-2006  yamt file syscall.c was added on branch yamt-lazymbuf on 2006-06-21 14:56:48 +0000
 1.15.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.15.2.1 07-Mar-2006  thorpej file syscall.c was added on branch elad-kernelauth on 2006-03-07 07:21:52 +0000
 1.16.6.1 22-Oct-2006  yamt sync with head
 1.16.4.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.16.4.2 11-Jan-2007  ad Checkpoint work in progress.
 1.16.4.1 18-Nov-2006  ad Sync with head.
 1.19.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.20.20.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.20.16.1 03-Sep-2007  skrll Sync with HEAD.
 1.20.12.1 03-Oct-2007  garbled Sync with HEAD
 1.20.4.1 20-Aug-2007  ad Sync with HEAD.
 1.21.2.3 23-Mar-2008  matt sync with HEAD
 1.21.2.2 09-Jan-2008  matt sync with HEAD
 1.21.2.1 06-Nov-2007  matt sync with HEAD
 1.22.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.22.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.25.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.25.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.25.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.25.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.28.2.2 17-Jun-2008  yamt sync with head.
 1.28.2.1 18-May-2008  yamt sync with head.
 1.29.2.4 11-Aug-2010  yamt sync with head.
 1.29.2.3 11-Mar-2010  yamt sync with head
 1.29.2.2 04-May-2009  yamt sync with head.
 1.29.2.1 16-May-2008  yamt sync with head.
 1.30.4.2 27-Jun-2008  simonb Sync with head.
 1.30.4.1 18-Jun-2008  simonb Sync with head.
 1.30.2.5 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.30.2.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.30.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.30.2.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.30.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.32.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.32.2.1 19-Oct-2008  haad Sync with HEAD.
 1.36.4.2 21-Apr-2011  rmind sync with head
 1.36.4.1 30-May-2010  rmind sync with head
 1.36.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.37.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.39.8.2 24-Feb-2012  mrg sync to -current.
 1.39.8.1 18-Feb-2012  mrg merge to -current.
 1.39.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.39.4.1 17-Apr-2012  yamt sync with head
 1.41.2.2 03-Dec-2017  jdolecek update from HEAD
 1.41.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.2.1 18-May-2014  rmind sync with head
 1.43.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.46.18.1 10-Jun-2019  christos Sync with HEAD
 1.3 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.2 06-Jan-2003  wiz branches: 1.2.18; 1.2.30; 1.2.32; 1.2.34;
writable, not writeable.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.32;
Import of sparc64.
 1.1.1.1.32.1 07-Jan-2003  thorpej Sync with HEAD.
 1.2.34.1 22-Apr-2006  simonb Sync with head.
 1.2.32.1 09-Sep-2006  rpaulo sync with head
 1.2.30.1 18-Feb-2006  yamt sync with head.
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 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 05-Jun-1999  mrg branches: 1.3.36;
clock attaches at ebus also now.
 1.2 13-Aug-1998  eeh branches: 1.2.8;
Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.2.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.36.1 03-Aug-2004  skrll Sync with HEAD
 1.199 28-Dec-2024  martin PR 58936: do not panic if we hit a VA-hole address in copyin/copyout.
 1.198 13-May-2024  msaitoh branches: 1.198.2;
s/priviliged/privileged/
 1.197 15-Jan-2024  andvar Fix typos in trap types and one log message.

OpenBSD fixed those over 20 years ago.
 1.196 08-Jan-2024  palle sun4v: only DFA (Data fault address) and DFA (Datafault context) are valid when a mem_address_not_aligned fault is triggered, so ajust debug printout to this
 1.195 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.194 16-May-2022  mrg branches: 1.194.4;
try to handle ultrasparc III* "fast ecc error" traps.

i had a sunblade 2500 reset with this trap recently, and the
manual says it should have been recoverable. in particular,
the US IIIv2 manual says in section 12.4.4.2 that the i-cache
won't see this data ever (so nothing needed there), and that
the d-cache needs to be disabled, and all the entries flushed,
and then re-enabled.

tested with a "trap 0x70" from kernel space, that trap.c
converted the "0x170" back to "0x70" (with an ADVANCE). this
code not commited.
 1.193 02-Feb-2021  martin Worakround for traps on invalid VAs:
uvm_fault() can not (currently) deal properly with invalid VAs (inside the
VA hole), so do not pass faults for such addresses to it, but instead
either panic (if fault is in kernel) or send a SIGSEGV to userland.
 1.192 21-Nov-2019  ad branches: 1.192.8;
mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.
 1.191 15-Feb-2019  hannken Add /* FALLTHROUGH */ for DEBUG kernel.
 1.190 14-Feb-2019  palle sun4v: add debug printout for ALIGN trap
 1.189 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.188 12-Feb-2017  palle branches: 1.188.12; 1.188.14;
sun4v: Revert previous - paddr_t is not a pointer... noted by nakayama@
 1.187 11-Feb-2017  palle sun4v: Fix calculation of mmu data fault address (pointer arithmetic)
 1.186 11-Feb-2017  christos make this compile again.
 1.185 10-Feb-2017  palle sun4v: Added handling of trap type 0x034 (address alignment error) + fixed typo mmfsa -> mmufsa. Verified for both sun4u and sun4v using qemu.
 1.184 07-Jul-2016  msaitoh branches: 1.184.2; 1.184.4;
KNF. Remove extra spaces. No functional change.
 1.183 13-May-2016  palle Fixed typo in comment + reorder parameters for trap debug output to match function prototype for data_access_fault()
 1.182 01-May-2016  palle print_trapframe() should print out Local and In registers as well
 1.181 28-Feb-2015  martin As christos put it: "Tidy up error handling, and return SIGBUS for mmap
past the end of file as required by the spec."
 1.180 20-Feb-2014  joerg branches: 1.180.6;
Use a format string.
 1.179 15-Sep-2013  martin ifdef a variable like its use
 1.178 21-Jun-2013  nakayama branches: 1.178.2;
Avoid data_access_error trap panic when reading unused PCI
configuration space.

This method is described in UltraSPARC IIi User's Manual "16.2.1
Probing PCI during boot using deferred errors", and refer to the
implementation of OpenBSD.
 1.177 01-Aug-2012  martin branches: 1.177.2;
Do not spam the console when sending a sigill due to a T_ILLINST trap,
new openssl probes for the cpu sub family/features by trying some new
instructions and catching sigill.
In all other cases, move the printf inside a #ifdef DEBUG.
 1.176 25-Apr-2012  martin Fix 32bit build
 1.175 23-Apr-2012  martin Report faulting data address with SIGBUS (instead of the faulting instruction)
 1.174 25-Mar-2012  nakayama Redo previous. Print register as a hexadecimal.
 1.173 25-Mar-2012  martin Make 32bit kernels compilable
 1.172 25-Mar-2012  mrg print %i7 for data faults
 1.171 17-Mar-2012  mrg count ECC corrected traps with evcnt(9).
 1.170 17-Mar-2012  mrg port the corrected ECC error handling code from freebsd. i noticed my U10
took one of these and then hang. it shouldn't hang, there's a 'sir' here that
doesn't seem to reset properly. oh well.

tested by simulated a trap via 'ta 0x10' and considering that the same, but
it hasn't been tested against a real ECC error yet.
 1.169 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.168 30-Jul-2011  martin branches: 1.168.2; 1.168.6; 1.168.8;
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.167 12-Jul-2011  mrg rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.166 23-Jun-2011  nakayama No need to repeat checking want_resched then call preempt() in
T_AST case, so check it only once.
 1.165 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.164 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.163 13-Dec-2010  mrg trap 0x70 is a "+fast ECC error".
 1.162 08-Aug-2010  chs remove some unreachable debug code.
 1.161 20-Mar-2010  chs fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.160 02-Dec-2009  mrg branches: 1.160.2; 1.160.4;
print pid, lid and p_comm in some diag messages that indicate killed processes.
 1.159 21-Nov-2009  rmind Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.158 17-Oct-2009  nakayama Merge want_ast check in userret() into trap handler, and repeat
preempt() call while want_resched is true. While there remove
unnecessary #if 1.

This should fix a performance degradation of disk I/O on heavy load.
 1.157 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.156 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.155 15-Oct-2008  wrstuden branches: 1.155.2; 1.155.4; 1.155.8; 1.155.10;
Merge wrstuden-revivesa into HEAD.
 1.154 13-Oct-2008  nakayama Remove unnecessary includes.
 1.153 10-Jul-2008  nakayama sparc64_ipi_save_fpstate:
- use primary MMU context for consistency with other trap/interrupt handlers.

sparc64_ipi_save_fpstate, savefpstate:
- avoid storing fp registers as we can.

sparc64_ipi_save_fpstate, savefpstate, loadfpstate:
- remove unaligned case since buffers allocated with pool_cache are ensured
64-byte aligned.

Ok by martin@.
 1.152 10-Jul-2008  nakayama Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.
 1.151 30-Jun-2008  nakayama branches: 1.151.2;
Fix commented sparc derived code.
 1.150 29-Jun-2008  nakayama Wrap trapstats counters with #ifdef TRAPSTATS.
 1.149 29-Jun-2008  nakayama Constify initfpstate, and omit initialization for .fs_qsize.
 1.148 26-Jun-2008  nakayama - remove unused old code.
- avoid use of "<< TSTATE_PSTATE_SHIFT".
 1.147 09-Apr-2008  nakayama branches: 1.147.4; 1.147.6; 1.147.8;
Remove kernel locks around malloc introduced when I added SMP support.
 1.146 14-Mar-2008  nakayama Improve FPU state save/clear like x86, idea from OpenBSD.
 1.145 24-Oct-2007  ad branches: 1.145.12; 1.145.16;
Make ras_lookup() lockless.
 1.144 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.143 17-May-2007  yamt branches: 1.143.8; 1.143.10; 1.143.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.142 04-Mar-2007  christos branches: 1.142.2; 1.142.4; 1.142.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.141 10-Feb-2007  hannken branches: 1.141.2;
newlock2: curproc->p_sigctx.ps_sigmask -> curlwp->l_sigmask.

Ok: Andrew Doran <ad@netbsd.org>
 1.140 09-Feb-2007  ad Merge newlock2 to head.
 1.139 20-Oct-2006  martin A few -Wextra nits
 1.138 16-Oct-2006  martin Missing initializer
 1.137 25-Sep-2006  mrg print the cpu number in a bunch of fault handler debug messages.
 1.136 18-Sep-2006  martin branches: 1.136.2;
Lazy FPU handling for the MULTIPROCESSOR case
 1.135 14-Sep-2006  he Replace CPU_UPAID with cpu_number(), says martin.
 1.134 13-Sep-2006  mrg SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.133 23-Jul-2006  ad branches: 1.133.4;
Use the LWP cached credentials where sane.
 1.132 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.131 14-May-2006  elad integrate kauth.
 1.130 15-Mar-2006  drochner branches: 1.130.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument
 1.129 07-Mar-2006  thorpej branches: 1.129.2;
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.128 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.127 20-Feb-2006  cdi branches: 1.127.2;
Use ANSI-style function definitions and declarations.
 1.126 13-Feb-2006  cdi ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.125 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.124 24-Dec-2005  perry branches: 1.124.2; 1.124.4; 1.124.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.123 11-Dec-2005  christos merge ktrace-lwp.
 1.122 27-Oct-2005  martin Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork
 1.121 10-Jul-2005  christos branches: 1.121.2;
Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.120 31-May-2005  christos branches: 1.120.2;
- sprinkle const
- avoid shadowed variables
 1.119 12-Feb-2005  nakayama Make 32-bit kernels with DIAGNOSTIC compile again.
 1.118 29-Jan-2005  martin If we get a kernel data access fault without curlwp, we would panic later
in uvmfault with a meaningless messages - instead, panic right away with
a helpfull message. Or course, neither of this should ever happen.
 1.117 28-Aug-2004  jdolecek branches: 1.117.4; 1.117.6;
use uvm_grow() to update stack segment size on stack page fault instead
of MD code
 1.116 14-Mar-2004  cl add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP
 1.115 12-Mar-2004  drochner report SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Martin Husemann
 1.114 18-Jan-2004  martin Support RAS for 32bit kernels too.
 1.113 18-Jan-2004  martin Use mi_userret() to do most of our userret() work.
 1.112 16-Jan-2004  martin Minor comment fix.
 1.111 16-Jan-2004  mrg clean up a little:
- delete ktrsyscall32()
- add a check #ifdef _LP64 to do the conversion if P_32 is set to the
standard ktrsyscall()
- add a couple of similar _LP64/P_32 checks to the systrace code.

this should get systrace working for 32 bit apps as well as complete
ktrace support for "trace_enter/trace_exit" using platforms such as amd64.

XXX: systrace isn't supported on sparc64 currently... (it doesn't use
trace_enter/trace_exit, or have it's own calls to systrace_xxx()...)
 1.110 15-Jan-2004  mrg call ktrsyscall32() for 64 bit kernels and 32 bit syscalls.
 1.109 11-Jan-2004  martin Avoid ras_lookup call if compiling 32bit kernel (which does not have
__HAVE_RAS). Avoids a compile failure pointed out by Juergen Hannken-Illjes.
 1.108 06-Jan-2004  martin Implement restartable atomic sequences (RAS) for sparc64.
 1.107 02-Jan-2004  martin Don't set ksi_errno - other archs don't bother, so avoid being different.
OK'd by Christos. This makes sparc64 pass the siginfo regression tests.
 1.106 10-Dec-2003  petrov Fix strict-aliasing compiler warning.
 1.105 05-Dec-2003  petrov Don't convert syscall args for tracing 32bit binaries on 64bit
kernel. Found and suggested by David Light. Fixes port-sparc64/23473.
 1.104 03-Dec-2003  petrov syscall clean up from ifdeffed out code.
 1.103 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 1.102 24-Nov-2003  cdi Call 'proc_trampoline_mp' from 'proc_trampoline' in a multiprocessor
configuration. Fix process locking. Approved by petrov@.
 1.101 09-Nov-2003  martin bzero/bcopy -> memset/memcpy
 1.100 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.99 04-Nov-2003  pk Remove !__HAVE_SIGINFO transitional code.
 1.98 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.97 27-Oct-2003  christos Provide the correct trap address to userland.
 1.96 26-Oct-2003  christos use curproc, instead of homebrew test.
 1.95 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.94 12-Oct-2003  pk Prepare for move to SIGINFO framework.
 1.93 16-Sep-2003  cl add MD part of SA/pthread pagefault handling on sparc64
 1.92 15-Jul-2003  lukem __KERNEL_RCSID()
 1.91 29-Jun-2003  fvdl branches: 1.91.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.90 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.89 15-May-2003  dsl ktrace rval[1] - in order to get both fd numbers for pipe()
 1.88 21-Jan-2003  martin Rename the DIV0 traps to avoid confusion with the usage on the sparc
port: T_IDIV0 is the hardware trap generated on integer division by
zero, T_DIV0 is the software trap used to signal the same event.

This makes 32 bit kernels able to run sparc code with the v7 multiply/
divide library, as well as with the v8 one.
 1.87 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.86 23-Dec-2002  jdolecek update for added ktrsyscall() argument

XXX this should probably be converted to use trace_enter()/trace_exit(),
XXX the current code doesn't support systrace
 1.85 16-Nov-2002  uebayasi branches: 1.85.2;
Fix compilation errors introduced by recent trace_enter()/ktrsyscall() changes.

Provided by FUKAUMI Naoki <naoki at fukaumi dot org> in kern/19070.
 1.84 29-Sep-2002  chs remove some vestigial FPU and cache code that's not need on ultrasparcs.
misc tidiness.
 1.83 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.82 11-Sep-2002  martin Make kernels without KTRACE work.
 1.81 25-Jun-2002  eeh Fix ktrace call for 32-bit kernels.
 1.80 19-Jun-2002  eeh Get ktrace working once more.
 1.79 19-Jun-2002  grant remove extraneous #endif from last commit, make this compile again.
 1.78 17-Jun-2002  christos MD systrace gluons.
 1.77 14-May-2002  eeh branches: 1.77.2;
Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.76 14-Feb-2002  chs allow writing to write-only mappings. fixes PR 3493.
 1.75 12-Dec-2001  petrov initialize all fpu registers and don't panic on user 'privileged action'
 1.74 22-Sep-2001  mrg branches: 1.74.4;
don't print the alignment fault twice.
 1.73 09-Aug-2001  eeh branches: 1.73.2;
Clean up some debug printfs.
 1.72 08-Aug-2001  eeh Clean up the trap code to handle the changes cause by supporting non-faulting
accesses. Also change the parameter order so trap frames are easy to find.
 1.71 23-Jul-2001  eeh Get rid of some debug code that really isn't all that useful any more.
 1.70 19-Jul-2001  eeh Print out PID and command name for alignment faults.
 1.69 05-Jul-2001  eeh branches: 1.69.2;
New fpu handling code.
 1.68 21-Jun-2001  eeh Allow probes to kernel addresses that generate access errors not panic the machine.
 1.67 07-Jun-2001  mrg print p_pid & p_comm for alignment errors.
 1.66 06-Jun-2001  mrg make a NETBSD32 stack check LKM friendly.
 1.65 03-Jun-2001  chs clear and restore pcb_onfault around calling uvm_fault(),
so that bugs in the fault-handling code will panic sooner.
 1.64 18-May-2001  mrg cross compile friendly.
 1.63 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.62 11-Feb-2001  eeh branches: 1.62.2;
Add support for COMPAT_SVR4_32.
 1.61 05-Feb-2001  mrg make sure 32 bit addresses are truncated properly.
 1.60 29-Dec-2000  eeh Update for new signal structures in struct proc.
 1.59 10-Dec-2000  eeh Cleanup types in DEBUG printf()s.
 1.58 07-Dec-2000  eeh Fix a bug in rwindow_save() that always wrote out window 0 in 64-bit
code and caused problems with ksh.
 1.57 06-Dec-2000  mrg fix warnings in DEBUG & DIAGNSTIC code.
 1.56 04-Dec-2000  fvdl Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.
 1.55 02-Dec-2000  mrg const poison to avoid a warning.
 1.54 28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.53 08-Aug-2000  tv sizeof(fmtstring) + 8 wasn't enough for the string; that won't cope with the
printed version. Make a little more room for the bitmask_snprintf() call.
 1.52 07-Aug-2000  tv %b -> bitmask_snprintf()
 1.51 20-Jul-2000  eeh Now we're running 64-bit userland don't panic the system if a process steps
into the address space hole.
 1.50 13-Jul-2000  pk printf() format for 64-bit integers `tf_pc' and `tf_npc'.
 1.49 13-Jul-2000  mrg remove memreg.h.
 1.48 02-Jul-2000  mrg whoops; turn off trapdebug again.
 1.47 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.46 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.45 24-Jun-2000  eeh masterpaddr is gone.
 1.44 19-Jun-2000  eeh branches: 1.44.2;
Have separate data and text segments, make text read-only.
 1.43 18-Jun-2000  mrg catch up with fpu changes.
 1.42 06-Jun-2000  soren defopt SYSCALL_DEBUG.
 1.41 27-May-2000  sommerfeld branches: 1.41.2;
Reduce use of curproc in several places:

- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

- Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

- Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

- ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

- move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

- simplify interface to ktrwrite()
 1.40 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.39 24-May-2000  thorpej Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).
 1.38 18-Apr-2000  eeh Turn off traptrace before printing a panic message so we don't flush the useful
traces out with the printf guts, and wrap some lines at 80 columns.
 1.37 10-Apr-2000  pk Get a kernel without DDB to build.
 1.36 06-Apr-2000  mrg avoid some more compiler warnings, and fix a couple of errors.
 1.35 10-Jan-2000  eeh Add debugger single-stepping and fix interrupt dispatch bugs.
 1.34 30-Dec-1999  eeh Revamp 32-bit syscall entry points.
Change in-kernel FPU usage conventions.
 1.33 05-Dec-1999  ragge clrnd()/clbase() discarding.
 1.32 20-Nov-1999  eeh Add handler for T_FLUSHWIN trap in case old code makes use of it.
 1.31 06-Nov-1999  eeh Expliticly use 64-bit and 32-bit types. And get rid of ftype. Aparently all
the other ports have.
 1.30 17-Sep-1999  thorpej branches: 1.30.2; 1.30.4; 1.30.8;
Centralize the declaration and clearing of `cold'.
 1.29 30-Mar-1999  eeh include compat_sparc32.h->compat_netbsd32.h
 1.28 28-Mar-1999  eeh Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().
 1.27 28-Mar-1999  eeh Fix ref counting.
 1.26 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.25 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.24 18-Mar-1999  eeh Fix problem w/FPU use in the kernel.
 1.23 28-Feb-1999  eeh Use block load/store in pmap_zero_page()/pmap_copy_page().
 1.22 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.21 14-Dec-1998  kleink Also need to initialize the queue length of a newly allocated fpstate.
 1.20 24-Nov-1998  mrg remove fixalign prototype, it is now elsewhere
 1.19 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.18 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.17 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.16 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.15 11-Sep-1998  eeh Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.
 1.14 07-Sep-1998  eeh Fixup for 32-bit and 64-bit syscalls.
 1.13 07-Sep-1998  eeh Fix problems copying in extended syscall arguments.
 1.12 06-Sep-1998  eeh 32-bit fixup.
 1.11 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.10 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.9 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.8 27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.7 26-Aug-1998  mrg deal with no DDB
 1.6 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.5 07-Jul-1998  eeh branches: 1.5.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.4 04-Jul-1998  jonathan defopt DDB.
 1.3 26-Jun-1998  thorpej defopt COMPAT_SVR4
 1.2 25-Jun-1998  thorpej defopt KTRACE
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.5.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.5.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.30.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.30.4.1 15-Nov-1999  fvdl Sync with -current
 1.30.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.30.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.30.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.30.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.30.2.2 08-Dec-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.41.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.44.2.3 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.44.2.2 31-Jul-2000  mrg pull up 1.51 (approved by thorpej):
>Now we're running 64-bit userland don't panic the system if a process steps
>into the address space hole.
 1.44.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.62.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.62.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.69.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.69.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.69.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.69.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.69.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.69.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.69.2.1 03-Aug-2001  lukem update to -current
 1.73.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.74.4.22 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.74.4.21 29-Dec-2002  thorpej Sync with HEAD.
 1.74.4.20 11-Dec-2002  thorpej Sync with HEAD.
 1.74.4.19 20-Nov-2002  petrov catch-up lossage fixed.
 1.74.4.18 20-Nov-2002  skrll Restore a #if 0 lost in the recent catch up to -current.
 1.74.4.17 18-Oct-2002  nathanw Catch up to -current.
 1.74.4.16 17-Sep-2002  nathanw Catch up to -current.
 1.74.4.15 28-Aug-2002  petrov cpu_preempt fix, adjust pc/npc in syscall, use T_AST for cpu_preempt.
 1.74.4.14 24-Aug-2002  petrov make it run.
 1.74.4.13 23-Aug-2002  petrov sync
 1.74.4.12 01-Aug-2002  nathanw Catch up to -current.
 1.74.4.11 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.74.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.74.4.9 20-Jun-2002  nathanw Catch up to -current.
 1.74.4.8 01-Mar-2002  petrov make it compile
 1.74.4.7 28-Feb-2002  nathanw Catch up to -current.
 1.74.4.6 08-Jan-2002  nathanw Catch up to -current.
 1.74.4.5 04-Jan-2002  eeh Cleanup.
 1.74.4.4 04-Jan-2002  petrov more bits to SA
 1.74.4.3 03-Jan-2002  petrov sync again
 1.74.4.2 03-Jan-2002  petrov make kernel compile
 1.74.4.1 22-Sep-2001  petrov file trap.c was added on branch nathanw_sa on 2002-01-03 06:42:37 +0000
 1.77.2.2 17-Jul-2002  gehenna catch up with -current.
 1.77.2.1 15-Jul-2002  gehenna catch up with -current.
 1.85.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.91.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.91.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.91.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.91.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.91.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.91.2.3 03-Sep-2004  skrll Sync with HEAD
 1.91.2.2 03-Aug-2004  skrll Sync with HEAD
 1.91.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.117.6.1 12-Feb-2005  yamt sync with head.
 1.117.4.1 29-Apr-2005  kent sync with -current
 1.120.2.6 17-Mar-2008  yamt sync with head.
 1.120.2.5 27-Oct-2007  yamt sync with head.
 1.120.2.4 03-Sep-2007  yamt sync with head.
 1.120.2.3 26-Feb-2007  yamt sync with head.
 1.120.2.2 30-Dec-2006  yamt sync with head.
 1.120.2.1 21-Jun-2006  yamt sync with head.
 1.121.2.1 02-Nov-2005  yamt sync with head.
 1.124.6.2 01-Jun-2006  kardel Sync with head.
 1.124.6.1 22-Apr-2006  simonb Sync with head.
 1.124.4.1 09-Sep-2006  rpaulo sync with head
 1.124.2.2 01-Mar-2006  yamt sync with head.
 1.124.2.1 18-Feb-2006  yamt sync with head.
 1.127.2.5 14-Sep-2006  yamt sync with head.
 1.127.2.4 11-Aug-2006  yamt sync with head
 1.127.2.3 24-May-2006  yamt sync with head.
 1.127.2.2 01-Apr-2006  yamt sync with head.
 1.127.2.1 13-Mar-2006  yamt sync with head.
 1.129.2.4 12-May-2006  elad adapt to kauth kpi, include sys/kauth.h where needed..
 1.129.2.3 19-Apr-2006  elad sync with head - hopefully this will work
 1.129.2.2 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.129.2.1 07-Mar-2006  elad file trap.c was added on branch elad-kernelauth on 2006-03-08 00:43:13 +0000
 1.130.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.133.4.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.133.4.2 11-Jan-2007  ad Checkpoint work in progress.
 1.133.4.1 18-Nov-2006  ad Sync with head.
 1.136.2.2 22-Oct-2006  yamt sync with head
 1.136.2.1 18-Sep-2006  yamt file trap.c was added on branch yamt-splraiseipl on 2006-10-22 06:05:12 +0000
 1.141.2.2 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.141.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.142.10.1 22-May-2007  matt Update to HEAD.
 1.142.4.1 11-Jul-2007  mjf Sync with head.
 1.142.2.2 03-Dec-2007  ad Sync with HEAD.
 1.142.2.1 27-May-2007  ad Sync with head.
 1.143.14.1 13-Nov-2007  bouyer Sync with HEAD
 1.143.10.2 23-Mar-2008  matt sync with HEAD
 1.143.10.1 06-Nov-2007  matt sync with HEAD
 1.143.8.1 28-Oct-2007  joerg Sync with HEAD.
 1.145.16.6 17-Jan-2009  mjf Sync with HEAD.
 1.145.16.5 28-Sep-2008  mjf Sync with HEAD.
 1.145.16.4 02-Jul-2008  mjf Sync with HEAD.
 1.145.16.3 29-Jun-2008  mjf Sync with HEAD.
 1.145.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.145.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.145.12.1 24-Mar-2008  keiichi sync with head.
 1.147.8.3 18-Jul-2008  simonb Sync with head.
 1.147.8.2 03-Jul-2008  simonb Sync with head.
 1.147.8.1 27-Jun-2008  simonb Sync with head.
 1.147.6.5 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.147.6.4 30-Jun-2008  wrstuden Change how we make SA threads not generate upcalls. Instead of clearing
LW_SA, use a private flag, LP_SA_NOBLOCK, that we set when we want
to not generate upcalls. This means we do NOT need to lock (l)
(ourselves) to set it.

Adjust tests that look at LW_SA. Now, we are an upcall-generating
lwp if ((l->l_flag & LW_SA) && (~l->l_pflag & LP_SA_NOBLOCK)).

Introduce code pattern to set & remember this:

f = ~l->l_pflag & LP_SA_NOBLOCK;
l->l_pflag |= LP_SA_NOBLOCK;

...

/* f is now LP_SA_NOBLOCK if it wasn't set in l_pflag before */

l->l_pflag ^= f;

I updated a lot of the trap handlers to do trap handling iff LP_SA_NOBLOCK
is not set. I tried to figure out if the trap handler could be triggered
for user-based faults as opposed to kernel faults to user addresses, and
only look at LP_SA_NOBLOCK for the latter.

Above is a result of discussions with rmind at to reduce lock twiddling.

Also, per same discussions, add locking to sys_sa_preempt(). p_lock is
the lock we want.

Also, per same discussions, remove use of LSSUSPENDED as a thread state.
We needed to use it when we were emulating the 4.X and previous behavior
of hiding cached threads. For the moment, we now have them instead
remain visible to all and have them sleeping on the "lwpcache" wait
channel.

sa_newcachelwp(): sa_putcachelwp() wants savp_mutex held, not p_lock.

Tweak some comments.
 1.147.6.3 22-Jun-2008  wrstuden Re-add cpu_upcall() and page fault code. i386 kernels now compile.
They don't boot, but that seems to be a consequence of current from the
day this branch was started.
 1.147.6.2 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.147.6.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.147.4.4 11-Aug-2010  yamt sync with head.
 1.147.4.3 11-Mar-2010  yamt sync with head
 1.147.4.2 20-Jun-2009  yamt sync with head
 1.147.4.1 04-May-2009  yamt sync with head.
 1.151.2.1 19-Oct-2008  haad Sync with HEAD.
 1.155.10.1 21-Apr-2010  matt sync to netbsd-5
 1.155.8.1 19-Oct-2009  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #1103):
sys/arch/sparc64/include/userret.h: revision 1.9
sys/arch/sparc64/sparc64/trap.c: revision 1.158

Merge want_ast check in userret() into trap handler, and repeat preempt()
call while want_resched is true. While there remove unnecessary #if 1. This
should fix a performance degradation of disk I/O on heavy load.
 1.155.4.1 19-Oct-2009  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #1103):
sys/arch/sparc64/include/userret.h: revision 1.9
sys/arch/sparc64/sparc64/trap.c: revision 1.158

Merge want_ast check in userret() into trap handler, and repeat preempt()
call while want_resched is true. While there remove unnecessary #if 1. This
should fix a performance degradation of disk I/O on heavy load.
 1.155.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.160.4.2 05-Mar-2011  rmind sync with head
 1.160.4.1 30-May-2010  rmind sync with head
 1.160.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.160.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.168.8.4 09-Aug-2012  jdc Pull up revision 1.177 (requested by martin in ticket #462).

Do not spam the console when sending a sigill due to a T_ILLINST trap,
new openssl probes for the cpu sub family/features by trying some new
instructions and catching sigill.
In all other cases, move the printf inside a #ifdef DEBUG.
 1.168.8.3 26-Apr-2012  riz Pull up following revision(s) (requested by martin in ticket #201):
sys/arch/sparc64/sparc64/trap.c: revision 1.176
Fix 32bit build
 1.168.8.2 24-Apr-2012  riz Pull up following revision(s) (requested by martin in ticket #199):
sys/arch/sparc64/sparc64/trap.c: revision 1.175
Report faulting data address with SIGBUS (instead of the faulting instruction)
 1.168.8.1 21-Mar-2012  riz Pull up following revision(s) (requested by mrg in ticket #131):
sys/arch/sparc64/sparc64/trap.c: revision 1.170
sys/arch/sparc64/sparc64/trap.c: revision 1.171
sys/arch/sparc64/sparc64/locore.s: revision 1.341
port the corrected ECC error handling code from freebsd. i noticed my U10
took one of these and then hang. it shouldn't hang, there's a 'sir' here that
doesn't seem to reset properly. oh well.
tested by simulated a trap via 'ta 0x10' and considering that the same, but
it hasn't been tested against a real ECC error yet.
count ECC corrected traps with evcnt(9).
 1.168.6.3 29-Apr-2012  mrg sync to latest -current.
 1.168.6.2 05-Apr-2012  mrg sync to latest -current.
 1.168.6.1 24-Feb-2012  mrg sync to -current.
 1.168.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.168.2.3 30-Oct-2012  yamt sync with head
 1.168.2.2 23-May-2012  yamt sync with head.
 1.168.2.1 17-Apr-2012  yamt sync with head
 1.177.2.3 03-Dec-2017  jdolecek update from HEAD
 1.177.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.177.2.1 23-Jun-2013  tls resync from head
 1.178.2.1 18-May-2014  rmind sync with head
 1.180.6.4 28-Aug-2017  skrll Sync with HEAD
 1.180.6.3 09-Jul-2016  skrll Sync with HEAD
 1.180.6.2 29-May-2016  skrll Sync with HEAD
 1.180.6.1 06-Apr-2015  skrll Sync with HEAD
 1.184.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.184.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.188.14.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.188.14.1 10-Jun-2019  christos Sync with HEAD
 1.188.12.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.192.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.194.4.1 31-Dec-2024  snj Pull up following revision(s) (requested by martin in ticket #1035):
sys/arch/sparc64/sparc64/trap.c: 1.199
PR 58936: do not panic if we hit a VA-hole address in copyin/copyout.
 1.198.2.1 02-Aug-2025  perseant Sync with HEAD
 1.6 24-Jun-2000  eeh Get rid of vaddrs.h.
 1.5 19-Jun-2000  eeh branches: 1.5.2;
Have separate data and text segments, make text read-only.
 1.4 12-Jun-2000  eeh Start reorganizing the kernel for MULTIPROCESSOR support.
 1.3 05-Sep-1998  eeh branches: 1.3.12; 1.3.20;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.20.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.12.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.5.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.102 11-Feb-2019  macallan retry timed out IPIs, complain and dump timing info into dmesg
ok martin@
 1.101 06-Nov-2015  martin branches: 1.101.18;
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:

Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.

which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.

Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
 1.100 15-Sep-2013  martin branches: 1.100.4; 1.100.6; 1.100.8;
Remove unused variable
 1.99 19-Feb-2012  rmind branches: 1.99.2; 1.99.4;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.98 08-Oct-2011  nakayama branches: 1.98.2; 1.98.6; 1.98.8; 1.98.12; 1.98.14;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.
 1.97 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.96 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.95 10-Feb-2011  pooka Make vmapbuf() return success/error and make physio deal with a
failure.
 1.94 18-Jan-2011  matt branches: 1.94.2;
Copy PK_32 to p2->p_flag instead of doing it in the cpu_proc_fork hook.
 1.93 14-Jan-2011  rmind branches: 1.93.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.92 06-Nov-2010  mrg remove an XXX comment.
 1.91 21-Nov-2009  rmind branches: 1.91.2; 1.91.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.90 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.89 30-May-2009  martin cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.88 21-May-2009  martin Deja Vu: when preparing the initial trap frame for a new forked lwp,
explicitly clear condition code. Otherwise we might catch a signal
(handlers are inherited from the parent) before we ever return to
userland. The current trapframe is converted into a ucontext and after
the signal handler returns, the lwp stays in userland and directly
uses the ucontext to return to the fork call.
Fixes PR 41302.
 1.87 16-Mar-2009  dsl ANSIfy functions with function-pointer arguments
 1.86 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.85 19-Nov-2008  ad branches: 1.85.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.84 24-Oct-2008  martin branches: 1.84.2; 1.84.4; 1.84.6;
Avoid code duplication: make cpu_lwp_fork() use cpu_setfunc(). Leave
the inlinig to the compiler. Suggested by Nick Hudson.
 1.83 16-Oct-2008  martin resurrect cpu_setfunc(), adapted to new world order.
 1.82 13-Oct-2008  nakayama Remove unnecessary includes.
 1.81 10-Jul-2008  nakayama Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.
 1.80 17-Mar-2008  nakayama branches: 1.80.4; 1.80.6; 1.80.8; 1.80.10;
Fix a race condition in IPI handlers of save/drop fpstate, from OpenBSD.
Reported and tested by martin@.
 1.79 14-Mar-2008  nakayama Improve FPU state save/clear like x86, idea from OpenBSD.
 1.78 22-Feb-2008  martin Get rid of the IPI simple_lock.
 1.77 17-Oct-2007  garbled branches: 1.77.12; 1.77.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.76 11-Sep-2007  martin Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.
 1.75 15-Aug-2007  tnn branches: 1.75.2;
Correct some comments (proc -> lwp conversion)
 1.74 28-May-2007  mrg branches: 1.74.4; 1.74.8;
fix some NOTDEF_DEBUG code.
 1.73 20-May-2007  martin Remove special case handling for userland lwps from cpu_lwp_fork, instead
do it in lwp_trampoline when we first return to userland.
 1.72 19-May-2007  martin No need to pass "old lwp" to lwp_trampoline - we'll get it as return
value from cpu_swithchto() once the lwp gets scheduled for the first
time.
 1.71 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.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 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.68 09-Feb-2007  ad branches: 1.68.2;
Merge newlock2 to head.
 1.67 19-Sep-2006  mrg remove an always printed debugging message.
 1.66 18-Sep-2006  martin branches: 1.66.2;
Lazy FPU handling for the MULTIPROCESSOR case
 1.65 15-Sep-2006  martin Do not bother to save fpu state when we are about to get rid of it.
 1.64 31-Aug-2006  matt branches: 1.64.2;
Make cpu_coredump dependent on COREDUMP
 1.63 11-Feb-2006  cdi branches: 1.63.2;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.62 11-Dec-2005  christos branches: 1.62.2; 1.62.4; 1.62.6;
merge ktrace-lwp.
 1.61 27-Oct-2005  martin Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork
 1.60 11-Jun-2005  snj branches: 1.60.2; 1.60.4;
Fix typo in last. This compiles once again.
 1.59 10-Jun-2005  matt 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.58 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.57 17-Sep-2004  skrll branches: 1.57.4; 1.57.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.56 28-Aug-2004  thorpej Garbage-collect pagemove(); nothing use it anymore (YAY!!!)
 1.55 19-Jan-2004  martin Rename switchexit to cpu_exit and g/c the old C implementation of cpu_exit.
 1.54 16-Jan-2004  martin Don't rely on proc_trampoline to clear condition codes for a new
child process on fork - it could be overtaken by a signal delivery
and then use the stale condition code in the trap frame.
Instead, set tf_tstate aproprietaly right from the start.
Fixes PR sparc64/20675.
Many thanks to Paul Kranenburg for hints on a similar problem he fixed
for the sparc port.
 1.53 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.52 02-Dec-2003  martin Minor cleanup: remove unused code, sync a comment with current reality.
 1.51 09-Nov-2003  martin bzero/bcopy -> memset/memcpy
 1.50 15-Jul-2003  lukem __KERNEL_RCSID()
 1.49 29-Jun-2003  fvdl branches: 1.49.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.48 29-Jun-2003  martin struct proc * -> struct lwp *
 1.47 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.46 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.45 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.44 13-Aug-2002  petrov cpu_fork: clear PSTATE_PEF for a child process, reviewed by thorpej
 1.43 03-Jun-2002  eeh Pass on the P_32 flag on fork and support fork syscall returns using
%g7 as the completion address.
 1.42 14-May-2002  eeh branches: 1.42.2; 1.42.4;
Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.41 10-Sep-2001  chris branches: 1.41.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.40 24-Aug-2001  chs branches: 1.40.2;
use pmap_k* for buffer cache pages.
 1.39 19-Aug-2001  chs in vunmapbuf(), call pmap_*remove() explicitly since uvm_km_free_wakeup()
will soon no longer do it for us.
 1.38 30-Jun-2001  eeh branches: 1.38.2;
Handle proper saving of the fpstate.
 1.37 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.36 17-Dec-2000  pk branches: 1.36.2;
Remove spurious `#define DEBUG'
 1.35 11-Dec-2000  eeh Don't use rwindow_save() since the stack has already been made COW.
 1.34 07-Dec-2000  eeh Initialize pcb_lastcall so db_dump_pcb() will not bomb on non-DEBUG kernels.
 1.33 19-Oct-2000  mrg remove unneeded cast.
 1.32 28-Sep-2000  eeh Remove unneeded cache flushes.
 1.31 11-Sep-2000  eeh Don't take protection faults on I/O mappings.
 1.30 01-Aug-2000  eeh Cleanup trapstate handling and garbage collect old stuff.
 1.29 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.28 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.27 28-May-2000  thorpej branches: 1.27.2;
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.26 26-Mar-2000  kleink branches: 1.26.2;
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.25 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.24 30-Dec-1999  eeh Update COMPAT_NETBSD32 stuff.
 1.23 04-Dec-1999  ragge CL* discarding.
 1.22 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.21 06-Nov-1999  eeh Explicitly use 32-bit and 64-bit types and add some of the hooks needed for
32-bit coredumps.
 1.20 11-Oct-1999  eeh branches: 1.20.2; 1.20.4;
Update to post 1.4.
 1.19 08-Jul-1999  thorpej branches: 1.19.2;
Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.18 26-May-1999  thorpej Generally update the comment above vunmapbuf().
 1.17 26-May-1999  thorpej Generally update the comment above the vmapbuf() implementations.
 1.16 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.15 26-Mar-1999  mycroft branches: 1.15.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.14 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.13 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.12 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.11 09-Sep-1998  thorpej In cpu_coredump(), use MID_MACHINE rather than MID_* (whatever it expands
to).
 1.10 09-Sep-1998  thorpej Use MID_MACHINE rather than MID_SPARC in cpu_coredump(), and add a comment
about dumping a SPARC32 core file if we're using emul_sparc32.
 1.9 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.8 06-Sep-1998  eeh 32-bit fixup.
 1.7 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.6 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.5 23-Aug-1998  eeh Remove dvma_mapin() and other cruft.
 1.4 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.3 28-Jul-1998  thorpej branches: 1.3.2;
Don't cast the null residual pointer passed to vn_rdwr().
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.3.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.4.2 02-Aug-1999  thorpej Update from trunk.
 1.15.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.19.2.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.4 05-Jan-2001  bouyer Sync with HEAD
 1.20.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.20.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.20.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.26.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.27.2.1 07-Aug-2000  mrg pull up 1.30 (approved by thorpej):
>Cleanup trapstate handling and garbage collect old stuff.
 1.36.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.38.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.38.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.38.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.38.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.38.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.40.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.41.4.14 18-Oct-2002  nathanw Catch up to -current.
 1.41.4.13 28-Aug-2002  petrov cpu_preempt fix, adjust pc/npc in syscall, use T_AST for cpu_preempt.
 1.41.4.12 27-Aug-2002  nathanw Catch up to -current.
 1.41.4.11 23-Aug-2002  petrov sync
 1.41.4.10 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.41.4.9 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.41.4.8 20-Jun-2002  nathanw Catch up to -current.
 1.41.4.7 04-Jan-2002  eeh Implement upcalls and cpu_preempt().
 1.41.4.6 04-Jan-2002  eeh Cleanup.
 1.41.4.5 04-Jan-2002  petrov old stuff(single-threaded) works
 1.41.4.4 04-Jan-2002  petrov more bits to SA
 1.41.4.3 03-Jan-2002  petrov make kernel compile
 1.41.4.2 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.41.4.1 10-Sep-2001  thorpej file vm_machdep.c was added on branch nathanw_sa on 2001-12-08 04:22:23 +0000
 1.42.4.1 04-Sep-2002  lukem Pull up revision 1.44 (requested by chuq in ticket #760):
cpu_fork: clear PSTATE_PEF for a child process, reviewed by thorpej
 1.42.2.2 31-Aug-2002  gehenna catch up with -current.
 1.42.2.1 15-Jul-2002  gehenna catch up with -current.
 1.49.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.49.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.49.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.49.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.49.2.3 03-Sep-2004  skrll Sync with HEAD
 1.49.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.49.2.1 03-Aug-2004  skrll Sync with HEAD
 1.57.6.1 26-Jan-2005  yamt convert arch/sparc64 to new apis.
 1.57.4.1 29-Apr-2005  kent sync with -current
 1.60.4.1 02-Nov-2005  yamt sync with head.
 1.60.2.8 24-Mar-2008  yamt sync with head.
 1.60.2.7 17-Mar-2008  yamt sync with head.
 1.60.2.6 27-Feb-2008  yamt sync with head.
 1.60.2.5 27-Oct-2007  yamt sync with head.
 1.60.2.4 03-Sep-2007  yamt sync with head.
 1.60.2.3 26-Feb-2007  yamt sync with head.
 1.60.2.2 30-Dec-2006  yamt sync with head.
 1.60.2.1 21-Jun-2006  yamt sync with head.
 1.62.6.1 22-Apr-2006  simonb Sync with head.
 1.62.4.1 09-Sep-2006  rpaulo sync with head
 1.62.2.1 18-Feb-2006  yamt sync with head.
 1.63.2.1 03-Sep-2006  yamt sync with head.
 1.64.2.2 11-Jan-2007  ad Checkpoint work in progress.
 1.64.2.1 18-Nov-2006  ad Sync with head.
 1.66.2.2 22-Oct-2006  yamt sync with head
 1.66.2.1 18-Sep-2006  yamt file vm_machdep.c was added on branch yamt-splraiseipl on 2006-10-22 06:05:12 +0000
 1.68.2.3 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.68.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.68.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.70.10.3 03-Oct-2007  garbled Sync with HEAD
 1.70.10.2 26-Jun-2007  garbled 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.4 09-Oct-2007  ad Sync with head.
 1.70.2.3 20-Aug-2007  ad Sync with HEAD.
 1.70.2.2 09-Jun-2007  ad Sync with head.
 1.70.2.1 27-May-2007  ad Sync with head.
 1.74.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.74.8.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.74.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.75.2.2 23-Mar-2008  matt sync with HEAD
 1.75.2.1 06-Nov-2007  matt sync with HEAD
 1.77.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.77.16.2 28-Sep-2008  mjf Sync with HEAD.
 1.77.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.77.12.1 24-Mar-2008  keiichi sync with head.
 1.80.10.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.80.10.1 19-Oct-2008  haad Sync with HEAD.
 1.80.8.1 18-Jul-2008  simonb Sync with head.
 1.80.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.80.4.3 11-Mar-2010  yamt sync with head
 1.80.4.2 20-Jun-2009  yamt sync with head
 1.80.4.1 04-May-2009  yamt sync with head.
 1.84.6.2 05-Jun-2009  snj branches: 1.84.6.2.2;
Pull up following revision(s) (requested by martin in ticket #786):
sys/arch/sparc64/include/cpu.h: revision 1.86
sys/arch/sparc64/sparc64/locore.s: revision 1.291
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.89
cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.84.6.1 26-May-2009  snj Pull up following revision(s) (requested by martin in ticket #774):
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.88
Deja Vu: when preparing the initial trap frame for a new forked lwp,
explicitly clear condition code. Otherwise we might catch a signal
(handlers are inherited from the parent) before we ever return to
userland. The current trapframe is converted into a ucontext and after
the signal handler returns, the lwp stays in userland and directly
uses the ucontext to return to the fork call.
Fixes PR 41302.
 1.84.6.2.2.1 21-Apr-2010  matt sync to netbsd-5
 1.84.4.2 05-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #786):
sys/arch/sparc64/include/cpu.h: revision 1.86
sys/arch/sparc64/sparc64/locore.s: revision 1.291
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.89
cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.84.4.1 26-May-2009  snj Pull up following revision(s) (requested by martin in ticket #774):
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.88
Deja Vu: when preparing the initial trap frame for a new forked lwp,
explicitly clear condition code. Otherwise we might catch a signal
(handlers are inherited from the parent) before we ever return to
userland. The current trapframe is converted into a ucontext and after
the signal handler returns, the lwp stays in userland and directly
uses the ucontext to return to the fork call.
Fixes PR 41302.
 1.84.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.84.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.85.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.91.4.1 05-Mar-2011  rmind sync with head
 1.91.2.1 09-Nov-2010  uebayasi Sync with HEAD.
 1.93.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.94.2.2 05-Mar-2011  bouyer Sync with HEAD
 1.94.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.98.14.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.98.12.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.98.8.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.98.6.1 24-Feb-2012  mrg sync to -current.
 1.98.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.98.2.1 17-Apr-2012  yamt sync with head
 1.99.4.1 18-May-2014  rmind sync with head
 1.99.2.2 03-Dec-2017  jdolecek update from HEAD
 1.99.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.100.8.1 16-Nov-2015  msaitoh Pull up following revision(s) (requested by martin in ticket #1028):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
- Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
- Fix kmem_free() size mismatch
- Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.100.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.100.4.1 16-Nov-2015  msaitoh Pull up following revision(s) (requested by martin in ticket #1028):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
- Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
- Fix kmem_free() size mismatch
- Convert siginfo to 32bit version before copying it out to 32bit userland.
 1.101.18.1 10-Jun-2019  christos Sync with HEAD
 1.9 13-Dec-2009  nakayama System utilities, boot programs and kernel modules are machine
(port) specific not CPU, so use MACHINE not MACHINE_ARCH.
 1.8 14-Feb-2009  abs Convert more MACHINE tests to MACHINE_ARCH
 1.7 11-Dec-2005  christos branches: 1.7.78; 1.7.86; 1.7.92;
merge ktrace-lwp.
 1.6 07-Dec-2003  mrg ofwboot.net is gone. from hannken@
 1.5 07-May-2002  lukem branches: 1.5.10;
no more ../../sparc/stand/installboot
 1.4 20-Aug-2000  mrg branches: 1.4.4; 1.4.8;
move everything to arch/sparc/stand; leave the Makefile behind.
 1.3 30-Dec-1999  eeh branches: 1.3.4;
Add bootblk directory and only compile things on sparc64 machines.
 1.2 23-Nov-1998  mrg branches: 1.2.10;
add installboot
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.4.2 13-Nov-2000  tv Pullup patch [eeh]:
Fix botch "ofwboot->ofwboot.net" in last pullup.
 1.3.4.1 26-Aug-2000  mrg everything has moved to arch/sparc/stand. approved by thorpej.
 1.4.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.10.1 03-Aug-2004  skrll Sync with HEAD
 1.7.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.86.1 03-Mar-2009  skrll 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.5 20-Aug-2000  mrg move everything to arch/sparc/stand; leave the Makefile behind.
 1.4 23-Jan-2000  mycroft branches: 1.4.4;
Clean up the machine symlink stuff ever so slightly. Needs to be
standardized between files.
 1.3 25-Nov-1999  pk Target `machine' symlink explicitly at the sparc64 headers.
 1.2 25-Nov-1999  pk Make symlink to appropriate header directory and have cpp use it.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.4.4.1 26-Aug-2000  mrg everything has moved to arch/sparc/stand. approved by thorpej.
 1.6 25-Jul-2000  mycroft Switch back to newvers_stand.sh. Dunno why it bombed the first time.
 1.5 25-Jul-2000  mycroft Duh, hp300 -> sparc64.
 1.4 25-Jul-2000  mycroft Put back missing newvers.sh.
 1.3 21-Jul-2000  jdolecek switch to sys/conf/newvers_stand.sh for generation of version file
slighly adjust the Makefile WRT vers.c and SRCS & CLEANFILES
sync the message in boot/version with other ports using newvers_stand.sh
 1.2 09-May-1999  eeh branches: 1.2.2;
Fixup non-DEBUG kernels.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.10;
Import of sparc64.
 1.1.1.1.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck

RSS XML Feed