Home | History | Annotate | only in /src/sys/arch/luna68k
History log of /src/sys/arch/luna68k
RevisionDateAuthorComments
 1.5 17-Nov-2013  nisimura fix a botch in comment.
 1.4 06-Jan-2013  tsutsui branches: 1.4.2;
Build and install resurrected luna68k bootloader.
 1.3 25-Oct-2008  apb branches: 1.3.28; 1.3.38;
Use ${TOOL_SED} instead if plain sed in Makefiles.
 1.2 06-Jan-2003  lukem branches: 1.2.104; 1.2.108; 1.2.114;
Rework how KERNOBJDIR functions; now it's always determined with
cd ${KERNSRCDIR}/${KERNARCHDIR}/compile && ${PRINTOBJDIR}
This is far simpler than the previous system, and more robust with
objdirs built via BSDOBJDIR.

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

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

Per lengthy discussion with Andrew Brown.
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.1 07-Jan-2003  thorpej Sync with HEAD.
 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 05-Jan-2000  bouyer file Makefile was added on branch thorpej_scsipi on 2000-11-20 20:10:24 +0000
 1.2.114.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.108.1 04-May-2009  yamt sync with head.
 1.2.104.1 17-Jan-2009  mjf Sync with HEAD.
 1.3.38.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.38.1 25-Feb-2013  tls resync with head
 1.3.28.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.28.1 23-Jan-2013  yamt sync with head
 1.4.2.1 18-May-2014  rmind 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 17-Jan-2000  nisimura branches: 1.1.6; 1.1.14;
Add a place holder.
 1.1.14.1 07-Jan-2003  thorpej Sync with HEAD.
 1.1.6.2 17-Jan-2000  nisimura Add a place holder.
 1.1.6.1 17-Jan-2000  nisimura file .keep_me was added on branch thorpej_scsipi on 2000-01-17 00:55:38 +0000
 1.1 06-Jan-2003  lukem branches: 1.1.2;
Rework how KERNOBJDIR functions; now it's always determined with
cd ${KERNSRCDIR}/${KERNARCHDIR}/compile && ${PRINTOBJDIR}
This is far simpler than the previous system, and more robust with
objdirs built via BSDOBJDIR.

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

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

Per lengthy discussion with Andrew Brown.
 1.1.2.2 07-Jan-2003  thorpej Sync with HEAD.
 1.1.2.1 06-Jan-2003  thorpej file Makefile was added on branch nathanw_sa on 2003-01-07 21:11:52 +0000
 1.138 04-Jun-2025  tsutsui Use native wskbd keymap on X.Org server for hp300 and luna68k.

Also disable the no-longer-needed WSKBD_COMPAT_RAWKBD option in GENERIC.

It's more straightforward to use the native wskbd keymap provided by
the WSKBDIO_GETMAP ioctl, rather than relying on WSKBD_COMPAT_RAWKBD,
which emulates raw PS/2 "pc105" scancodes assumed by the
xf86-input-keyboard driver if no specific keymap is not found.

Tested on HP9000/382 and LUNA-II.
 1.137 13-Oct-2023  tsutsui branches: 1.137.6;
Remove trailing spaces and TAB.
 1.136 12-Feb-2023  abs Add optoion GENERIC.local include to the end of ~all GENERIC configs

This excludes atari, sgimips, evbmips, evbppc, evbsh3, and hpcarm
all of which have somewhat specific kernel config file layouts
 1.135 29-Sep-2022  riastradh 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.134 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.133 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.132 27-May-2022  tsutsui Specify -fno-unwind-tables to shrink binaries.
 1.131 04-Feb-2022  tsutsui Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.
 1.130 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.129 10-Aug-2020  rin Add -fno-omit-frame-pointer to m68k kernels with DDB for backtraces.
-omit-frame-pointer is enabled for -O1 and higher for GCC8 by default.
 1.128 01-Aug-2020  maxv Remove references to BRIDGE_IPF, it is now compiled in by default.
 1.127 26-Apr-2019  sevan branches: 1.127.2;
Use veriexec.config to reduce duplication
 1.126 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.125 23-Jan-2018  sevan branches: 1.125.2; 1.125.4;
Alternate buffer queue strategies no longer considered experimental, update
description.

Discussed on tech-kern
http://mail-index.netbsd.org/tech-kern/2018/01/21/msg023002.html
 1.124 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.123 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.122 29-Jul-2017  maxv Remove TCP_COMPAT_42 from the config files. Pass 3.
 1.121 09-Mar-2017  tsutsui branches: 1.121.6;
Add a driver for LUNA's front panel LCD. Ported from OpenBSD/luna88k.

Reviewed by enami@. Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.
 1.120 03-Dec-2016  tsutsui branches: 1.120.2;
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).

Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.119 16-Nov-2014  manu branches: 1.119.2; 1.119.4;
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.118 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.117 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.116 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.115 17-Aug-2014  joerg Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.
 1.114 16-Aug-2014  apb Add "options COMPAT_70" to all kernel configuration files that
already had "options COMPAT_60".
 1.113 20-Jul-2014  tsutsui branches: 1.113.2;
Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.112 18-Jul-2014  tsutsui Enable INET6 (for modern network) and MODULAR, and disable accept filters.
 1.111 05-Jul-2014  tsutsui Use COPTS="-O2 -fno-reorder-blocks" as defined in sys.mk for userland.

with "-O2":
text data bss dec hex filename
2064824 48784 85920 2199528 218fe8 netbsd

with "-O2 -fno-reorder-blocks":
text data bss dec hex filename
1842944 48784 85920 1977648 1e2d30 netbsd
 1.110 01-Jan-2014  tsutsui branches: 1.110.2;
Enable file-system CD9660 to make cd(4) actually usable.
 1.109 21-Dec-2013  tsutsui Add and enable wsmux(4) in GENERIC (for mlterm-fb demonstration).
 1.108 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.107 05-Jun-2013  christos branches: 1.107.2;
remove obsolete networking options
 1.106 10-May-2013  tsutsui Enable cd at scsibus, just works on LUNA-II.
 1.105 27-Apr-2013  christos the bogus number police
 1.104 27-Apr-2013  christos remove confusing numeric locators where they are unused.
 1.103 02-Mar-2013  christos Under FAST_IPSEC, IPSEC_ESP is mandatory; GC it.
 1.102 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.101 17-Oct-2012  apb Add "options COMPAT_60" to all kernel configuration files
that already had "options COMPAT_50".
 1.100 17-Aug-2012  abs branches: 1.100.2;
Update all kernel configs mentioning WSEMUL_* but not already including
WSDISPLAY_COMPAT_USL using the following rules:
- If WSEMUL_ is commented out, add commented out out WSDISPLAY_COMPAT_USL
- If INSTALL or obviously memory constrained, add WSDISPLAY_DEFAULTSCREENS=1
and commented out WSDISPLAY_COMPAT_USL
- Otherwise add WSDISPLAY_COMPAT_USL

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

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

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

On 5 June 2012 09:47, David Brownlee <abs@absd.org> wrote:
> wsconscfg(8) requires WSDISPLAY_COMPAT_USL in order to switch virtual
> terminals.
>
> Except when in an exceptionally memory or space constrained
> environment (INSTALL being the obvious case), is there any reason why
> all GENERIC and GENERIC-like kernels which have wscons enabled
> shouldn't also have WSDISPLAY_COMPAT_USL?
 1.99 20-Jul-2012  tsutsui Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
 1.98 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.97 18-Dec-2011  dholland branches: 1.97.2;
WABPL is no longer considered experimental (has not been for some time)
so update its comment in config files.
 1.96 26-Nov-2011  tsutsui branches: 1.96.2;
Bump (commented out) SYMTAB_SPACE.
 1.95 22-Nov-2011  tls 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.94 12-Nov-2011  tsutsui Finally complete LUNA-II support, after almost 12 years since
initial import of NetBSD/luna68k.

Note a working LUNA-II machine was found and provided by OMRON guys
after LUNA demonstration at Open Source Conference 2011 Kansai @ Kyoto:
http://mail-index.NetBSD.org/source-changes/2011/07/16/msg024675.html
and this resurrected LUNA-II which runs NetBSD/luna68k -current with Xserver
was also demonstrated on the NetBSD booth at Kansai Open Source 2011:
http://www.NetBSD.org/gallery/events.html#kansai-os-jp-2011

It's really pleasure to meet many OMRON LUNA developers and LUNA users
at the NetBSD booth. Thank you everyone!


Changes details:

luna68k/luna68k/locore.s
- don't use 68030 specific pflusha instruction in 68040 initialization path
- use TBIA() to invalidate TLB instead of 68030's pflusha
after MMU is turned on (as hp300 does)
(these two bugs are fatal at early bootstrap)
- pull loadustp() fixes from hp300/locore.s rev 1.82
(more flush ops are required in it otherwise causes random coredumps)
- specify correct %tt1 mask value
(the mask value means actually bit mask, not transparent range)

luna68k/luna68k/machdep.c
- use proper delay_divisor for 68040 25MHz LUNA-II

luna68k/luna68k/mainbus.c
- prepare and use per-model mainbus device lists for mainbus_attach_args

luna68k/conf/GENERIC
luna68k/conf/INSTALL
- enable options M68040 and FPSP
- enable secondary spc(4) on LUNA-II

luna68k/conf/Makefile.luna68k
- include arch/m68k/fpsp/Makefile.inc for FPSP

luna68k/dev/lcd.c
- promote LUNA-II model on LCD

XXX: old and slow SCSI-1 drives like Hitachi DK312 seems to have
XXX: some problem with spc(4) driver, even on the original LUNA
 1.93 16-Jul-2011  tsutsui branches: 1.93.2;
Revive NetBSD/luna68k.

Even after almost a lost decade since NetBSD/luna68k was
switched to using ELF format by default back in 2001,
actually only one fix (bus.h) is required for a GENERIC kernel itself
to get multiuser login: prompt on a real hardware. Hurrahhh!!!

Demonstrated with a working Xorg mono server on the NetBSD booth
at Open Source Conference 2011 Kansai @ Kyoto:
http://www.ospn.jp/osc2011-kyoto/

"Very impressed," commented by Tomoko YOSHIDA,
Program Committee Chair of the Conference,
and some other OMRON guys.

Special Thanks to Tadashi Okamura, for providing
a working SX-9100/DT "LUNA" for this mission.


Changes details:

sys/arch/luna68k/include/bus.h
- handle stride properly even on multi and region ops for MI spc(4)
- also fix stride handling of (currently unused) 2 and 4 byte ops

sys/arch/luna68k/conf/Makefile.luna68k
sys/arch/luna68k/conf/kern.ldscript.head
sys/arch/luna68k/conf/kern.ldscript.tail
- build a faked a.out kernel using elf2aout(8) tool
and a linker script derived from cats and shark
for the LUNA firmware that loads a.out binary directly
via network or from a UNIOS partition on a local disk

sys/arch/luna68k/dev/omrasops.c
sys/arch/luna68k/dev/omron_rfont.h
- use the original OMRON font derived from 4.4BSD-Lite/luna68k
rather than gallant19 which is used on Sun workstations
(XXX omrasops.c should be rewritten to use generic wsfont(4))

distrib/luna68k/*
distrib/utils/sysinst/arch/luna68k/*
etc/etc.luna68k/MAKEDEV.conf
etc/etc.luna68k/Makefile.inc
sys/arch/luna68k/conf/INSTALL
- build a ramdisk based INSTALL kernel with sysinst(8) for luna68k
- also build an installation iso image for luna68k

sys/arch/luna68k/conf/GENERIC
- enable SYSVSHM (and other SYSV*) options for Xorg server

More Xorg changes (which need some more cleanup) and
isiboot.c fixes will come soon.
 1.92 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.91 23-Nov-2010  hannken branches: 1.91.2; 1.91.4;
Remove unused count from pseudo-device md.
 1.90 29-Apr-2010  chs enable TMPFS in all GENERICs that have MFS enabled.
 1.89 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.88 05-Dec-2009  pooka branches: 1.88.2; 1.88.4;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.87 24-Jan-2009  mrg add COMPAT_50 to all the configs with COMPAT_40.
 1.86 24-Nov-2008  ad Remove softdep, pass 1. We are focused on improving journalling.

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

Proposed on tech-kern@.
 1.84 10-Aug-2008  tls branches: 1.84.2;
Add accept filters to GENERIC kernels where they exist.
 1.83 31-Jul-2008  simonb Add "options WAPBL" to standard GENERIC/INSTALL type configs.
 1.82 30-May-2008  tsutsui branches: 1.82.4;
Add options COMPAT_40 to files which have options COMPAT_30.
 1.81 31-Dec-2007  ad branches: 1.81.6; 1.81.8; 1.81.10; 1.81.12;
Remove systrace. Ok core@.
 1.80 04-Nov-2007  xtraeme branches: 1.80.2; 1.80.8;
Remove System V semaphores and share memory options to set the limits:
SEMMNI, SEMMNS, SEMUME and SHMMAXPGS.

They can be tweaked via sysctl now. Ports that were setting values on
them weren't touched, I only removed the ones that were commented out.
 1.79 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.78 04-Jun-2007  martin branches: 1.78.8; 1.78.10; 1.78.14;
Add pseudo-device agr to all GENERIC kernels where it might make sense
(commented out in some).
 1.77 24-Nov-2006  wiz branches: 1.77.2; 1.77.8; 1.77.10; 1.77.16; 1.77.18;
s/independant/independent/, from Zafer.
 1.76 11-Nov-2006  jmmv Remove tmpfs's experimental status. OK'ed by core@.
 1.75 26-Aug-2006  christos branches: 1.75.2; 1.75.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.74 26-Aug-2006  tsutsui Remove obsolete #options VERIFIED_EXEC, found by grep(1).
 1.73 12-Aug-2006  christos Disable SYSTRACE by default on all kernels (discussed with core)
 1.72 28-Jun-2006  liamjfoy branches: 1.72.2;
Add CARP to GENERIC kernel configs. CARP is not enabled by default.

ok: christos
 1.71 05-Feb-2006  cube branches: 1.71.2; 1.71.10;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.70 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.69 02-Feb-2006  reinoud branches: 1.69.2;
Add commented out UDF file-system entry in all GENERIC configurations.
 1.68 09-Dec-2005  elad branches: 1.68.2; 1.68.4;
Add (commented out) Veriexec options and pseudo-device to GENERIC kernels,
and remove the i386 GENERIC_VERIEXEC config.
 1.67 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

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

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

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

OK'ed by my project mentor, William Studenmund (wrstuden@).
 1.65 04-Sep-2005  isaki typo in comment.
 1.64 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.63 19-Aug-2005  christos 64 bit inode changes.
 1.62 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.61 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.60 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.59 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.58 25-Jun-2005  rpaulo branches: 1.58.2;
Add file-system PTYFS (commented out) so that people know its existence.

Ok'ed by Christos Zoulas and Hubert Feyrer.
 1.57 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.56 25-Feb-2005  simonb branches: 1.56.2;
Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.55 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.54 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.53 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.52 28-Jan-2005  rumble Sprinkle options UFS_DIRHASH on GENERIC kernels. It's presently
commented out and labeled experimental pending further review and
testing.
 1.51 17-Jan-2005  cube branches: 1.51.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.50 10-Nov-2004  christos branches: 1.50.4;
Add COMPAT_BSDPTY to the rest of the config files.
 1.49 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.48 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.47 28-Jun-2004  bouyer Add options P1003_1B_SEMAPHORE
to all GENERIC-like kernel config files where SYSV* options were already
present (commented out if the SYSV* options are commented out).
Fix lib/25897 and lib/25898.
 1.46 26-Jun-2004  abs Add (commented out) ALTQ options to all GENERIC-like files
 1.45 22-Jun-2004  itojun have pf and pflog pseudo-device (commented out).
reviewed by matt, perry, christos
 1.44 18-Jun-2004  christos ptm is now mandatory, depends on pty, and can be disabled with -DNO_DEV_PTM
 1.43 16-Jun-2004  christos Add pseudo-device ptm on all the generic flavored kernels.
 1.42 22-Sep-2003  cl branches: 1.42.2;
add COMPAT_15/COMPAT_16
 1.41 26-Apr-2003  ragge branches: 1.41.2;
Add pseudo-device ksyms.
 1.40 10-Apr-2003  christos Bye Bye UCONSOLE
 1.39 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.38 22-Nov-2002  wiz Fix typo (responsiness -> responsiveness).
 1.37 18-Oct-2002  junyoung Add NEW_BUFQ_STRATEGY (disabled by default).
 1.36 14-Oct-2002  elric Added commented out cgd(4)s to GENERIC configs.
 1.35 06-Oct-2002  provos add SYSTRACE; approved perry.
 1.34 25-Sep-2002  martti Add one space between "#option" and "<tab>IPFILTER_DEFAULT_BLOCK"
 1.33 20-Sep-2002  martti Added (commented out) IPFILTER_DEFAULT_BLOCK.
 1.32 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.31 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.30 25-Apr-2002  atatat branches: 1.30.2; 1.30.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.29 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.28 05-Mar-2002  wiz 'securyty' looks nice. Sadly, it's wrong.
 1.27 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.26 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.25 22-Dec-2001  chs convert luna68k to ELF. ok'd by nisimura.
 1.24 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.23 23-Nov-2001  atatat The bridge(4) pseudo-device no longer requires the port to
__HAVE_GENERIC_SOFT_INTERRUPTS, so add it back to all GENERIC configs.
 1.22 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.21 01-Sep-2001  atatat branches: 1.21.6;
Comment out bridge pseudo devices from ports that don't
__HAVE_GENERIC_SOFT_INTERRUPTS. bridge(4) doesn't compile there.
 1.20 01-Sep-2001  atatat Add bridge pseudo devices to GENERIC configs
 1.19 08-Jul-2001  abs branches: 1.19.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.18 30-Jun-2001  darcy Add System V semaphore resource limits to each GENERIC file that has an
option for System V semaphores. It appears that there are no overrides
in the code and each file has the following added.

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

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

Note - the i386 port was not forgotten. It was done separately.
 1.17 11-Jun-2001  wiz Fix various misspellings of compatible/compatibility.
 1.16 21-Feb-2001  nisimura branches: 1.16.2;
Make sure to have rnd pseudo device.
 1.15 19-Dec-2000  tsutsui Remove "rnd is EXPERIMENTAL" comments.
 1.14 19-Dec-2000  bouyer Add pseudo-device vlan
 1.13 19-Oct-2000  nisimura branches: 1.13.2;
Add wsmouse support.
 1.12 18-Oct-2000  nisimura GENERIC root filesys had mistakenly typed nfs. Let it wildcarded.
 1.11 04-Oct-2000  itojun enable rnd device. they are now mandatory for ssh/sshd support,
so it makes more sense to enable it.
please disable them if there's any issues, but in that case, in-tree
ssh/sshd won't work.
 1.10 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.9 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.8 27-Jul-2000  mason Moving to a default of 64 PTYs.
 1.7 30-Jun-2000  itojun add PULLDOWN_TEST for all the platforms.
XXX should be moved to somewhere else when stabilized
 1.6 22-Jun-2000  fvdl Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.5 14-Jun-2000  veego branches: 1.5.2;
Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.4 12-Feb-2000  thorpej branches: 1.4.2;
Nuke NKMEMCLUSTERS.
 1.3 23-Jan-2000  hubertf Add commented out "ident"-command
 1.2 17-Jan-2000  nisimura Remove extra debugging/sanity checking code from GENERIC.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.4 01-May-2001  he Pull up revisions 1.14-1.15 (requested by he):
Add pseudo-device vlan.
Make sure "rnd is EXPERIMENTAL" comment is removed.
 1.5.2.3 04-Oct-2000  itojun pullup (approved by releng-1-5)

enable rnd device. they are now mandatory for ssh/sshd support,
so it makes more sense to enable it.
please disable them if there's any issues, but in that case, in-tree
ssh/sshd won't work.

cvs rdiff -r1.166 -r1.167 syssrc/sys/arch/alpha/conf/GENERIC
cvs rdiff -r1.149 -r1.150 syssrc/sys/arch/amiga/conf/GENERIC
cvs rdiff -r1.11 -r1.12 syssrc/sys/arch/arm26/conf/GENERIC
cvs rdiff -r1.72 -r1.73 syssrc/sys/arch/atari/conf/GENERIC
cvs rdiff -r1.60 -r1.61 syssrc/sys/arch/hp300/conf/GENERIC
cvs rdiff -r1.10 -r1.11 syssrc/sys/arch/luna68k/conf/GENERIC
cvs rdiff -r1.35 -r1.36 syssrc/sys/arch/next68k/conf/GENERIC
cvs rdiff -r1.32 -r1.33 syssrc/sys/arch/ofppc/conf/GENERIC
cvs rdiff -r1.73 -r1.74 syssrc/sys/arch/sun3/conf/GENERIC
cvs rdiff -r1.80 -r1.81 syssrc/sys/arch/vax/conf/GENERIC
cvs rdiff -r1.52 -r1.53 syssrc/sys/arch/x68k/conf/GENERIC
 1.5.2.2 11-Aug-2000  mason Move to default of 64 PTYs in GENERIC kernel config.
Requested by mason, approved by jhawk.
 1.5.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.13.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.13.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.13.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.13.2.1 19-Oct-2000  bouyer file GENERIC was added on branch thorpej_scsipi on 2000-11-20 20:10:24 +0000
 1.16.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.19.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.19.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.19.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.19.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.19.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.21.6.9 11-Dec-2002  thorpej Sync with HEAD.
 1.21.6.8 11-Nov-2002  nathanw Catch up to -current
 1.21.6.7 18-Oct-2002  nathanw Catch up to -current.
 1.21.6.6 20-Jun-2002  nathanw Catch up to -current.
 1.21.6.5 17-Apr-2002  nathanw Catch up to -current.
 1.21.6.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.21.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.21.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.21.6.1 01-Sep-2001  nathanw file GENERIC was added on branch nathanw_sa on 2002-01-08 00:25:49 +0000
 1.30.4.2 24-Oct-2002  lukem Pull up upgrade to IPfilter 3.4.29 (requested by martti in ticket #905).
Affected files & revisions:

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

Hi Perry!
 1.41.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.41.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.41.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.41.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.41.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.41.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.41.2.1 03-Aug-2004  skrll Sync with HEAD
 1.42.2.3 15-Jul-2004  he Pull up revision 1.48 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.42.2.2 02-Jul-2004  he Pull up revision 1.47 (requested by bouyer in ticket #573):
Add options P1003_1B_SEMAPHORE to all GENERIC-like kernel
config files where SYSV* options were already present
(commented out if the SYSV* options are commented out).
Fixes PR#25897 and PR#25898.
 1.42.2.1 30-Jun-2004  jdc Pull up revision 1.46 (requested by abs in ticket #567).

Add (commented out) ALTQ options to all GENERIC-like files
 1.50.4.1 29-Apr-2005  kent sync with -current
 1.51.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.51.2.1 12-Feb-2005  yamt sync with head.
 1.56.2.2 14-Aug-2005  riz Pull up revision 1.60 (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.56.2.1 18-Jul-2005  riz Pull up revision 1.59 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.58.2.5 21-Jan-2008  yamt sync with head
 1.58.2.4 15-Nov-2007  yamt sync with head.
 1.58.2.3 03-Sep-2007  yamt sync with head.
 1.58.2.2 30-Dec-2006  yamt sync with head.
 1.58.2.1 21-Jun-2006  yamt sync with head.
 1.68.4.1 09-Sep-2006  rpaulo sync with head
 1.68.2.1 18-Feb-2006  yamt sync with head.
 1.69.2.1 22-Apr-2006  simonb Sync with head.
 1.71.10.1 13-Jul-2006  gdamore Merge from HEAD.
 1.71.2.2 03-Sep-2006  yamt sync with head.
 1.71.2.1 11-Aug-2006  yamt sync with head
 1.72.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.72.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.75.4.1 10-Dec-2006  yamt sync with head.
 1.75.2.2 12-Jan-2007  ad Sync with head.
 1.75.2.1 18-Nov-2006  ad Sync with head.
 1.77.18.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.77.16.1 26-Jun-2007  garbled Sync with HEAD.
 1.77.10.1 11-Jul-2007  mjf Sync with head.
 1.77.8.2 03-Dec-2007  ad Sync with HEAD.
 1.77.8.1 09-Jun-2007  ad Sync with head.
 1.77.2.1 05-Jun-2007  bouyer Pull up following revision(s) (requested by martin in ticket #699):
sys/arch/hpcmips/conf/GENERIC: revision 1.196
sys/arch/hp700/conf/GENERIC: revision 1.74
sys/arch/i386/conf/GENERIC: revision 1.831
sys/arch/next68k/conf/GENERIC: revision 1.108
sys/arch/alpha/conf/GENERIC: revision 1.313
sys/arch/arc/conf/GENERIC: revision 1.146
sys/arch/cats/conf/GENERIC: revision 1.115
sys/arch/ews4800mips/conf/GENERIC: revision 1.18
sys/arch/landisk/conf/GENERIC: revision 1.8 via patch
sys/arch/sparc64/conf/GENERIC: revision 1.85
sys/arch/pmax/conf/GENERIC: revision 1.152
sys/arch/iyonix/conf/GENERIC: revision 1.38 via patch
sys/arch/amiga/conf/GENERIC: revision 1.245
sys/arch/vax/conf/GENERIC: revision 1.157
sys/arch/prep/conf/GENERIC: revision 1.135
sys/arch/pc532/conf/GENERIC: revision 1.70
sys/arch/sbmips/conf/GENERIC: revision 1.61
sys/arch/mipsco/conf/GENERIC: revision 1.65
sys/arch/cobalt/conf/GENERIC: revision 1.108
sys/arch/ofppc/conf/GENERIC: revision 1.98
sys/arch/amd64/conf/GENERIC: revision 1.148
sys/arch/acorn26/conf/GENERIC: revision 1.50
sys/arch/dreamcast/conf/GENERIC: revision 1.78
sys/arch/mac68k/conf/GENERIC: revision 1.181
sys/arch/hp300/conf/GENERIC: revision 1.139
sys/arch/mmeye/conf/GENERIC: revision 1.88
sys/arch/news68k/conf/GENERIC: revision 1.88
sys/arch/mvme68k/conf/GENERIC: revision 1.71
sys/arch/acorn32/conf/GENERIC: revision 1.79
sys/arch/sparc/conf/GENERIC: revision 1.199
sys/arch/luna68k/conf/GENERIC: revision 1.78
sys/arch/bebox/conf/GENERIC: revision 1.105
sys/arch/macppc/conf/GENERIC: revision 1.256 via patch
sys/arch/x68k/conf/GENERIC: revision 1.134
sys/arch/sun3/conf/GENERIC: revision 1.138
sys/arch/newsmips/conf/GENERIC: revision 1.98
Add pseudo-device agr to all GENERIC kernels where it might make sense
(commented out in some).
 1.78.14.1 13-Nov-2007  bouyer Sync with HEAD
 1.78.10.2 09-Jan-2008  matt sync with HEAD
 1.78.10.1 06-Nov-2007  matt sync with HEAD
 1.78.8.1 04-Nov-2007  jmcneill Sync with HEAD.
 1.80.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.80.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.81.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.81.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.81.10.3 11-Aug-2010  yamt sync with head.
 1.81.10.2 11-Mar-2010  yamt sync with head
 1.81.10.1 04-May-2009  yamt sync with head.
 1.81.8.1 04-Jun-2008  yamt sync with head
 1.81.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.81.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.81.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.82.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.82.4.1 19-Oct-2008  haad Sync with HEAD.
 1.84.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.84.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.88.4.3 21-Apr-2011  rmind sync with head
 1.88.4.2 05-Mar-2011  rmind sync with head
 1.88.4.1 30-May-2010  rmind sync with head
 1.88.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.88.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.91.4.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.91.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.93.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.93.2.2 30-Oct-2012  yamt sync with head
 1.93.2.1 17-Apr-2012  yamt sync with head
 1.96.2.2 11-Mar-2012  mrg sync to latest -current
 1.96.2.1 18-Feb-2012  mrg merge to -current.
 1.97.2.3 09-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.97.2.2 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1000):
sys/arch/luna68k/conf/GENERIC: revision 1.106
sys/arch/luna68k/conf/GENERIC: revision 1.109
sys/arch/luna68k/conf/GENERIC: revision 1.110
Enable cd at scsibus, just works on LUNA-II.
Add and enable wsmux(4) in GENERIC (for mlterm-fb demonstration).
Enable file-system CD9660 to make cd(4) actually usable.
 1.97.2.1 25-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
 1.100.2.4 03-Dec-2017  jdolecek update from HEAD
 1.100.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.100.2.2 23-Jun-2013  tls resync from head
 1.100.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.107.2.2 18-May-2014  rmind sync with head
 1.107.2.1 28-Aug-2013  rmind sync with head
 1.110.2.1 10-Aug-2014  tls Rebase.
 1.113.2.5 05-Apr-2017  snj Pull up following revision(s) (requested by skrll in ticket #1395):
share/man/man4/axe.4: netbsd-7-nhusb
share/man/man4/axen.4: netbsd-7-nhusb
share/man/man4/cdce.4: netbsd-7-nhusb
share/man/man4/uaudio.4: netbsd-7-nhusb
share/man/man4/ucom.4: netbsd-7-nhusb
share/man/man4/uep.4: netbsd-7-nhusb
share/man/man4/urtw.4: netbsd-7-nhusb
share/man/man4/usb.4: netbsd-7-nhusb
share/man/man4/uyap.4: netbsd-7-nhusb
share/man/man4/xhci.4: netbsd-7-nhusb
share/man/man9/usbdi.9: netbsd-7-nhusb
sys/arch/amd64/conf/ALL: netbsd-7-nhusb
sys/arch/amd64/conf/GENERIC: netbsd-7-nhusb
sys/arch/amiga/dev/slhci_zbus.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_otg.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_usb.c: netbsd-7-nhusb
sys/arch/arm/amlogic/amlogic_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/at91/at91ohci.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm2835_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm53xx_usb.c: netbsd-7-nhusb
sys/arch/arm/ep93xx/epohci.c: netbsd-7-nhusb
sys/arch/arm/gemini/obio_ehci.c: netbsd-7-nhusb
sys/arch/arm/imx/files.imx23: netbsd-7-nhusb
sys/arch/arm/imx/imxusb.c: netbsd-7-nhusb
sys/arch/arm/imx/imxusbreg.h: netbsd-7-nhusb
sys/arch/arm/omap/obio_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/omap3_ehci.c: netbsd-7-nhusb
sys/arch/arm/omap/omapl1x_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/tiotg.c: netbsd-7-nhusb
sys/arch/arm/s3c2xx0/ohci_s3c24x0.c: netbsd-7-nhusb
sys/arch/arm/samsung/exynos_usb.c: netbsd-7-nhusb
sys/arch/arm/xscale/pxa2x0_ohci.c: netbsd-7-nhusb
sys/arch/arm/zynq/zynq_usb.c: netbsd-7-nhusb
sys/arch/hpcarm/dev/nbp_slhci.c: netbsd-7-nhusb
sys/arch/hpcmips/dev/plumohci.c: netbsd-7-nhusb
sys/arch/i386/conf/ALL: netbsd-7-nhusb
sys/arch/i386/conf/GENERIC: netbsd-7-nhusb
sys/arch/i386/pci/gcscehci.c: netbsd-7-nhusb
sys/arch/luna68k/conf/GENERIC: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahci.c: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahcivar.h: netbsd-7-nhusb
sys/arch/mips/alchemy/dev/ohci_aubus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ehci_arbus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ohci_arbus.c: netbsd-7-nhusb
sys/arch/mips/conf/files.adm5120: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ehci.c: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ohci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ehci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ohci.c: netbsd-7-nhusb
sys/arch/playstation2/dev/ohci_sbus.c: netbsd-7-nhusb
sys/arch/powerpc/booke/dev/pq3ehci.c: netbsd-7-nhusb
sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c: netbsd-7-nhusb
sys/arch/x68k/dev/slhci_intio.c: netbsd-7-nhusb
sys/conf/files: netbsd-7-nhusb
sys/dev/cardbus/ehci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/ohci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/uhci_cardbus.c: netbsd-7-nhusb
sys/dev/ic/sl811hs.c: netbsd-7-nhusb
sys/dev/ic/sl811hsvar.h: netbsd-7-nhusb
sys/dev/isa/slhci_isa.c: netbsd-7-nhusb
sys/dev/marvell/ehci_mv.c: netbsd-7-nhusb
sys/dev/pci/ehci_pci.c: netbsd-7-nhusb
sys/dev/pci/ohci_pci.c: netbsd-7-nhusb
sys/dev/pci/uhci_pci.c: netbsd-7-nhusb
sys/dev/pci/xhci_pci.c: netbsd-7-nhusb
sys/dev/pcmcia/slhci_pcmcia.c: netbsd-7-nhusb
sys/dev/usb/Makefile.usbdevs: netbsd-7-nhusb
sys/dev/usb/TODO: netbsd-7-nhusb
sys/dev/usb/TODO.usbmp: netbsd-7-nhusb
sys/dev/usb/aubtfwl.c: netbsd-7-nhusb
sys/dev/usb/auvitek.c: netbsd-7-nhusb
sys/dev/usb/auvitek_audio.c: netbsd-7-nhusb
sys/dev/usb/auvitek_dtv.c: netbsd-7-nhusb
sys/dev/usb/auvitek_i2c.c: netbsd-7-nhusb
sys/dev/usb/auvitek_video.c: netbsd-7-nhusb
sys/dev/usb/auvitekvar.h: netbsd-7-nhusb
sys/dev/usb/ehci.c: netbsd-7-nhusb
sys/dev/usb/ehcireg.h: netbsd-7-nhusb
sys/dev/usb/ehcivar.h: netbsd-7-nhusb
sys/dev/usb/emdtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_dtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_ir.c: netbsd-7-nhusb
sys/dev/usb/emdtvvar.h: netbsd-7-nhusb
sys/dev/usb/ezload.c: netbsd-7-nhusb
sys/dev/usb/ezload.h: netbsd-7-nhusb
sys/dev/usb/files.usb: netbsd-7-nhusb
sys/dev/usb/hid.c: netbsd-7-nhusb
sys/dev/usb/hid.h: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.c: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.h: netbsd-7-nhusb
sys/dev/usb/if_atu.c: netbsd-7-nhusb
sys/dev/usb/if_atureg.h: netbsd-7-nhusb
sys/dev/usb/if_aue.c: netbsd-7-nhusb
sys/dev/usb/if_auereg.h: netbsd-7-nhusb
sys/dev/usb/if_axe.c: netbsd-7-nhusb
sys/dev/usb/if_axen.c: netbsd-7-nhusb
sys/dev/usb/if_axenreg.h: netbsd-7-nhusb
sys/dev/usb/if_axereg.h: netbsd-7-nhusb
sys/dev/usb/if_cdce.c: netbsd-7-nhusb
sys/dev/usb/if_cdcereg.h: netbsd-7-nhusb
sys/dev/usb/if_cue.c: netbsd-7-nhusb
sys/dev/usb/if_cuereg.h: netbsd-7-nhusb
sys/dev/usb/if_kue.c: netbsd-7-nhusb
sys/dev/usb/if_kuereg.h: netbsd-7-nhusb
sys/dev/usb/if_otus.c: netbsd-7-nhusb
sys/dev/usb/if_otusvar.h: netbsd-7-nhusb
sys/dev/usb/if_rum.c: netbsd-7-nhusb
sys/dev/usb/if_rumreg.h: netbsd-7-nhusb
sys/dev/usb/if_rumvar.h: netbsd-7-nhusb
sys/dev/usb/if_run.c: netbsd-7-nhusb
sys/dev/usb/if_runvar.h: netbsd-7-nhusb
sys/dev/usb/if_smsc.c: netbsd-7-nhusb
sys/dev/usb/if_smscreg.h: netbsd-7-nhusb
sys/dev/usb/if_smscvar.h: netbsd-7-nhusb
sys/dev/usb/if_udav.c: netbsd-7-nhusb
sys/dev/usb/if_udavreg.h: netbsd-7-nhusb
sys/dev/usb/if_upgt.c: netbsd-7-nhusb
sys/dev/usb/if_upgtvar.h: netbsd-7-nhusb
sys/dev/usb/if_upl.c: netbsd-7-nhusb
sys/dev/usb/if_ural.c: netbsd-7-nhusb
sys/dev/usb/if_uralreg.h: netbsd-7-nhusb
sys/dev/usb/if_uralvar.h: netbsd-7-nhusb
sys/dev/usb/if_url.c: netbsd-7-nhusb
sys/dev/usb/if_urlreg.h: netbsd-7-nhusb
sys/dev/usb/if_urndis.c: netbsd-7-nhusb
sys/dev/usb/if_urndisreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtw.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn_data.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnvar.h: netbsd-7-nhusb
sys/dev/usb/if_urtwreg.h: netbsd-7-nhusb
sys/dev/usb/if_zyd.c: netbsd-7-nhusb
sys/dev/usb/if_zydreg.h: netbsd-7-nhusb
sys/dev/usb/irmce.c: netbsd-7-nhusb
sys/dev/usb/moscom.c: netbsd-7-nhusb
sys/dev/usb/motg.c: netbsd-7-nhusb
sys/dev/usb/motgvar.h: netbsd-7-nhusb
sys/dev/usb/ohci.c: netbsd-7-nhusb
sys/dev/usb/ohcireg.h: netbsd-7-nhusb
sys/dev/usb/ohcivar.h: netbsd-7-nhusb
sys/dev/usb/pseye.c: netbsd-7-nhusb
sys/dev/usb/slurm.c: netbsd-7-nhusb
sys/dev/usb/stuirda.c: netbsd-7-nhusb
sys/dev/usb/u3g.c: netbsd-7-nhusb
sys/dev/usb/uark.c: netbsd-7-nhusb
sys/dev/usb/uatp.c: netbsd-7-nhusb
sys/dev/usb/uaudio.c: netbsd-7-nhusb
sys/dev/usb/uberry.c: netbsd-7-nhusb
sys/dev/usb/ubsa.c: netbsd-7-nhusb
sys/dev/usb/ubsa_common.c: netbsd-7-nhusb
sys/dev/usb/ubsavar.h: netbsd-7-nhusb
sys/dev/usb/ubt.c: netbsd-7-nhusb
sys/dev/usb/uchcom.c: netbsd-7-nhusb
sys/dev/usb/ucom.c: netbsd-7-nhusb
sys/dev/usb/ucomvar.h: netbsd-7-nhusb
sys/dev/usb/ucycom.c: netbsd-7-nhusb
sys/dev/usb/udl.c: netbsd-7-nhusb
sys/dev/usb/udl.h: netbsd-7-nhusb
sys/dev/usb/udsbr.c: netbsd-7-nhusb
sys/dev/usb/udsir.c: netbsd-7-nhusb
sys/dev/usb/uep.c: netbsd-7-nhusb
sys/dev/usb/uftdi.c: netbsd-7-nhusb
sys/dev/usb/uftdireg.h: netbsd-7-nhusb
sys/dev/usb/ugen.c: netbsd-7-nhusb
sys/dev/usb/ugensa.c: netbsd-7-nhusb
sys/dev/usb/uhci.c: netbsd-7-nhusb
sys/dev/usb/uhcireg.h: netbsd-7-nhusb
sys/dev/usb/uhcivar.h: netbsd-7-nhusb
sys/dev/usb/uhid.c: netbsd-7-nhusb
sys/dev/usb/uhidev.c: netbsd-7-nhusb
sys/dev/usb/uhidev.h: netbsd-7-nhusb
sys/dev/usb/uhmodem.c: netbsd-7-nhusb
sys/dev/usb/uhso.c: netbsd-7-nhusb
sys/dev/usb/uhub.c: netbsd-7-nhusb
sys/dev/usb/uipad.c: netbsd-7-nhusb
sys/dev/usb/uipaq.c: netbsd-7-nhusb
sys/dev/usb/uirda.c: netbsd-7-nhusb
sys/dev/usb/uirdavar.h: netbsd-7-nhusb
sys/dev/usb/ukbd.c: netbsd-7-nhusb
sys/dev/usb/ukbdmap.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.h: netbsd-7-nhusb
sys/dev/usb/ulpt.c: netbsd-7-nhusb
sys/dev/usb/umass.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.h: netbsd-7-nhusb
sys/dev/usb/umass_quirks.c: netbsd-7-nhusb
sys/dev/usb/umass_quirks.h: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.c: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.h: netbsd-7-nhusb
sys/dev/usb/umassvar.h: netbsd-7-nhusb
sys/dev/usb/umcs.c: netbsd-7-nhusb
sys/dev/usb/umct.c: netbsd-7-nhusb
sys/dev/usb/umidi.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.h: netbsd-7-nhusb
sys/dev/usb/umodem.c: netbsd-7-nhusb
sys/dev/usb/umodem_common.c: netbsd-7-nhusb
sys/dev/usb/umodemvar.h: netbsd-7-nhusb
sys/dev/usb/ums.c: netbsd-7-nhusb
sys/dev/usb/uplcom.c: netbsd-7-nhusb
sys/dev/usb/urio.c: netbsd-7-nhusb
sys/dev/usb/urio.h: netbsd-7-nhusb
sys/dev/usb/usb.c: netbsd-7-nhusb
sys/dev/usb/usb.h: netbsd-7-nhusb
sys/dev/usb/usb_mem.c: netbsd-7-nhusb
sys/dev/usb/usb_mem.h: netbsd-7-nhusb
sys/dev/usb/usb_quirks.c: netbsd-7-nhusb
sys/dev/usb/usb_quirks.h: netbsd-7-nhusb
sys/dev/usb/usb_subr.c: netbsd-7-nhusb
sys/dev/usb/usbdevices.config: netbsd-7-nhusb
sys/dev/usb/usbdevs: netbsd-7-nhusb
sys/dev/usb/usbdevs.h: netbsd-7-nhusb
sys/dev/usb/usbdevs_data.h: netbsd-7-nhusb
sys/dev/usb/usbdi.c: netbsd-7-nhusb
sys/dev/usb/usbdi.h: netbsd-7-nhusb
sys/dev/usb/usbdi_util.c: netbsd-7-nhusb
sys/dev/usb/usbdi_util.h: netbsd-7-nhusb
sys/dev/usb/usbdivar.h: netbsd-7-nhusb
sys/dev/usb/usbhid.h: netbsd-7-nhusb
sys/dev/usb/usbhist.h: netbsd-7-nhusb
sys/dev/usb/usbroothub.c: netbsd-7-nhusb
sys/dev/usb/usbroothub.h: netbsd-7-nhusb
sys/dev/usb/usbroothub_subr.c: delete
sys/dev/usb/usbroothub_subr.h: delete
sys/dev/usb/uscanner.c: netbsd-7-nhusb
sys/dev/usb/uslsa.c: netbsd-7-nhusb
sys/dev/usb/usscanner.c: netbsd-7-nhusb
sys/dev/usb/ustir.c: netbsd-7-nhusb
sys/dev/usb/uthum.c: netbsd-7-nhusb
sys/dev/usb/utoppy.c: netbsd-7-nhusb
sys/dev/usb/uts.c: netbsd-7-nhusb
sys/dev/usb/uvideo.c: netbsd-7-nhusb
sys/dev/usb/uvisor.c: netbsd-7-nhusb
sys/dev/usb/uvscom.c: netbsd-7-nhusb
sys/dev/usb/uyap.c: netbsd-7-nhusb
sys/dev/usb/uyap_firmware.h: netbsd-7-nhusb
sys/dev/usb/uyurex.c: netbsd-7-nhusb
sys/dev/usb/x1input_rdesc.h: netbsd-7-nhusb
sys/dev/usb/xhci.c: netbsd-7-nhusb
sys/dev/usb/xhcireg.h: netbsd-7-nhusb
sys/dev/usb/xhcivar.h: netbsd-7-nhusb
sys/dev/usb/xinput_rdesc.h: netbsd-7-nhusb
sys/external/bsd/common/conf/files.linux: netbsd-7-nhusb
sys/external/bsd/common/include/linux/err.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/kernel.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/workqueue.h: netbsd-7-nhusb
sys/external/bsd/common/linux/linux_work.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/drm/files.drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/i915drm/files.i915drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/include/linux/err.h: delete
sys/external/bsd/drm2/include/linux/workqueue.h: delete
sys/external/bsd/drm2/linux/files.drmkms_linux: netbsd-7-nhusb
sys/external/bsd/drm2/linux/linux_work.c: delete
sys/external/bsd/dwc2/dwc2.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2var.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwctwo2netbsd: netbsd-7-nhusb
sys/external/bsd/dwc2/conf/files.dwc2: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_coreintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdddma.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hw.h: netbsd-7-nhusb
sys/modules/drmkms_linux/Makefile: netbsd-7-nhusb
sys/modules/i915drmkms/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libugenhc/ugenhc.c: netbsd-7-nhusb
sys/rump/dev/lib/libusb/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libusb/USB.ioconf: netbsd-7-nhusb
sys/rump/dev/lib/libusb/usb_at_ugenhc.c: delete
sys/rump/dev/lib/libusb/opt/opt_usb.h: delete
sys/rump/dev/lib/libusb/opt/opt_usbverbose.h: delete
sys/sys/mbuf.h: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.8: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.c: netbsd-7-nhusb
Merge netbsd-7-nhusb:
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
- Change the SOFTINT level from NET to SERIAL for the USB softint handler.
This gives the callback a chance of running when another softint handler
at SOFTINT_NET has blocked holding a lock, e.g. softnet_lock and most of
the network stack.
- kern/49065 - ifconfig tun0 ... sequence locks up system / lockup:
softnet_lock held across usb xfr
- kern/50491 - unkillable wait in usbd_transfer while using usmsc0
on raspberry pi 2
- kern/51395 - USB Ethernet makes xhci hang
- Various improvements to slhci(4)
- Various improvements to dwc2(4)
 1.113.2.4 06-Dec-2016  snj Pull up following revision(s) (requested by tsutsui in ticket #1283):
distrib/sets/lists/comp/md.luna68k: revision 1.21
etc/etc.luna68k/MAKEDEV.conf: revision 1.9
sys/arch/luna68k/conf/GENERIC: revision 1.120
sys/arch/luna68k/conf/files.luna68k: revision 1.25
sys/arch/luna68k/conf/majors.luna68k: revision 1.21
sys/arch/luna68k/dev/xp.c: revision 1.1
sys/arch/luna68k/include/Makefile: revision 1.19
sys/arch/luna68k/include/xpio.h: revision 1.1
sys/arch/luna68k/luna68k/mainbus.c: revision 1.14
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).
Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.113.2.3 15-May-2015  snj branches: 1.113.2.3.4;
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.113.2.2 18-Nov-2014  snj Pull up following revision(s) (requested by manu in ticket #251):
sys/arch/acorn26/conf/GENERIC: revision 1.81
sys/arch/acorn32/conf/GENERIC: revision 1.116
sys/arch/alpha/conf/GENERIC: revision 1.362
sys/arch/amd64/conf/ALL: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.404
sys/arch/amd64/conf/XEN3_DOM0: revision 1.112
sys/arch/amd64/conf/XEN3_DOMU: revision 1.60
sys/arch/amiga/conf/GENERIC.in: revision 1.129
sys/arch/amiga/conf/GENERIC: revision 1.311
sys/arch/amigappc/conf/GENERIC: revision 1.24
sys/arch/arc/conf/GENERIC: revision 1.184
sys/arch/bebox/conf/GENERIC: revision 1.145
sys/arch/cats/conf/GENERIC: revision 1.155
sys/arch/cesfic/conf/GENERIC: revision 1.65
sys/arch/cobalt/conf/GENERIC: revision 1.147
sys/arch/dreamcast/conf/GENERIC: revision 1.121
sys/arch/emips/conf/GENERIC: revision 1.15
sys/arch/epoc32/conf/GENERIC: revision 1.8
sys/arch/ews4800mips/conf/GENERIC: revision 1.51
sys/arch/hp300/conf/GENERIC: revision 1.190
sys/arch/hpcmips/conf/GENERIC: revision 1.229
sys/arch/hpcsh/conf/GENERIC: revision 1.106
sys/arch/hppa/conf/GENERIC: revision 1.6
sys/arch/i386/conf/ALL: revision 1.389
sys/arch/i386/conf/GENERIC: revision 1.1118
sys/arch/i386/conf/XEN3_DOM0: revision 1.93
sys/arch/i386/conf/XEN3_DOMU: revision 1.65
sys/arch/ibmnws/conf/GENERIC: revision 1.46
sys/arch/iyonix/conf/GENERIC: revision 1.88
sys/arch/landisk/conf/GENERIC: revision 1.45
sys/arch/luna68k/conf/GENERIC: revision 1.119
sys/arch/mac68k/conf/GENERIC: revision 1.220
sys/arch/macppc/conf/GENERIC: revision 1.320
sys/arch/macppc/conf/MAMBO: revision 1.24
sys/arch/macppc/conf/POWERMAC_G5: revision 1.25
sys/arch/mipsco/conf/GENERIC: revision 1.88
sys/arch/mmeye/conf/GENERIC: revision 1.120
sys/arch/mvme68k/conf/GENERIC: revision 1.94
sys/arch/mvmeppc/conf/GENERIC: revision 1.24
sys/arch/netwinder/conf/GENERIC: revision 1.126
sys/arch/news68k/conf/GENERIC: revision 1.125
sys/arch/newsmips/conf/GENERIC: revision 1.129
sys/arch/next68k/conf/GENERIC: revision 1.139
sys/arch/ofppc/conf/GENERIC: revision 1.157
sys/arch/pmax/conf/GENERIC64: revision 1.21
sys/arch/pmax/conf/GENERIC: revision 1.185
sys/arch/prep/conf/GENERIC: revision 1.174
sys/arch/rs6000/conf/GENERIC: revision 1.33
sys/arch/sandpoint/conf/GENERIC: revision 1.88
sys/arch/sbmips/conf/GENERIC: revision 1.101
sys/arch/sgimips/conf/GENERIC32_IP12: revision 1.28
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.104
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.106
sys/arch/shark/conf/GENERIC: revision 1.121
sys/arch/sparc/conf/GENERIC: revision 1.248
sys/arch/sparc/conf/TADPOLE3GX: revision 1.65
sys/arch/sparc64/conf/GENERIC: revision 1.177
sys/arch/sparc64/conf/NONPLUS64: revision 1.44
sys/arch/sun2/conf/GENERIC: revision 1.94
sys/arch/sun3/conf/GENERIC: revision 1.171
sys/arch/vax/conf/GENERIC: revision 1.193
sys/arch/vax/conf/VAX780: revision 1.19
sys/arch/x68k/conf/GENERIC: revision 1.179
sys/arch/zaurus/conf/GENERIC: revision 1.65
sys/ufs/files.ufs: revision 1.38
Remove unused extended attributes kernel options

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

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.127.2.1 15-May-2022  martin Pull up following revision(s) (requested by tsutsui in ticket #1450):

sys/arch/luna68k/conf/INSTALL: revision 1.32
sys/arch/luna68k/conf/GENERIC: revision 1.131

Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.
 1.137.6.1 02-Aug-2025  perseant Sync with HEAD
 1.36 13-Oct-2023  tsutsui Remove trailing spaces and TAB.
 1.35 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.34 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.33 27-May-2022  tsutsui Specify -fno-unwind-tables to shrink binaries.
 1.32 04-Feb-2022  tsutsui Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.
 1.31 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.30 01-Aug-2020  maxv Remove references to BRIDGE_IPF, it is now compiled in by default.
 1.29 19-May-2020  rin Oops, fix comment in the previous for accuracy.
 1.28 19-May-2020  rin Bump ramdisk size to 2MB.
 1.27 26-Apr-2019  sevan branches: 1.27.2;
Use veriexec.config to reduce duplication
 1.26 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.25 23-Jan-2018  sevan branches: 1.25.2; 1.25.4;
Alternate buffer queue strategies no longer considered experimental, update
description.

Discussed on tech-kern
http://mail-index.netbsd.org/tech-kern/2018/01/21/msg023002.html
 1.24 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.23 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.22 29-Jul-2017  maxv Remove TCP_COMPAT_42 from the config files. Pass 3.
 1.21 09-Mar-2017  tsutsui branches: 1.21.6;
Add a driver for LUNA's front panel LCD. Ported from OpenBSD/luna88k.

Reviewed by enami@. Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.
 1.20 18-Sep-2016  christos branches: 1.20.2;
bump
 1.19 23-Aug-2014  dholland branches: 1.19.2; 1.19.4;
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.18 17-Aug-2014  joerg Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.
 1.17 16-Aug-2014  apb Add commented out "#options COMPAT_70" to all kernel configuration
files that already had commented out "#options COMPAT_60".
 1.16 05-Aug-2014  martin Adapt to grown ramdisk image size
 1.15 20-Feb-2014  tsutsui branches: 1.15.2;
Add dhcpcd(8) to luna68k sysinst. Also bump ramdisk size.
 1.14 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.13 05-Jun-2013  christos branches: 1.13.2;
remove obsolete networking options
 1.12 27-Apr-2013  christos the bogus number police
 1.11 27-Apr-2013  christos remove confusing numeric locators where they are unused.
 1.10 02-Mar-2013  christos Under FAST_IPSEC, IPSEC_ESP is mandatory; GC it.
 1.9 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.8 17-Oct-2012  apb Add commented out "#options COMPAT_60" to all kernel configuration files
that already had commented out "#options COMPAT_50".
 1.7 17-Aug-2012  abs branches: 1.7.2;
Update all kernel configs mentioning WSEMUL_* but not already including
WSDISPLAY_COMPAT_USL using the following rules:
- If WSEMUL_ is commented out, add commented out out WSDISPLAY_COMPAT_USL
- If INSTALL or obviously memory constrained, add WSDISPLAY_DEFAULTSCREENS=1
and commented out WSDISPLAY_COMPAT_USL
- Otherwise add WSDISPLAY_COMPAT_USL

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

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

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

On 5 June 2012 09:47, David Brownlee <abs@absd.org> wrote:
> wsconscfg(8) requires WSDISPLAY_COMPAT_USL in order to switch virtual
> terminals.
>
> Except when in an exceptionally memory or space constrained
> environment (INSTALL being the obvious case), is there any reason why
> all GENERIC and GENERIC-like kernels which have wscons enabled
> shouldn't also have WSDISPLAY_COMPAT_USL?
 1.6 20-Jul-2012  tsutsui Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
 1.5 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.4 18-Dec-2011  dholland branches: 1.4.2;
WABPL is no longer considered experimental (has not been for some time)
so update its comment in config files.
 1.3 22-Nov-2011  tls branches: 1.3.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.2 12-Nov-2011  tsutsui Finally complete LUNA-II support, after almost 12 years since
initial import of NetBSD/luna68k.

Note a working LUNA-II machine was found and provided by OMRON guys
after LUNA demonstration at Open Source Conference 2011 Kansai @ Kyoto:
http://mail-index.NetBSD.org/source-changes/2011/07/16/msg024675.html
and this resurrected LUNA-II which runs NetBSD/luna68k -current with Xserver
was also demonstrated on the NetBSD booth at Kansai Open Source 2011:
http://www.NetBSD.org/gallery/events.html#kansai-os-jp-2011

It's really pleasure to meet many OMRON LUNA developers and LUNA users
at the NetBSD booth. Thank you everyone!


Changes details:

luna68k/luna68k/locore.s
- don't use 68030 specific pflusha instruction in 68040 initialization path
- use TBIA() to invalidate TLB instead of 68030's pflusha
after MMU is turned on (as hp300 does)
(these two bugs are fatal at early bootstrap)
- pull loadustp() fixes from hp300/locore.s rev 1.82
(more flush ops are required in it otherwise causes random coredumps)
- specify correct %tt1 mask value
(the mask value means actually bit mask, not transparent range)

luna68k/luna68k/machdep.c
- use proper delay_divisor for 68040 25MHz LUNA-II

luna68k/luna68k/mainbus.c
- prepare and use per-model mainbus device lists for mainbus_attach_args

luna68k/conf/GENERIC
luna68k/conf/INSTALL
- enable options M68040 and FPSP
- enable secondary spc(4) on LUNA-II

luna68k/conf/Makefile.luna68k
- include arch/m68k/fpsp/Makefile.inc for FPSP

luna68k/dev/lcd.c
- promote LUNA-II model on LCD

XXX: old and slow SCSI-1 drives like Hitachi DK312 seems to have
XXX: some problem with spc(4) driver, even on the original LUNA
 1.1 16-Jul-2011  tsutsui branches: 1.1.2;
Revive NetBSD/luna68k.

Even after almost a lost decade since NetBSD/luna68k was
switched to using ELF format by default back in 2001,
actually only one fix (bus.h) is required for a GENERIC kernel itself
to get multiuser login: prompt on a real hardware. Hurrahhh!!!

Demonstrated with a working Xorg mono server on the NetBSD booth
at Open Source Conference 2011 Kansai @ Kyoto:
http://www.ospn.jp/osc2011-kyoto/

"Very impressed," commented by Tomoko YOSHIDA,
Program Committee Chair of the Conference,
and some other OMRON guys.

Special Thanks to Tadashi Okamura, for providing
a working SX-9100/DT "LUNA" for this mission.


Changes details:

sys/arch/luna68k/include/bus.h
- handle stride properly even on multi and region ops for MI spc(4)
- also fix stride handling of (currently unused) 2 and 4 byte ops

sys/arch/luna68k/conf/Makefile.luna68k
sys/arch/luna68k/conf/kern.ldscript.head
sys/arch/luna68k/conf/kern.ldscript.tail
- build a faked a.out kernel using elf2aout(8) tool
and a linker script derived from cats and shark
for the LUNA firmware that loads a.out binary directly
via network or from a UNIOS partition on a local disk

sys/arch/luna68k/dev/omrasops.c
sys/arch/luna68k/dev/omron_rfont.h
- use the original OMRON font derived from 4.4BSD-Lite/luna68k
rather than gallant19 which is used on Sun workstations
(XXX omrasops.c should be rewritten to use generic wsfont(4))

distrib/luna68k/*
distrib/utils/sysinst/arch/luna68k/*
etc/etc.luna68k/MAKEDEV.conf
etc/etc.luna68k/Makefile.inc
sys/arch/luna68k/conf/INSTALL
- build a ramdisk based INSTALL kernel with sysinst(8) for luna68k
- also build an installation iso image for luna68k

sys/arch/luna68k/conf/GENERIC
- enable SYSVSHM (and other SYSV*) options for Xorg server

More Xorg changes (which need some more cleanup) and
isiboot.c fixes will come soon.
 1.1.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.1.2.2 30-Oct-2012  yamt sync with head
 1.1.2.1 17-Apr-2012  yamt sync with head
 1.3.2.2 11-Mar-2012  mrg sync to latest -current
 1.3.2.1 18-Feb-2012  mrg merge to -current.
 1.4.2.1 25-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
 1.7.2.4 03-Dec-2017  jdolecek update from HEAD
 1.7.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.2.2 23-Jun-2013  tls resync from head
 1.7.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.13.2.2 18-May-2014  rmind sync with head
 1.13.2.1 28-Aug-2013  rmind sync with head
 1.15.2.1 10-Aug-2014  tls Rebase.
 1.19.4.2 20-Mar-2017  pgoyette Sync with HEAD
 1.19.4.1 04-Nov-2016  pgoyette Sync with HEAD
 1.19.2.2 28-Aug-2017  skrll Sync with HEAD
 1.19.2.1 05-Oct-2016  skrll Sync with HEAD
 1.20.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.21.6.1 26-Jan-2018  martin Pull up following revision(s) (requested by sevan in ticket #510):
sys/arch/sun3/conf/GENERIC3X: revision 1.130
sys/arch/sparc64/conf/GENERIC: revision 1.203
sys/arch/news68k/conf/LIBERO: revision 1.66
sys/arch/amiga/conf/DRACO: revision 1.185
sys/arch/evbarm/conf/MV2120: revision 1.35
sys/arch/x68k/conf/GENERIC: revision 1.187
sys/arch/rs6000/conf/GENERIC: revision 1.39
sys/arch/news68k/conf/GENERIC_TINY: revision 1.86
sys/arch/i386/conf/XEN3_DOMU: revision 1.88
sys/arch/iyonix/conf/GENERIC: revision 1.97
sys/arch/evbarm64/conf/A64EMUL: revision 1.11
sys/arch/mvme68k/conf/GENERIC: revision 1.98
sys/arch/acorn32/conf/GENERIC: revision 1.124
sys/arch/i386/conf/XEN3_DOM0: revision 1.125
sys/arch/cobalt/conf/INSTALL: revision 1.65
sys/arch/macppc/conf/GENERIC_601: revision 1.16
sys/arch/hppa/conf/GENERIC: revision 1.17
sys/arch/amiga/conf/GENERIC.in: revision 1.137
sys/arch/sgimips/conf/GENERIC32_IP12: revision 1.33
sys/arch/netwinder/conf/GENERIC: revision 1.134
sys/arch/amd64/conf/XEN3_DOMU: revision 1.83
sys/arch/mac68k/conf/GENERIC: revision 1.225
sys/arch/arc/conf/RPC44: revision 1.54
sys/arch/mipsco/conf/GENERIC: revision 1.92
sys/arch/cats/conf/GENERIC: revision 1.166
sys/arch/amd64/conf/XEN3_DOM0: revision 1.145
sys/arch/amigappc/conf/GENERIC: revision 1.33
sys/arch/sun3/conf/GENERIC: revision 1.176
sys/arch/news68k/conf/GENERIC: revision 1.130
sys/arch/hpcsh/conf/GENERIC: revision 1.110
sys/arch/hp300/conf/GENERIC: revision 1.198
sys/arch/atari/conf/GENERIC.in: revision 1.115
sys/arch/sparc/conf/MRCOFFEE: revision 1.54
sys/arch/evbppc/conf/EXPLORA451: revision 1.62
sys/arch/cesfic/conf/GENERIC: revision 1.69
sys/arch/vax/conf/GENERIC: revision 1.204
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.115
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.112
sys/arch/sparc/conf/GENERIC: revision 1.258
sys/arch/next68k/conf/GENERIC: revision 1.145
sys/arch/evbarm/conf/MMNET_GENERIC: revision 1.34
sys/arch/prep/conf/GENERIC: revision 1.185
sys/arch/amiga/conf/INSTALL: revision 1.129
sys/arch/newsmips/conf/GENERIC: revision 1.133
sys/arch/cobalt/conf/GENERIC: revision 1.156
sys/arch/sun2/conf/GENERIC: revision 1.99
sys/arch/luna68k/conf/INSTALL: revision 1.25
sys/arch/amigappc/conf/NULL: revision 1.53
sys/arch/acorn26/conf/GENERIC: revision 1.85
sys/arch/vax/conf/VAX780: revision 1.25
sys/arch/luna68k/conf/GENERIC: revision 1.125
sys/arch/ews4800mips/conf/GENERIC: revision 1.56
sys/arch/macppc/conf/POWERMAC_G5: revision 1.29
sys/arch/arc/conf/GENERIC: revision 1.189
sys/arch/macppc/conf/MAMBO: revision 1.27
sys/arch/acorn32/conf/EB7500ATX: revision 1.64
sys/arch/pmax/conf/GENERIC: revision 1.196
sys/arch/pmax/conf/GENERIC64: revision 1.28
sys/arch/amiga/conf/GENERIC: revision 1.319
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.55
sys/arch/macppc/conf/GENERIC: revision 1.339
sys/arch/emips/conf/GENERIC: revision 1.21
sys/arch/sandpoint/conf/GENERIC: revision 1.97
sys/arch/landisk/conf/GENERIC: revision 1.58
sys/arch/bebox/conf/GENERIC: revision 1.157
sys/arch/alpha/conf/GENERIC: revision 1.379
Alternate buffer queue strategies no longer considered experimental, update
description.
Discussed on tech-kern
http://mail-index.netbsd.org/tech-kern/2018/01/21/msg023002.html
 1.25.4.1 10-Jun-2019  christos Sync with HEAD
 1.25.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.27.2.1 15-May-2022  martin Pull up following revision(s) (requested by tsutsui in ticket #1450):

sys/arch/luna68k/conf/INSTALL: revision 1.32
sys/arch/luna68k/conf/GENERIC: revision 1.131

Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.
 1.30 11-Apr-2023  tsutsui Fix missing locore.d dependency output on make depend.

Reported from isaki@. Looks missed in rev 1.13 (22 years ago):
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13

Should be pulled up to netbsd-8, netbsd-9, and netbsd-10.
 1.29 22-Sep-2018  rin branches: 1.29.4; 1.29.30;
- 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.28 25-Feb-2018  mrg branches: 1.28.2; 1.28.4;
add a special rule to build m68k/fpu.c to avoid passing -msoft-float.
fixes GCC 6 kernel builds that use this file.
 1.27 06-Sep-2015  uebayasi branches: 1.27.10;
Declare dependency on fpsp.o via newly introduced ${MD_LIBS} instead of
${MD_OBJS}.

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

${MD_LIBS} defines libraries that are built by separate makefiles, under
separate directories. `Makefile.kern.inc' doesn't know intermediate library
objects.
 1.26 13-Nov-2014  tsutsui branches: 1.26.2;
Stop building a.out kernels so that mkldscript.sh is no longer necessary.

Tested "build.sh release", and the default ELF GENERIC kernel loaded by
the native bootloader just works on LUNA-II.
 1.25 13-Nov-2014  uebayasi Missing dependency on ldscript files.
 1.24 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.23 12-Nov-2011  tsutsui branches: 1.23.10;
Finally complete LUNA-II support, after almost 12 years since
initial import of NetBSD/luna68k.

Note a working LUNA-II machine was found and provided by OMRON guys
after LUNA demonstration at Open Source Conference 2011 Kansai @ Kyoto:
http://mail-index.NetBSD.org/source-changes/2011/07/16/msg024675.html
and this resurrected LUNA-II which runs NetBSD/luna68k -current with Xserver
was also demonstrated on the NetBSD booth at Kansai Open Source 2011:
http://www.NetBSD.org/gallery/events.html#kansai-os-jp-2011

It's really pleasure to meet many OMRON LUNA developers and LUNA users
at the NetBSD booth. Thank you everyone!


Changes details:

luna68k/luna68k/locore.s
- don't use 68030 specific pflusha instruction in 68040 initialization path
- use TBIA() to invalidate TLB instead of 68030's pflusha
after MMU is turned on (as hp300 does)
(these two bugs are fatal at early bootstrap)
- pull loadustp() fixes from hp300/locore.s rev 1.82
(more flush ops are required in it otherwise causes random coredumps)
- specify correct %tt1 mask value
(the mask value means actually bit mask, not transparent range)

luna68k/luna68k/machdep.c
- use proper delay_divisor for 68040 25MHz LUNA-II

luna68k/luna68k/mainbus.c
- prepare and use per-model mainbus device lists for mainbus_attach_args

luna68k/conf/GENERIC
luna68k/conf/INSTALL
- enable options M68040 and FPSP
- enable secondary spc(4) on LUNA-II

luna68k/conf/Makefile.luna68k
- include arch/m68k/fpsp/Makefile.inc for FPSP

luna68k/dev/lcd.c
- promote LUNA-II model on LCD

XXX: old and slow SCSI-1 drives like Hitachi DK312 seems to have
XXX: some problem with spc(4) driver, even on the original LUNA
 1.22 20-Jul-2011  tsutsui branches: 1.22.2;
Fix thinko. src/sys/conf/mkldscript.sh requires $OBJDUMP, not $ELF2AOUT.
(note generated faked a.out kernels can still be loaded and work fine)
 1.21 16-Jul-2011  tsutsui Revive NetBSD/luna68k.

Even after almost a lost decade since NetBSD/luna68k was
switched to using ELF format by default back in 2001,
actually only one fix (bus.h) is required for a GENERIC kernel itself
to get multiuser login: prompt on a real hardware. Hurrahhh!!!

Demonstrated with a working Xorg mono server on the NetBSD booth
at Open Source Conference 2011 Kansai @ Kyoto:
http://www.ospn.jp/osc2011-kyoto/

"Very impressed," commented by Tomoko YOSHIDA,
Program Committee Chair of the Conference,
and some other OMRON guys.

Special Thanks to Tadashi Okamura, for providing
a working SX-9100/DT "LUNA" for this mission.


Changes details:

sys/arch/luna68k/include/bus.h
- handle stride properly even on multi and region ops for MI spc(4)
- also fix stride handling of (currently unused) 2 and 4 byte ops

sys/arch/luna68k/conf/Makefile.luna68k
sys/arch/luna68k/conf/kern.ldscript.head
sys/arch/luna68k/conf/kern.ldscript.tail
- build a faked a.out kernel using elf2aout(8) tool
and a linker script derived from cats and shark
for the LUNA firmware that loads a.out binary directly
via network or from a UNIOS partition on a local disk

sys/arch/luna68k/dev/omrasops.c
sys/arch/luna68k/dev/omron_rfont.h
- use the original OMRON font derived from 4.4BSD-Lite/luna68k
rather than gallant19 which is used on Sun workstations
(XXX omrasops.c should be rewritten to use generic wsfont(4))

distrib/luna68k/*
distrib/utils/sysinst/arch/luna68k/*
etc/etc.luna68k/MAKEDEV.conf
etc/etc.luna68k/Makefile.inc
sys/arch/luna68k/conf/INSTALL
- build a ramdisk based INSTALL kernel with sysinst(8) for luna68k
- also build an installation iso image for luna68k

sys/arch/luna68k/conf/GENERIC
- enable SYSVSHM (and other SYSV*) options for Xorg server

More Xorg changes (which need some more cleanup) and
isiboot.c fixes will come soon.
 1.20 21-Jan-2011  joerg Switch remaining platforms to modern CPP for assembler.
 1.19 19-Feb-2008  joerg branches: 1.19.32; 1.19.38; 1.19.40;
Add missing assym.h dependencies.
 1.18 11-Dec-2005  christos branches: 1.18.50;
merge ktrace-lwp.
 1.17 31-May-2005  christos branches: 1.17.2;
s/GENASSYM/GENASSYM_CONF/ so we can use "GENASSYM" as the program name.
 1.16 04-Jun-2004  thorpej Add the %MAKEOPTIONSAPPEND token at the end of the file, after the
common Makefile.kern.inc has been included.
 1.15 26-Nov-2002  thorpej branches: 1.15.6; 1.15.10;
The traditional C preprocessor is fixed in GCC 3.3 now, so no need
to skip -traditional-cpp for HAVE_GCC3.
 1.14 04-Jun-2002  thorpej Don't use -traditional-cpp if HAVE_GCC3.
 1.13 09-Dec-2001  atatat branches: 1.13.8;
Roll the rest of the ports over to the new MI kernel build machinery.
Any problems reported by testers have been fixed, and massive
cross-compiling of kernels has shown that any problems that remain
with actually building kernels are not related to this.
 1.12 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.11 26-Oct-2001  jmc branches: 1.11.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.10 23-Oct-2001  thorpej branches: 1.10.2;
Set MACHINE_ARCH explicitly in Makefiles for which it is constant.
Also, since config(8) now explcitly sets MACHINE, there is no need
to do it here in the Makefile.
 1.9 29-May-2001  mrg branches: 1.9.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.8 17-Dec-2000  jdolecek branches: 1.8.2;
delete obsolete comment
 1.7 09-May-2000  hubertf branches: 1.7.6;
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.6 09-May-2000  thorpej HAVE_GCC28 -> HAVE_EGCS, and make it match gcc 2.9 as well. Also,
make the use of -Wno-uninitialized explicit, don't rely on a compiler
hack to do it for us.
 1.5 01-Feb-2000  tsutsui Revert STRIPPROG -> STRIP
 1.4 24-Jan-2000  tron Add "dependall" target for comfort.
 1.3 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.2 19-Jan-2000  tsutsui Change STRIPFLAGS=-g for cross-toolchains.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.7.6.3 05-Jan-2001  bouyer Sync with HEAD
 1.7.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.7.6.1 09-May-2000  bouyer file Makefile.luna68k was added on branch thorpej_scsipi on 2000-11-20 20:10:25 +0000
 1.8.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.9.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.11.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.11.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.11.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.11.2.1 26-Oct-2001  nathanw file Makefile.luna68k was added on branch nathanw_sa on 2002-01-08 00:25:50 +0000
 1.13.8.1 14-Jul-2002  gehenna catch up with -current.
 1.15.10.1 06-Feb-2005  jmc Pull up patch (requested by martti in ticket #1086)
Move ipf to sys/dist/ipf and sync w. trunk
 1.15.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.6.1 03-Aug-2004  skrll Sync with HEAD
 1.17.2.1 27-Feb-2008  yamt sync with head.
 1.18.50.1 23-Mar-2008  matt sync with HEAD
 1.19.40.1 08-Feb-2011  bouyer Sync with HEAD
 1.19.38.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.32.1 05-Mar-2011  rmind sync with head
 1.22.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.22.2.1 17-Apr-2012  yamt sync with head
 1.23.10.2 03-Dec-2017  jdolecek update from HEAD
 1.23.10.1 23-Jun-2013  tls resync from head
 1.26.2.1 22-Sep-2015  skrll Sync with HEAD
 1.27.10.1 20-Apr-2023  martin Pull up following revision(s) (requested by tsutsui in ticket #1821):

sys/arch/luna68k/conf/Makefile.luna68k: revision 1.30

Fix missing locore.d dependency output on make depend.
Reported from isaki@. Looks missed in rev 1.13 (22 years ago):

https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13
 1.28.4.1 10-Jun-2019  christos Sync with HEAD
 1.28.2.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.29.30.1 20-Apr-2023  martin Pull up following revision(s) (requested by tsutsui in ticket #143):

sys/arch/luna68k/conf/Makefile.luna68k: revision 1.30

Fix missing locore.d dependency output on make depend.
Reported from isaki@. Looks missed in rev 1.13 (22 years ago):

https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13
 1.29.4.1 20-Apr-2023  martin Pull up following revision(s) (requested by tsutsui in ticket #1627):

sys/arch/luna68k/conf/Makefile.luna68k: revision 1.30

Fix missing locore.d dependency output on make depend.
Reported from isaki@. Looks missed in rev 1.13 (22 years ago):

https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13
 1.34 15-Jan-2024  thorpej Switch luna68k over to the common interrupt dispatch code.
 1.33 14-Jan-2024  thorpej Switch luna68k over to the common m68k vector table.
 1.32 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.31 17-Sep-2023  andvar fix KGDB enabled build for luna68k:
* include sys/kgdb.h in luna68k/trap.c for missing definitions.
* cast second kgdb_trap argument to (db_regs_t *).
* build m68k/kgdb_machdep.c in kgdb enable build for kgdb_trap() implementation.
 1.30 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.29 26-Dec-2021  andvar fix various typos, mainly in comments.
 1.28 18-Feb-2019  thorpej Refactor the 68040 writeback() from each m68k port's trap handler into a
shared copy: m68040_writeback(). It is essentially a copy of the Atari
version, with some minor cosmetic tweaks and one small performance optimization
from the mvme68k port.

Tested by rjs@ on a Quadra 950. (Thanks!)
 1.27 25-Feb-2018  mrg branches: 1.27.4;
add a special rule to build m68k/fpu.c to avoid passing -msoft-float.
fixes GCC 6 kernel builds that use this file.
 1.26 09-Mar-2017  tsutsui Add a driver for LUNA's front panel LCD. Ported from OpenBSD/luna88k.

Reviewed by enami@. Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.
 1.25 03-Dec-2016  tsutsui branches: 1.25.2;
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).

Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.24 20-Jul-2014  tsutsui branches: 1.24.2; 1.24.4; 1.24.8; 1.24.10;
Pull LUNA's keyboard driver changes from OpenBSD/luna88k.

- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values

Now LUNA's keyboard works on Xorg server without tweaks by xmodmap(1) etc.
 1.23 15-Nov-2011  tsutsui branches: 1.23.6; 1.23.10; 1.23.24;
Use now common fpu_probe() and print FPU type per probe result since
it turns out that server and high-end LUNA models actually have MC68882,
not MC68881 as basic and standard models:
http://www.h2.dion.ne.jp/~dogs/collect/ds/luna.html

Also put LUNA model names into cpu_model[] for sysctl(3).
(maybe we don't have to consider sysctl backward compatibility on this port ;-)
 1.22 12-Jun-2011  rmind branches: 1.22.2;
Welcome to 5.99.53! Merge rmind-uvmplock branch:

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

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

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

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

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

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.21 16-May-2011  tsutsui branches: 1.21.2;
- merge and move pasted m68k MD setreg() functions into m68k/m68k_machdep.c
- move m68881_save() and m68881_restore() declarations into <m68k/m68k.h>

Briefly tested and no obvious breakage on atari, sun3, and x68k.
 1.20 20-Feb-2008  drochner branches: 1.20.32; 1.20.38;
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.19 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.18 04-Mar-2007  tsutsui branches: 1.18.2; 1.18.18; 1.18.20; 1.18.26;
Add MI softintr(9) support for luna68k with common m68k/softintr.c.
Compile test only.
 1.17 11-Dec-2005  christos branches: 1.17.26;
merge ktrace-lwp.
 1.16 14-Nov-2004  christos branches: 1.16.12;
use the common procfs_machdep.c
 1.15 07-Jul-2004  mycroft Move spc into the MI area.
 1.14 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.13 27-Jun-2003  he branches: 1.13.2;
Defflag PANICBUTTON, now that machdep.c includes opt_panicbutton.h.
 1.12 05-Nov-2002  chs merge pmap.c for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.11 03-Nov-2002  chs use a merged sys_machdep.c for all the motorola-MMU m68k platforms.
 1.10 02-Nov-2002  chs enhance the common m68k db_memrw.c to handle read-only kernel text
and switch all the motorola-MMU m68k platforms to use it.
 1.9 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.8 20-Oct-2002  chs merge the 12 copies of vm_machdep.c on the m68k platforms.
clean up some other stuff along the way, including:
- use m68k/cacheops.*, remove duplicates from cpu.h.
- centralize a few declarations in (all the copies of) cpu.h.
- define M68K_VAC on platforms which have a VAC.
- switch the sun platforms to the (now common) proc_trampoline().
- do the phys_map thang on the sun platforms too, no reason not to.
 1.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 21-Jan-2002  jdolecek branches: 1.6.8;
Switch to MI dev/md_root.c for archs which don't have any special
memory disk hooks (i.e. everything except atari).
 1.5 22-Dec-2001  chs convert luna68k to ELF. ok'd by nisimura.
 1.4 17-Jan-2001  fvdl branches: 1.4.4; 1.4.8;
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.3 15-Mar-2000  soren branches: 1.3.6;
s/md/raid/ for RAIDframe major name.
 1.2 15-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.
(Missed these yesterday.. Thanks to Izumi Tsutsui for noticing, and for
letting me know :) )
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.3.6.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 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-Mar-2000  bouyer file files.luna68k was added on branch thorpej_scsipi on 2000-11-20 20:10:25 +0000
 1.4.8.4 11-Nov-2002  nathanw Catch up to -current
 1.4.8.3 17-Sep-2002  nathanw Catch up to -current.
 1.4.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.4.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.4.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.4.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.4.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.8.2 17-May-2002  gehenna Remove old block majors list.
 1.6.8.1 16-May-2002  gehenna Include the list of block/character major numbers.
 1.13.2.4 29-Nov-2004  skrll Sync with HEAD.
 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.16.12.3 27-Feb-2008  yamt sync with head.
 1.16.12.2 07-Dec-2007  yamt sync with head
 1.16.12.1 03-Sep-2007  yamt sync with head.
 1.17.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.18.20.2 23-Mar-2008  matt sync with HEAD
 1.18.20.1 09-Jan-2008  matt sync with HEAD
 1.18.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.18.2.1 03-Dec-2007  ad Sync with HEAD.
 1.20.38.1 06-Jun-2011  jruoho Sync with HEAD.
 1.20.32.2 31-May-2011  rmind sync with head
 1.20.32.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.21.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.22.2.1 17-Apr-2012  yamt sync with head
 1.23.24.1 10-Aug-2014  tls Rebase.
 1.23.10.2 03-Dec-2017  jdolecek update from HEAD
 1.23.10.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.6.1 09-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.24.10.1 18-Jan-2017  skrll Sync with netbsd-5
 1.24.8.2 20-Mar-2017  pgoyette Sync with HEAD
 1.24.8.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.24.4.2 28-Aug-2017  skrll Sync with HEAD
 1.24.4.1 05-Dec-2016  skrll Sync with HEAD
 1.24.2.1 06-Dec-2016  snj Pull up following revision(s) (requested by tsutsui in ticket #1283):
distrib/sets/lists/comp/md.luna68k: revision 1.21
etc/etc.luna68k/MAKEDEV.conf: revision 1.9
sys/arch/luna68k/conf/GENERIC: revision 1.120
sys/arch/luna68k/conf/files.luna68k: revision 1.25
sys/arch/luna68k/conf/majors.luna68k: revision 1.21
sys/arch/luna68k/dev/xp.c: revision 1.1
sys/arch/luna68k/include/Makefile: revision 1.19
sys/arch/luna68k/include/xpio.h: revision 1.1
sys/arch/luna68k/luna68k/mainbus.c: revision 1.14
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).
Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.25.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.27.4.1 10-Jun-2019  christos Sync with HEAD
 1.2 13-Nov-2014  tsutsui Stop building a.out kernels so that mkldscript.sh is no longer necessary.

Tested "build.sh release", and the default ELF GENERIC kernel loaded by
the native bootloader just works on LUNA-II.
 1.1 16-Jul-2011  tsutsui branches: 1.1.12;
Revive NetBSD/luna68k.

Even after almost a lost decade since NetBSD/luna68k was
switched to using ELF format by default back in 2001,
actually only one fix (bus.h) is required for a GENERIC kernel itself
to get multiuser login: prompt on a real hardware. Hurrahhh!!!

Demonstrated with a working Xorg mono server on the NetBSD booth
at Open Source Conference 2011 Kansai @ Kyoto:
http://www.ospn.jp/osc2011-kyoto/

"Very impressed," commented by Tomoko YOSHIDA,
Program Committee Chair of the Conference,
and some other OMRON guys.

Special Thanks to Tadashi Okamura, for providing
a working SX-9100/DT "LUNA" for this mission.


Changes details:

sys/arch/luna68k/include/bus.h
- handle stride properly even on multi and region ops for MI spc(4)
- also fix stride handling of (currently unused) 2 and 4 byte ops

sys/arch/luna68k/conf/Makefile.luna68k
sys/arch/luna68k/conf/kern.ldscript.head
sys/arch/luna68k/conf/kern.ldscript.tail
- build a faked a.out kernel using elf2aout(8) tool
and a linker script derived from cats and shark
for the LUNA firmware that loads a.out binary directly
via network or from a UNIOS partition on a local disk

sys/arch/luna68k/dev/omrasops.c
sys/arch/luna68k/dev/omron_rfont.h
- use the original OMRON font derived from 4.4BSD-Lite/luna68k
rather than gallant19 which is used on Sun workstations
(XXX omrasops.c should be rewritten to use generic wsfont(4))

distrib/luna68k/*
distrib/utils/sysinst/arch/luna68k/*
etc/etc.luna68k/MAKEDEV.conf
etc/etc.luna68k/Makefile.inc
sys/arch/luna68k/conf/INSTALL
- build a ramdisk based INSTALL kernel with sysinst(8) for luna68k
- also build an installation iso image for luna68k

sys/arch/luna68k/conf/GENERIC
- enable SYSVSHM (and other SYSV*) options for Xorg server

More Xorg changes (which need some more cleanup) and
isiboot.c fixes will come soon.
 1.1.12.1 03-Dec-2017  jdolecek update from HEAD
 1.2 13-Nov-2014  tsutsui Stop building a.out kernels so that mkldscript.sh is no longer necessary.

Tested "build.sh release", and the default ELF GENERIC kernel loaded by
the native bootloader just works on LUNA-II.
 1.1 16-Jul-2011  tsutsui branches: 1.1.12;
Revive NetBSD/luna68k.

Even after almost a lost decade since NetBSD/luna68k was
switched to using ELF format by default back in 2001,
actually only one fix (bus.h) is required for a GENERIC kernel itself
to get multiuser login: prompt on a real hardware. Hurrahhh!!!

Demonstrated with a working Xorg mono server on the NetBSD booth
at Open Source Conference 2011 Kansai @ Kyoto:
http://www.ospn.jp/osc2011-kyoto/

"Very impressed," commented by Tomoko YOSHIDA,
Program Committee Chair of the Conference,
and some other OMRON guys.

Special Thanks to Tadashi Okamura, for providing
a working SX-9100/DT "LUNA" for this mission.


Changes details:

sys/arch/luna68k/include/bus.h
- handle stride properly even on multi and region ops for MI spc(4)
- also fix stride handling of (currently unused) 2 and 4 byte ops

sys/arch/luna68k/conf/Makefile.luna68k
sys/arch/luna68k/conf/kern.ldscript.head
sys/arch/luna68k/conf/kern.ldscript.tail
- build a faked a.out kernel using elf2aout(8) tool
and a linker script derived from cats and shark
for the LUNA firmware that loads a.out binary directly
via network or from a UNIOS partition on a local disk

sys/arch/luna68k/dev/omrasops.c
sys/arch/luna68k/dev/omron_rfont.h
- use the original OMRON font derived from 4.4BSD-Lite/luna68k
rather than gallant19 which is used on Sun workstations
(XXX omrasops.c should be rewritten to use generic wsfont(4))

distrib/luna68k/*
distrib/utils/sysinst/arch/luna68k/*
etc/etc.luna68k/MAKEDEV.conf
etc/etc.luna68k/Makefile.inc
sys/arch/luna68k/conf/INSTALL
- build a ramdisk based INSTALL kernel with sysinst(8) for luna68k
- also build an installation iso image for luna68k

sys/arch/luna68k/conf/GENERIC
- enable SYSVSHM (and other SYSV*) options for Xorg server

More Xorg changes (which need some more cleanup) and
isiboot.c fixes will come soon.
 1.1.12.1 03-Dec-2017  jdolecek update from HEAD
 1.26 13-Oct-2023  tsutsui Remove trailing spaces and TAB.
 1.25 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.24 04-Apr-2020  jdolecek mark nsmb major obsolete
 1.23 28-Jan-2019  dholland Systematize handling of removed drivers.

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

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

Note that some of the things now explicitly listed as obsolete are
really ancient history. My scan went back as far as when the majors
files were added. (But not before that.)
 1.22 09-Mar-2017  tsutsui branches: 1.22.14;
Add a driver for LUNA's front panel LCD. Ported from OpenBSD/luna88k.

Reviewed by enami@. Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.
 1.21 03-Dec-2016  tsutsui branches: 1.21.2;
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).

Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.20 30-Jun-2011  wiz branches: 1.20.12; 1.20.28; 1.20.30; 1.20.34; 1.20.36;
dependant -> dependent
 1.19 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.18 31-Dec-2007  ad branches: 1.18.6; 1.18.10; 1.18.16; 1.18.18;
Remove systrace. Ok core@.
 1.17 24-Nov-2006  wiz branches: 1.17.28; 1.17.34; 1.17.42;
s/independant/independent/, from Zafer.
 1.16 11-Dec-2005  christos branches: 1.16.20; 1.16.22;
merge ktrace-lwp.
 1.15 17-Sep-2005  yamt make VMSWAP optional again.
 1.14 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.13 30-Jul-2005  yamt defflag VMSWAP.
 1.12 10-May-2005  jdolecek branches: 1.12.2;
assign major for nsmb(4)
 1.11 10-Dec-2003  jmc Change reference at bottom from sys/dev/majors to sys/conf/majors to match
reality
 1.10 22-Oct-2003  jdolecek add wsfont major to archs which have the other wscons devices
 1.9 10-Oct-2003  jdolecek reassing majors for crypto and pf to use the newly defined MI major
range
 1.8 10-Oct-2003  jdolecek update the comment - the space for machine-dependant majors
is reduced to 0-143
follows discussion on tech-kern
 1.7 05-Oct-2003  jdolecek Add some framework for MI assignment of device majors - add sys/dev/majors
which is automatically included during kernel config, and add comments
to individual machine-dependant majors.* files to assign new MI majors
in MI file.

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

Follows recent discussion on tech-kern@
 1.6 22-Aug-2003  itojun create /dev/crypto
 1.5 27-Jul-2003  itojun reserve cdev major # for PF. ok'ed by technical-exec
 1.4 25-Apr-2003  ragge branches: 1.4.2;
Add ksyms device major.
 1.3 04-Oct-2002  elric branches: 1.3.2;
assign majors for raw and cooked cgd's.
 1.2 06-Sep-2002  gehenna branches: 1.2.2;
Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.1 16-May-2002  gehenna branches: 1.1.2;
file majors.luna68k was initially added on branch gehenna-devsw.
 1.1.2.3 14-Jul-2002  gehenna catch up with -current.
 1.1.2.2 30-May-2002  gehenna Add $NetBSD$
 1.1.2.1 16-May-2002  gehenna Add the list of block/character majors.
 1.2.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.2.2.1 06-Sep-2002  nathanw file majors.luna68k was added on branch nathanw_sa on 2002-09-17 21:15:16 +0000
 1.3.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.2.1 04-Oct-2002  jdolecek file majors.luna68k was added on branch kqueue on 2002-10-10 18:33:37 +0000
 1.4.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.2.3 21-Jan-2008  yamt sync with head
 1.12.2.2 30-Dec-2006  yamt sync with head.
 1.12.2.1 21-Jun-2006  yamt sync with head.
 1.16.22.1 10-Dec-2006  yamt sync with head.
 1.16.20.1 12-Jan-2007  ad Sync with head.
 1.17.42.1 02-Jan-2008  bouyer Sync with HEAD
 1.17.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.17.28.1 09-Jan-2008  matt sync with HEAD
 1.18.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.18.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.18.10.1 04-May-2009  yamt sync with head.
 1.18.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.20.36.1 18-Jan-2017  skrll Sync with netbsd-5
 1.20.34.2 20-Mar-2017  pgoyette Sync with HEAD
 1.20.34.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.20.30.2 28-Aug-2017  skrll Sync with HEAD
 1.20.30.1 05-Dec-2016  skrll Sync with HEAD
 1.20.28.1 06-Dec-2016  snj Pull up following revision(s) (requested by tsutsui in ticket #1283):
distrib/sets/lists/comp/md.luna68k: revision 1.21
etc/etc.luna68k/MAKEDEV.conf: revision 1.9
sys/arch/luna68k/conf/GENERIC: revision 1.120
sys/arch/luna68k/conf/files.luna68k: revision 1.25
sys/arch/luna68k/conf/majors.luna68k: revision 1.21
sys/arch/luna68k/dev/xp.c: revision 1.1
sys/arch/luna68k/include/Makefile: revision 1.19
sys/arch/luna68k/include/xpio.h: revision 1.1
sys/arch/luna68k/luna68k/mainbus.c: revision 1.14
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).
Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.20.12.1 03-Dec-2017  jdolecek update from HEAD
 1.21.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.22.14.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.22.14.1 10-Jun-2019  christos Sync with HEAD
 1.8 19-Sep-2010  tsutsui - add m68k/conf/std.m68k, which includes common standard options for m68k,
options EXEC_ELF32, EXEC_SCRIPTS, and CPU_IN_CKSUM for md cpu_in_cksum.c
- make all m68k ports include common arch/m68k/conf/std.m68k
from MD std.${MACHINE}
 1.7 11-Dec-2005  christos branches: 1.7.78; 1.7.98; 1.7.100;
merge ktrace-lwp.
 1.6 17-Sep-2005  yamt include "conf/std".
 1.5 24-Dec-2001  chs branches: 1.5.16; 1.5.32;
typo in last.
 1.4 22-Dec-2001  chs convert luna68k to ELF. ok'd by nisimura.
 1.3 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.2 22-Jun-2000  fvdl branches: 1.2.2; 1.2.6; 1.2.10;
Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.1 05-Jan-2000  nisimura branches: 1.1.4;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.4.1 23-Jun-2000  fvdl As on the trunk, update these for the move of ffs_softdep.c into the
kernel source itself. Remove prefix construction, and add the SOFTDEP
option to GENERIC kernels.
 1.2.10.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 22-Jun-2000  bouyer file std.luna68k was added on branch thorpej_scsipi on 2000-11-20 20:10:25 +0000
 1.5.32.1 21-Jun-2006  yamt sync with head.
 1.5.16.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.100.1 05-Mar-2011  rmind sync with head
 1.7.98.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.7.78.1 09-Oct-2010  yamt sync with head
 1.9 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.8 30-Jun-2019  tsutsui Misc KNF.
 1.7 23-Sep-2013  tsutsui branches: 1.7.30;
Tab/space cleanup.
 1.6 19-Jan-2010  pooka branches: 1.6.12; 1.6.22; 1.6.26;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

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

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.5 04-Apr-2008  tsutsui branches: 1.5.4;
Split device_t/softc for le(4) and variants and misc cosmetic changes.
 1.4 11-Dec-2005  christos branches: 1.4.74;
merge ktrace-lwp.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 02-Oct-2002  thorpej branches: 1.2.6;
Use CFATTACH_DECL().
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.10; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.10.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.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 05-Jan-2000  bouyer file if_le.c was added on branch thorpej_scsipi on 2000-11-20 20:10:25 +0000
 1.2.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 03-Aug-2004  skrll Sync with HEAD
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.4.1 11-Mar-2010  yamt sync with head
 1.6.26.1 18-May-2014  rmind sync with head
 1.6.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.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.7.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.13 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.12 29-Dec-2020  tsutsui Make local functions static.
 1.11 30-Jun-2019  tsutsui branches: 1.11.10;
Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.10 30-Jun-2019  tsutsui Misc KNF.
 1.9 08-Mar-2018  mrg branches: 1.9.2;
fix various gcc6 m68k issues:
- bad indentation. next68k en.c and mvme68k le_poll.c fixes real issues
in error handling, the rest are NFCI.
- pass 68030 flags as appropriate for mvme68k.
- next68k nextrom.c has -Warray-bounds ignored for an odd expression
that appears to run before relocation, and needs manual offsets
added which trips bounds array checking.

with this all m68k ports build with GCC 6.
 1.8 09-Mar-2017  tsutsui branches: 1.8.12;
Add a driver for LUNA's front panel LCD. Ported from OpenBSD/luna88k.

Reviewed by enami@. Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.
 1.7 12-Nov-2011  tsutsui branches: 1.7.10; 1.7.28; 1.7.32; 1.7.36;
Finally complete LUNA-II support, after almost 12 years since
initial import of NetBSD/luna68k.

Note a working LUNA-II machine was found and provided by OMRON guys
after LUNA demonstration at Open Source Conference 2011 Kansai @ Kyoto:
http://mail-index.NetBSD.org/source-changes/2011/07/16/msg024675.html
and this resurrected LUNA-II which runs NetBSD/luna68k -current with Xserver
was also demonstrated on the NetBSD booth at Kansai Open Source 2011:
http://www.NetBSD.org/gallery/events.html#kansai-os-jp-2011

It's really pleasure to meet many OMRON LUNA developers and LUNA users
at the NetBSD booth. Thank you everyone!


Changes details:

luna68k/luna68k/locore.s
- don't use 68030 specific pflusha instruction in 68040 initialization path
- use TBIA() to invalidate TLB instead of 68030's pflusha
after MMU is turned on (as hp300 does)
(these two bugs are fatal at early bootstrap)
- pull loadustp() fixes from hp300/locore.s rev 1.82
(more flush ops are required in it otherwise causes random coredumps)
- specify correct %tt1 mask value
(the mask value means actually bit mask, not transparent range)

luna68k/luna68k/machdep.c
- use proper delay_divisor for 68040 25MHz LUNA-II

luna68k/luna68k/mainbus.c
- prepare and use per-model mainbus device lists for mainbus_attach_args

luna68k/conf/GENERIC
luna68k/conf/INSTALL
- enable options M68040 and FPSP
- enable secondary spc(4) on LUNA-II

luna68k/conf/Makefile.luna68k
- include arch/m68k/fpsp/Makefile.inc for FPSP

luna68k/dev/lcd.c
- promote LUNA-II model on LCD

XXX: old and slow SCSI-1 drives like Hitachi DK312 seems to have
XXX: some problem with spc(4) driver, even on the original LUNA
 1.6 18-Mar-2009  cegger branches: 1.6.12;
Ansify function definitions w/o arguments. Generated with sed.
 1.5 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.4 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 28-Apr-2008  martin branches: 1.3.8; 1.3.14;
Remove clause 3 and 4 from TNF licenses
 1.2 07-Jan-2000  nisimura branches: 1.2.6; 1.2.132; 1.2.134; 1.2.136;
- Make SCSI work; by kludges of machine/bus.h. TEAC streamer tape drive
found to be tweaked. Need extensive verifications.
- Add wsmouse node under ws; not useful this moment.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.136.2 04-May-2009  yamt sync with head.
 1.2.136.1 16-May-2008  yamt sync with head.
 1.2.134.1 18-May-2008  yamt sync with head.
 1.2.132.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 07-Jan-2000  bouyer file lcd.c was added on branch thorpej_scsipi on 2000-11-20 20:10:25 +0000
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.6.12.1 17-Apr-2012  yamt sync with head
 1.7.36.1 21-Apr-2017  bouyer Sync with HEAD
 1.7.32.1 20-Mar-2017  pgoyette Sync with HEAD
 1.7.28.1 28-Aug-2017  skrll Sync with HEAD
 1.7.10.1 03-Dec-2017  jdolecek update from HEAD
 1.8.12.1 15-Mar-2018  pgoyette Synch with HEAD
 1.9.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.11.10.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.49 03-Oct-2022  tsutsui Remove global hwplanecount and use ri_depth in struct rasops instead.

No functional change.
 1.48 01-Oct-2022  tsutsui Set an actual framebuffer depth (bpp) to rasops ri_depth.

The previous value was derived from OpenBSD/luna88k but
it has not been referenced even via ioctl(2).
 1.47 25-Sep-2022  isaki lunafb: Improve drawing performance using VRAM ROP features.
- Drawing a character on 4bpp normally needs 4 times writes, but by using
VRAM ROP actively, it can be reduced to write only once.
The same goes for copyrows. If the whole row consists of only two colors
(one foreground and one background), it can be copied by reading once and
writing once, regardless of the number of planes. Only if the row consists
of more than two colors, it will be copied plane by plane.
- On 8bpp board, it acts as 4bpp (16 colors).
- On 4bpp board on the real LUNA-I(68030/20MHz), monochrome scroll is about
4 times faster even without asm. Using asm improves it by additional 5%
(asm is enabled by default).
- By tsutsui@-san's report, even color scroll is about about 2 times faster
on his 8bpp board on the real LUNA-II(68040).
This was first developped by Y.Sugahara back in late 2019, and was modified
a lot by me in 2022.
http://mail-index.netbsd.org/port-luna68k/2022/09/23/msg000072.html
 1.46 14-Jul-2022  tsutsui Misc KNF and cosmetics.
 1.45 14-Jul-2022  tsutsui Fix pasto.
 1.44 03-Jul-2022  andvar fix various typos in comments, mainly s/pallete/palette/.
 1.43 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.42 24-Apr-2021  thorpej branches: 1.42.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.41 22-Sep-2019  rin branches: 1.41.10;
Correct size of framebuffer; page offset appears only once,
not every color depths.

Pointed out by Araki Ken. Thanks!
 1.40 23-Jul-2019  rin branches: 1.40.2;
For drivers whose framebuffer is located not page-aligned, permit
offset of mmap up to (length of framebuffer) + (page offset of base
address of framebuffer). This is necessary in order to map the
highest page of framebuffer correctly, see,
http://cvsweb.netbsd.org/bsdweb.cgi/xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c#rev1.35
 1.39 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.38 30-Jun-2019  tsutsui Misc KNF.
 1.37 24-Jan-2018  riastradh branches: 1.37.4;
Fix integer overflows noted by Silvio Cesare of InfoSect.

Someone^TM should name these idioms so we can eliminate this class of
copypasta bug.
 1.36 04-Oct-2014  tsutsui Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.

http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
>> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
>> It makes 4bpp wscons putchar ~20% faster.

This Makes 4bpp wscons putchar ~30% on LUNA-II.

Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.

Tested on all 1bpp/4bpp/8bpp framebuffers.
 1.35 25-Jul-2014  tsutsui branches: 1.35.2;
Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.

- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL

Tested on LUNA with 4bpp framebuffer.
 1.34 24-Jul-2014  tsutsui Add consistent prefix to a softc member name.
 1.33 18-Jul-2014  tsutsui Use kmem(9) instead of malloc(9).
 1.32 18-Jul-2014  tsutsui Use C99 struct initialization for wsdisplay_accessops.
 1.31 13-Jul-2014  tsutsui Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.

Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.

Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
 1.30 30-Dec-2013  tsutsui branches: 1.30.2;
Pull a fix of Bt458 (8bpp framebuffer) initialization from OpenBSD/luna88k.

http://marc.info/?l=openbsd-cvs&m=138838884202196
>> Correct initialization of Bt458, used in LUNA's 8bpp frame buffer.
>>
>> According to the manual, the address register does not automatically
>> increment when we access to the control registers. Also we disable
>> overlay planes, because we do not use them.
 1.29 28-Dec-2013  tsutsui Add preleminary support of 4bpp LUNA framebuffer.

Changes details:
- prepare and switch 4bpp rasops functions that read/write all 4 planes
and also handle both fg and bg colors
- make 1bpp ops use first plane on write rather than common bitmap plane
(which is prepared for multiple plane write with raster ops)
- prepare 4bpp allocattr function to handle ANSI 16 color text
- split omrasops_init() function for each bpp
- move struct hwcmap from softc to hwdevconfig to sync palette values
on initialization
- allow mmap(2) against all available planes

Now we can use ANSI 16 color text console and also can
demonstrate mlterm-fb with color sixel graphics and wallpaper.
XXX: Xserver needs much more work.
 1.28 14-Dec-2013  tsutsui Initialize capabilities in struct wsscreen_descr per omrasops settings.

Now REVERSE characters are drawn properly.
 1.27 19-Jul-2013  tsutsui Properly initialize the palette for while on black even on 1bpp framebuffer.
Preparing for demonstration in Open Source Conference 2013 Kyoto.
 1.26 20-Jul-2012  tsutsui branches: 1.26.2; 1.26.4; 1.26.10;
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
 1.25 27-Jul-2011  tsutsui branches: 1.25.2; 1.25.8;
KNF, use uintNN_t, tab/space cosmetics etc.
 1.24 27-Jul-2011  tsutsui - split device_t/softc and use device_t and cfdata_t etc.
- use aprint_normal(9)
- include "ioconf.h" for struct cfdriver decls
No crash on LUNA.
 1.23 21-Jul-2011  tsutsui Add and return WSKBD_TYPE_LUNA and WSDISPLAY_TYPE_LUNA on WS*_GTYPE ioctls.

XXX: should we still sync <sys/dev/wsconsio.h> and src/sbin/wsconsctl/util.c?
 1.22 21-Jul-2011  tsutsui Changes put for luna68k X.Org mono server demo at OSC 2011 Kansai @ Kyoto:
- sprinkle volatile around register access
- initialize pallete for WHITE on BLACK text
- add WSDISPLAYIO_LINEBYTES ioctl(2)
- fix index count in omsetcmap()
- make omfbmmap() return cookie for OMFB_FB_RADDR to make
X.Org wsfb driver work on 1bpp framebuffer memory
(XXX: should revisit later)
- make WSDISPLAYIO_GINFO always return 1bpp to avoid pallete mangled
by X.Org server initialization
(XXX: should revisit later)
 1.21 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.20 16-Mar-2009  dsl ANSIfy functions with function-pointer arguments
 1.19 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.18 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.17 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.16 28-Apr-2008  martin branches: 1.16.8; 1.16.14;
Remove clause 3 and 4 from TNF licenses
 1.15 04-Mar-2007  christos branches: 1.15.40; 1.15.42; 1.15.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 12-Apr-2006  jmmv branches: 1.14.14;
Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called. The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place. There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
merge ktrace-lwp.
 1.12 13-Nov-2003  chs branches: 1.12.16;
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.11 02-Apr-2003  thorpej branches: 1.11.2;
Use PAGE_SIZE rather than NBPG.
 1.10 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.9 06-Aug-2002  itojun integer overflow. from silvio@qualys.com
 1.8 04-Jul-2002  junyoung alloc_attr -> allocattr

Approved by Matthias Drochner.
 1.7 17-Mar-2002  atatat branches: 1.7.4; 1.7.6;
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.6 29-Jun-2000  mrg branches: 1.6.2; 1.6.6; 1.6.10;
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 12-Jan-2000  nisimura branches: 1.4.4;
- Fix an error in clearing entire screen.
- Add 3 byte long mouse event parsing.
- Fix errors in comments.
 1.3 08-Jan-2000  nisimura Kludge to avoid a panic in badaddr() when no framebuffer is installed.
 1.2 06-Jan-2000  nisimura Fix a typo of screen size; pointed by tsubai.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.4.4.2 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.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.6.10.4 18-Oct-2002  nathanw Catch up to -current.
 1.6.10.3 13-Aug-2002  nathanw Catch up to -current.
 1.6.10.2 01-Aug-2002  nathanw Catch up to -current.
 1.6.10.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.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.6.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.6.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 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 29-Jun-2000  bouyer file lunafb.c was added on branch thorpej_scsipi on 2000-11-20 20:10:25 +0000
 1.7.6.1 07-Aug-2002  lukem Pull up revision 1.9 (requested by itojun in ticket #616):
integer overflow. from silvio@qualys.com
 1.7.4.2 31-Aug-2002  gehenna catch up with -current.
 1.7.4.1 16-Jul-2002  gehenna catch up with -current.
 1.11.2.4 25-Jan-2005  skrll Adapt to branch.
 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.2 03-Sep-2007  yamt sync with head.
 1.12.16.1 21-Jun-2006  yamt sync with head.
 1.13.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.13.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.13.8.1 24-May-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.14.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.44.2 04-May-2009  yamt sync with head.
 1.15.44.1 16-May-2008  yamt sync with head.
 1.15.42.1 18-May-2008  yamt sync with head.
 1.15.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.8.3 09-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.25.8.2 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1005):
sys/arch/luna68k/dev/omrasops.c: revision 1.15
sys/arch/luna68k/dev/omrasops.c: revision 1.16
sys/arch/luna68k/dev/lunafb.c: revision 1.27
sys/arch/luna68k/dev/lunafb.c: revision 1.28
sys/arch/luna68k/dev/lunafb.c: revision 1.29
sys/arch/luna68k/dev/lunafb.c: revision 1.30
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.2
sys/arch/luna68k/dev/omrasops.c: revision 1.14
Properly initialize the palette for while on black even on 1bpp framebuffer.
Preparing for demonstration in Open Source Conference 2013 Kyoto.
Fix off by one in copyrows() backward case.
Make omrasops copycols() op work even if columns are not 32 bit aligned.
This means command line editing works properly in any cases.
The bitcopy strategies for 1bpp copycols() op are taken from
recently fixed MI sys/dev/rasops/rasops_bitops.h.
GETBITS() and PUTBITS() m68k asm macro are taken from hp300.
Tested on both 1bpp (on LUNA-II) and 4bpp (on LUNA) framebuffers.
Initialize capabilities in struct wsscreen_descr per omrasops settings.
Now REVERSE characters are drawn properly.
Add preleminary support of 4bpp LUNA framebuffer.
Changes details:
- prepare and switch 4bpp rasops functions that read/write all 4 planes
and also handle both fg and bg colors
- make 1bpp ops use first plane on write rather than common bitmap plane
(which is prepared for multiple plane write with raster ops)
- prepare 4bpp allocattr function to handle ANSI 16 color text
- split omrasops_init() function for each bpp
- move struct hwcmap from softc to hwdevconfig to sync palette values
on initialization
- allow mmap(2) against all available planes
Now we can use ANSI 16 color text console and also can
demonstrate mlterm-fb with color sixel graphics and wallpaper.
XXX: Xserver needs much more work.
Pull a fix of Bt458 (8bpp framebuffer) initialization from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvs&m=138838884202196
> Correct initialization of Bt458, used in LUNA's 8bpp frame buffer.
>
> According to the manual, the address register does not automatically
> increment when we access to the control registers. Also we disable
> overlay planes, because we do not use them.
 1.25.8.1 25-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
 1.25.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.25.2.1 30-Oct-2012  yamt sync with head
 1.26.10.1 23-Jul-2013  riastradh sync with HEAD
 1.26.4.2 18-May-2014  rmind sync with head
 1.26.4.1 28-Aug-2013  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.30.2.1 10-Aug-2014  tls Rebase.
 1.35.2.1 05-Oct-2014  martin Pull up following revision(s) (requested by tsutsui in ticket #130):
sys/arch/luna68k/dev/omrasops.c: revision 1.17
sys/arch/luna68k/dev/omrasops.c: revision 1.18
sys/arch/luna68k/dev/omrasops.c: revision 1.19
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
sys/arch/luna68k/dev/lunafb.c: revision 1.36
Pull readability changes from OpenBSD/luna88k.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
Tested on LUNA-II with 8bpp framebuffer.
Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
 1.37.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.40.2.1 03-Oct-2019  martin Pull up following revision(s) (requested by rin in ticket #271):

sys/arch/luna68k/dev/lunafb.c: revision 1.41

Correct size of framebuffer; page offset appears only once,
not every color depths.

Pointed out by Araki Ken. Thanks!
 1.41.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.42.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.42 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.41 25-Jun-2022  tsutsui Add rnd(9) entropy source from keyboard and mouse.
 1.40 09-Oct-2021  tsutsui Handle wskbd(9) .set_leds op in cngetc(9) using wskbd_cnattach(9) cookie.

XXX1: LUNA's keyboards emulate "mechanical lock" for CAP and Kana keys,
i.e. it sends "DOWN" code only when CAP/Kana LEDs are turned on
and send "UP" code only when the LEDs are turned off.
The MD omkbd_input() via wskbd_input(9) for the normal wskbd(4)
(i.e. ttyE0) devices handles this quirk, but MI wskbd_cngetc()
in sys/dev/wscons/wskbd.c can do nothing for this.

XXX2: I wonder if we should have an independent .set_leds op for cons(9)
as cnbell(9), rather than referring a device specific softc stuff
during .set_leds op in struct wskbd_accessop (registered during
autoconf(9) via struct wskbddev_attach_args passed to config_found(9))
even for wskbd cngetc(9) op in struct wskbd_consops (registered
via early wskbd_cnattach(9)).
 1.39 25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.38 20-Sep-2021  tsutsui Add a comment that .set_leds function won't work correctly on cngetc(9).

I'm afraid all other keyboard drivers that have .set_leds function
(like sgimips/dev/zs_kbd.c) have the same issue.
Maybe we needs 'polled' flag in .set_leds function, or an independent
.set_leds accessop in struct wskbd_consops for cons(9).
 1.37 19-Sep-2021  tsutsui Use more C99 designated initializer.
 1.36 19-Sep-2021  tsutsui Handle CAP and Kana modifier key specification quirk of LUNA's keyboard.

LUNA's keyboard doesn't send any keycode when these modifier keys are
released. Instead, it sends a pressed or released code per how each
modifier LED status will be changed when the modifier keys are pressed.
To handle this quirk in MI wskbd(4) layer, we have to send a faked
"pressed and released" sequence on passing keycodes to wskbd_input(9).

Tested on LUNA both on ttyE0 and WSKBD_RAW mode (on Xorg server).
 1.35 18-Sep-2021  tsutsui Implement transmitting keyboard LED and buzzer control commands.

- enable TX on uPD7201 for keyboard port
- prepare TX queue and handle it in hardware interrupt and softint(9)
- send proper LED commands on WSKBDIO_SETLEDS
(XXX: KANA LED is not handled in wscons)
- return current LED settings on WSKBDIO_GETLEDS
- implement WSKBDIO_COMPLEXBELL by parsing struct wskbd_bell_data and
send proper buzzer commands
- handle pitch, period, and volume in cnbell(9)
(XXX: no description in cnbell(9) man pages)
- use proper queued TX function for omms_enable() and omms_disable()
- add DPRINTF()s for debug
- use C99 designated initializer and misc cosmetics

Tested on LUNA and its keyboard (3W4SD-098NDT).
 1.34 04-Sep-2021  tsutsui Ignore mouse packets properly even if wsmouse(4) isn't configured.

The internal state of wskbd(4) could be mangled if mouse (which was
connected behind keyboard) was enabled by unexpected keyboard reset.
This could happen on the INSTALL kernel (no wsmouse(4) on it).

Based on a patch from moveccr, with several tweaks by me.
 1.33 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.32 24-Apr-2021  thorpej branches: 1.32.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.31 21-Aug-2015  christos branches: 1.31.32;
- move prototypes to common header file
- rename function to avoid confusion with pseudo-device attach
 1.30 20-Jul-2014  tsutsui branches: 1.30.4;
Pull LUNA's keyboard driver changes from OpenBSD/luna88k.

- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values

Now LUNA's keyboard works on Xorg server without tweaks by xmodmap(1) etc.
 1.29 18-Jul-2014  tsutsui Minor KNF. No binary changes.
 1.28 02-Feb-2014  tsutsui branches: 1.28.2;
Misc cleanup of sio drivers.

- register softc of child devices as an argument of the sio interrupt
handler to avoid device_lookup_private() calls on every interrupt
- change type of sc_reg from (void *) to (struct sioreg *)
to avoid weird address offset calculations with redundant casts
- rename struct sio_softc members for consistency
- use a channel number passed via sio_attach_args in lunaws_attach()

No functional chnages. Tested on LUNA.
 1.27 23-Sep-2013  tsutsui Tab/space cleanup.
 1.26 14-May-2013  tsutsui branches: 1.26.2;
Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
 1.25 13-Oct-2012  tsutsui struct device * -> device_t, use device_xname() (from chs@)
 1.24 16-Jul-2012  tsutsui branches: 1.24.2;
Use & not && to mask bits. From OpenBSD/luna88k
 1.23 27-Jul-2011  tsutsui branches: 1.23.2; 1.23.8;
KNF, use uintNN_t, tab/space cosmetics etc.
 1.22 27-Jul-2011  tsutsui - split device_t/softc and use device_t and cfdata_t etc.
- use aprint_normal(9)
- include "ioconf.h" for struct cfdriver decls
No crash on LUNA.
 1.21 21-Jul-2011  tsutsui Add and return WSKBD_TYPE_LUNA and WSDISPLAY_TYPE_LUNA on WS*_GTYPE ioctls.

XXX: should we still sync <sys/dev/wsconsio.h> and src/sbin/wsconsctl/util.c?
 1.20 26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.19 18-Mar-2009  cegger bcopy -> memcpy
 1.18 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.17 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.16 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.15 13-Jun-2008  cegger branches: 1.15.4; 1.15.10;
use device_lookup_private to get softc
 1.14 28-Apr-2008  martin branches: 1.14.2; 1.14.4;
Remove clause 3 and 4 from TNF licenses
 1.13 04-Mar-2007  christos branches: 1.13.40; 1.13.42; 1.13.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12 12-Nov-2006  plunky branches: 1.12.4;
Tidy away wsmouse_input() abstractions and update
documentation to include the W direction.
 1.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 28-Jun-2005  drochner branches: 1.10.2;
convert remaining autoconf bus "submatch" functions to use the new
signature (passing locators), and remove some which obviously don't
serve any purpose
(untested, sorry)
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.7 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.6 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.5 19-Oct-2000  nisimura branches: 1.5.2; 1.5.6; 1.5.10;
Fix errors in mouse event handling;
- convert LMR bit pattern into RML since wsevent counts 0 for the leftmost
mouse button.
- found hardware reports mouse button state in negated.
 1.4 14-Jan-2000  nisimura Fix an argument error of wsmouse_input() call.
 1.3 12-Jan-2000  nisimura - Fix an error in clearing entire screen.
- Add 3 byte long mouse event parsing.
- Fix errors in comments.
 1.2 07-Jan-2000  nisimura - Make SCSI work; by kludges of machine/bus.h. TEAC streamer tape drive
found to be tweaked. Need extensive verifications.
- Add wsmouse node under ws; not useful this moment.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.5.10.2 18-Oct-2002  nathanw Catch up to -current.
 1.5.10.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.6.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 19-Oct-2000  bouyer file lunaws.c was added on branch thorpej_scsipi on 2000-11-20 20:10:26 +0000
 1.9.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.6.1 25-Jan-2005  skrll Adapt to branch.
 1.10.2.3 03-Sep-2007  yamt sync with head.
 1.10.2.2 30-Dec-2006  yamt sync with head.
 1.10.2.1 21-Jun-2006  yamt sync with head.
 1.11.22.1 10-Dec-2006  yamt sync with head.
 1.11.20.1 18-Nov-2006  ad Sync with head.
 1.12.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.44.3 11-Mar-2010  yamt sync with head
 1.13.44.2 04-May-2009  yamt sync with head.
 1.13.44.1 16-May-2008  yamt sync with head.
 1.13.42.2 17-Jun-2008  yamt sync with head.
 1.13.42.1 18-May-2008  yamt sync with head.
 1.13.40.2 29-Jun-2008  mjf Sync with HEAD.
 1.13.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.4.1 18-Jun-2008  simonb Sync with head.
 1.14.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.23.8.3 09-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.23.8.2 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1004):
sys/arch/luna68k/dev/siotty.c: revision 1.35
sys/arch/luna68k/dev/siotty.c: revision 1.36
sys/arch/luna68k/dev/siotty.c: revision 1.37
sys/arch/luna68k/dev/siotty.c: revision 1.38
sys/arch/luna68k/dev/lunaws.c: revision 1.25
sys/arch/luna68k/dev/lunaws.c: revision 1.26
sys/arch/luna68k/dev/lunaws.c: revision 1.27
sys/arch/luna68k/dev/siovar.h: revision 1.7
sys/arch/luna68k/dev/siotty.c: revision 1.34
struct device * -> device_t, use device_xname() (from chs@)
Whitespace cleanup.
Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
Tab/space cleanup.
Use softint(9) properly to process TX/RX data between tty(4) layer.
It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.
Changes details (mostly similar to com(4) and z8530tty(4)):
- allocate RX buffer and put data and status into it in the interrupt handler
- call t_linesw->l_rint from the software interrupt handler
- set the only first byte in siottystart() and use t_outq buffer to send
multiple TX data
- call the next t_linesw->l_start on TX complete in the software interrupt
handler
Also put more changes:
- handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
- allocate tty in the attach function as other drivers rather than first open
- use proper variable types
Remove initialization of unused t_softc in struct tty (to make pullup easier).
 1.23.8.1 25-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
 1.23.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.23.2.1 30-Oct-2012  yamt sync with head
 1.24.2.4 03-Dec-2017  jdolecek update from HEAD
 1.24.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.24.2.2 23-Jun-2013  tls resync from head
 1.24.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.26.2.1 18-May-2014  rmind sync with head
 1.28.2.1 10-Aug-2014  tls Rebase.
 1.30.4.1 22-Sep-2015  skrll Sync with HEAD
 1.31.32.1 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.32.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 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.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.10; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.1 28-Feb-2002  nathanw Catch up to -current.
 1.1.10.1 11-Feb-2002  jdolecek Sync w/ -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 05-Jan-2000  bouyer file md_root.c was added on branch thorpej_scsipi on 2000-11-20 20:10:26 +0000
 1.3 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.2 04-Oct-2014  tsutsui branches: 1.2.2;
Fix unintended RCS Id substitution.
 1.1 20-Jul-2014  tsutsui branches: 1.1.2; 1.1.6;
Pull LUNA's keyboard driver changes from OpenBSD/luna88k.

- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values

Now LUNA's keyboard works on Xorg server without tweaks by xmodmap(1) etc.
 1.1.6.3 03-Dec-2017  jdolecek update from HEAD
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 20-Jul-2014  tls file omkbdmap.c was added on branch tls-maxphys on 2014-08-20 00:03:10 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 20-Jul-2014  tls file omkbdmap.c was added on branch tls-earlyentropy on 2014-08-10 06:54:00 +0000
 1.2.2.2 09-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.2.2.1 04-Oct-2014  msaitoh file omkbdmap.c was added on branch netbsd-6 on 2014-11-09 07:34:12 +0000
 1.1 20-Jul-2014  tsutsui branches: 1.1.2; 1.1.6; 1.1.8;
Pull LUNA's keyboard driver changes from OpenBSD/luna88k.

- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values

Now LUNA's keyboard works on Xorg server without tweaks by xmodmap(1) etc.
 1.1.8.2 09-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.1.8.1 20-Jul-2014  msaitoh file omkbdmap.h was added on branch netbsd-6 on 2014-11-09 07:34:12 +0000
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 20-Jul-2014  tls file omkbdmap.h was added on branch tls-maxphys on 2014-08-20 00:03:10 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 20-Jul-2014  tls file omkbdmap.h was added on branch tls-earlyentropy on 2014-08-10 06:54:00 +0000
 1.27 20-Sep-2024  isaki s/speficically/specifically/ in comment. (Sync with OpenBSD/luna88k)
 1.26 15-Jan-2023  tsutsui branches: 1.26.6;
TAB/space/indent cleanup.
 1.25 03-Oct-2022  tsutsui Remove global hwplanecount and use ri_depth in struct rasops instead.

No functional change.
 1.24 01-Oct-2022  tsutsui Explicitly limit a number of rasops rows per size of rowattr[].
 1.23 25-Sep-2022  isaki lunafb: Improve drawing performance using VRAM ROP features.
- Drawing a character on 4bpp normally needs 4 times writes, but by using
VRAM ROP actively, it can be reduced to write only once.
The same goes for copyrows. If the whole row consists of only two colors
(one foreground and one background), it can be copied by reading once and
writing once, regardless of the number of planes. Only if the row consists
of more than two colors, it will be copied plane by plane.
- On 8bpp board, it acts as 4bpp (16 colors).
- On 4bpp board on the real LUNA-I(68030/20MHz), monochrome scroll is about
4 times faster even without asm. Using asm improves it by additional 5%
(asm is enabled by default).
- By tsutsui@-san's report, even color scroll is about about 2 times faster
on his 8bpp board on the real LUNA-II(68040).
This was first developped by Y.Sugahara back in late 2019, and was modified
a lot by me in 2022.
http://mail-index.netbsd.org/port-luna68k/2022/09/23/msg000072.html
 1.22 25-Sep-2022  isaki Cosmetic changes. Fix a typo in comment.
 1.21 31-Jul-2019  rin G/C ri_delta.

XXX
Bump kernel version after other changes for struct rasops_info.
 1.20 06-Jun-2018  maya branches: 1.20.2; 1.20.6;
Remove duplicate ;
 1.19 04-Oct-2014  tsutsui branches: 1.19.18;
Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.

http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
>> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
>> It makes 4bpp wscons putchar ~20% faster.

This Makes 4bpp wscons putchar ~30% on LUNA-II.

Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.

Tested on all 1bpp/4bpp/8bpp framebuffers.
 1.18 28-Sep-2014  tsutsui Put dumb optimizations to avoid conditionals in putchar drawing loops.

~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
 1.17 28-Sep-2014  tsutsui Pull readability changes from OpenBSD/luna88k.

- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings

Tested on LUNA-II with 8bpp framebuffer.
 1.16 28-Dec-2013  tsutsui branches: 1.16.4;
Add preleminary support of 4bpp LUNA framebuffer.

Changes details:
- prepare and switch 4bpp rasops functions that read/write all 4 planes
and also handle both fg and bg colors
- make 1bpp ops use first plane on write rather than common bitmap plane
(which is prepared for multiple plane write with raster ops)
- prepare 4bpp allocattr function to handle ANSI 16 color text
- split omrasops_init() function for each bpp
- move struct hwcmap from softc to hwdevconfig to sync palette values
on initialization
- allow mmap(2) against all available planes

Now we can use ANSI 16 color text console and also can
demonstrate mlterm-fb with color sixel graphics and wallpaper.
XXX: Xserver needs much more work.
 1.15 14-Dec-2013  tsutsui Make omrasops copycols() op work even if columns are not 32 bit aligned.

This means command line editing works properly in any cases.

The bitcopy strategies for 1bpp copycols() op are taken from
recently fixed MI sys/dev/rasops/rasops_bitops.h.
GETBITS() and PUTBITS() m68k asm macro are taken from hp300.

Tested on both 1bpp (on LUNA-II) and 4bpp (on LUNA) framebuffers.
 1.14 02-Dec-2013  tsutsui Fix off by one in copyrows() backward case.
 1.13 20-Jul-2012  tsutsui branches: 1.13.2; 1.13.4;
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
 1.12 16-Jul-2012  tsutsui Fix typo in comment. From OpenBSD/luna88k.
 1.11 27-Jul-2011  tsutsui branches: 1.11.2; 1.11.8;
KNF, use uintNN_t, tab/space cosmetics etc.
 1.10 16-Jul-2011  tsutsui Revive NetBSD/luna68k.

Even after almost a lost decade since NetBSD/luna68k was
switched to using ELF format by default back in 2001,
actually only one fix (bus.h) is required for a GENERIC kernel itself
to get multiuser login: prompt on a real hardware. Hurrahhh!!!

Demonstrated with a working Xorg mono server on the NetBSD booth
at Open Source Conference 2011 Kansai @ Kyoto:
http://www.ospn.jp/osc2011-kyoto/

"Very impressed," commented by Tomoko YOSHIDA,
Program Committee Chair of the Conference,
and some other OMRON guys.

Special Thanks to Tadashi Okamura, for providing
a working SX-9100/DT "LUNA" for this mission.


Changes details:

sys/arch/luna68k/include/bus.h
- handle stride properly even on multi and region ops for MI spc(4)
- also fix stride handling of (currently unused) 2 and 4 byte ops

sys/arch/luna68k/conf/Makefile.luna68k
sys/arch/luna68k/conf/kern.ldscript.head
sys/arch/luna68k/conf/kern.ldscript.tail
- build a faked a.out kernel using elf2aout(8) tool
and a linker script derived from cats and shark
for the LUNA firmware that loads a.out binary directly
via network or from a UNIOS partition on a local disk

sys/arch/luna68k/dev/omrasops.c
sys/arch/luna68k/dev/omron_rfont.h
- use the original OMRON font derived from 4.4BSD-Lite/luna68k
rather than gallant19 which is used on Sun workstations
(XXX omrasops.c should be rewritten to use generic wsfont(4))

distrib/luna68k/*
distrib/utils/sysinst/arch/luna68k/*
etc/etc.luna68k/MAKEDEV.conf
etc/etc.luna68k/Makefile.inc
sys/arch/luna68k/conf/INSTALL
- build a ramdisk based INSTALL kernel with sysinst(8) for luna68k
- also build an installation iso image for luna68k

sys/arch/luna68k/conf/GENERIC
- enable SYSVSHM (and other SYSV*) options for Xorg server

More Xorg changes (which need some more cleanup) and
isiboot.c fixes will come soon.
 1.9 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.8 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.7 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.6 28-Apr-2008  martin branches: 1.6.8; 1.6.14;
Remove clause 3 and 4 from TNF licenses
 1.5 04-Mar-2007  tsutsui branches: 1.5.40; 1.5.42; 1.5.44;
Use (uint8_t *) for framebuffer address.
 1.4 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.3 04-Jul-2002  junyoung branches: 1.3.22; 1.3.60;
alloc_attr -> allocattr

Approved by Matthias Drochner.
 1.2 30-May-2002  thorpej Statements must follow labels.
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.10; 1.1.14; 1.1.22;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.22.2 16-Jul-2002  gehenna catch up with -current.
 1.1.22.1 14-Jul-2002  gehenna catch up with -current.
 1.1.14.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.14.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.10.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.10.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 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 05-Jan-2000  bouyer file omrasops.c was added on branch thorpej_scsipi on 2000-11-20 20:10:26 +0000
 1.3.60.1 12-Mar-2007  rmind Sync with HEAD.
 1.3.22.1 03-Sep-2007  yamt sync with head.
 1.5.44.2 04-May-2009  yamt sync with head.
 1.5.44.1 16-May-2008  yamt sync with head.
 1.5.42.1 18-May-2008  yamt sync with head.
 1.5.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.11.8.3 09-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.11.8.2 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1005):
sys/arch/luna68k/dev/omrasops.c: revision 1.15
sys/arch/luna68k/dev/omrasops.c: revision 1.16
sys/arch/luna68k/dev/lunafb.c: revision 1.27
sys/arch/luna68k/dev/lunafb.c: revision 1.28
sys/arch/luna68k/dev/lunafb.c: revision 1.29
sys/arch/luna68k/dev/lunafb.c: revision 1.30
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.2
sys/arch/luna68k/dev/omrasops.c: revision 1.14
Properly initialize the palette for while on black even on 1bpp framebuffer.
Preparing for demonstration in Open Source Conference 2013 Kyoto.
Fix off by one in copyrows() backward case.
Make omrasops copycols() op work even if columns are not 32 bit aligned.
This means command line editing works properly in any cases.
The bitcopy strategies for 1bpp copycols() op are taken from
recently fixed MI sys/dev/rasops/rasops_bitops.h.
GETBITS() and PUTBITS() m68k asm macro are taken from hp300.
Tested on both 1bpp (on LUNA-II) and 4bpp (on LUNA) framebuffers.
Initialize capabilities in struct wsscreen_descr per omrasops settings.
Now REVERSE characters are drawn properly.
Add preleminary support of 4bpp LUNA framebuffer.
Changes details:
- prepare and switch 4bpp rasops functions that read/write all 4 planes
and also handle both fg and bg colors
- make 1bpp ops use first plane on write rather than common bitmap plane
(which is prepared for multiple plane write with raster ops)
- prepare 4bpp allocattr function to handle ANSI 16 color text
- split omrasops_init() function for each bpp
- move struct hwcmap from softc to hwdevconfig to sync palette values
on initialization
- allow mmap(2) against all available planes
Now we can use ANSI 16 color text console and also can
demonstrate mlterm-fb with color sixel graphics and wallpaper.
XXX: Xserver needs much more work.
Pull a fix of Bt458 (8bpp framebuffer) initialization from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvs&m=138838884202196
> Correct initialization of Bt458, used in LUNA's 8bpp frame buffer.
>
> According to the manual, the address register does not automatically
> increment when we access to the control registers. Also we disable
> overlay planes, because we do not use them.
 1.11.8.1 25-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
 1.11.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.11.2.1 30-Oct-2012  yamt sync with head
 1.13.4.1 18-May-2014  rmind sync with head
 1.13.2.2 03-Dec-2017  jdolecek update from HEAD
 1.13.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.4.1 05-Oct-2014  martin Pull up following revision(s) (requested by tsutsui in ticket #130):
sys/arch/luna68k/dev/omrasops.c: revision 1.17
sys/arch/luna68k/dev/omrasops.c: revision 1.18
sys/arch/luna68k/dev/omrasops.c: revision 1.19
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
sys/arch/luna68k/dev/lunafb.c: revision 1.36
Pull readability changes from OpenBSD/luna88k.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
Tested on LUNA-II with 8bpp framebuffer.
Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
 1.19.18.1 25-Jun-2018  pgoyette Sync with HEAD
 1.20.6.1 15-Aug-2019  martin Pull up following revision(s) (requested by rin in ticket #56):

sys/dev/rasops/rasops.c: revision 1.120
sys/dev/rasops/rasops.h: revision 1.40
sys/dev/rasops/rasops.c: revision 1.121
sys/dev/rasops/rasops.h: revision 1.41
sys/dev/rasops/rasops.c: revision 1.122
sys/dev/rasops/rasops.h: revision 1.42
sys/dev/rasops/rasops.h: revision 1.43
sys/dev/rasops/rasops.h: revision 1.44
sys/dev/rasops/rasops.h: revision 1.45
sys/dev/rasops/rasops.h: revision 1.46
sys/dev/rasops/rasops.h: revision 1.47
sys/dev/rasops/rasops.h: revision 1.48
sys/dev/rasops/rasops32.c: revision 1.40
sys/dev/rasops/rasops32.c: revision 1.41
sys/dev/rasops/rasops32.c: revision 1.42
sys/dev/rasops/rasops32.c: revision 1.43
sys/dev/rasops/rasops32.c: revision 1.44
sys/dev/rasops/rasops32.c: revision 1.45
sys/dev/rasops/rasops32.c: revision 1.46
sys/dev/rasops/rasops1-4_putchar.h: revision 1.1
sys/dev/rasops/rasops1-4_putchar.h: revision 1.2
sys/dev/rasops/rasops1-4_putchar.h: revision 1.3
sys/dev/rasops/rasops1_putchar_width.h: revision 1.3
sys/dev/rasops/rasops1_putchar_width.h: revision 1.4
sys/dev/rasops/rasops1_putchar_width.h: revision 1.5
sys/dev/rasops/rasops1_putchar_width.h: revision 1.6
sys/dev/rasops/README: revision 1.7
sys/dev/rasops/rasops_putchar_aa.h: revision 1.5
sys/dev/rasops/rasops_putchar_aa.h: revision 1.6
sys/dev/rasops/rasops8.c: revision 1.45
sys/dev/rasops/rasops8.c: revision 1.46
sys/dev/rasops/rasops8.c: revision 1.47
sys/dev/rasops/rasops24.c: revision 1.40
sys/dev/rasops/rasops8.c: revision 1.48
sys/dev/rasops/rasops24.c: revision 1.41
sys/dev/rasops/rasops8.c: revision 1.49
sys/dev/rasops/rasops24.c: revision 1.42
sys/dev/rasops/rasops24.c: revision 1.43
sys/dev/rasops/rasops24.c: revision 1.44
sys/dev/rasops/rasops_masks.c: revision 1.10
doc/CHANGES: revision 1.2566
sys/dev/rasops/rasops24.c: revision 1.45
doc/CHANGES: revision 1.2567
sys/dev/rasops/rasops24.c: revision 1.46
sys/dev/rasops/rasops24.c: revision 1.47
sys/dev/rasops/rasops24.c: revision 1.48
sys/dev/rasops/rasops24.c: revision 1.49
sys/dev/rasops/rasops_bitops.h: revision 1.19
sys/dev/rasops/rasops_putchar_aa.h: file removal
sys/dev/wscons/wsdisplay_vcons.c: revision 1.40
sys/dev/rasops/rasops8.c: revision 1.50
sys/dev/rasops/rasops8.c: revision 1.51
sys/dev/rasops/rasops24.c: revision 1.50
sys/arch/luna68k/dev/omrasops.c: revision 1.21
sys/dev/rasops/rasops_bitops.h: revision 1.20
sys/dev/wsfb/genfb.c: revision 1.68
sys/dev/rasops/rasops_bitops.h: revision 1.21
sys/dev/wsfb/genfb.c: revision 1.69
sys/dev/rasops/rasops_putchar_width.h: revision 1.10
sys/dev/rasops/rasops_bitops.h: revision 1.22
sys/dev/rasops/rasops_putchar_width.h: revision 1.11
sys/dev/rasops/rasops_bitops.h: revision 1.23
sys/dev/rasops/rasops_putchar_width.h: revision 1.12
sys/dev/rasops/rasops_bitops.h: revision 1.24
sys/dev/rasops/rasops_putchar_width.h: revision 1.13
sys/dev/rasops/rasops_bitops.h: revision 1.25
sys/dev/rasops/rasops_putchar_width.h: revision 1.14
sys/dev/rasops/rasops_putchar_width.h: revision 1.15
sys/dev/rasops/rasops1.c: revision 1.32
sys/dev/rasops/rasops1.c: revision 1.33
sys/dev/rasops/rasops1.c: revision 1.34
sys/dev/rasops/rasops1.c: revision 1.35
sys/dev/rasops/rasops1.c: revision 1.36
sys/dev/rasops/rasops1.c: revision 1.37
sys/dev/rasops/rasops4.c: revision 1.21
sys/dev/rasops/rasops4.c: revision 1.22
sys/dev/rasops/rasops4.c: revision 1.23
sys/dev/rasops/rasops4.c: revision 1.24
sys/dev/rasops/rasops4.c: revision 1.25
sys/dev/rasops/rasops4.c: revision 1.26
sys/dev/rasops/rasops4.c: revision 1.27
sys/dev/rasops/rasops4.c: revision 1.28
sys/dev/wsfb/genfb.c: revision 1.70
sys/dev/rasops/rasops2.c: revision 1.27
sys/dev/rasops/rasops2.c: revision 1.28
share/man/man9/rasops.9: revision 1.18
sys/dev/rasops/rasops.c: revision 1.102
sys/dev/rasops/rasops2.c: revision 1.29
share/man/man9/rasops.9: revision 1.19
sys/dev/rasops/rasops.c: revision 1.103
sys/dev/rasops/rasops.c: revision 1.104
sys/dev/rasops/rasops.c: revision 1.105
sys/dev/rasops/rasops.c: revision 1.106
sys/dev/rasops/rasops.c: revision 1.107
sys/dev/rasops/rasops_putchar.h: revision 1.6
sys/dev/rasops/rasops.c: revision 1.108
sys/dev/rasops/rasops_putchar.h: revision 1.7
sys/dev/rasops/rasops.c: revision 1.109
sys/dev/rasops/rasops_putchar.h: revision 1.8
sys/dev/rasops/rasops2.c: revision 1.30
sys/dev/rasops/rasops2.c: revision 1.31
sys/dev/rasops/rasops15.c: revision 1.32
sys/dev/rasops/rasops2.c: revision 1.32
sys/dev/rasops/rasops15.c: revision 1.33
sys/dev/rasops/rasops2.c: revision 1.33
sys/dev/rasops/rasops15.c: revision 1.34
sys/dev/rasops/rasops15.c: revision 1.35
sys/dev/rasops/rasops15.c: revision 1.36
sys/dev/rasops/rasops.c: revision 1.110
sys/dev/rasops/rasops15.c: revision 1.37
sys/dev/rasops/rasops.c: revision 1.111
sys/dev/rasops/rasops15.c: revision 1.38
sys/dev/rasops/rasops.c: revision 1.112
sys/dev/rasops/rasops15.c: revision 1.39
sys/dev/rasops/rasops.c: revision 1.113
sys/dev/rasops/rasops.c: revision 1.114
sys/dev/rasops/rasops.c: revision 1.115
sys/dev/rasops/rasops_masks.h: revision 1.9
sys/dev/rasops/rasops.c: revision 1.116
sys/dev/rasops/rasops.c: revision 1.117
sys/dev/rasops/rasops.c: revision 1.118
sys/dev/rasops/rasops.c: revision 1.119
sys/dev/rasops/rasops.h: revision 1.39

Misc clean-up's:
- protect private stuff in rasops.h by _RASOPS_PRIVATE
- staticify rasops_copycols() and rasops_isgray[]
- G/C unused extern int cold
Switch to per-device stamp, and retire stamp_mutex.

Provide buffer capable of single-row pixels in order to make things simpler.

Factor out copy-paste. No functional changes.
When font is switched, not only putchar, but also other ri_ops can be
changed by backend driver, e.g., see rasops1.c:
https://nxr.netbsd.org/xref/src/sys/dev/rasops/rasops1.c#58
4 is 1 << 2, not 1 << 3...

Fix erasecols and do_cursor for font width >= 32 bits.
Also, some cosmetic clean-up's.

Oops, for rasops_copycols(), we cannot use memmove even if src == dst.
On the other hand, memmove is safe for rasops_copyrows().
Fix unaligned writes to buffer, that are introduced in 1.105:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops.c#rev1.105

Support font width 32 on monochrome screen.

Remove duplicate substitution. Style. No functional changes.

Correct copy count. This affects ``left-to-right'' copy for region
including word boundary.

Fix a bug in shadow fb support for copycols on 1, 2, and 4bpp screen,
which was introduced in 1.18:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops_bitops.h#rev1.18

Add general putchar functions for 2 and 4bpp.
Note that 1bpp continues to use its local version in rasops1.c,
which is much faster and simpler.

Cosmetic changes. No functional changes.

Reflect reality.

Notify size of shadow framebuffer if enabled.

Fix unaligned word write's to buffer, introduced in rev 1.42:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops24.c#rev1.42

Real fix for 24-bpp color:
- When centering screen, locate effective base address of framebuffer to
both word and 24-bit color boundary.
- Consistently convert ri_devcmap to ``big endian'' if not RI_BSWAP.

Also, fix possible bug for 15/16-bpp with RI_BSWAP (not tested).

Protect rasops_copy{rows,cols}() by _RASOPS_PRIVATE.

Use _KERNEL_OPT.

Simplify calculation for 12-byte alignment.
No functional changes.

Fix black color-attribution for depths 2 and 4.

Depth 2 is monochrome.
IMO, it is impossible to support ANSI colors on 2-bpp display; fore-
and background can be same value even if they are different colors
logically.

Fix a critical bug for rasops_copyrows() introduced in rev. 1.90:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops.c#rev1.90
When src < dst, we have to copy backward.

Simplify rasops_do_cursor():
- Use static masks similar to that used in rasops_bitops.h,
rather than generating them on the fly.
- Use pointer for proper type to avoid unnecessary casts.

Use "hp" instead of "hrp" consistently with other files.
No functional changes.

Stop allocating ri_buf and ri_stamp dynamically. As commented in
rasops.h, it is not safe to use kmem_alloc(9) in rasops_init();
rasops routines can be used for early putchar, which means that
UVM is not fully initialized.

Should fix a problem reported by macallan:
http://mail-index.netbsd.org/tech-kern/2019/08/02/msg025327.html

Instead of using ri_buf, inline function rasops_memcpy32() is
introduced to fill 32bit data efficiently.

Instead of using ri_stamp (per device stamp), stamp_ri is
introduced to distinguish for which device stamp is calculated.

Oops, revert an unintentional change for now.

If RI_CLEAR is set, do not forget to clear real framebuffer.

Modify struct rasops_info again (ride 9.99.4 bump).
- remove ri_buf and friends.
- remove ri_stamp and frieds.
- introduce ri_ul, which will be used for scaling underline with font.

Also add hack for ri_ul; adjust its size to obsoleted member, ri_delta,
which was only used rasops routines internally. Now, size and offsets of
all members of struct rasops_info become same with netbsd-9, -8, and -7,
again. So we can safelly pull up fixes to any release branches!

Scaling dimensions of underline by font height.

Currently,
- offset of underline is fixed to 1-row from bottom of characters, and
- height of underline is fixed to 1.
Both are good for standard 8x16 fonts. However, it is too thin for
larger fonts, especially when used on display of high resolution.
Also, 1-row offset of underline is ugly for small fonts, e.g.,
spleen5x8.
Therefore, adjust offset and height as,
- no changes for standard 16-height fonts.
- scaling by font height for larger fonts.
- set offset to zero for fonts of height smaller than 16.

Merge rasops_putchar_aa.h into rasops_putchar.h.

Support scaling underline dimensions by font height.

Separate general putchar for 1-4bpp from rasops_bitops:
- Support anti-aliasing for 2bpp, which works perfectly!
- Support scaling underline dimensions with font height.

We support anti-aliasing for depth 2.
Use switch appropriately.
- Stop showing struct rasops_info; readers can read the header itself.
- Correct description for optimized font widths.
- Remove strange blank line.

Try to improve formatting and naration.

Make rasops_erase{rows,cols}() public again; hp300/diofb uses them.
Pointed out by martin.

When legacy Apple 4-bpp color palette is used, make green dark so that
kernel messages are printed nicely on white background.

Fix color range overflow; we cannot make bright colors more brighter.

Correctly check whether character is in font in rasops_mapchar().
Also, make sure that in putchar functions for completeness.

Fix bug introduced in rev. 1.69:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/wsfb/genfb.c#rev1.69
is_bgr should be initialized to false. Otherwise, color becomes strange
for depths 24 and 32 unless backend explicitly set "is_bgr" property.

Set 4-bpp devcmap in a similar manner to non-RGB case of 8-bpp.
No functional changes since this is not in use (4-bpp is monochrome).

Misc style clean up's.
- Introduce and use proper macros.
- Use not ambiguous variable names.
- Unify similar functions as possible as I can.
- G/C unused headers.
- Use #include <dev/rasops/foo.h> instead of "foo.h"

No particular functional changes intended.

My work for rasops(9) was finished (hopefully).

I will send pull-up request for netbsd-9, if there are no new failures
reported within few days.

Fix format in order not to confuse changes2html script.
Minor improvements of wording for my entry.

When using stamp, drop attributions other than back and foreground
colors so that stamp is not updated unnecessarily.
 1.20.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.26.6.1 02-Aug-2025  perseant Sync with HEAD
 1.8 03-Oct-2022  tsutsui Remove global hwplanecount and use ri_depth in struct rasops instead.

No functional change.
 1.7 01-Oct-2022  tsutsui Remove trailing whitespaces.
 1.6 25-Sep-2022  isaki lunafb: Improve drawing performance using VRAM ROP features.
- Drawing a character on 4bpp normally needs 4 times writes, but by using
VRAM ROP actively, it can be reduced to write only once.
The same goes for copyrows. If the whole row consists of only two colors
(one foreground and one background), it can be copied by reading once and
writing once, regardless of the number of planes. Only if the row consists
of more than two colors, it will be copied plane by plane.
- On 8bpp board, it acts as 4bpp (16 colors).
- On 4bpp board on the real LUNA-I(68030/20MHz), monochrome scroll is about
4 times faster even without asm. Using asm improves it by additional 5%
(asm is enabled by default).
- By tsutsui@-san's report, even color scroll is about about 2 times faster
on his 8bpp board on the real LUNA-II(68040).
This was first developped by Y.Sugahara back in late 2019, and was modified
a lot by me in 2022.
http://mail-index.netbsd.org/port-luna68k/2022/09/23/msg000072.html
 1.5 22-Sep-2019  rin Spell out "Hitachi" correctly in comment.
No binary changes.
 1.4 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.3 04-Oct-2014  tsutsui branches: 1.3.20;
Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.

http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
>> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
>> It makes 4bpp wscons putchar ~20% faster.

This Makes 4bpp wscons putchar ~30% on LUNA-II.

Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.

Tested on all 1bpp/4bpp/8bpp framebuffers.
 1.2 28-Dec-2013  tsutsui branches: 1.2.4;
Add preleminary support of 4bpp LUNA framebuffer.

Changes details:
- prepare and switch 4bpp rasops functions that read/write all 4 planes
and also handle both fg and bg colors
- make 1bpp ops use first plane on write rather than common bitmap plane
(which is prepared for multiple plane write with raster ops)
- prepare 4bpp allocattr function to handle ANSI 16 color text
- split omrasops_init() function for each bpp
- move struct hwcmap from softc to hwdevconfig to sync palette values
on initialization
- allow mmap(2) against all available planes

Now we can use ANSI 16 color text console and also can
demonstrate mlterm-fb with color sixel graphics and wallpaper.
XXX: Xserver needs much more work.
 1.1 20-Jul-2012  tsutsui branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
 1.1.8.1 18-May-2014  rmind sync with head
 1.1.6.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.2 30-Oct-2012  yamt sync with head
 1.1.6.1 20-Jul-2012  yamt file omrasopsvar.h was added on branch yamt-pagecache on 2012-10-30 17:19:54 +0000
 1.1.4.2 03-Dec-2017  jdolecek update from HEAD
 1.1.4.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.2.4 09-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.1.2.3 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1005):
sys/arch/luna68k/dev/omrasops.c: revision 1.15
sys/arch/luna68k/dev/omrasops.c: revision 1.16
sys/arch/luna68k/dev/lunafb.c: revision 1.27
sys/arch/luna68k/dev/lunafb.c: revision 1.28
sys/arch/luna68k/dev/lunafb.c: revision 1.29
sys/arch/luna68k/dev/lunafb.c: revision 1.30
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.2
sys/arch/luna68k/dev/omrasops.c: revision 1.14
Properly initialize the palette for while on black even on 1bpp framebuffer.
Preparing for demonstration in Open Source Conference 2013 Kyoto.
Fix off by one in copyrows() backward case.
Make omrasops copycols() op work even if columns are not 32 bit aligned.
This means command line editing works properly in any cases.
The bitcopy strategies for 1bpp copycols() op are taken from
recently fixed MI sys/dev/rasops/rasops_bitops.h.
GETBITS() and PUTBITS() m68k asm macro are taken from hp300.
Tested on both 1bpp (on LUNA-II) and 4bpp (on LUNA) framebuffers.
Initialize capabilities in struct wsscreen_descr per omrasops settings.
Now REVERSE characters are drawn properly.
Add preleminary support of 4bpp LUNA framebuffer.
Changes details:
- prepare and switch 4bpp rasops functions that read/write all 4 planes
and also handle both fg and bg colors
- make 1bpp ops use first plane on write rather than common bitmap plane
(which is prepared for multiple plane write with raster ops)
- prepare 4bpp allocattr function to handle ANSI 16 color text
- split omrasops_init() function for each bpp
- move struct hwcmap from softc to hwdevconfig to sync palette values
on initialization
- allow mmap(2) against all available planes
Now we can use ANSI 16 color text console and also can
demonstrate mlterm-fb with color sixel graphics and wallpaper.
XXX: Xserver needs much more work.
Pull a fix of Bt458 (8bpp framebuffer) initialization from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvs&m=138838884202196
> Correct initialization of Bt458, used in LUNA's 8bpp frame buffer.
>
> According to the manual, the address register does not automatically
> increment when we access to the control registers. Also we disable
> overlay planes, because we do not use them.
 1.1.2.2 25-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
 1.1.2.1 20-Jul-2012  martin file omrasopsvar.h was added on branch netbsd-6 on 2012-07-25 21:30:35 +0000
 1.2.4.1 05-Oct-2014  martin Pull up following revision(s) (requested by tsutsui in ticket #130):
sys/arch/luna68k/dev/omrasops.c: revision 1.17
sys/arch/luna68k/dev/omrasops.c: revision 1.18
sys/arch/luna68k/dev/omrasops.c: revision 1.19
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
sys/arch/luna68k/dev/lunafb.c: revision 1.36
Pull readability changes from OpenBSD/luna88k.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
Tested on LUNA-II with 8bpp framebuffer.
Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
 1.3.20.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2 20-Jul-2012  tsutsui Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
 1.1 16-Jul-2011  tsutsui branches: 1.1.2; 1.1.8;
Revive NetBSD/luna68k.

Even after almost a lost decade since NetBSD/luna68k was
switched to using ELF format by default back in 2001,
actually only one fix (bus.h) is required for a GENERIC kernel itself
to get multiuser login: prompt on a real hardware. Hurrahhh!!!

Demonstrated with a working Xorg mono server on the NetBSD booth
at Open Source Conference 2011 Kansai @ Kyoto:
http://www.ospn.jp/osc2011-kyoto/

"Very impressed," commented by Tomoko YOSHIDA,
Program Committee Chair of the Conference,
and some other OMRON guys.

Special Thanks to Tadashi Okamura, for providing
a working SX-9100/DT "LUNA" for this mission.


Changes details:

sys/arch/luna68k/include/bus.h
- handle stride properly even on multi and region ops for MI spc(4)
- also fix stride handling of (currently unused) 2 and 4 byte ops

sys/arch/luna68k/conf/Makefile.luna68k
sys/arch/luna68k/conf/kern.ldscript.head
sys/arch/luna68k/conf/kern.ldscript.tail
- build a faked a.out kernel using elf2aout(8) tool
and a linker script derived from cats and shark
for the LUNA firmware that loads a.out binary directly
via network or from a UNIOS partition on a local disk

sys/arch/luna68k/dev/omrasops.c
sys/arch/luna68k/dev/omron_rfont.h
- use the original OMRON font derived from 4.4BSD-Lite/luna68k
rather than gallant19 which is used on Sun workstations
(XXX omrasops.c should be rewritten to use generic wsfont(4))

distrib/luna68k/*
distrib/utils/sysinst/arch/luna68k/*
etc/etc.luna68k/MAKEDEV.conf
etc/etc.luna68k/Makefile.inc
sys/arch/luna68k/conf/INSTALL
- build a ramdisk based INSTALL kernel with sysinst(8) for luna68k
- also build an installation iso image for luna68k

sys/arch/luna68k/conf/GENERIC
- enable SYSVSHM (and other SYSV*) options for Xorg server

More Xorg changes (which need some more cleanup) and
isiboot.c fixes will come soon.
 1.1.8.1 25-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
 1.1.2.1 30-Oct-2012  yamt sync with head
 1.2 11-Jun-2022  tsutsui Match psgpam(4) only on LUNA-I. LUNA-II doesn't have YM2149 at XP.
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.3 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.2 01-Oct-2022  tsutsui Remove trailing whitespaces.
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.16 25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.15 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.14 24-Apr-2021  thorpej branches: 1.14.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.13 02-Feb-2014  tsutsui branches: 1.13.44;
Misc cleanup of sio drivers.

- register softc of child devices as an argument of the sio interrupt
handler to avoid device_lookup_private() calls on every interrupt
- change type of sc_reg from (void *) to (struct sioreg *)
to avoid weird address offset calculations with redundant casts
- rename struct sio_softc members for consistency
- use a channel number passed via sio_attach_args in lunaws_attach()

No functional chnages. Tested on LUNA.
 1.12 23-Sep-2013  tsutsui Tab/space cleanup.
 1.11 28-Jul-2011  tsutsui branches: 1.11.2; 1.11.12; 1.11.16;
Explicitly print uPD7201A name, which is a Z80 SIO like serial chip
with 8086 I/O interfaces.
 1.10 27-Jul-2011  tsutsui KNF, use uintNN_t, tab/space cosmetics etc.
 1.9 27-Jul-2011  tsutsui - split device_t/softc and use device_t and cfdata_t etc.
- use aprint_normal(9)
- include "ioconf.h" for struct cfdriver decls
No crash on LUNA.
 1.8 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.7 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.6 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.5 28-Apr-2008  martin branches: 1.5.8; 1.5.14;
Remove clause 3 and 4 from TNF licenses
 1.4 04-Mar-2007  christos branches: 1.4.40; 1.4.42; 1.4.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.3 01-Jan-2003  thorpej branches: 1.3.18; 1.3.56;
Use aprint_normal() for cfprint routines.
 1.2 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.10; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.2 03-Jan-2003  thorpej Sync with HEAD.
 1.1.14.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.10.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.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 05-Jan-2000  bouyer file sio.c was added on branch thorpej_scsipi on 2000-11-20 20:10:26 +0000
 1.3.56.1 12-Mar-2007  rmind Sync with HEAD.
 1.3.18.1 03-Sep-2007  yamt sync with head.
 1.4.44.2 04-May-2009  yamt sync with head.
 1.4.44.1 16-May-2008  yamt sync with head.
 1.4.42.1 18-May-2008  yamt sync with head.
 1.4.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.11.16.1 18-May-2014  rmind sync with head
 1.11.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.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.13.44.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.14.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.6 28-Mar-2023  andvar s/interrput/interrupt/ and s/accesss/access/ in comments.
 1.5 25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.4 27-Jul-2011  tsutsui KNF, use uintNN_t, tab/space cosmetics etc.
 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 05-Jan-2000  nisimura branches: 1.1.6; 1.1.30;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.30.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.30.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.30.1 03-Aug-2004  skrll Sync with HEAD
 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 05-Jan-2000  bouyer file sioreg.h was added on branch thorpej_scsipi on 2000-11-20 20:10:26 +0000
 1.54 14-Sep-2025  andvar Fix various typos in comments and log message.
 1.53 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.52 22-Nov-2022  tsutsui Use explicit struct to represent RX queue buffer data structure.

No binary change.

Maybe the similar change should be applied to MI com(4) and zsc(4)?
 1.51 25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.50 04-Sep-2021  tsutsui Fix several styles and formats.
 1.49 04-Sep-2021  tsutsui Use C99 designated initializer.
 1.48 04-Sep-2021  tsutsui Use proper macro for device register addresses.
 1.47 29-Dec-2020  tsutsui Make local functions static.
 1.46 01-Oct-2019  chs branches: 1.46.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.45 30-Jun-2019  tsutsui Misc KNF.
 1.44 21-Aug-2015  christos branches: 1.44.18;
- move prototypes to common header file
- rename function to avoid confusion with pseudo-device attach
 1.43 20-Aug-2015  christos include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.42 25-Jul-2014  dholland branches: 1.42.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.41 18-Jul-2014  tsutsui Minor KNF. No binary changes.
 1.40 16-Mar-2014  dholland branches: 1.40.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.39 02-Feb-2014  tsutsui Misc cleanup of sio drivers.

- register softc of child devices as an argument of the sio interrupt
handler to avoid device_lookup_private() calls on every interrupt
- change type of sc_reg from (void *) to (struct sioreg *)
to avoid weird address offset calculations with redundant casts
- rename struct sio_softc members for consistency
- use a channel number passed via sio_attach_args in lunaws_attach()

No functional chnages. Tested on LUNA.
 1.38 02-Jan-2014  tsutsui Remove initialization of unused t_softc in struct tty (to make pullup easier).
 1.37 31-Dec-2013  tsutsui Use softint(9) properly to process TX/RX data between tty(4) layer.

It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.

Changes details (mostly similar to com(4) and z8530tty(4)):
- allocate RX buffer and put data and status into it in the interrupt handler
- call t_linesw->l_rint from the software interrupt handler
- set the only first byte in siottystart() and use t_outq buffer to send
multiple TX data
- call the next t_linesw->l_start on TX complete in the software interrupt
handler

Also put more changes:
- handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
- allocate tty in the attach function as other drivers rather than first open
- use proper variable types
 1.36 23-Sep-2013  tsutsui Tab/space cleanup.
 1.35 22-Jan-2013  tsutsui branches: 1.35.2;
Whitespace cleanup.
 1.34 13-Oct-2012  tsutsui struct device * -> device_t, use device_xname() (from chs@)
 1.33 26-Nov-2011  tsutsui branches: 1.33.4; 1.33.8;
Reorganize IPL for devices.
 1.32 27-Jul-2011  tsutsui branches: 1.32.2;
KNF, use uintNN_t, tab/space cosmetics etc.
 1.31 27-Jul-2011  tsutsui - split device_t/softc and use device_t and cfdata_t etc.
- use aprint_normal(9)
- include "ioconf.h" for struct cfdriver decls
No crash on LUNA.
 1.30 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.29 23-Nov-2009  rmind branches: 1.29.4; 1.29.6;
Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.28 26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.27 18-Mar-2009  cegger bcopy -> memcpy
 1.26 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.25 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.24 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.23 13-Jun-2008  cegger branches: 1.23.4; 1.23.10;
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 19-Nov-2007  ad branches: 1.21.14; 1.21.16; 1.21.18;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.20 04-Mar-2007  christos branches: 1.20.2; 1.20.18; 1.20.20; 1.20.24; 1.20.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 01-Oct-2006  elad branches: 1.19.4;
Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks!
 1.18 23-Jul-2006  ad branches: 1.18.4; 1.18.6;
Use the LWP cached credentials where sane.
 1.17 14-May-2006  elad integrate kauth.
 1.16 11-Dec-2005  christos branches: 1.16.4; 1.16.6; 1.16.8; 1.16.10; 1.16.12;
merge ktrace-lwp.
 1.15 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.14 25-Apr-2004  matt branches: 1.14.12;
Constify the speedtab arrays
 1.13 28-Mar-2003  he branches: 1.13.2;
Initialize the two new members of consdev (cn_halt, cn_flush) to NULL so
that this compiles again.
 1.12 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.11 02-Oct-2002  thorpej Use CFATTACH_DECL().
 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 02-May-2001  scw branches: 1.8.2; 1.8.4; 1.8.8;
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.7 31-Mar-2001  enami Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.
 1.6 07-Nov-2000  nisimura branches: 1.6.2; 1.6.4;
Fix a minor typo in the previous change of tp->t_linesw introduction.
 1.5 02-Nov-2000  eeh Adapt to new line discipline scheme.
 1.4 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.3 12-Jan-2000  nisimura Put a comment about BREAK detection; DDB fails to resume. Need to clear
the condition before resume?
 1.2 07-Jan-2000  nisimura - Make SCSI work; by kludges of machine/bus.h. TEAC streamer tape drive
found to be tweaked. Need extensive verifications.
- Add wsmouse node under ws; not useful this moment.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.6.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.6.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.6.2.4 21-Apr-2001  bouyer Sync with HEAD
 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 07-Nov-2000  bouyer file siotty.c was added on branch thorpej_scsipi on 2000-11-20 20:10:26 +0000
 1.8.8.5 11-Nov-2002  nathanw Catch up to -current
 1.8.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.8.8.3 17-Sep-2002  nathanw Catch up to -current.
 1.8.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.8.1 02-May-2001  nathanw file siotty.c was added on branch nathanw_sa on 2002-04-01 07:40:45 +0000
 1.8.4.2 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.8.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 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.9.4.1 19-May-2002  gehenna Add device switch.
Replace the access to devsw table and the hard-coded majors with devsw API.
 1.13.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.4 25-Jan-2005  skrll Adapt to branch.
 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.12.4 07-Dec-2007  yamt sync with head
 1.14.12.3 03-Sep-2007  yamt sync with head.
 1.14.12.2 30-Dec-2006  yamt sync with head.
 1.14.12.1 21-Jun-2006  yamt sync with head.
 1.16.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.16.10.3 13-May-2006  elad sprinkle some #include <sys/kauth.h> in files that use kauth kpi but
don't include it yet. hopefully this will prevent some fallout.
 1.16.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.16.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.16.8.2 11-Aug-2006  yamt sync with head
 1.16.8.1 24-May-2006  yamt sync with head.
 1.16.6.1 01-Jun-2006  kardel Sync with head.
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.18.6.1 22-Oct-2006  yamt sync with head
 1.18.4.1 18-Nov-2006  ad Sync with head.
 1.19.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.20.24.1 21-Nov-2007  bouyer Sync with HEAD
 1.20.20.1 09-Jan-2008  matt sync with HEAD
 1.20.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.20.2.1 03-Dec-2007  ad Sync with HEAD.
 1.21.18.3 11-Mar-2010  yamt sync with head
 1.21.18.2 04-May-2009  yamt sync with head.
 1.21.18.1 16-May-2008  yamt sync with head.
 1.21.16.2 17-Jun-2008  yamt sync with head.
 1.21.16.1 18-May-2008  yamt sync with head.
 1.21.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.21.14.1 02-Jun-2008  mjf 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.23.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.29.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.4.1 31-May-2011  rmind sync with head
 1.32.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.32.2.2 30-Oct-2012  yamt sync with head
 1.32.2.1 17-Apr-2012  yamt sync with head
 1.33.8.4 03-Dec-2017  jdolecek update from HEAD
 1.33.8.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.8.2 25-Feb-2013  tls resync with head
 1.33.8.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.33.4.1 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1004):
sys/arch/luna68k/dev/siotty.c: revision 1.35
sys/arch/luna68k/dev/siotty.c: revision 1.36
sys/arch/luna68k/dev/siotty.c: revision 1.37
sys/arch/luna68k/dev/siotty.c: revision 1.38
sys/arch/luna68k/dev/lunaws.c: revision 1.25
sys/arch/luna68k/dev/lunaws.c: revision 1.26
sys/arch/luna68k/dev/lunaws.c: revision 1.27
sys/arch/luna68k/dev/siovar.h: revision 1.7
sys/arch/luna68k/dev/siotty.c: revision 1.34
struct device * -> device_t, use device_xname() (from chs@)
Whitespace cleanup.
Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
Tab/space cleanup.
Use softint(9) properly to process TX/RX data between tty(4) layer.
It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.
Changes details (mostly similar to com(4) and z8530tty(4)):
- allocate RX buffer and put data and status into it in the interrupt handler
- call t_linesw->l_rint from the software interrupt handler
- set the only first byte in siottystart() and use t_outq buffer to send
multiple TX data
- call the next t_linesw->l_start on TX complete in the software interrupt
handler
Also put more changes:
- handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
- allocate tty in the attach function as other drivers rather than first open
- use proper variable types
Remove initialization of unused t_softc in struct tty (to make pullup easier).
 1.35.2.1 18-May-2014  rmind sync with head
 1.40.2.1 10-Aug-2014  tls Rebase.
 1.42.4.1 22-Sep-2015  skrll Sync with HEAD
 1.44.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.46.8.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.1 25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.9 25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.8 02-Feb-2014  tsutsui Misc cleanup of sio drivers.

- register softc of child devices as an argument of the sio interrupt
handler to avoid device_lookup_private() calls on every interrupt
- change type of sc_reg from (void *) to (struct sioreg *)
to avoid weird address offset calculations with redundant casts
- rename struct sio_softc members for consistency
- use a channel number passed via sio_attach_args in lunaws_attach()

No functional chnages. Tested on LUNA.
 1.7 31-Dec-2013  tsutsui Use softint(9) properly to process TX/RX data between tty(4) layer.

It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.

Changes details (mostly similar to com(4) and z8530tty(4)):
- allocate RX buffer and put data and status into it in the interrupt handler
- call t_linesw->l_rint from the software interrupt handler
- set the only first byte in siottystart() and use t_outq buffer to send
multiple TX data
- call the next t_linesw->l_start on TX complete in the software interrupt
handler

Also put more changes:
- handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
- allocate tty in the attach function as other drivers rather than first open
- use proper variable types
 1.6 27-Jul-2011  tsutsui branches: 1.6.2; 1.6.8; 1.6.12; 1.6.16;
KNF, use uintNN_t, tab/space cosmetics etc.
 1.5 27-Jul-2011  tsutsui - split device_t/softc and use device_t and cfdata_t etc.
- use aprint_normal(9)
- include "ioconf.h" for struct cfdriver decls
No crash on LUNA.
 1.4 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 28-Apr-2008  martin branches: 1.3.8; 1.3.14;
Remove clause 3 and 4 from TNF licenses
 1.2 04-Mar-2007  christos branches: 1.2.40; 1.2.42; 1.2.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.46; 1.1.84;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.84.1 12-Mar-2007  rmind Sync with HEAD.
 1.1.46.1 03-Sep-2007  yamt sync with head.
 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 05-Jan-2000  bouyer file siovar.h was added on branch thorpej_scsipi on 2000-11-20 20:10:26 +0000
 1.2.44.2 04-May-2009  yamt sync with head.
 1.2.44.1 16-May-2008  yamt sync with head.
 1.2.42.1 18-May-2008  yamt sync with head.
 1.2.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.6.16.1 18-May-2014  rmind sync with head
 1.6.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.8.1 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1004):
sys/arch/luna68k/dev/siotty.c: revision 1.35
sys/arch/luna68k/dev/siotty.c: revision 1.36
sys/arch/luna68k/dev/siotty.c: revision 1.37
sys/arch/luna68k/dev/siotty.c: revision 1.38
sys/arch/luna68k/dev/lunaws.c: revision 1.25
sys/arch/luna68k/dev/lunaws.c: revision 1.26
sys/arch/luna68k/dev/lunaws.c: revision 1.27
sys/arch/luna68k/dev/siovar.h: revision 1.7
sys/arch/luna68k/dev/siotty.c: revision 1.34
struct device * -> device_t, use device_xname() (from chs@)
Whitespace cleanup.
Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
Tab/space cleanup.
Use softint(9) properly to process TX/RX data between tty(4) layer.
It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.
Changes details (mostly similar to com(4) and z8530tty(4)):
- allocate RX buffer and put data and status into it in the interrupt handler
- call t_linesw->l_rint from the software interrupt handler
- set the only first byte in siottystart() and use t_outq buffer to send
multiple TX data
- call the next t_linesw->l_start on TX complete in the software interrupt
handler
Also put more changes:
- handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
- allocate tty in the attach function as other drivers rather than first open
- use proper variable types
Remove initialization of unused t_softc in struct tty (to make pullup easier).
 1.6.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.11 23-Apr-2023  tsutsui Explicitly check machine type (LUNA-II) on secondary spc(4) probe.

So that individual mainbus_attach_args for both LUNA and LUNA-II
are no longer necessary.
While here, use proper address macro in <machine/board.h>.

Tested on both LUNA and LUNA-II.
 1.10 22-Jan-2013  tsutsui Whitespace cleanup.
 1.9 27-Jul-2011  tsutsui branches: 1.9.2; 1.9.12;
KNF, use uintNN_t, tab/space cosmetics etc.
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 31-Mar-2008  tsutsui branches: 1.7.2; 1.7.4;
Split softc/device_t for spc(4) and misc related cleanup.
 1.6 04-Mar-2007  christos branches: 1.6.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 11-Dec-2005  christos branches: 1.5.26;
merge ktrace-lwp.
 1.4 05-Jul-2003  tsutsui branches: 1.4.16;
Rename some MI mb89352 functions for consistency:
spcintr() -> spc_intr()
spcattach() -> spc_attach()
 1.3 05-Jul-2003  tsutsui Rename functions to avoid namespace conflicts:
spc_match() -> spc_mainbus_match()
spc_attach() -> spc_mainbus_attach()
 1.2 02-Oct-2002  thorpej branches: 1.2.6;
Use CFATTACH_DECL().
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.10; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.10.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.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 05-Jan-2000  bouyer file spc.c was added on branch thorpej_scsipi on 2000-11-20 20:10:27 +0000
 1.2.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 03-Sep-2007  yamt sync with head.
 1.5.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.40.2 02-Jun-2008  mjf Sync with HEAD.
 1.6.40.1 03-Apr-2008  mjf 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.9.12.1 25-Feb-2013  tls resync with head
 1.9.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.2 25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.1 21-Aug-2015  christos branches: 1.1.2; 1.1.18;
- move prototypes to common header file
- rename function to avoid confusion with pseudo-device attach
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 21-Aug-2015  jdolecek file syscn.h was added on branch tls-maxphys on 2017-12-03 11:36:23 +0000
 1.1.2.2 22-Sep-2015  skrll Sync with HEAD
 1.1.2.1 21-Aug-2015  skrll file syscn.h was added on branch nick-nhusb on 2015-09-22 12:05:45 +0000
 1.16 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.15 20-Nov-2014  christos use the inline bcdtobin and bintobcd directly instead through a macro.
 1.14 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.13 19-Jul-2013  tsutsui Add an initialization function of DS1287A RTC and call it during attach.

It looks the boot firmware doesn't initialize the control registers
of DS1287A (while it resets NVRAM settings) and RTC oscillator is not
started properly after replacement.

Now my LUNA-II can keep RTC properly even after reboot.
 1.12 26-Jan-2013  tsutsui branches: 1.12.2; 1.12.8;
Fix offset of DS1287A NVRAM address on LUNA-II.
 1.11 22-Jan-2013  tsutsui Whitespace cleanup.
 1.10 27-Jul-2011  tsutsui branches: 1.10.2; 1.10.8; 1.10.12;
KNF, use uintNN_t, tab/space cosmetics etc.
 1.9 27-Jul-2011  tsutsui - split device_t/softc and use device_t and cfdata_t etc.
- use aprint_normal(9)
- include "ioconf.h" for struct cfdriver decls
No crash on LUNA.
 1.8 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.7 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.6 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.5 28-Apr-2008  martin branches: 1.5.8; 1.5.14;
Remove clause 3 and 4 from TNF licenses
 1.4 14-Sep-2006  gdamore branches: 1.4.54; 1.4.56; 1.4.58;
Update luna68k to MI todr and timecounters.
 1.3 12-Mar-2006  he branches: 1.3.10;
Now that FROMBCD and TOBCD is in <sys/dev/clock_subr.h>, delete the
local definitions here.
 1.2 02-Oct-2002  thorpej branches: 1.2.22; 1.2.36; 1.2.38; 1.2.40; 1.2.42;
Use CFATTACH_DECL().
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.10; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.10.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.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 05-Jan-2000  bouyer file timekeeper.c was added on branch thorpej_scsipi on 2000-11-20 20:10:27 +0000
 1.2.42.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.2.40.1 13-Mar-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.2 30-Dec-2006  yamt sync with head.
 1.2.22.1 21-Jun-2006  yamt sync with head.
 1.3.10.1 18-Nov-2006  ad Sync with head.
 1.4.58.2 04-May-2009  yamt sync with head.
 1.4.58.1 16-May-2008  yamt sync with head.
 1.4.56.1 18-May-2008  yamt sync with head.
 1.4.54.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.10.12.3 03-Dec-2017  jdolecek update from HEAD
 1.10.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.12.1 25-Feb-2013  tls resync with head
 1.10.8.1 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1003):
sys/arch/luna68k/dev/timekeeper.h: revision 1.3
sys/arch/luna68k/dev/timekeeper.c: revision 1.11
sys/arch/luna68k/dev/timekeeper.c: revision 1.12
sys/arch/luna68k/dev/timekeeper.c: revision 1.13
Whitespace cleanup.
Fix offset of DS1287A NVRAM address on LUNA-II.
Add an initialization function of DS1287A RTC and call it during attach.
It looks the boot firmware doesn't initialize the control registers
of DS1287A (while it resets NVRAM settings) and RTC oscillator is not
started properly after replacement.
Now my LUNA-II can keep RTC properly even after reboot.
 1.10.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.12.8.1 23-Jul-2013  riastradh sync with HEAD
 1.12.2.1 28-Aug-2013  rmind sync with head
 1.4 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.3 19-Jul-2013  tsutsui Add an initialization function of DS1287A RTC and call it during attach.

It looks the boot firmware doesn't initialize the control registers
of DS1287A (while it resets NVRAM settings) and RTC oscillator is not
started properly after replacement.

Now my LUNA-II can keep RTC properly even after reboot.
 1.2 28-Apr-2008  martin branches: 1.2.34; 1.2.40; 1.2.44; 1.2.50; 1.2.58;
Remove clause 3 and 4 from TNF licenses
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.132; 1.1.134; 1.1.136;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.136.1 16-May-2008  yamt sync with head.
 1.1.134.1 18-May-2008  yamt sync with head.
 1.1.132.1 02-Jun-2008  mjf Sync with HEAD.
 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 05-Jan-2000  bouyer file timekeeper.h was added on branch thorpej_scsipi on 2000-11-20 20:10:27 +0000
 1.2.58.1 23-Jul-2013  riastradh sync with HEAD
 1.2.50.1 28-Aug-2013  rmind sync with head
 1.2.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.40.1 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1003):
sys/arch/luna68k/dev/timekeeper.h: revision 1.3
sys/arch/luna68k/dev/timekeeper.c: revision 1.11
sys/arch/luna68k/dev/timekeeper.c: revision 1.12
sys/arch/luna68k/dev/timekeeper.c: revision 1.13
Whitespace cleanup.
Fix offset of DS1287A NVRAM address on LUNA-II.
Add an initialization function of DS1287A RTC and call it during attach.
It looks the boot firmware doesn't initialize the control registers
of DS1287A (while it resets NVRAM settings) and RTC oscillator is not
started properly after replacement.
Now my LUNA-II can keep RTC properly even after reboot.
 1.2.34.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.7 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.6 29-Dec-2020  tsutsui Make local functions static.
 1.5 30-Jun-2019  tsutsui branches: 1.5.10;
Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.4 01-Jun-2017  chs branches: 1.4.8; 1.4.12;
remove checks for failure after memory allocation calls that cannot fail:

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

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.3 08-Jan-2017  tsutsui branches: 1.3.4;
Consistently use sc_shm_size initialized at device attach.
 1.2 08-Jan-2017  tsutsui Fix (mostly harmless) off-by-one size check in XPIOCDOWNLD ioctl.

Pointed out by Kenji Aoyama.
 1.1 03-Dec-2016  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).

Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.1.6.3 20-Mar-2017  pgoyette Sync with HEAD
 1.1.6.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.1.6.1 03-Dec-2016  pgoyette file xp.c was added on branch pgoyette-localcount on 2017-01-07 08:56:20 +0000
 1.1.4.2 06-Dec-2016  snj Pull up following revision(s) (requested by tsutsui in ticket #1283):
distrib/sets/lists/comp/md.luna68k: revision 1.21
etc/etc.luna68k/MAKEDEV.conf: revision 1.9
sys/arch/luna68k/conf/GENERIC: revision 1.120
sys/arch/luna68k/conf/files.luna68k: revision 1.25
sys/arch/luna68k/conf/majors.luna68k: revision 1.21
sys/arch/luna68k/dev/xp.c: revision 1.1
sys/arch/luna68k/include/Makefile: revision 1.19
sys/arch/luna68k/include/xpio.h: revision 1.1
sys/arch/luna68k/luna68k/mainbus.c: revision 1.14
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).
Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.1.4.1 03-Dec-2016  snj file xp.c was added on branch netbsd-7 on 2016-12-06 06:50:23 +0000
 1.1.2.4 28-Aug-2017  skrll Sync with HEAD
 1.1.2.3 05-Feb-2017  skrll Sync with HEAD
 1.1.2.2 05-Dec-2016  skrll Sync with HEAD
 1.1.2.1 03-Dec-2016  skrll file xp.c was added on branch nick-nhusb on 2016-12-05 10:54:54 +0000
 1.3.4.2 18-Jan-2017  skrll Sync with netbsd-5
 1.3.4.1 08-Jan-2017  skrll file xp.c was added on branch netbsd-7-nhusb on 2017-01-18 08:46:25 +0000
 1.4.12.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.8.2 03-Dec-2017  jdolecek update from HEAD
 1.4.8.1 01-Jun-2017  jdolecek file xp.c was added on branch tls-maxphys on 2017-12-03 11:36:23 +0000
 1.5.10.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.2 01-Oct-2022  tsutsui Remove trailing whitespaces.
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.2 13-Oct-2023  tsutsui Remove trailing spaces and TAB.
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.1 10-Jun-2022  tsutsui luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.22 30-Nov-2024  christos Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.21 12-Jul-2018  maxv branches: 1.21.36;
Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

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

* Removes the PMC code of ARM XSCALE.

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

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

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

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.20 09-Mar-2017  tsutsui branches: 1.20.12; 1.20.14;
Add a driver for LUNA's front panel LCD. Ported from OpenBSD/luna88k.

Reviewed by enami@. Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.
 1.19 03-Dec-2016  tsutsui branches: 1.19.2;
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).

Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.18 24-Dec-2015  christos branches: 1.18.2;
fenv for m68k
 1.17 17-Jul-2011  joerg branches: 1.17.12; 1.17.28; 1.17.30; 1.17.34;
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 09-Feb-2007  ad Merge newlock2 to head.
 1.15 26-Jul-2006  drochner branches: 1.15.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.8;
merge ktrace-lwp.
 1.13 08-May-2004  kleink branches: 1.13.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.12 17-Jan-2003  thorpej branches: 1.12.2;
Merge the nathanw_sa branch.
 1.11 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.10 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.9 04-Apr-2002  bjh21 branches: 1.9.2;
Install elf_machdep.h.
 1.8 15-Apr-2001  kleink branches: 1.8.2; 1.8.8;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.7 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.6 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.5 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.4 26-Jun-2000  kleink branches: 1.4.2; 1.4.4;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.3 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.2 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.3 21-Apr-2001  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 26-Jun-2000  bouyer file Makefile was added on branch thorpej_scsipi on 2000-11-20 20:10:27 +0000
 1.8.8.5 11-Dec-2002  thorpej Sync with HEAD.
 1.8.8.4 13-Aug-2002  nathanw Catch up to -current.
 1.8.8.3 17-Apr-2002  nathanw Catch up to -current.
 1.8.8.2 10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 1.8.8.1 15-Apr-2001  scw file Makefile was added on branch nathanw_sa on 2001-11-10 21:22:50 +0000
 1.8.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.8.2.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.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.12.2 26-Feb-2007  yamt sync with head.
 1.13.12.1 30-Dec-2006  yamt sync with head.
 1.14.8.1 11-Aug-2006  yamt sync with head
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.4.1 01-Feb-2007  ad Header file cleanup.
 1.17.34.1 18-Jan-2017  skrll Sync with netbsd-5
 1.17.30.3 28-Aug-2017  skrll Sync with HEAD
 1.17.30.2 05-Dec-2016  skrll Sync with HEAD
 1.17.30.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.17.28.1 06-Dec-2016  snj Pull up following revision(s) (requested by tsutsui in ticket #1283):
distrib/sets/lists/comp/md.luna68k: revision 1.21
etc/etc.luna68k/MAKEDEV.conf: revision 1.9
sys/arch/luna68k/conf/GENERIC: revision 1.120
sys/arch/luna68k/conf/files.luna68k: revision 1.25
sys/arch/luna68k/conf/majors.luna68k: revision 1.21
sys/arch/luna68k/dev/xp.c: revision 1.1
sys/arch/luna68k/include/Makefile: revision 1.19
sys/arch/luna68k/include/xpio.h: revision 1.1
sys/arch/luna68k/luna68k/mainbus.c: revision 1.14
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).
Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.17.12.1 03-Dec-2017  jdolecek update from HEAD
 1.18.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.18.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.19.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.20.14.1 10-Jun-2019  christos Sync with HEAD
 1.20.12.1 28-Jul-2018  pgoyette Sync with HEAD
 1.21.36.1 02-Aug-2025  perseant Sync with HEAD
 1.2 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.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.220;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.220.1 10-Jun-2019  christos Sync with HEAD
 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 05-Jan-2000  bouyer file ansi.h was added on branch thorpej_scsipi on 2000-11-20 20:10:27 +0000
 1.2 05-Jul-2022  tsutsui Remove unnecessary and incorrect mulitple inclusion protection.
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file aout_machdep.h was added on branch thorpej_scsipi on 2000-11-20 20:10:27 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file asm.h was added on branch thorpej_scsipi on 2000-11-20 20:10:28 +0000
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.132; 1.1.134; 1.1.136;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.136.1 16-May-2008  yamt sync with head.
 1.1.134.1 18-May-2008  yamt sync with head.
 1.1.132.1 02-Jun-2008  mjf Sync with HEAD.
 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 05-Jan-2000  bouyer file autoconf.h was added on branch thorpej_scsipi on 2000-11-20 20:10:28 +0000
 1.2 26-Sep-2021  tsutsui TAB/space cleanup.
 1.1 30-Jun-2019  tsutsui branches: 1.1.10;
Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.1.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.10.1 30-Jun-2019  martin file board.h was added on branch phil-wifi on 2020-04-13 08:03:56 +0000
 1.1 11-Jan-2014  tsutsui branches: 1.1.4; 1.1.6; 1.1.10;
Add support to pass boothowto and bootdev info from bootloader to kernel.

Kernel side changes:
- use %d7 (boothowto) and %d6 (bootdev) to pass info and also use
old macro in <sys/reboot.h> as ancient 4.4BSD did for simplicity
- add <machine/bootinfo.h> to define values as API to pass these info
- save boothowto and bootdev in registers right after zero'ing bss
- add MD device_register(9) to check booted_device per passed bootdev info
- merge old bootarg checks in rootconf() and luna68k_init() with
tweaks for backward compatibility
(direct boot a.out kernel from ROM monitor without bootloader still works)
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 11-Jan-2014  tls file bootinfo.h was added on branch tls-maxphys on 2014-08-20 00:03:10 +0000
 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 11-Jan-2014  yamt file bootinfo.h was added on branch yamt-pagecache on 2014-05-22 11:39:55 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 11-Jan-2014  rmind file bootinfo.h was added on branch rmind-smpnet on 2014-05-18 17:45:15 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file bswap.h was added on branch thorpej_scsipi on 2000-11-20 20:10:28 +0000
 1.18 27-Jan-2023  tsutsui luna68k: Specify proper constraints for bus_space_read region and multi ops.

Sync with next68k.
 1.17 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.16 23-Jan-2021  christos Remove cargo-culted '#if 0' code that was designed to produce a
compile-time error if any of the bus_space_*_8 functions was used,
but was documented that it produces a link-time error.
 1.15 02-Apr-2020  msaitoh branches: 1.15.4;
s/impliment/implement/ in comment.
 1.14 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.13 07-May-2012  tsutsui branches: 1.13.40;
Add dummy bus_dma(9) typedefs (enabled by __HAVE_NO_BUS_DMA) in <sys/bus.h>
for ports which don't bother to have unnecessary bus_dma(9) implementation
to appease MI driver modules that require bus_dma_tag_t.

For amiga, move <m68k/bus_dma.h> inclusion from <machine/pci_machdep.h>
to <machine/bus.h> since amiga will want actual bus_dma(9) in future
for PCI devices.

Fixes builds on sys/modules/if_axe etc on ancient ports.

"Sounds good" from martin@ on port-m68k@.
 1.12 12-Feb-2012  matt Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.11 16-Jul-2011  tsutsui branches: 1.11.2; 1.11.6;
Revive NetBSD/luna68k.

Even after almost a lost decade since NetBSD/luna68k was
switched to using ELF format by default back in 2001,
actually only one fix (bus.h) is required for a GENERIC kernel itself
to get multiuser login: prompt on a real hardware. Hurrahhh!!!

Demonstrated with a working Xorg mono server on the NetBSD booth
at Open Source Conference 2011 Kansai @ Kyoto:
http://www.ospn.jp/osc2011-kyoto/

"Very impressed," commented by Tomoko YOSHIDA,
Program Committee Chair of the Conference,
and some other OMRON guys.

Special Thanks to Tadashi Okamura, for providing
a working SX-9100/DT "LUNA" for this mission.


Changes details:

sys/arch/luna68k/include/bus.h
- handle stride properly even on multi and region ops for MI spc(4)
- also fix stride handling of (currently unused) 2 and 4 byte ops

sys/arch/luna68k/conf/Makefile.luna68k
sys/arch/luna68k/conf/kern.ldscript.head
sys/arch/luna68k/conf/kern.ldscript.tail
- build a faked a.out kernel using elf2aout(8) tool
and a linker script derived from cats and shark
for the LUNA firmware that loads a.out binary directly
via network or from a UNIOS partition on a local disk

sys/arch/luna68k/dev/omrasops.c
sys/arch/luna68k/dev/omron_rfont.h
- use the original OMRON font derived from 4.4BSD-Lite/luna68k
rather than gallant19 which is used on Sun workstations
(XXX omrasops.c should be rewritten to use generic wsfont(4))

distrib/luna68k/*
distrib/utils/sysinst/arch/luna68k/*
etc/etc.luna68k/MAKEDEV.conf
etc/etc.luna68k/Makefile.inc
sys/arch/luna68k/conf/INSTALL
- build a ramdisk based INSTALL kernel with sysinst(8) for luna68k
- also build an installation iso image for luna68k

sys/arch/luna68k/conf/GENERIC
- enable SYSVSHM (and other SYSV*) options for Xorg server

More Xorg changes (which need some more cleanup) and
isiboot.c fixes will come soon.
 1.10 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.9 28-Apr-2008  martin branches: 1.9.8; 1.9.14;
Remove clause 3 and 4 from TNF licenses
 1.8 16-Feb-2006  perry branches: 1.8.68; 1.8.70; 1.8.72;
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.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 05-Jul-2003  tsutsui branches: 1.5.16;
Add some missing register prefixes.
 1.4 25-Aug-2001  chs branches: 1.4.6; 1.4.22;
add register prefixes. no change in generated .o files.
 1.3 25-Jan-2000  drochner branches: 1.3.6; 1.3.10;
define a "BUS_SPACE_MAP_PREFETCHABLE" flag which basically means that
device accesses are idempotent (but should not be cached by the CPU)
 1.2 07-Jan-2000  nisimura - Make SCSI work; by kludges of machine/bus.h. TEAC streamer tape drive
found to be tweaked. Need extensive verifications.
- Add wsmouse node under ws; not useful this moment.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.3.10.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 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 25-Jan-2000  bouyer file bus.h was added on branch thorpej_scsipi on 2000-11-20 20:10:28 +0000
 1.4.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.22.1 03-Aug-2004  skrll Sync with HEAD
 1.4.6.2 25-Aug-2001  chs add register prefixes. no change in generated .o files.
 1.4.6.1 25-Aug-2001  chs file bus.h was added on branch nathanw_sa on 2001-08-25 23:08:40 +0000
 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.72.2 04-May-2009  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.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.11.6.2 02-Jun-2012  mrg sync to latest -current.
 1.11.6.1 18-Feb-2012  mrg merge to -current.
 1.11.2.2 23-May-2012  yamt sync with head.
 1.11.2.1 17-Apr-2012  yamt sync with head
 1.13.40.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.13.40.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 05-Jul-2022  tsutsui Remove unnecessary multiple inclusion protections.
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file cdefs.h was added on branch thorpej_scsipi on 2000-11-20 20:10:28 +0000
 1.42 20-Jan-2024  thorpej Largely unify the <machine/cpu.h> headers on the m68k platforms.
 1.41 18-Jan-2024  thorpej Make the M68K_MMU_* defines real kernel options, available in opt_m68k_arch.h.
For 68030, 68040, and 68060, infer M68K_MMU_MOTOROLA. For 68010 and 68020, it
must be an explicit option (set in std.${MACHINE} or, in the case of hp300,
inferred from the specific model option).
 1.40 15-Jan-2024  thorpej Switch luna68k over to the common interrupt dispatch code.
 1.39 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.38 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.37 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.36 18-Feb-2019  thorpej Refactor the 68040 writeback() from each m68k port's trap handler into a
shared copy: m68040_writeback(). It is essentially a copy of the Atari
version, with some minor cosmetic tweaks and one small performance optimization
from the mvme68k port.

Tested by rjs@ on a Quadra 950. (Thanks!)
 1.35 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.34 16-Jun-2017  jdolecek branches: 1.34.4; 1.34.6;
dumpconf(void) long doesn't exist, remove the prototype

PR kern/39714 by Henning Petersen
 1.33 17-Dec-2016  flxd Fix typo "one the" and architecture where appropriate.
 1.32 19-Oct-2013  christos branches: 1.32.6; 1.32.10;
make cpu_need_resched() macros consistent; __USE flags
 1.31 02-Feb-2012  tsutsui branches: 1.31.6; 1.31.10;
Always include <m68k/cpu.h> (i.e. outside #if defined(_KERNEL))
for crash(8) as amiga and sun3. There are _KERNEL protections in it.

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

Briefly tested and no obvious breakage on atari, sun3, and x68k.
 1.29 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.28 22-Dec-2010  matt branches: 1.28.2; 1.28.4;
Collect cpu_info and friends and move to m68k/include/cpu.h
Add a define __HAVE_CPU_DATA_FIRST which means that cpu_data is the first
member in struct cpu_info.
 1.27 21-Oct-2009  rmind branches: 1.27.4;
Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.
 1.26 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.25 27-Feb-2008  xtraeme branches: 1.25.4; 1.25.12; 1.25.18;
Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.24 17-Oct-2007  garbled branches: 1.24.12; 1.24.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.23 04-Aug-2007  ad branches: 1.23.2;
Add ci_cpuid where it's missing.
 1.22 21-May-2007  tsutsui branches: 1.22.2; 1.22.4; 1.22.8;
Move declarations of m68k common functions
from <machine/cpu.h> to <m68k/m68k.h>.
While here, remove some obsolete function decls.
 1.21 21-May-2007  tsutsui Remove an obsolete "extern int want_resched" decl.
 1.20 21-May-2007  tsutsui Remove obsolete decralations of switch_exit() and switch_lwp_ext().
 1.19 21-May-2007  he Remove proc_trampoline() declaration that I added, we use
lwp_trampoline() now instead.
 1.18 20-May-2007  he Patterned after the changes to atari, restore the luna68k port to a
buildable state after the yamt-idlelwp merge.
Struct cpu_info now must contain ci_want_resched, so get rid of the
global want_resched.
The cpu_need_resched macro now takes two arguments.
We need to declare proc_trampoline() from for the new m68k vm_machdep.c.
The fields l_back and l_forw no longer exists in struct lwp, so excise
their definition from genassym.cf.
Remove the use of the apparently now obsolete m68k/proc_subr.s.
 1.17 20-May-2007  mhitch Add missing call to lwp_startup() in lwp_trampoline() (which was renamed
from proc_trampoline to match the other ports).

A DIAGNOSTIC kernel will now boot and run. LOCKDEBUG still doesn't work yet.
Also, my amiga no longer loses time.
 1.16 04-Mar-2007  christos branches: 1.16.2; 1.16.4; 1.16.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.15 04-Mar-2007  tsutsui Add MI softintr(9) support for luna68k with common m68k/softintr.c.
Compile test only.
 1.14 16-Feb-2007  ad branches: 1.14.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.13 09-Feb-2007  ad Merge newlock2 to head.
 1.12 24-Dec-2005  perry branches: 1.12.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 26-Sep-2004  yamt branches: 1.10.12;
don't expose cpu_info to userland.
 1.9 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.8 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.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 17-Jan-2003  thorpej branches: 1.6.2;
Merge the nathanw_sa branch.
 1.5 30-May-2001  mrg branches: 1.5.8;
use _KERNEL_OPT
 1.4 19-Dec-2000  scw branches: 1.4.2;
Unification of the m68k syscall() function.
 1.3 25-Aug-2000  thorpej branches: 1.3.2;
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.2 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.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 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 25-Aug-2000  bouyer file cpu.h was added on branch thorpej_scsipi on 2000-11-20 20:10:29 +0000
 1.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.8.4 03-Dec-2002  gmcgarry Use cpu_proc_fork().
 1.5.8.3 08-Dec-2001  thorpej Add a cpu_proc_fork(), called from uvm_proc_fork(), which takes care
of machine-dependent handling a fork() time (this is different from
forking the actual context in an LWP world). #define it away on
platforms which do not need it.

Problem noted by Gregory McGarry.
 1.5.8.2 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 1.5.8.1 30-May-2001  scw file cpu.h was added on branch nathanw_sa on 2001-11-18 18:10:19 +0000
 1.6.2.5 19-Oct-2004  skrll Sync with HEAD
 1.6.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.10.12.4 17-Mar-2008  yamt sync with head.
 1.10.12.3 03-Sep-2007  yamt sync with head.
 1.10.12.2 26-Feb-2007  yamt sync with head.
 1.10.12.1 21-Jun-2006  yamt sync with head.
 1.12.20.1 06-Feb-2007  ad Update m68k pasteware.
 1.14.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.10.2 03-Oct-2007  garbled Sync with HEAD
 1.16.10.1 22-May-2007  matt Update to HEAD.
 1.16.4.1 11-Jul-2007  mjf Sync with head.
 1.16.2.2 20-Aug-2007  ad Sync with HEAD.
 1.16.2.1 27-May-2007  ad Sync with head.
 1.22.8.1 04-Aug-2007  jmcneill Sync with HEAD.
 1.22.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.22.2.1 07-Aug-2007  matt Sync with HEAD.
 1.23.2.2 23-Mar-2008  matt sync with HEAD
 1.23.2.1 06-Nov-2007  matt sync with HEAD
 1.24.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.24.12.1 24-Mar-2008  keiichi sync with head.
 1.25.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.4.2 11-Mar-2010  yamt sync with head
 1.25.4.1 04-May-2009  yamt sync with head.
 1.27.4.2 31-May-2011  rmind sync with head
 1.27.4.1 05-Mar-2011  rmind sync with head
 1.28.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.28.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.8.1 18-Feb-2012  mrg merge to -current.
 1.30.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.30.4.1 17-Apr-2012  yamt sync with head
 1.31.10.1 18-May-2014  rmind sync with head
 1.31.6.2 03-Dec-2017  jdolecek update from HEAD
 1.31.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.32.6.2 28-Aug-2017  skrll Sync with HEAD
 1.32.6.1 05-Feb-2017  skrll Sync with HEAD
 1.34.6.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.34.6.1 10-Jun-2019  christos Sync with HEAD
 1.34.4.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.4 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.3 11-Apr-2011  mrg branches: 1.3.14;
obsolete DB_AOUT_SYMBOLS. however, we need to leave most of the code
in db_sym.[ch] as it is used by the elf version of crash(8).

i will be cleaning up the db_sym.c code in a follow up commit to avoid
having dead code compiled.
 1.2 24-Dec-2001  chs branches: 1.2.144; 1.2.150;
use ELF instead of a.out symbols now.
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.10; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.1 08-Jan-2002  nathanw Catch up to -current.
 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 05-Jan-2000  bouyer file db_machdep.h was added on branch thorpej_scsipi on 2000-11-20 20:10:29 +0000
 1.2.150.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.144.1 21-Apr-2011  rmind sync with head
 1.3.14.1 03-Dec-2017  jdolecek update from HEAD
 1.3 30-Aug-2011  bouyer Add getlabelusesmbr(), as proposed in
http://mail-index.netbsd.org/tech-userlevel/2011/08/25/msg005404.html
This is used by disk tools such as disklabel(8) to dynamically decide is
the undelyling platform uses a disklabel-in-mbr-partition or not
(instead of using a compile-time list of ports).
getlabelusesmbr() reads the sysctl kern.labelusesmbr, takes its value from the
machdep #define LABELUSESMBR.
For evbmips, make LABELUSESMBR 1 if the platform uses pmon
as bootloader, and 0 (the previous value) otherwise.
 1.2 28-Jan-2000  nisimura branches: 1.2.6;
Nuke isbad(), and fix typos.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 28-Jan-2000  bouyer file disklabel.h was added on branch thorpej_scsipi on 2000-11-20 20:10:29 +0000
 1.2 05-Jul-2022  tsutsui Remove unnecessary multiple inclusion protections.
 1.1 24-Dec-2001  chs branches: 1.1.2; 1.1.4;
needed for ELF, just include the m68k common header.
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 24-Dec-2001  thorpej file elf_machdep.h was added on branch kqueue on 2002-01-10 19:45:18 +0000
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 24-Dec-2001  nathanw file elf_machdep.h was added on branch nathanw_sa on 2002-01-08 00:25:51 +0000
 1.3 17-Mar-2000  mycroft branches: 1.3.6;
In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.2 16-Mar-2000  mycroft Foolish consistency. Mainly, always use underscores and sys/endian.h.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 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 17-Mar-2000  bouyer file endian.h was added on branch thorpej_scsipi on 2000-11-20 20:10:29 +0000
 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:10:29 +0000
 1.1 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.1 24-Dec-2015  christos branches: 1.1.2; 1.1.18;
fenv for m68k
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 24-Dec-2015  jdolecek file fenv.h was added on branch tls-maxphys on 2017-12-03 11:36:23 +0000
 1.1.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.1 24-Dec-2015  skrll file fenv.h was added on branch nick-nhusb on 2015-12-27 12:09:37 +0000
 1.2 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.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file float.h was added on branch thorpej_scsipi on 2000-11-20 20:10:29 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file frame.h was added on branch thorpej_scsipi on 2000-11-20 20:10:29 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file ieee.h was added on branch thorpej_scsipi on 2000-11-20 20:10:30 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file ieeefp.h was added on branch thorpej_scsipi on 2000-11-20 20:10:30 +0000
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 integer constant macros.
 1.1.12.2 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
 1.1.12.1 14-Apr-2001  kleink file int_const.h was added on branch nathanw_sa on 2001-04-14 22:38:39 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_const.h was added on branch thorpej_scsipi on 2001-04-21 17:53:55 +0000
 1.1 15-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.2 15-Apr-2001  kleink Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.1 15-Apr-2001  kleink file int_fmtio.h was added on branch nathanw_sa on 2001-04-15 17:13:12 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_fmtio.h was added on branch thorpej_scsipi on 2001-04-21 17:53:55 +0000
 1.1 15-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.2 15-Apr-2001  kleink Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.1 15-Apr-2001  kleink file int_limits.h was added on branch nathanw_sa on 2001-04-15 15:29:08 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_limits.h was added on branch thorpej_scsipi on 2001-04-21 17:53:55 +0000
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.2 14-Apr-2001  kleink Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.1 14-Apr-2001  kleink file int_mwgwtypes.h was added on branch nathanw_sa on 2001-04-14 12:19:55 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_mwgwtypes.h was added on branch thorpej_scsipi on 2001-04-21 17:53:55 +0000
 1.1 26-Jun-2000  kleink branches: 1.1.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.1.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 26-Jun-2000  bouyer file int_types.h was added on branch thorpej_scsipi on 2000-11-20 20:10:30 +0000
 1.19 19-Jan-2024  thorpej Add _KERNEL guards around most of the definitions in these files.
 1.18 15-Jan-2024  thorpej G/C __HAVE_LEGACY_INTRCNT from luna68k.
 1.17 15-Jan-2024  thorpej Switch luna68k over to the common interrupt dispatch code.
 1.16 11-Jul-2023  riastradh luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
 1.15 22-Mar-2014  tsutsui branches: 1.15.60;
Remove obsolete ssir stuff which was used for pre-5.0 softintr(9).
 1.14 26-Nov-2011  tsutsui branches: 1.14.8; 1.14.12;
Reorganize IPL for devices.
 1.13 10-Jul-2008  tsutsui branches: 1.13.28;
Cosmetic changes to sync with other m68k ports:
- rename ipl2spl_table[] to ipl2psl_table[] and make it uint16_t
- rename _spl member in ipl_cookie_t to _psl
- sort some splbio entries
 1.12 10-Jul-2008  tsutsui Remove __P().
 1.11 28-Apr-2008  martin branches: 1.11.2; 1.11.4; 1.11.6;
Remove clause 3 and 4 from TNF licenses
 1.10 03-Dec-2007  ad branches: 1.10.14; 1.10.16; 1.10.18;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.9 11-Mar-2007  thorpej branches: 1.9.16; 1.9.18; 1.9.24;
- Shrink ipl_cookie_t from 32-bits to 16-bits (large enough to hold
an SR value or an IPL_* constant).
- Take advange of the smaller ipl_cookie_t to shrink kmutex_t from
16 bytes to 8 bytes by overlapping storage where possible.
- Implement a RAS-based _lock_cas() for mc68010 systems (Sun2). See
sun68k/sun68k/isr.c.

Tested on various m68k platforms, but NOT Sun2. In any case, at least
Sun2 compiles now.
 1.8 04-Mar-2007  tsutsui branches: 1.8.2;
Hide #include <m68k/softintr.h> inside #ifdef _KERNEL in <machine/intr.h>
to avoid exporting unnecessary files to userland.
Should fix build.sh failure, which was pointed out by isaki@.

XXX: which userland program would require contents of <machine/intr.h>?
 1.7 04-Mar-2007  tsutsui Add MI softintr(9) support for luna68k with common m68k/softintr.c.
Compile test only.
 1.6 16-Feb-2007  ad branches: 1.6.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.5 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.4 05-May-2002  jdolecek branches: 1.4.26; 1.4.56; 1.4.58;
Put the contents inside #ifdef _KERNEL, similarily to mac68k one,
so that the innards are not exposed to userland.
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.8;
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.2 22-Aug-2000  thorpej branches: 1.2.2; 1.2.4;
Add spllock(). See spl(9) for details.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 22-Aug-2000  bouyer file intr.h was added on branch thorpej_scsipi on 2000-11-20 20:10:30 +0000
 1.3.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.3.8.1 13-Apr-2001  nathanw file intr.h was added on branch nathanw_sa on 2002-06-20 03:39:18 +0000
 1.3.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.58.1 22-Sep-2006  yamt implement splraiseipl for luna68k.
 1.4.56.1 12-Jan-2007  ad Sync with head.
 1.4.26.4 07-Dec-2007  yamt sync with head
 1.4.26.3 03-Sep-2007  yamt sync with head.
 1.4.26.2 26-Feb-2007  yamt sync with head.
 1.4.26.1 30-Dec-2006  yamt sync with head.
 1.6.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.2.2 03-Dec-2007  ad Sync with HEAD.
 1.8.2.1 13-Mar-2007  ad Sync with head.
 1.9.24.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.18.1 09-Jan-2008  matt sync with HEAD
 1.9.16.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.18.2 04-May-2009  yamt sync with head.
 1.10.18.1 16-May-2008  yamt sync with head.
 1.10.16.1 18-May-2008  yamt sync with head.
 1.10.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.10.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.6.1 19-Oct-2008  haad Sync with HEAD.
 1.11.4.1 18-Jul-2008  simonb Sync with head.
 1.11.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.13.28.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.28.1 17-Apr-2012  yamt sync with head
 1.14.12.1 18-May-2014  rmind sync with head
 1.14.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.60.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.2 05-Jul-2022  tsutsui Remove unnecessary multiple inclusion protections.
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file kcore.h was added on branch thorpej_scsipi on 2000-11-20 20:10:30 +0000
 1.2 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.1 09-Mar-2017  tsutsui branches: 1.1.2; 1.1.6; 1.1.14; 1.1.18;
Add a driver for LUNA's front panel LCD. Ported from OpenBSD/luna88k.

Reviewed by enami@. Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 09-Mar-2017  jdolecek file lcd.h was added on branch tls-maxphys on 2017-12-03 11:36:23 +0000
 1.1.14.2 28-Aug-2017  skrll Sync with HEAD
 1.1.14.1 09-Mar-2017  skrll file lcd.h was added on branch nick-nhusb on 2017-08-28 17:51:43 +0000
 1.1.6.2 21-Apr-2017  bouyer Sync with HEAD
 1.1.6.1 09-Mar-2017  bouyer file lcd.h was added on branch bouyer-socketcan on 2017-04-21 16:53:30 +0000
 1.1.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.1.2.1 09-Mar-2017  pgoyette file lcd.h was added on branch pgoyette-localcount on 2017-03-20 06:57:16 +0000
 1.2 28-Mar-2012  christos - Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.170; 1.1.174;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.174.1 05-Apr-2012  mrg sync to latest -current.
 1.1.170.1 17-Apr-2012  yamt sync with head
 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 05-Jan-2000  bouyer file limits.h was added on branch thorpej_scsipi on 2000-11-20 20:10:30 +0000
 1.3 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.2 17-Jan-2013  tsutsui branches: 1.2.2; 1.2.6; 1.2.14;
Make loadfile() accept OMAGIC a.out binary.
LUNA's ROM monitor assumes it.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.14.1 10-Aug-2014  tls Rebase.
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 17-Jan-2013  tls file loadfile_machdep.h was added on branch tls-maxphys on 2013-02-25 00:28:47 +0000
 1.2.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 17-Jan-2013  yamt file loadfile_machdep.h was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.1 29-Apr-2000  thorpej branches: 1.1.6;
Require that each each MACHINE/MACHINE_ARCH supply a lock.h. This file
contains the values __SIMPLELOCK_LOCKED and __SIMPLELOCK_UNLOCKED, which
replace the old SIMPLELOCK_LOCKED and SIMPLELOCK_UNLOCKED. These files
are also required to supply inline functions __cpu_simple_lock(),
__cpu_simple_lock_try(), and __cpu_simple_unlock() if locking is to be
supported on that platform (i.e. if MULTIPROCESSOR is defined in the
_KERNEL case). Change these functions to take an int * (&alp->lock_data)
rather than the struct simplelock * itself.

These changes make it possible for userland to use the locking primitives
by including <machine/lock.h>.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 29-Apr-2000  bouyer file lock.h was added on branch thorpej_scsipi on 2000-11-20 20:10:30 +0000
 1.1 30-Nov-2024  christos branches: 1.1.4;
Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 30-Nov-2024  perseant file lwp_private.h was added on branch perseant-exfatfs on 2025-08-02 05:55:47 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file math.h was added on branch thorpej_scsipi on 2000-11-20 20:10:31 +0000
 1.2 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.1 10-Nov-2001  scw branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.1 10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 1.2 09-Feb-2007  ad branches: 1.2.4;
Merge newlock2 to head.
 1.1 22-Dec-2006  ad branches: 1.1.2;
file mutex.h was initially added on branch newlock2.
 1.1.2.1 22-Dec-2006  ad Pull in CPU specific stubs.
 1.2.4.2 26-Feb-2007  yamt sync with head.
 1.2.4.1 09-Feb-2007  yamt file mutex.h was added on branch yamt-lazymbuf on 2007-02-26 09:07:10 +0000
 1.15 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.14 28-Dec-2019  isaki Remove a pointless MSGBUFSIZE definition.
The same operation is already done in <m68k/param.h>.
luna68k is not imported yet in 1997 but see also:
http://mail-index.netbsd.org/source-changes/1997/09/20/0021.html
 1.13 10-Feb-2012  para branches: 1.13.48;
proper sizing of kmem_arena on different ports

PR port-i386/45946: Kernel locks up in VMEM system
 1.12 05-Nov-2011  tsutsui branches: 1.12.4;
Sync _delay() with hp300:
- unsigned -> u_int
- use ENTRY_NOPROFILE()
- align main delay loop with 8 byte cacheline boundary
 1.11 08-Feb-2011  rmind branches: 1.11.4;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.10 11-Dec-2009  tsutsui branches: 1.10.4; 1.10.6; 1.10.8;
Refactoring MD segment related definitions on m68k ports:
- move macro SEGSHIFT, NBSEG, and SEGOFSET from <machine/param.h>
to <m68k/pmap_motorola.h> where they should belong
- also simplify NBSEG macro for both 020/030 and 040/060 cases
- also move m68k_trunc_seg(), m68k_round_seg(), and m68k_seg_offset()
(that use SEGOFSET) from <m68k/param.h> to <m68k/pmap_motorola.h>
- add comments about each segment size value used on pmap_motorola
implementation
- add TIA_SIZE, TIA_SHIFT, TIB_SIZE, and TIB_SHIFT macro which can be
used for ste/pte index sizes
- use proper vaddr_t cast instead of unsigned for SEGOFSET/PGOFSET macro

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

Anyway, these values will be moved into <m68k/pmap_motorola.h> soon
since they are quite pmap implementation dependent.
 1.8 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.7 11-Dec-2005  christos branches: 1.7.78; 1.7.86; 1.7.92;
merge ktrace-lwp.
 1.6 24-Oct-2004  skrll s/Id/NetBSD/
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 03-Nov-2002  chs branches: 1.4.6;
merge pmap.h for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.3 30-Nov-2000  nisimura branches: 1.3.8;
Reduce UPAGES from 3 to 2.
 1.2 11-Feb-2000  thorpej branches: 1.2.6;
Update for the NKMEMPAGES changes.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.6.3 08-Dec-2000  bouyer Sync with HEAD.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 11-Feb-2000  bouyer file param.h was added on branch thorpej_scsipi on 2000-11-20 20:10:31 +0000
 1.3.8.1 11-Nov-2002  nathanw Catch up to -current
 1.4.6.4 02-Nov-2004  skrll Sync with HEAD.
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.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 28-Apr-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.10.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.10.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.4.1 05-Mar-2011  rmind sync with head
 1.11.4.2 17-Apr-2012  yamt sync with head
 1.11.4.1 10-Nov-2011  yamt sync with head
 1.12.4.1 18-Feb-2012  mrg merge to -current.
 1.13.48.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file pcb.h was added on branch thorpej_scsipi on 2000-11-20 20:10:31 +0000
 1.11 29-Dec-2023  tsutsui Use proper macro for the 030/040 TT registers to map LUNA's I/O spaces.

No binary change.
 1.10 03-Nov-2002  chs merge pmap.h for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.9 22-Sep-2002  chs it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.8 22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.7 10-Sep-2001  chris branches: 1.7.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.6 26-May-2001  chs branches: 1.6.2; 1.6.4;
replace vm_page_t with struct vm_page *.
 1.5 26-May-2001  chs replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.4 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.3 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.2 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.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.8;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.8.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.6.3 23-Apr-2001  bouyer Sync with HEAD.
 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 05-Jan-2000  bouyer file pmap.h was added on branch thorpej_scsipi on 2000-11-20 20:10:31 +0000
 1.6.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.6.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.7.4.6 11-Nov-2002  nathanw Catch up to -current
 1.7.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.7.4.4 02-Jul-2002  nathanw Adjust whitespace so that this matches the trunk.
 1.7.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.7.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 1.7.4.1 10-Sep-2001  scw file pmap.h was added on branch nathanw_sa on 2001-11-18 18:10:19 +0000
 1.2 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

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

* Removes the PMC code of ARM XSCALE.

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

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

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

* Removes the pmc_evid_t and pmc_ctr_t types.

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

pmc(9) is meant to be a general interface. Initially, the Intel XScale
counters are the only ones supported.
 1.1.204.1 10-Jun-2019  christos Sync with HEAD
 1.1.202.1 28-Jul-2018  pgoyette Sync with HEAD
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 07-Aug-2002  jdolecek file pmc.h was added on branch kqueue on 2002-09-06 08:36:43 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 07-Aug-2002  gehenna file pmc.h was added on branch gehenna-devsw on 2002-08-31 13:45:00 +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:26 +0000
 1.2 13-Jul-2002  scw m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.10; 1.1.14; 1.1.22;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.22.1 16-Jul-2002  gehenna catch up with -current.
 1.1.14.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.14.1 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 1.1.10.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 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 05-Jan-2000  bouyer file proc.h was added on branch thorpej_scsipi on 2000-11-20 20:10:31 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file profile.h was added on branch thorpej_scsipi on 2000-11-20 20:10:31 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file psl.h was added on branch thorpej_scsipi on 2000-11-20 20:10:32 +0000
 1.2 14-Oct-2002  chs merge pte.h for m68k w/ motorola or compatible MMU
(only 4k-page platforms so far).
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.1 18-Oct-2002  nathanw Catch up to -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 05-Jan-2000  bouyer file pte.h was added on branch thorpej_scsipi on 2000-11-20 20:10:32 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file ptrace.h was added on branch thorpej_scsipi on 2000-11-20 20:10:32 +0000
 1.2 05-Jul-2022  tsutsui Remove unnecessary multiple inclusion protections.
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file reg.h was added on branch thorpej_scsipi on 2000-11-20 20:10:32 +0000
 1.2 09-Feb-2007  ad branches: 1.2.4;
Merge newlock2 to head.
 1.1 22-Dec-2006  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 22-Dec-2006  ad Pull in CPU specific stubs.
 1.2.4.2 26-Feb-2007  yamt sync with head.
 1.2.4.1 09-Feb-2007  yamt file rwlock.h was added on branch yamt-lazymbuf on 2007-02-26 09:07:10 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file setjmp.h was added on branch thorpej_scsipi on 2000-11-20 20:10:32 +0000
 1.2 27-Oct-2021  thorpej Remove a superflouous comment.
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file signal.h was added on branch thorpej_scsipi on 2000-11-20 20:10:32 +0000
 1.2 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.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file stdarg.h was added on branch thorpej_scsipi on 2000-11-20 20:10:32 +0000
 1.2 11-Dec-2005  christos branches: 1.2.18;
merge ktrace-lwp.
 1.1 12-Jul-2005  he branches: 1.1.6;
This port also needs it's own sunos_machdep.h.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 12-Jul-2005  skrll file sunos_machdep.h was added on branch ktrace-lwp on 2005-11-10 13:57:09 +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:52:58 +0000
 1.2 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.1 12-Apr-2002  bjh21 branches: 1.1.2; 1.1.8; 1.1.204; 1.1.206;
Add <luna68k/svr4_machdep.h>, since that seems to be necessary to get
things to compile.
 1.1.206.1 10-Jun-2019  christos Sync with HEAD
 1.1.204.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 12-Apr-2002  jdolecek file svr4_machdep.h was added on branch kqueue on 2002-06-23 17:37:38 +0000
 1.1.2.2 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.1 12-Apr-2002  nathanw file svr4_machdep.h was added on branch nathanw_sa on 2002-04-17 00:03:28 +0000
 1.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file trap.h was added on branch thorpej_scsipi on 2000-11-20 20:10:33 +0000
 1.10 15-Jan-2024  thorpej G/C __HAVE_LEGACY_INTRCNT from luna68k.
 1.9 05-Jul-2022  tsutsui Remove unnecessary multiple inclusion protections.
 1.8 01-Apr-2021  simonb Define __HAVE_LEGACY_INTRCNT to indicate this port uses legacy intrcnt
interrupt accounting.
 1.7 20-Jan-2008  joerg branches: 1.7.110; 1.7.112;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.6 17-Oct-2007  garbled branches: 1.6.2; 1.6.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.5 14-Jul-2007  ad branches: 1.5.10;
Generic soft interrupts are mandatory.
 1.4 04-Mar-2007  tsutsui branches: 1.4.2; 1.4.10;
Add MI softintr(9) support for luna68k with common m68k/softintr.c.
Compile test only.
 1.3 14-Sep-2006  gdamore branches: 1.3.6;
Update luna68k to MI todr and timecounters.
 1.2 28-Feb-2002  simonb branches: 1.2.32; 1.2.62;
Use "#define<tab>".
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.10; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.10.1 16-Mar-2002  jdolecek Catch up 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 05-Jan-2000  bouyer file types.h was added on branch thorpej_scsipi on 2000-11-20 20:10:33 +0000
 1.2.62.1 18-Nov-2006  ad Sync with head.
 1.2.32.2 21-Jan-2008  yamt sync with head
 1.2.32.1 30-Dec-2006  yamt sync with head.
 1.3.6.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.10.1 03-Oct-2007  garbled Sync with HEAD
 1.4.2.1 15-Jul-2007  ad Sync with head.
 1.5.10.2 23-Mar-2008  matt sync with HEAD
 1.5.10.1 06-Nov-2007  matt sync with HEAD
 1.6.8.1 23-Jan-2008  bouyer Sync with HEAD.
 1.6.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.7.112.1 03-Apr-2021  thorpej Sync with HEAD.
 1.7.110.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 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.1 05-Jan-2000  nisimura branches: 1.1.6;
Introduce NetBSD/luna68k port into CVS repository.
 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 05-Jan-2000  bouyer file varargs.h was added on branch thorpej_scsipi on 2000-11-20 20:10:33 +0000
 1.3 15-Jan-2024  thorpej No need for our own spurious interrupt handler now that m68k_intr.c
handles them for us.
 1.2 15-Jan-2024  thorpej Switch luna68k over to the common interrupt dispatch code.
 1.1 14-Jan-2024  thorpej Switch luna68k over to the common m68k vector table.
 1.26 08-Feb-2025  tsutsui Bump DFLSSIZ from 512KB to 2MB on all hp300 pmap m68k ports.

Some modern applications could require 512KB buffer on stack and
no particular comment on port-m68k@:
https://mail-index.netbsd.org/port-m68k/2025/02/02/msg000893.html
 1.25 14-May-2024  andvar branches: 1.25.2;
fix recently committed typos by msaitoh in few more places, as well as few more.
mainly s/contigous/contiguous/ and s/miliseconds/milliseconds/ in comments.
 1.24 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.23 01-Feb-2020  tsutsui Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

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

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

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

Should be pulled up to netbsd-9.
 1.22 28-Jun-2019  tsutsui branches: 1.22.2; 1.22.4;
Fix lingering page size comments.

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

XXX: we also need MAX_PAGE_SIZE in somewhere for newer jemalloc?
 1.21 02-Feb-2017  rin branches: 1.21.14;
PR port-mac68k/51923
Bump default MAXTSIZ to 32MB for m68k ports, which allos us to use GCC 5.4 on
GENERIC kernels.
Ok jklos
 1.20 02-Feb-2017  rin PR port-mac68k/51923
Remove unused SYSPTSIZE and USRPTSIZE from m68k ports.
Ok jklos
 1.19 26-Jul-2014  tsutsui branches: 1.19.4; 1.19.8; 1.19.12;
Sync VM_MAXUSER_ADDRESS and VM_MAX_ADDRESS with other hp300 derived ports.

There is no particular reason to have different values among m68k ports.
Briefly checked on LUNA-II.
 1.18 08-Feb-2011  rmind branches: 1.18.14; 1.18.28;
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.17 06-Nov-2010  uebayasi branches: 1.17.2; 1.17.4;
Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)). This functionality will be re-added later.
 1.16 08-Feb-2010  joerg branches: 1.16.2;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.15 11-Dec-2009  tsutsui branches: 1.15.2;
Define SYSMAP_VA in <m68k/pmap_motorola.h>
where the Sysmap pointer is declared.
 1.14 08-Dec-2009  tsutsui Use PGSHIFT from <machine/param.h> for PAGE_SHIFT.
We can assume PGSHIFT is always constant on current
m68k pmap_motorola implementation.
Also fix some leftover HP300 comments on some ports.
 1.13 26-Aug-2009  thorpej Minor tweak to the pv_table management in the Hibler-derived m68k pmaps:
The head of the list is now a pv_header, which contains the first pv_entry
as well as a 16-bit attributes field (replaces the pmap_attributes array
plus the pv_entry::pv_flags field) as a 16-bit count of caller-specified
cache-inhibited mappings.

Tested on hp300 (shared pmap_motorola.c), changes to atari and amiga copies
are purely mechanical.
 1.12 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.11 11-Dec-2005  christos branches: 1.11.78; 1.11.86; 1.11.92;
merge ktrace-lwp.
 1.10 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.9 07-Aug-2003  agc branches: 1.9.8; 1.9.10;
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-Apr-2003  thorpej branches: 1.8.2;
Use PAGE_SIZE rather than NBPG.
 1.7 02-Apr-2003  thorpej Make PAGE_SIZE, PAGE_SHIFT, and PAGE_MASK compile-time constants on
luna68k.
 1.6 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.5 15-Nov-2001  soren MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.4 01-May-2001  thorpej branches: 1.4.2; 1.4.8;
Per discussion w/ chuck and chuck, restructure the md page stuff
to use a structure called "vm_page_md", and use __HAVE_VM_PAGE_MD
and __HAVE_PMAP_PHYSSEG.
 1.3 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.2 11-Feb-2000  thorpej branches: 1.2.6; 1.2.8;
Update for the NKMEMPAGES changes.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.8.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 11-Feb-2000  bouyer file vmparam.h was added on branch thorpej_scsipi on 2000-11-20 20:10:33 +0000
 1.4.8.3 11-Dec-2002  thorpej Sync with HEAD.
 1.4.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.8.1 01-May-2001  nathanw file vmparam.h was added on branch nathanw_sa on 2002-01-08 00:25:51 +0000
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.2.4 01-Apr-2005  skrll Sync with HEAD.
 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.10.2 19-Mar-2005  yamt move Sysmap to avoid TTR ranges.
 1.9.10.1 24-Feb-2005  yamt - remove stale(?) references to lkptpa in #if defined(M68040) block.
- change kernel va layout, following mac68k.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.11.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.86.1 28-Apr-2009  skrll Sync with HEAD.
 1.11.78.3 11-Mar-2010  yamt sync with head
 1.11.78.2 16-Sep-2009  yamt sync with head
 1.11.78.1 04-May-2009  yamt sync with head.
 1.15.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.15.2.1 26-Apr-2010  uebayasi Remove the unfinished code to add a memory segment after uvm_page_init().
It doesn't even compile.

(In the future, we should allocate struct vm_page [] on the added memory
segment for NUMA's sake.)
 1.16.2.1 05-Mar-2011  rmind sync with head
 1.17.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.17.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.18.28.1 10-Aug-2014  tls Rebase.
 1.18.14.2 03-Dec-2017  jdolecek update from HEAD
 1.18.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.12.1 21-Apr-2017  bouyer Sync with HEAD
 1.19.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.19.4.1 05-Feb-2017  skrll Sync with HEAD
 1.21.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.22.4.1 29-Feb-2020  ad Sync with head.
 1.22.2.1 10-Feb-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #682):

sys/arch/next68k/include/vmparam.h: revision 1.27
sys/arch/mac68k/include/vmparam.h: revision 1.46
sys/arch/sun3/include/vmparam.h: revision 1.38
sys/arch/m68k/include/vmparam.h: revision 1.1
sys/arch/hp300/include/vmparam.h: revision 1.41
sys/arch/m68k/include/Makefile: revision 1.32
sys/arch/amiga/include/vmparam.h: revision 1.48
distrib/sets/lists/comp/ad.m68k: revision 1.63
sys/arch/x68k/include/vmparam.h: revision 1.40
sys/arch/mvme68k/include/vmparam.h: revision 1.38
sys/arch/luna68k/include/vmparam.h: revision 1.23
sys/arch/news68k/include/vmparam.h: revision 1.23
sys/arch/atari/include/vmparam.h: revision 1.34
sys/arch/cesfic/include/vmparam.h: revision 1.19

Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

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

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.

For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

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

Should be pulled up to netbsd-9.
 1.25.2.1 02-Aug-2025  perseant Sync 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:36:30 +0000
 1.1 03-Dec-2016  tsutsui branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.22;
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).

Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.1.22.2 03-Dec-2017  jdolecek update from HEAD
 1.1.22.1 03-Dec-2016  jdolecek file xpio.h was added on branch tls-maxphys on 2017-12-03 11:36:23 +0000
 1.1.10.2 18-Jan-2017  skrll Sync with netbsd-5
 1.1.10.1 03-Dec-2016  skrll file xpio.h was added on branch netbsd-7-nhusb on 2017-01-18 08:46:25 +0000
 1.1.6.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.1.6.1 03-Dec-2016  pgoyette file xpio.h was added on branch pgoyette-localcount on 2017-01-07 08:56:20 +0000
 1.1.4.2 06-Dec-2016  snj Pull up following revision(s) (requested by tsutsui in ticket #1283):
distrib/sets/lists/comp/md.luna68k: revision 1.21
etc/etc.luna68k/MAKEDEV.conf: revision 1.9
sys/arch/luna68k/conf/GENERIC: revision 1.120
sys/arch/luna68k/conf/files.luna68k: revision 1.25
sys/arch/luna68k/conf/majors.luna68k: revision 1.21
sys/arch/luna68k/dev/xp.c: revision 1.1
sys/arch/luna68k/include/Makefile: revision 1.19
sys/arch/luna68k/include/xpio.h: revision 1.1
sys/arch/luna68k/luna68k/mainbus.c: revision 1.14
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).
Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.1.4.1 03-Dec-2016  snj file xpio.h was added on branch netbsd-7 on 2016-12-06 06:50:23 +0000
 1.1.2.2 05-Dec-2016  skrll Sync with HEAD
 1.1.2.1 03-Dec-2016  skrll file xpio.h was added on branch nick-nhusb on 2016-12-05 10:54:54 +0000
 1.15 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Kernel side changes:
- use %d7 (boothowto) and %d6 (bootdev) to pass info and also use
old macro in <sys/reboot.h> as ancient 4.4BSD did for simplicity
- add <machine/bootinfo.h> to define values as API to pass these info
- save boothowto and bootdev in registers right after zero'ing bss
- add MD device_register(9) to check booted_device per passed bootdev info
- merge old bootarg checks in rootconf() and luna68k_init() with
tweaks for backward compatibility
(direct boot a.out kernel from ROM monitor without bootloader still works)
 1.14 13-Oct-2012  tsutsui branches: 1.14.2;
struct device * -> device_t, use device_xname() (from chs@)
 1.13 29-Jul-2012  mlelstv branches: 1.13.2;
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.

No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().

Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().

Make cpu_rootconf(9) describe the calling order.
 1.12 18-Mar-2009  cegger branches: 1.12.12; 1.12.18;
Ansify function definitions w/o arguments. Generated with sed.
 1.11 03-May-2008  martin branches: 1.11.8; 1.11.14;
Move to standard 2 clause TNF license
 1.10 12-Feb-2008  joerg branches: 1.10.6; 1.10.8; 1.10.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.9 05-Dec-2007  tsutsui Use TAILQ_FIRST(3) and TAILQ_NEXT(3) macro.
 1.8 03-Dec-2007  ad branches: 1.8.2;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.7 04-Mar-2007  tsutsui branches: 1.7.2; 1.7.18; 1.7.20; 1.7.26;
Add MI softintr(9) support for luna68k with common m68k/softintr.c.
Compile test only.
 1.6 11-Dec-2005  christos branches: 1.6.26;
merge ktrace-lwp.
 1.5 05-Jun-2005  he branches: 1.5.2;
Adapt to compiling with -Wcast-qual by sprinkling consts around.
 1.4 23-Oct-2004  thorpej Centralize the declaration of booted_device and booted_partition.
 1.3 25-Sep-2002  thorpej branches: 1.3.6;
Don't include <sys/map.h>.
 1.2 15-Jan-2000  nisimura branches: 1.2.6; 1.2.10; 1.2.14;
Kludge to detect booted_device detection. Needs helpful 2nd stage boot
loaders for finer controls.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.14.1 18-Oct-2002  nathanw Catch up to -current.
 1.2.10.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 15-Jan-2000  bouyer file autoconf.c was added on branch thorpej_scsipi on 2000-11-20 20:10:33 +0000
 1.3.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.6.1 02-Nov-2004  skrll Sync with HEAD.
 1.5.2.3 27-Feb-2008  yamt sync with head.
 1.5.2.2 07-Dec-2007  yamt sync with head
 1.5.2.1 03-Sep-2007  yamt sync with head.
 1.6.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.26.2 18-Feb-2008  mjf Sync with HEAD.
 1.7.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.20.2 23-Mar-2008  matt sync with HEAD
 1.7.20.1 09-Jan-2008  matt sync with HEAD
 1.7.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.7.2.1 03-Dec-2007  ad Sync with HEAD.
 1.8.2.1 08-Dec-2007  ad Sync with head.
 1.10.10.2 04-May-2009  yamt sync with head.
 1.10.10.1 16-May-2008  yamt sync with head.
 1.10.8.1 18-May-2008  yamt sync with head.
 1.10.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.12.18.1 08-Aug-2012  martin Pull up following revision(s) (requested by mlelstv in ticket #466):
sys/arch/amiga/amiga/autoconf.c: revision 1.113
sys/arch/rs6000/rs6000/autoconf.c: revision 1.4
sys/arch/emips/emips/autoconf.c: revision 1.6
sys/arch/sandpoint/sandpoint/autoconf.c: revision 1.27
sys/arch/evbmips/alchemy/autoconf.c: revision 1.18
sys/arch/sgimips/sgimips/autoconf.c: revision 1.43
sys/arch/atari/atari/autoconf.c: revision 1.63
sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.17
sys/arch/mmeye/mmeye/autoconf.c: revision 1.9
distrib/sets/lists/comp/mi: revision 1.1771
sys/arch/mipsco/mipsco/autoconf.c: revision 1.25
sys/arch/iyonix/iyonix/autoconf.c: revision 1.14
sys/arch/hp300/hp300/autoconf.c: revision 1.100
sys/kern/init_main.c: revision 1.445
sys/arch/pmax/pmax/autoconf.c: revision 1.79
sys/arch/netwinder/netwinder/autoconf.c: revision 1.11
sys/arch/dreamcast/dreamcast/autoconf.c: revision 1.10
sys/arch/ibmnws/ibmnws/autoconf.c: revision 1.12
sys/arch/evbppc/ev64260/autoconf.c: revision 1.17
sys/arch/evbmips/gdium/autoconf.c: revision 1.5
sys/arch/algor/algor/autoconf.c: revision 1.21
share/man/man9/Makefile: revision 1.367
sys/arch/ews4800mips/ews4800mips/autoconf.c: revision 1.9
sys/arch/amigappc/amigappc/autoconf.c: revision 1.5
sys/arch/x86/x86/x86_autoconf.c: revision 1.65
sys/arch/acorn26/acorn26/autoconf.c: revision 1.9
sys/arch/mvmeppc/mvmeppc/autoconf.c: revision 1.13
sys/arch/vax/vax/autoconf.c: revision 1.94
sys/arch/usermode/dev/cpu.c: revision 1.72
sys/arch/evbppc/virtex/autoconf.c: revision 1.5
sys/arch/next68k/next68k/autoconf.c: revision 1.26
sys/arch/mac68k/mac68k/autoconf.c: revision 1.73
sys/arch/ia64/ia64/autoconf.c: revision 1.6
sys/arch/evbppc/obs405/obs405_autoconf.c: revision 1.6
share/man/man9/cpu_rootconf.9: revision 1.7
sys/arch/landisk/landisk/autoconf.c: revision 1.6
sys/arch/evbmips/malta/autoconf.c: revision 1.16
sys/arch/sun3/sun3/autoconf.c: revision 1.76
sys/arch/evbppc/explora/autoconf.c: revision 1.13
sys/arch/sun3/sun3/autoconf.c: revision 1.77
sys/arch/evbmips/loongson/autoconf.c: revision 1.3
sys/arch/evbmips/atheros/autoconf.c: revision 1.11
sys/arch/sparc64/sparc64/autoconf.c: revision 1.188
sys/arch/acorn32/acorn32/autoconf.c: revision 1.18
sys/arch/evbarm/evbarm/autoconf.c: revision 1.13
sys/arch/cobalt/cobalt/autoconf.c: revision 1.30
sys/arch/mvme68k/mvme68k/autoconf.c: revision 1.46
sys/arch/hp700/hp700/autoconf.c: revision 1.48
sys/arch/evbmips/adm5120/autoconf.c: revision 1.5
sys/arch/hpcmips/hpcmips/autoconf.c: revision 1.25
sys/arch/alpha/alpha/autoconf.c: revision 1.52
sys/arch/sparc/sparc/autoconf.c: revision 1.244
sys/arch/evbppc/pmppc/autoconf.c: revision 1.7
sys/arch/bebox/bebox/autoconf.c: revision 1.25
sys/arch/luna68k/luna68k/autoconf.c: revision 1.13
sys/arch/hpcarm/hpcarm/autoconf.c: revision 1.20
sys/arch/evbppc/walnut/autoconf.c: revision 1.21
sys/arch/cesfic/cesfic/autoconf.c: revision 1.26
sys/arch/cats/cats/autoconf.c: revision 1.17
sys/arch/x68k/x68k/autoconf.c: revision 1.67
sys/arch/news68k/news68k/autoconf.c: revision 1.21
sys/arch/arc/arc/autoconf.c: revision 1.34
sys/arch/evbsh3/evbsh3/autoconf.c: revision 1.11
sys/sys/conf.h: revision 1.143
sys/arch/evbmips/rasoc/autoconf.c: revision 1.3
sys/arch/hpcsh/hpcsh/autoconf.c: revision 1.26
sys/arch/sun68k/sun68k/autoconf.c: revision 1.29
sys/arch/evbmips/rmixl/autoconf.c: revision 1.6
sys/arch/zaurus/zaurus/autoconf.c: revision 1.12
sys/arch/xen/x86/autoconf.c: revision 1.15
sys/arch/evbppc/mpc85xx/autoconf.c: revision 1.6
sys/arch/shark/shark/autoconf.c: revision 1.18
sys/arch/prep/prep/autoconf.c: revision 1.25
sys/arch/newsmips/newsmips/autoconf.c: revision 1.36
sys/arch/sbmips/sbmips/autoconf.c: revision 1.8
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.
No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().
Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().
Make cpu_rootconf(9) describe the calling order.
add rootconf(9) as a link to cpu_rootconf(9)
make this compile again
 1.12.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.12.12.1 30-Oct-2012  yamt sync with head
 1.13.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.14.2.1 18-May-2014  rmind sync with head
 1.9 26-Jan-2013  tsutsui Whitespace nits.
 1.8 08-Feb-2011  rmind branches: 1.8.4; 1.8.14;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.7 18-Mar-2009  cegger branches: 1.7.4; 1.7.6; 1.7.8;
Ansify function definitions w/o arguments. Generated with sed.
 1.6 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.5 14-Sep-2006  gdamore branches: 1.5.58; 1.5.66; 1.5.72;
Update luna68k to MI todr and timecounters.
 1.4 11-Dec-2005  christos branches: 1.4.20;
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 11-Jan-2000  nisimura branches: 1.2.6; 1.2.30;
Nuke unnecessary external variable declaration.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.30.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.30.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.30.1 03-Aug-2004  skrll Sync with HEAD
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 11-Jan-2000  bouyer file clock.c was added on branch thorpej_scsipi on 2000-11-20 20:10:33 +0000
 1.3.16.1 30-Dec-2006  yamt sync with head.
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.5.72.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.66.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.58.1 04-May-2009  yamt sync with head.
 1.7.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.7.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.4.1 05-Mar-2011  rmind sync with head
 1.8.14.1 25-Feb-2013  tls resync with head
 1.8.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2 14-Sep-2006  gdamore Update luna68k to MI todr and timecounters.
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.46; 1.1.76;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.76.1 18-Nov-2006  ad Sync with head.
 1.1.46.1 30-Dec-2006  yamt sync with head.
 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 05-Jan-2000  bouyer file clockvar.h was added on branch thorpej_scsipi on 2000-11-20 20:10:34 +0000
 1.9 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.8 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.7 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.6 04-Jul-2002  lukem use cdev_mouse_init() for wsmux
 1.5 17-Jun-2002  christos MD systrace gluons.
 1.4 12-Jan-2002  manu branches: 1.4.8;
Added clockctl
 1.3 21-Feb-2001  nisimura branches: 1.3.4; 1.3.8;
Make sure to have rnd pseudo device.
 1.2 13-Jan-2000  nisimura branches: 1.2.6;
- Add raidframe and wsmux.
- Fix off-by-one error of scsibus.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.6.3 12-Mar-2001  bouyer Sync with HEAD.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 13-Jan-2000  bouyer file conf.c was added on branch thorpej_scsipi on 2000-11-20 20:10:34 +0000
 1.3.8.5 11-Nov-2002  nathanw Catch up to -current
 1.3.8.4 17-Sep-2002  nathanw Catch up to -current.
 1.3.8.3 01-Aug-2002  nathanw Catch up to -current.
 1.3.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.3.8.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.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.3.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.4.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.4.8.4 21-Jul-2002  gehenna catch up with -current.
 1.4.8.3 16-Jul-2002  gehenna catch up with -current.
 1.4.8.2 14-Jul-2002  gehenna catch up with -current.
 1.4.8.1 16-May-2002  gehenna Bye block/character device swicth tables.
 1.3 02-Nov-2002  chs enhance the common m68k db_memrw.c to handle read-only kernel text
and switch all the motorola-MMU m68k platforms to use it.
 1.2 29-Jun-2000  mrg branches: 1.2.2; 1.2.10;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.10.1 11-Nov-2002  nathanw Catch up to -current
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 29-Jun-2000  bouyer file db_memrw.c was added on branch thorpej_scsipi on 2000-11-20 20:10:34 +0000
 1.34 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.33 16-Apr-2022  andvar fix various typos in comments and log messages.
 1.32 03-Apr-2019  christos centralize setdisklabel(9)
 1.31 02-Jan-2015  christos branches: 1.31.18;
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.30 15-Jan-2013  tsutsui branches: 1.30.14;
Make the default disklabel (for disks without label) have saner value.
I.e. use d_secperunit for RAW_PART rather than 0x1fffffff for part a.
 1.29 26-Oct-2009  cegger branches: 1.29.12; 1.29.18; 1.29.22;
kill extra whitespaces
reviewed by tsutsui@
 1.28 18-Mar-2009  cegger bcopy -> memcpy
 1.27 16-Mar-2009  dsl ANSIfy functions with function-pointer arguments
 1.26 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.25 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.24 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.23 17-Oct-2007  garbled branches: 1.23.20; 1.23.28; 1.23.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.22 08-Oct-2007  ad Merge brelse() changes from the vmlocking branch.
 1.21 04-Mar-2007  christos branches: 1.21.2; 1.21.10; 1.21.18; 1.21.20; 1.21.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 25-Nov-2006  scw branches: 1.20.4;
Replace the myriad copies of bounds_check_with_label() with a single MI
version.

Add disk_blocksize(9) so that disk drivers can record the physical
block size of a disk if it is different to DEV_BSIZE. Right now this
simply initialises dk_blkshift and dk_byteshift according to the
supplied block size. This information is used in the MI version of
bounds_check_with_label().
 1.19 11-Dec-2005  christos branches: 1.19.20; 1.19.22;
merge ktrace-lwp.
 1.18 05-Jun-2005  he branches: 1.18.2;
Adapt to compiling with -Wcast-qual by sprinkling consts around.
 1.17 10-Dec-2003  agc Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt, and ratified by
myself - the only discrepancy being the handling of the original
clause 3 in src/usr.sbin/yppoll/yppoll.c.
 1.16 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.15 15-Jul-2003  lukem __KERNEL_RCSID()
 1.14 10-May-2003  thorpej branches: 1.14.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.13 02-May-2003  dsl Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
 1.12 19-Feb-2002  wiz strategy should have an 'r'. Inspired by similar change in OpenBSD.
 1.11 25-Nov-2000  nisimura branches: 1.11.2; 1.11.4; 1.11.8;
Update and clarify the comment description of how disklabel is managed.
 1.10 20-Nov-2000  chs branches: 1.10.2;
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.9 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.8 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.7 07-Mar-2000  tsutsui Use b_cylinder as defined in sys/buf.h.
 1.6 07-Mar-2000  tsutsui Use DISKPART/DISKMINOR/DISKUNIT instead of dkpart/dkminor/dkunit.
 1.5 28-Jan-2000  nisimura Nuke isbad(), and fix typos.
 1.4 25-Jan-2000  nisimura Change the previous decision.

NetBSD/luna68k (1) creates UniOS/ISI label with BSD label embedded
at offset 64, (2) reads BSD label if found, (2) falls back to
reading UniOS/ISI label when no BSD label is found. Plus, (4)
reads SunOS label if found in place of UniOS/ISI label.
 1.3 18-Jan-2000  thorpej Use b_cylinder as defined in sys/buf.h
 1.2 11-Jan-2000  nisimura Allow to mount disk with UniOS (== ISI) disklabel as well as SunOS
label. Klude to access weird rootfs on 'c' via 'b'. ISI disklabel
can not be altered. Use SunOS label.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.10.2.4 08-Dec-2000  bouyer Sync with HEAD.
 1.10.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.10.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.10.2.1 20-Nov-2000  bouyer file disksubr.c was added on branch thorpej_scsipi on 2000-11-20 20:10:34 +0000
 1.11.8.1 28-Feb-2002  nathanw Catch up to -current.
 1.11.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.11.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.14.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.18.2.3 27-Oct-2007  yamt sync with head.
 1.18.2.2 03-Sep-2007  yamt sync with head.
 1.18.2.1 30-Dec-2006  yamt sync with head.
 1.19.22.1 10-Dec-2006  yamt sync with head.
 1.19.20.1 12-Jan-2007  ad Sync with head.
 1.20.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.22.1 14-Oct-2007  yamt sync with head.
 1.21.20.1 06-Nov-2007  matt sync with HEAD
 1.21.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.21.10.1 16-Oct-2007  garbled Sync with HEAD
 1.21.2.1 09-Oct-2007  ad Sync with head.
 1.23.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.23.20.2 11-Mar-2010  yamt sync with head
 1.23.20.1 04-May-2009  yamt sync with head.
 1.29.22.2 03-Dec-2017  jdolecek update from HEAD
 1.29.22.1 25-Feb-2013  tls resync with head
 1.29.18.1 12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1002):
sys/arch/luna68k/luna68k/disksubr.c: revision 1.30
Make the default disklabel (for disks without label) have saner value.
I.e. use d_secperunit for RAW_PART rather than 0x1fffffff for part a.
 1.29.12.1 23-Jan-2013  yamt sync with head
 1.30.14.1 06-Apr-2015  skrll Sync with HEAD
 1.31.18.1 10-Jun-2019  christos Sync with HEAD
 1.29 08-Jul-2025  thorpej Add common '030 and '040/'060 routines for configuring the transparent
translation registers. Adjust luna68k and news68k to use them.
 1.28 15-Jan-2024  thorpej branches: 1.28.2;
G/C __HAVE_LEGACY_INTRCNT from luna68k.
 1.27 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.26 29-Dec-2023  tsutsui Use proper macro for the 030/040 TT registers to map LUNA's I/O spaces.

No binary change.
 1.25 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.24 27-Dec-2023  thorpej Stop using magic numbers for the MMU root pointer attributes and the
Translation Control register, and also get rid of "#if PGSHIFT == ..."
where those magic numbers are used.

Instead, define new macros: MMU51_SRP_BITS, MMU51_CRP_BITS, MMU51_TCR_BITS,
and MMU40_TCR_BITS, in terms of the definitions in mmu_{40,51}.h. These
automagically adapt to 8K and 4K pages based on the machine-specific value
of PGSHIFT.
 1.23 20-Feb-2020  skrll G/C
 1.22 17-Feb-2020  skrll G/C LS{SLEEP,RUN,ONPROC}

LWP status manipulation was moved out of assembly long ago.
 1.21 19-Dec-2018  maxv branches: 1.21.6;
Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.20 05-Nov-2011  tsutsui branches: 1.20.50; 1.20.52;
Replace two magic numbers with macro via assym.h.
 1.19 14-Jan-2011  rmind branches: 1.19.8;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.18 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.17 10-Dec-2009  rmind branches: 1.17.4;
Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.16 23-Nov-2009  rmind Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.15 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.14 17-Oct-2007  garbled branches: 1.14.16; 1.14.20; 1.14.22; 1.14.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.13 20-May-2007  he branches: 1.13.10;
Patterned after the changes to atari, restore the luna68k port to a
buildable state after the yamt-idlelwp merge.
Struct cpu_info now must contain ci_want_resched, so get rid of the
global want_resched.
The cpu_need_resched macro now takes two arguments.
We need to declare proc_trampoline() from for the new m68k vm_machdep.c.
The fields l_back and l_forw no longer exists in struct lwp, so excise
their definition from genassym.cf.
Remove the use of the apparently now obsolete m68k/proc_subr.s.
 1.12 09-Feb-2007  ad branches: 1.12.6; 1.12.8; 1.12.14;
Merge newlock2 to head.
 1.11 11-Dec-2005  christos branches: 1.11.20;
merge ktrace-lwp.
 1.10 04-Nov-2003  dsl branches: 1.10.16;
Remove p_nras from struct proc - use LIST_EMPTY(&p->p_raslist) instead.
Remove p_raslock and rename p_lwplock p_lock (one lock is enough).
Simplify window test when adding a ras and correct test on VM_MAXUSER_ADDRESS.
Avoid unpredictable branch in i386 locore.S
(pad fields left in struct proc to avoid kernel bump)
 1.9 22-Sep-2003  cl SA_SIGINFO support for m68k (port specific changes)
 1.8 08-Apr-2003  thorpej branches: 1.8.2;
Use PAGE_SIZE rather than NBPG.
 1.7 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.6 26-Sep-2002  thorpej Remove <sys/map.h>
 1.5 13-Apr-2002  bjh21 Only include opt_compat_svr4.h ifdef _KERNEL_OPT.
 1.4 21-Nov-2000  tsutsui branches: 1.4.4; 1.4.8;
Define proper macros for FP frame offsets rather than magic numbers.
 1.3 29-Jun-2000  mrg branches: 1.3.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 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.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.3.2.3 08-Dec-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 29-Jun-2000  bouyer file genassym.cf was added on branch thorpej_scsipi on 2000-11-20 20:10:34 +0000
 1.4.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.4.8.5 05-Oct-2002  gmcgarry Add RAS offsets.
 1.4.8.4 02-Aug-2002  nathanw Don't need SAF_UPCALL anymore.
 1.4.8.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.4.8.2 17-Apr-2002  nathanw Catch up to -current.
 1.4.8.1 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 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 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.2 03-Sep-2007  yamt sync with head.
 1.10.16.1 26-Feb-2007  yamt sync with head.
 1.11.20.1 06-Feb-2007  ad Update m68k pasteware.
 1.12.14.1 22-May-2007  matt Update to HEAD.
 1.12.8.1 11-Jul-2007  mjf Sync with head.
 1.12.6.1 27-May-2007  ad Sync with head.
 1.13.10.1 06-Nov-2007  matt sync with HEAD
 1.14.26.1 19-Oct-2008  haad Sync with HEAD.
 1.14.22.1 10-Oct-2008  skrll Sync with HEAD.
 1.14.20.2 11-Mar-2010  yamt sync with head
 1.14.20.1 04-May-2009  yamt sync with head.
 1.14.16.1 28-Sep-2008  mjf Sync with HEAD.
 1.17.4.1 05-Mar-2011  rmind sync with head
 1.19.8.1 10-Nov-2011  yamt sync with head
 1.20.52.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.20.52.1 10-Jun-2019  christos Sync with HEAD
 1.20.50.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.21.6.1 29-Feb-2020  ad Sync with head.
 1.28.2.1 02-Aug-2025  perseant Sync with HEAD
 1.28 15-Jan-2024  thorpej Switch luna68k over to the common interrupt dispatch code.
 1.27 14-Jan-2024  thorpej Switch luna68k over to the common m68k vector table.
 1.26 12-Jan-2024  thorpej Make getsr() an inline in <m68k/psl.h> and G/C all of the now-redudant
copies.
 1.25 02-Apr-2021  rin For ports with __HAVE_LEGACY_INTRCNT, turn intrcnt[] and derived
variables into u_int, to match with kern/subr_evcnt.c.
 1.24 19-Dec-2020  thorpej branches: 1.24.2;
malloc(9) -> kmem(9)
 1.23 10-Nov-2019  chs branches: 1.23.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.22 22-Mar-2014  tsutsui branches: 1.22.30;
Remove obsolete ssir stuff which was used for pre-5.0 softintr(9).
 1.21 26-Nov-2011  tsutsui branches: 1.21.8; 1.21.12;
Reorganize IPL for devices.
 1.20 20-Dec-2010  matt branches: 1.20.8;
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.19 18-Mar-2009  cegger branches: 1.19.4;
bzero -> memset
 1.18 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.17 16-Mar-2009  dsl ANSIfy functions with function-pointer arguments
 1.16 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.15 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.14 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.13 10-Jul-2008  tsutsui branches: 1.13.2; 1.13.8;
Cosmetic changes to sync with other m68k ports:
- rename ipl2spl_table[] to ipl2psl_table[] and make it uint16_t
- rename _spl member in ipl_cookie_t to _psl
- sort some splbio entries
 1.12 28-Apr-2008  martin branches: 1.12.2; 1.12.4; 1.12.6;
Remove clause 3 and 4 from TNF licenses
 1.11 03-Dec-2007  ad branches: 1.11.14; 1.11.16; 1.11.18;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.10 04-Mar-2007  tsutsui branches: 1.10.2; 1.10.18; 1.10.20; 1.10.26;
Add MI softintr(9) support for luna68k with common m68k/softintr.c.
Compile test only.
 1.9 21-Dec-2006  yamt branches: 1.9.2;
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.8 11-Dec-2005  christos branches: 1.8.20; 1.8.22;
merge ktrace-lwp.
 1.7 14-Sep-2003  junyoung branches: 1.7.16;
Remove a duplicate $NetBSD$.
 1.6 27-Sep-2002  provos branches: 1.6.6;
remove trailing \n in panic(). approved perry.
 1.5 09-Jul-2000  nisimura branches: 1.5.2; 1.5.6; 1.5.10;
Add a patchwork prototype declaration for netintr().
 1.4 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.3 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 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.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.5.10.1 18-Oct-2002  nathanw Catch up to -current.
 1.5.6.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 09-Jul-2000  bouyer file isr.c was added on branch thorpej_scsipi on 2000-11-20 20:10:34 +0000
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.3 07-Dec-2007  yamt sync with head
 1.7.16.2 03-Sep-2007  yamt sync with head.
 1.7.16.1 30-Dec-2006  yamt sync with head.
 1.8.22.1 22-Sep-2006  yamt implement splraiseipl for luna68k.
 1.8.20.1 12-Jan-2007  ad Sync with head.
 1.9.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.10.20.1 09-Jan-2008  matt sync with HEAD
 1.10.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.2.1 03-Dec-2007  ad Sync with HEAD.
 1.11.18.2 04-May-2009  yamt sync with head.
 1.11.18.1 16-May-2008  yamt sync with head.
 1.11.16.1 18-May-2008  yamt sync with head.
 1.11.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.11.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.6.1 19-Oct-2008  haad Sync with HEAD.
 1.12.4.1 18-Jul-2008  simonb Sync with head.
 1.12.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.13.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.4.1 05-Mar-2011  rmind sync with head
 1.20.8.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.20.8.1 17-Apr-2012  yamt sync with head
 1.21.12.1 18-May-2014  rmind sync with head
 1.21.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.23.8.2 03-Apr-2021  thorpej Sync with HEAD.
 1.23.8.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.24.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 15-Jan-2024  thorpej Switch luna68k over to the common interrupt dispatch code.
 1.5 14-Jan-2024  thorpej Switch luna68k over to the common m68k vector table.
 1.4 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 28-Apr-2008  martin branches: 1.3.8; 1.3.14;
Remove clause 3 and 4 from TNF licenses
 1.2 06-Jan-2003  wiz branches: 1.2.104; 1.2.106; 1.2.108;
interrupt with two rs.
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.14;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.14.1 07-Jan-2003  thorpej Sync with HEAD.
 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 05-Jan-2000  bouyer file isr.h was added on branch thorpej_scsipi on 2000-11-20 20:10:34 +0000
 1.2.108.2 04-May-2009  yamt sync with head.
 1.2.108.1 16-May-2008  yamt sync with head.
 1.2.106.1 18-May-2008  yamt sync with head.
 1.2.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.84 08-Jul-2025  thorpej Add common '030 and '040/'060 routines for configuring the transparent
translation registers. Adjust luna68k and news68k to use them.
 1.83 19-Jan-2024  thorpej branches: 1.83.2;
Consistently use "intr_depth" as the name of the interrupt depth counter
on m68k platforms.
 1.82 17-Jan-2024  thorpej Make sigcode.s and sunos_sigcode.s build as their own stand-alone files.
 1.81 17-Jan-2024  thorpej Make compat_13_sigreturn13.s and compat_16_sigreturn14.s build as their
own stand-alone files and G/C the now-empty sigreturn.s.
 1.80 16-Jan-2024  thorpej Build m68k/support.s on its own; don't include it from locore.s
 1.79 15-Jan-2024  thorpej G/C __HAVE_LEGACY_INTRCNT from luna68k.
 1.78 15-Jan-2024  thorpej No need for our own spurious interrupt handler now that m68k_intr.c
handles them for us.
 1.77 15-Jan-2024  thorpej Switch luna68k over to the common interrupt dispatch code.
 1.76 14-Jan-2024  thorpej Switch luna68k over to the common m68k vector table.
 1.75 12-Jan-2024  thorpej Make getsr() an inline in <m68k/psl.h> and G/C all of the now-redudant
copies.
 1.74 09-Jan-2024  thorpej Statically-initialize the '851 / '030 protorp with MMU51_SRP_BITS. In
pmap_init(), re-initialize protorp with MMU51_CRP_BITS. Remove the now-
redundant code that does this in each of the m68k platforms.
 1.73 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.72 29-Dec-2023  tsutsui Use proper macro for the 030/040 TT registers to map LUNA's I/O spaces.

No binary change.
 1.71 27-Dec-2023  thorpej Stop using magic numbers for the MMU root pointer attributes and the
Translation Control register, and also get rid of "#if PGSHIFT == ..."
where those magic numbers are used.

Instead, define new macros: MMU51_SRP_BITS, MMU51_CRP_BITS, MMU51_TCR_BITS,
and MMU40_TCR_BITS, in terms of the definitions in mmu_{40,51}.h. These
automagically adapt to 8K and 4K pages based on the machine-specific value
of PGSHIFT.
 1.70 26-Dec-2023  thorpej G/C unused ploadw().
 1.69 25-Dec-2023  thorpej loadustp(): Optimize for the overwhelmingly common case of "not the HP MMU".
Rather than converting the level 1 table address to a page number before
calling loadustp() only to have loadustp() convert it back to an address
for the '851, '030, '040, and '060, instead pass the address and convert
to a page number only in the case of the HP MMU.

This is a wash on HP MMU machines (9000/320 and 9000/350), and saves at
least 4 instructions (2x moveq + 2x lsXl) on every context switch on
everything else.
 1.68 10-Jun-2022  tsutsui branches: 1.68.4;
luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.67 30-May-2022  andvar s/identifing/identifying/ and s/multipler/multiplier/ in comments.
 1.66 31-Mar-2021  simonb Adjust the number of entries in the intrcnt array to match the number
of names in the intrnames list.
 1.65 25-Jan-2021  tsutsui branches: 1.65.2;
Remove #undefs against INTERRUPT_SAVEREG and INTERRUPT_RESTOREREG.

They have been defined in <m68k/asm.h> for years.
 1.64 30-Jun-2019  tsutsui branches: 1.64.10;
Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.63 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.62 03-Sep-2015  tsutsui branches: 1.62.16; 1.62.18;
Fix spelling in comments.
 1.61 02-Sep-2015  tsutsui Make kernels build without options M68030.
 1.60 01-Sep-2015  tsutsui Allow NetBSD/luna68k kernel work with 8kB/page (PGSHIFT==13) settings.

Tested on both LUNA (68030) and LUNA-II (68040).
 1.59 22-Mar-2014  tsutsui branches: 1.59.4; 1.59.6; 1.59.10;
Remove obsolete ssir stuff which was used for pre-5.0 softintr(9).
 1.58 15-Mar-2014  tsutsui Use common m68k/busaddrerr.s for bus error and address error handlers.

No binary changes on GENERIC.
 1.57 09-Mar-2014  tsutsui Remove an instruction for nonexistent 060 branch prediction error accounting.

It's amiga and atari specific and copied from amiga/locore.s
to mac68k/locore.s in rev 1.80, then pasted into other ports.
Note this is harmless because all these ports don't have 68060 variants
(i.e. it's inside #if defined(M68060) block) and mvme68k (which has 68060)
has removed it since the initial import.
 1.56 09-Mar-2014  tsutsui Remove unused m68k_fault_addr, which is required only on mac68k for SBC.

It looks hp300 one was copied from mac68k in rev 1.75
and then it was pasted to other ports again and again.
 1.55 31-Jan-2014  tsutsui defined(LKM) -> defined(MODULAR)
 1.54 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Kernel side changes:
- use %d7 (boothowto) and %d6 (bootdev) to pass info and also use
old macro in <sys/reboot.h> as ancient 4.4BSD did for simplicity
- add <machine/bootinfo.h> to define values as API to pass these info
- save boothowto and bootdev in registers right after zero'ing bss
- add MD device_register(9) to check booted_device per passed bootdev info
- merge old bootarg checks in rootconf() and luna68k_init() with
tweaks for backward compatibility
(direct boot a.out kernel from ROM monitor without bootloader still works)
 1.53 23-Sep-2013  tsutsui Remove trailing tabs.
 1.52 21-Jan-2013  tsutsui branches: 1.52.2;
Umm, fix botch in previous.
 1.51 21-Jan-2013  tsutsui Account idepth properly in timer interrupt handler.
 1.50 18-Jan-2013  tsutsui Handle ddb symbol table loaded by the native bootloader properly.
- add a function that check if the symbol table is loaded and
return the table size (taken from sun3/sun3/locore2.c)
- calculate end of symbol table address in locore.s
- call ksym_addsyms_elf() with proper args
 1.49 28-Jul-2012  tsutsui branches: 1.49.2;
Handle bootarg strings passed from firmware prompt properly on LUNA-II.
LUNA-II seems to use a different vector from LUNA to pass bootargs.

Now we can specify RB_ASKNAME and RB_SINGLE at boot on LUNA-II.

Should be pulled up to netbsd-6.
 1.48 23-Jul-2012  tsutsui Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.

Should be pulled up to netbsd-6.
 1.47 22-Dec-2011  tsutsui branches: 1.47.2;
Merge m68881_save() and m68881_restore() (using most common mvme68k ones).
All functions are checked by my eyes, and all GENERIC kernels compile.
 1.46 26-Nov-2011  tsutsui branches: 1.46.2;
Make sure to call pflusha before (not after) enabling MMU on
68030/68851 initialization paths.

Pointed out by isaki@ per observation of ATC status on XM6i emulator.
Tested on TT030, HP362, NWS-1750, and X68030 by me.

XXX: probably we can remove existing pflusha or TBIA calls after MMU turned
XXX: on (and before enabling cache) but I leave them as is for now to avoid
XXX: unexcpected side effects.
 1.45 15-Nov-2011  tsutsui Use now common fpu_probe() and print FPU type per probe result since
it turns out that server and high-end LUNA models actually have MC68882,
not MC68881 as basic and standard models:
http://www.h2.dion.ne.jp/~dogs/collect/ds/luna.html

Also put LUNA model names into cpu_model[] for sysctl(3).
(maybe we don't have to consider sysctl backward compatibility on this port ;-)
 1.44 15-Nov-2011  tsutsui Move spread getsfc() and getdfc() functions into common m68k/support.s.

Note:
- ENTRY_NOPROFILE() is okay since they are used only for debug printf
- they are declared to return int so no need to put a return value into %a0
 1.43 12-Nov-2011  tsutsui Finally complete LUNA-II support, after almost 12 years since
initial import of NetBSD/luna68k.

Note a working LUNA-II machine was found and provided by OMRON guys
after LUNA demonstration at Open Source Conference 2011 Kansai @ Kyoto:
http://mail-index.NetBSD.org/source-changes/2011/07/16/msg024675.html
and this resurrected LUNA-II which runs NetBSD/luna68k -current with Xserver
was also demonstrated on the NetBSD booth at Kansai Open Source 2011:
http://www.NetBSD.org/gallery/events.html#kansai-os-jp-2011

It's really pleasure to meet many OMRON LUNA developers and LUNA users
at the NetBSD booth. Thank you everyone!


Changes details:

luna68k/luna68k/locore.s
- don't use 68030 specific pflusha instruction in 68040 initialization path
- use TBIA() to invalidate TLB instead of 68030's pflusha
after MMU is turned on (as hp300 does)
(these two bugs are fatal at early bootstrap)
- pull loadustp() fixes from hp300/locore.s rev 1.82
(more flush ops are required in it otherwise causes random coredumps)
- specify correct %tt1 mask value
(the mask value means actually bit mask, not transparent range)

luna68k/luna68k/machdep.c
- use proper delay_divisor for 68040 25MHz LUNA-II

luna68k/luna68k/mainbus.c
- prepare and use per-model mainbus device lists for mainbus_attach_args

luna68k/conf/GENERIC
luna68k/conf/INSTALL
- enable options M68040 and FPSP
- enable secondary spc(4) on LUNA-II

luna68k/conf/Makefile.luna68k
- include arch/m68k/fpsp/Makefile.inc for FPSP

luna68k/dev/lcd.c
- promote LUNA-II model on LCD

XXX: old and slow SCSI-1 drives like Hitachi DK312 seems to have
XXX: some problem with spc(4) driver, even on the original LUNA
 1.42 05-Nov-2011  tsutsui Replace two magic numbers with macro via assym.h.
 1.41 05-Nov-2011  tsutsui Sync _delay() with hp300:
- unsigned -> u_int
- use ENTRY_NOPROFILE()
- align main delay loop with 8 byte cacheline boundary
 1.40 05-Nov-2011  tsutsui Remove unused getsp().
 1.39 05-Nov-2011  tsutsui More tweaks.
 1.38 05-Nov-2011  tsutsui Tweak indent and misc comments to reduce diffs from hp300.
 1.37 08-Feb-2011  rmind branches: 1.37.4;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.36 20-Dec-2010  matt branches: 1.36.2; 1.36.4;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.35 06-Jun-2010  mrg fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h. FPSP meantioned
in the PR has already been fixed, and i could not find any more.

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

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
 1.34 25-Feb-2010  skrll branches: 1.34.2;
s/cpu_fork/cpu_lwp_fork/ in comment.
 1.33 13-Dec-2009  tsutsui branches: 1.33.2;
Now we have Sysseg_pa value so no need to calculate it from KVA Sysseg.
Tested on hp300.

XXX: mac68k seems to have a different VA vs PA mechanism so I leave it for now.
 1.32 11-Dec-2009  tsutsui Move uvm_setpagesize() calls from locore.s to pmap_bootstrap_finalize().
Also explicitly set uvmexp.pagesize to prepare 8KB/page settings.

XXX: There is #ifdef !defined(amiga) && !defined(atari) workaround
XXX: because they have different pmap initialization functions.
 1.31 04-Dec-2009  tsutsui Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc.
Also update some comment.
Compile test only.
 1.30 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.29 11-Jan-2009  tsutsui Fix inverted logic on FPU type check in fpfault(). From OpenBSD.
 1.28 17-Oct-2007  garbled branches: 1.28.16; 1.28.20; 1.28.28;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.27 12-Jun-2007  mhitch branches: 1.27.10;
Pass a frame pointer to trap() rather than the 'entire frame' trick. Gcc4
was optimizing away modifications to the frame contents (it's not nice to
trick gcc). Pass the pointer as the first argument to reduce the number
of places that would be changed otherwise. Fixes the getcwd regression
test on most m68k ports.
 1.26 21-May-2007  tsutsui Initialize curlwp as well as lwp0.l_addr right after MMU is enabled.
 1.25 20-May-2007  he Patterned after the changes to atari, restore the luna68k port to a
buildable state after the yamt-idlelwp merge.
Struct cpu_info now must contain ci_want_resched, so get rid of the
global want_resched.
The cpu_need_resched macro now takes two arguments.
We need to declare proc_trampoline() from for the new m68k vm_machdep.c.
The fields l_back and l_forw no longer exists in struct lwp, so excise
their definition from genassym.cf.
Remove the use of the apparently now obsolete m68k/proc_subr.s.
 1.24 04-Mar-2007  tsutsui branches: 1.24.2; 1.24.4; 1.24.10;
Add MI softintr(9) support for luna68k with common m68k/softintr.c.
Compile test only.
 1.23 11-Dec-2005  christos branches: 1.23.24; 1.23.26; 1.23.30;
merge ktrace-lwp.
 1.22 04-Mar-2004  nathanw branches: 1.22.16;
Centralize identical copies of proc_trampoline code.

(lots more opportunites here for the bored hacker, such as rei and trap0...)
 1.21 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.20 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.19 23-Jun-2003  martin branches: 1.19.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.18 27-Apr-2003  ragge Preserve the symbol table in the LKM || KSYMS cases also.
 1.17 08-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.16 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.15 14-May-2002  matt Eliminate commons (including many used ones). Clean up variable references.
 1.14 25-Aug-2001  chs branches: 1.14.6;
add register prefixes. no change in generated .o file.
 1.13 22-Jul-2001  wiz seperate -> separate
 1.12 30-May-2001  lukem branches: 1.12.2;
add missing #include "opt_kgdb.h"
 1.11 26-Nov-2000  jdolecek branches: 1.11.2;
split m68k SunOS and SVR4-specific sigcode.s code to sunos_sigcode.s
and svr4_sigcode.s respectively
adjust individual m68k port's locore.s to include new sigcode files if
appropriate
 1.10 21-Nov-2000  tsutsui Define proper macros for FP frame offsets rather than magic numbers.
 1.9 20-Aug-2000  thorpej branches: 1.9.2;
Add a lock around the scheduler, and use it as necessary, including
in the non-MULTIPROCESSOR case (LOCKDEBUG requires it). Scheduler
lock is held upon entry to mi_switch() and cpu_switch(), and
cpu_switch() releases the lock before returning.

Largely from Bill Sommerfeld, with some minor bug fixes and
machine-dependent code hacking from me.
 1.8 09-Jul-2000  nisimura Comment clarification in this file. Have consistent terminology, ATC
instead of TLB.
 1.7 31-May-2000  thorpej Add a comment on single-processor systems about p_cpu being initialized
by fork1().
 1.6 26-May-2000  thorpej branches: 1.6.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.5 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.4 14-May-2000  minoura defopt FPSP.
 1.3 15-Jan-2000  nisimura Revert to old ROM console I/O code.
 1.2 14-Jan-2000  nisimura Make suline() compilable for 68040.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.6.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.3 08-Dec-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 20-Aug-2000  bouyer file locore.s was added on branch thorpej_scsipi on 2000-11-20 20:10:35 +0000
 1.11.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.12.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.12.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.12.2.1 03-Aug-2001  lukem update to -current
 1.14.6.4 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.14.6.3 20-Jun-2002  nathanw Catch up to -current.
 1.14.6.2 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 1.14.6.1 25-Aug-2001  scw file locore.s was added on branch nathanw_sa on 2001-11-18 18:10:20 +0000
 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.16.1 03-Sep-2007  yamt sync with head.
 1.23.30.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.23.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.23.24.1 18-Jun-2007  liamjfoy Pull up following revision(s) (requested by mhitch in ticket #728):
sys/arch/mvme68k/mvme68k/locore.s: revision 1.98
sys/arch/mac68k/mac68k/trap.c: revision 1.128
sys/arch/next68k/next68k/locore.s: revision 1.48
sys/arch/mac68k/mac68k/locore.s: revision 1.152
sys/arch/sun3/sun3/locore.s: revision 1.88
sys/arch/sun2/sun2/locore.s: revision 1.19
sys/arch/sun2/sun2/trap.c: revision 1.32
sys/arch/m68k/m68k/db_trace.c: revision 1.51
sys/arch/mvme68k/mvme68k/trap.c: revision 1.90
sys/arch/news68k/news68k/trap.c: revision 1.53
sys/arch/luna68k/luna68k/locore.s: revision 1.27
sys/arch/atari/atari/locore.s: revision 1.99
sys/arch/sun3/sun3/trap.c: revision 1.130
sys/arch/x68k/x68k/trap.c: revision 1.89
sys/arch/next68k/next68k/trap.c: revision 1.67
sys/arch/x68k/x68k/locore.s: revision 1.79
sys/arch/news68k/news68k/locore.s: revision 1.43
sys/arch/luna68k/luna68k/trap.c: revision 1.46
sys/arch/hp300/hp300/locore.s: revision 1.140
sys/arch/cesfic/cesfic/locore.s: revision 1.15
sys/arch/cesfic/cesfic/trap.c: revision 1.35
sys/arch/m68k/m68k/trap_subr.s: revision 1.12
sys/arch/amiga/amiga/locore.s: revision 1.143
Pass a frame pointer to trap() rather than the 'entire frame' trick. Gcc4
was optimizing away modifications to the frame contents (it's not nice to
trick gcc). Pass the pointer as the first argument to reduce the number
of places that would be changed otherwise. Fixes the getcwd regression
test on most m68k ports.
 1.24.10.2 26-Jun-2007  garbled Sync with HEAD.
 1.24.10.1 22-May-2007  matt Update to HEAD.
 1.24.4.1 11-Jul-2007  mjf Sync with head.
 1.24.2.2 15-Jul-2007  ad Sync with head.
 1.24.2.1 27-May-2007  ad Sync with head.
 1.27.10.1 06-Nov-2007  matt sync with HEAD
 1.28.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.20.3 11-Aug-2010  yamt sync with head.
 1.28.20.2 11-Mar-2010  yamt sync with head
 1.28.20.1 04-May-2009  yamt sync with head.
 1.28.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.33.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.33.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.34.2.2 05-Mar-2011  rmind sync with head
 1.34.2.1 03-Jul-2010  rmind sync with head
 1.36.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.36.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.37.4.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.37.4.4 23-Jan-2013  yamt sync with head
 1.37.4.3 30-Oct-2012  yamt sync with head
 1.37.4.2 17-Apr-2012  yamt sync with head
 1.37.4.1 10-Nov-2011  yamt sync with head
 1.46.2.1 18-Feb-2012  mrg merge to -current.
 1.47.2.2 31-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #453):
sys/arch/luna68k/luna68k/machdep.c: revision 1.91
sys/arch/luna68k/luna68k/locore.s: revision 1.49
Handle bootarg strings passed from firmware prompt properly on LUNA-II.
LUNA-II seems to use a different vector from LUNA to pass bootargs.
Now we can specify RB_ASKNAME and RB_SINGLE at boot on LUNA-II.
Should be pulled up to netbsd-6.
 1.47.2.1 25-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
 1.49.2.3 03-Dec-2017  jdolecek update from HEAD
 1.49.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.49.2.1 25-Feb-2013  tls resync with head
 1.52.2.1 18-May-2014  rmind sync with head
 1.59.10.1 18-Jan-2017  skrll Sync with netbsd-5
 1.59.6.1 22-Sep-2015  skrll Sync with HEAD
 1.59.4.1 06-Dec-2016  snj Pull up following revision(s) (requested by tsutsui in ticket #1281):
sys/arch/luna68k/luna68k/locore.s: revisions 1.60-1.62
Allow NetBSD/luna68k kernel work with 8kB/page (PGSHIFT==13) settings.
Tested on both LUNA (68030) and LUNA-II (68040).
--
Make kernels build without options M68030.
--
Fix spelling in comments.
 1.62.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.62.18.1 10-Jun-2019  christos Sync with HEAD
 1.62.16.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.64.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.65.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.68.4.1 27-Jun-2024  martin Pull up following revision(s) (requested by rin in ticket #724
to fix build fallout on the branch):

sys/arch/m68k/m68k/compat_16_sigreturn14.s: revision 1.6
sys/arch/mvme68k/mvme68k/locore.s: revision 1.129
sys/arch/news68k/news68k/locore.s: revision 1.84
sys/arch/hp300/hp300/locore.s: revision 1.183
sys/arch/m68k/m68k/compat_13_sigreturn13.s: revision 1.8
sys/arch/m68k/m68k/sigreturn.s: file removal
sys/arch/m68k/include/pte_motorola.h: revision 1.10
sys/arch/atari/atari/locore.s: revision 1.125
sys/arch/amiga/amiga/locore.s: revision 1.169
sys/arch/sun2/sun2/locore.s: revision 1.37
sys/arch/next68k/next68k/locore.s: revision 1.84
sys/arch/x68k/x68k/locore.s: revision 1.130
sys/arch/sun3/sun3x/locore.s: revision 1.77
sys/arch/cesfic/cesfic/locore.s: revision 1.45
sys/arch/m68k/conf/files.m68k: revision 1.53
sys/arch/sun3/sun3/locore.s: revision 1.109
sys/arch/luna68k/luna68k/locore.s: revision 1.81
sys/arch/mac68k/mac68k/locore.s: revision 1.182

Define PTE used in the pmap module int terms of the bit definitions
in mmu_{51,40}.h.

Make compat_13_sigreturn13.s and compat_16_sigreturn14.s build as their
own stand-alone files and G/C the now-empty sigreturn.s.
 1.83.2.1 02-Aug-2025  perseant Sync with HEAD
 1.112 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.111 15-Jan-2024  andvar Fix few typos in comments, mainly s/argment/argument/.
 1.110 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.109 17-Sep-2023  andvar all sunos_exec_aout_makecmds references were removed from machedep back in 1997,
as the code was standardized and moved to sunos_exec_aout.c.

removing this code from luna68k as well, for whatever reason it was missed.

Fixes build with COMPAT_SUNOS enabled for luna68k.
 1.108 09-Oct-2021  tsutsui Call cnpollc(9) before cngetc(9) as the cons(9) man page says.

Currently most ports do nothing in cnpollc(9), but this is required to
handle wskbd(9) .set_leds op in cngetc(9) properly, at least on luna68k.
 1.107 25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.106 11-Jun-2020  ad 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.105 31-Dec-2019  ad Rename uvm_free() -> uvm_availmem().
 1.104 21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.103 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.102 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.101 07-Nov-2017  christos branches: 1.101.2; 1.101.4;
Don't define ELFSIZE
 1.100 09-Mar-2017  tsutsui branches: 1.100.4;
Add a driver for LUNA's front panel LCD. Ported from OpenBSD/luna88k.

Reviewed by enami@. Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.
 1.99 21-Aug-2015  christos branches: 1.99.2; 1.99.4;
- move prototypes to common header file
- rename function to avoid confusion with pseudo-device attach
 1.98 24-Mar-2014  christos branches: 1.98.6;
- use cpu_{g,s}etmodel
- fix unused
 1.97 11-Jan-2014  tsutsui Remove tab nits.
 1.96 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Kernel side changes:
- use %d7 (boothowto) and %d6 (bootdev) to pass info and also use
old macro in <sys/reboot.h> as ancient 4.4BSD did for simplicity
- add <machine/bootinfo.h> to define values as API to pass these info
- save boothowto and bootdev in registers right after zero'ing bss
- add MD device_register(9) to check booted_device per passed bootdev info
- merge old bootarg checks in rootconf() and luna68k_init() with
tweaks for backward compatibility
(direct boot a.out kernel from ROM monitor without bootloader still works)
 1.95 26-Jan-2013  tsutsui branches: 1.95.2;
Whitespace nits.
 1.94 18-Jan-2013  tsutsui Handle ddb symbol table loaded by the native bootloader properly.
- add a function that check if the symbol table is loaded and
return the table size (taken from sun3/sun3/locore2.c)
- calculate end of symbol table address in locore.s
- call ksym_addsyms_elf() with proper args
 1.93 10-Aug-2012  tsutsui branches: 1.93.2;
Appease gcc -fno-common:
- initialize cn_tab at runtime in pre-main luna68k_init()
Tested on LUNA.
 1.92 28-Jul-2012  matt Remove declartions of physmem
 1.91 28-Jul-2012  tsutsui Handle bootarg strings passed from firmware prompt properly on LUNA-II.
LUNA-II seems to use a different vector from LUNA to pass bootargs.

Now we can specify RB_ASKNAME and RB_SINGLE at boot on LUNA-II.

Should be pulled up to netbsd-6.
 1.90 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.89 12-Dec-2011  mrg branches: 1.89.2;
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.88 26-Nov-2011  tsutsui branches: 1.88.2;
Use pmap_kenter_pa(9) to map msgbuf memory which is not managed by VM.
 1.87 26-Nov-2011  tsutsui Clear innmihand flag (for recursion check) when the NMI hander is returned
so that we can abort kernel multiple times even after continue.
 1.86 15-Nov-2011  tsutsui Use now common fpu_probe() and print FPU type per probe result since
it turns out that server and high-end LUNA models actually have MC68882,
not MC68881 as basic and standard models:
http://www.h2.dion.ne.jp/~dogs/collect/ds/luna.html

Also put LUNA model names into cpu_model[] for sysctl(3).
(maybe we don't have to consider sysctl backward compatibility on this port ;-)
 1.85 12-Nov-2011  tsutsui Finally complete LUNA-II support, after almost 12 years since
initial import of NetBSD/luna68k.

Note a working LUNA-II machine was found and provided by OMRON guys
after LUNA demonstration at Open Source Conference 2011 Kansai @ Kyoto:
http://mail-index.NetBSD.org/source-changes/2011/07/16/msg024675.html
and this resurrected LUNA-II which runs NetBSD/luna68k -current with Xserver
was also demonstrated on the NetBSD booth at Kansai Open Source 2011:
http://www.NetBSD.org/gallery/events.html#kansai-os-jp-2011

It's really pleasure to meet many OMRON LUNA developers and LUNA users
at the NetBSD booth. Thank you everyone!


Changes details:

luna68k/luna68k/locore.s
- don't use 68030 specific pflusha instruction in 68040 initialization path
- use TBIA() to invalidate TLB instead of 68030's pflusha
after MMU is turned on (as hp300 does)
(these two bugs are fatal at early bootstrap)
- pull loadustp() fixes from hp300/locore.s rev 1.82
(more flush ops are required in it otherwise causes random coredumps)
- specify correct %tt1 mask value
(the mask value means actually bit mask, not transparent range)

luna68k/luna68k/machdep.c
- use proper delay_divisor for 68040 25MHz LUNA-II

luna68k/luna68k/mainbus.c
- prepare and use per-model mainbus device lists for mainbus_attach_args

luna68k/conf/GENERIC
luna68k/conf/INSTALL
- enable options M68040 and FPSP
- enable secondary spc(4) on LUNA-II

luna68k/conf/Makefile.luna68k
- include arch/m68k/fpsp/Makefile.inc for FPSP

luna68k/dev/lcd.c
- promote LUNA-II model on LCD

XXX: old and slow SCSI-1 drives like Hitachi DK312 seems to have
XXX: some problem with spc(4) driver, even on the original LUNA
 1.84 17-Oct-2011  tsutsui branches: 1.84.2;
Print LUNA model name (not only CPU/MMU/FPU) on boot as 4.4BSD Lite2 does.
 1.83 17-Oct-2011  tsutsui LUNA has 68030+68881, not 68882.

XXX: we should have a common fpu_probe() function among all m68k ports.
 1.82 28-Jul-2011  tsutsui Use volatile uint8_t to access 8255 PPI ports.
 1.81 28-Jul-2011  tsutsui KNF, use ANSI decls, remove an obsolete hack, misc cosmetics etc.
 1.80 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.79 16-May-2011  tsutsui branches: 1.79.2;
- merge and move pasted m68k MD setreg() functions into m68k/m68k_machdep.c
- move m68881_save() and m68881_restore() declarations into <m68k/m68k.h>

Briefly tested and no obvious breakage on atari, sun3, and x68k.
 1.78 04-Mar-2011  joerg Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.77 17-Jan-2011  tsutsui branches: 1.77.2;
Explicitly include <machine/pcb.h> for struct pcb.
 1.76 16-Oct-2010  tsutsui branches: 1.76.2;
Prepare empty module_init_md() for options MODULAR for all other m68k ports.
 1.75 06-Jun-2010  mrg fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h. FPSP meantioned
in the PR has already been fixed, and i could not find any more.

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

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
 1.74 08-Feb-2010  joerg branches: 1.74.2;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.73 10-Dec-2009  matt branches: 1.73.2;
Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.
 1.72 23-Nov-2009  rmind Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.71 26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.70 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.69 18-Mar-2009  cegger bcopy -> memcpy
 1.68 18-Mar-2009  cegger bzero -> memset
 1.67 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.66 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.65 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.64 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.63 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.62 21-Jan-2009  he branches: 1.62.2;
Re-adapt to the changed return types for major() and minor().
 1.61 17-Jan-2009  he Umm, add two spaces which accidentally was left by the wayside.
 1.60 17-Jan-2009  he Print dev_t with PRIu64 instead of llu, suggested by mhitch@.
 1.59 17-Jan-2009  he Print dev_t (from major() and minor()) with %llu.
 1.58 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.57 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.56 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.55 02-Jul-2008  ad branches: 1.55.2; 1.55.4;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.
 1.54 28-Apr-2008  martin branches: 1.54.2; 1.54.4;
Remove clause 3 and 4 from TNF licenses
 1.53 17-Oct-2007  garbled branches: 1.53.16; 1.53.18; 1.53.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.52 21-May-2007  tsutsui branches: 1.52.10;
curlwp can't be NULL so no need to check it.
 1.51 05-Mar-2007  tsutsui branches: 1.51.2; 1.51.4; 1.51.10;
Allocate msgbufaddr in pmap_bootstrap.c where it's initilized,
and move its declaration into <m68k/pmap_motorola.h>.
 1.50 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.49 28-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.48 09-Feb-2007  ad branches: 1.48.2;
Merge newlock2 to head.
 1.47 21-Oct-2006  mrg in cpu_dumpconf(), don't panic() if we can't bdevsw_lookup() the
dumpdev. this occurs when we try to set the dumpdev to a device
with no driver loaded. this fixes PR#34872.

in sys_swapctl, if bdevsw_lookup() fails, set dumpdev = NODEV
before calling cpu_dumpconf(). (this also fixes PR#34872.)

XXX: cpu_dumpconf() should probably be changed to take a dumpdev
XXX: and return an error in such cases, but that is a much more
XXX: intrusive change.

XXX2: this is only run-tested on sparc64 and compile tested on a
XXX2: couple of platforms.
 1.46 14-Sep-2006  gdamore branches: 1.46.2;
Update luna68k to MI todr and timecounters.
 1.45 04-Aug-2006  mhitch branches: 1.45.4;
gcc4 fix: correct declaration of 'end'.
 1.44 24-Dec-2005  perry branches: 1.44.4; 1.44.8;
bare asm -> __asm
 1.43 11-Dec-2005  christos merge ktrace-lwp.
 1.42 30-Oct-2005  chs fix crash dumps on m68k platforms, cpu_kcore_hdr_t is larger than
512 bytes now so we need a bigger buffer. PR 26958.
 1.41 05-Jun-2005  he branches: 1.41.2; 1.41.4;
Adapt to compiling with -Wcast-qual by sprinkling consts around.
 1.40 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.39 11-Feb-2005  yamt branches: 1.39.4;
remove uvm_map_protect from cpu_startup of several ports.
- they shouldn't be needed with the current fault handler.
- they causes assertion failure with the recent vm_map implementation.

discussed on tech-kern@. reviewed by Chuck Silvers.
PR/29179 from Julio M. Merino Vidal.
 1.38 24-Mar-2004  atatat branches: 1.38.8; 1.38.10;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.37 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.36 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.35 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.34 27-Sep-2003  cl Cast through (void *) to appease gcc3.
 1.33 29-Jun-2003  fvdl branches: 1.33.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.32 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.31 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.30 10-May-2003  thorpej Back out the following chagne:
http://mail-index.netbsd.org/source-changes/2003/05/08/0068.html

There were some side-effects that I didn't anticipate, and fixing them
is proving to be more difficult than I thought, do just eject for now.
Maybe one day we can look at this again.

Fixes PR kern/21517.
 1.29 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.28 26-Apr-2003  ragge Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)
 1.27 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.26 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.25 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.24 19-Sep-2002  ragge Do not include <sys/clist.h>, it's not used in NetBSD at all.
 1.23 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.22 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.21 20-Mar-2002  christos branches: 1.21.4;
kill remaining PS_STRINGS instances.
 1.20 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.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 25-Aug-2001  chs branches: 1.18.2;
add register prefixes in asms.
 1.17 02-Jun-2001  chs branches: 1.17.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.16 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.15 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.14 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.13 12-Dec-2000  nisimura branches: 1.13.2;
Relocate boot flag detection from consinit() to more logical place.
 1.12 24-Sep-2000  jdolecek branches: 1.12.2;
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.11 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.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 05-Jun-2000  jhawk Do not clear msgbufenabled in dumpsys(). Dump messages will now go to
the message buffer. This can be invaluable in debugging if the dump
fails (assuming a persistant message buffer)
 1.7 26-May-2000  thorpej branches: 1.7.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.6 28-Mar-2000  simonb Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.5 26-Mar-2000  kleink Merge parts of chs-ubc2 into the trunk:
* Remove the casts to vaddr_t from the round_page() and trunc_page() macros to
make them type-generic, which is necessary i.e. to operate on file offsets
without truncating them.
* In due course, cast pointer arguments to these macros to an appropriate
integral type (paddr_t, vaddr_t).

Originally done by Chuck Silvers, updated by myself.
 1.4 19-Jan-2000  thorpej Move callout initialization to a single location; no need to duplicate
that code all over the place.
 1.3 19-Jan-2000  msaitoh check whether tv_usec >= 1000000
 1.2 15-Jan-2000  nisimura Revert to old ROM console I/O code.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.12.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.12.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.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.12.2.1 24-Sep-2000  bouyer file machdep.c was added on branch thorpej_scsipi on 2000-11-20 20:10:35 +0000
 1.13.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.13.2.1 09-Apr-2001  nathanw 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 16-Mar-2002  jdolecek Catch up with -current.
 1.17.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.19.4.10 18-Oct-2002  nathanw Catch up to -current.
 1.19.4.9 17-Sep-2002  nathanw Catch up to -current.
 1.19.4.8 27-Aug-2002  nathanw Catch up to -current.
 1.19.4.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.19.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.19.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.19.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.19.4.3 02-Dec-2001  scw If an FPU is available, call m68k_make_fpu_idle_frame() to generate
a reference FPU idle frame.
 1.19.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 1.19.4.1 10-Sep-2001  scw file machdep.c was added on branch nathanw_sa on 2001-11-18 18:10:20 +0000
 1.21.4.2 31-Aug-2002  gehenna catch up with -current.
 1.21.4.1 17-May-2002  gehenna Replace the access to devsw table and the hard-coded major with devsw API.
 1.33.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.2.5 15-Feb-2005  skrll Sync with HEAD.
 1.33.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.33.2.2 03-Aug-2004  skrll Sync with HEAD
 1.33.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.38.10.1 12-Feb-2005  yamt sync with head.
 1.38.8.1 29-Apr-2005  kent sync with -current
 1.39.4.1 01-Nov-2005  tron Pull up following revision(s) (requested by chs in ticket #923):
sys/arch/next68k/next68k/machdep.c: revision 1.73
sys/arch/luna68k/luna68k/machdep.c: revision 1.42
sys/arch/hp300/hp300/machdep.c: revision 1.184
sys/arch/amiga/amiga/machdep.c: revision 1.193
sys/arch/x68k/x68k/machdep.c: revision 1.129
sys/arch/mac68k/mac68k/machdep.c: revision 1.306
sys/arch/news68k/news68k/machdep.c: revision 1.61
sys/arch/mvme68k/mvme68k/machdep.c: revision 1.113
sys/arch/atari/atari/atari_init.c: revision 1.63
fix crash dumps on m68k platforms, cpu_kcore_hdr_t is larger than
512 bytes now so we need a bigger buffer. PR 26958.
 1.41.4.1 02-Nov-2005  yamt sync with head.
 1.41.2.4 03-Sep-2007  yamt sync with head.
 1.41.2.3 26-Feb-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.44.8.1 11-Aug-2006  yamt sync with head
 1.44.4.1 09-Sep-2006  rpaulo sync with head
 1.45.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.45.4.1 18-Nov-2006  ad Sync with head.
 1.46.2.1 22-Oct-2006  yamt sync with head
 1.48.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.51.10.1 22-May-2007  matt Update to HEAD.
 1.51.4.1 11-Jul-2007  mjf Sync with head.
 1.51.2.1 27-May-2007  ad Sync with head.
 1.52.10.1 06-Nov-2007  matt sync with HEAD
 1.53.20.5 11-Aug-2010  yamt sync with head.
 1.53.20.4 11-Mar-2010  yamt sync with head
 1.53.20.3 19-Aug-2009  yamt sync with head.
 1.53.20.2 04-May-2009  yamt sync with head.
 1.53.20.1 16-May-2008  yamt sync with head.
 1.53.18.1 18-May-2008  yamt sync with head.
 1.53.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.53.16.2 02-Jul-2008  mjf Sync with HEAD.
 1.53.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.54.4.1 03-Jul-2008  simonb Sync with head.
 1.54.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.54.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.54.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.55.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.55.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.55.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.55.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.62.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.73.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.73.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.73.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.74.2.5 31-May-2011  rmind sync with head
 1.74.2.4 05-Mar-2011  rmind sync with head
 1.74.2.3 03-Jul-2010  rmind sync with head
 1.74.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.74.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.76.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.77.2.1 05-Mar-2011  bouyer Sync with HEAD
 1.79.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.84.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.84.2.3 23-Jan-2013  yamt sync with head
 1.84.2.2 30-Oct-2012  yamt sync with head
 1.84.2.1 17-Apr-2012  yamt sync with head
 1.88.2.1 18-Feb-2012  mrg merge to -current.
 1.89.2.1 31-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #453):
sys/arch/luna68k/luna68k/machdep.c: revision 1.91
sys/arch/luna68k/luna68k/locore.s: revision 1.49
Handle bootarg strings passed from firmware prompt properly on LUNA-II.
LUNA-II seems to use a different vector from LUNA to pass bootargs.
Now we can specify RB_ASKNAME and RB_SINGLE at boot on LUNA-II.
Should be pulled up to netbsd-6.
 1.93.2.3 03-Dec-2017  jdolecek update from HEAD
 1.93.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.93.2.1 25-Feb-2013  tls resync with head
 1.95.2.1 18-May-2014  rmind sync with head
 1.98.6.2 28-Aug-2017  skrll Sync with HEAD
 1.98.6.1 22-Sep-2015  skrll Sync with HEAD
 1.99.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.99.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.99.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.100.4.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.101.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.101.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.101.4.1 10-Jun-2019  christos Sync with HEAD
 1.101.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.21 23-Apr-2023  tsutsui Explicitly check machine type (LUNA-II) on secondary spc(4) probe.

So that individual mainbus_attach_args for both LUNA and LUNA-II
are no longer necessary.
While here, use proper address macro in <machine/board.h>.

Tested on both LUNA and LUNA-II.
 1.20 13-Apr-2023  tsutsui Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.
 1.19 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.18 10-Jun-2022  tsutsui branches: 1.18.4;
luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
https://www.youtube.com/watch?v=fR7PqaLpijQ
https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
https://github.com/isaki68k/netbsd-src/tree/audio2
https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!
 1.17 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.16 24-Apr-2021  thorpej branches: 1.16.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.15 09-Mar-2017  tsutsui branches: 1.15.18; 1.15.28;
Add a driver for LUNA's front panel LCD. Ported from OpenBSD/luna88k.

Reviewed by enami@. Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.
 1.14 03-Dec-2016  tsutsui branches: 1.14.2;
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).

Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.13 11-Jan-2014  tsutsui branches: 1.13.4; 1.13.6; 1.13.10; 1.13.12;
Use the same address as LUNA to probe LANCE on LUNA-II.

It looks the device is mapped at both regions.
4.4BSD/luna68k probes it at 0xf1000000, but UniOS-Mach for LUNA-II
attaches the lance at 0xf0000000. It is probably because
the UniOS needs to map DS1220 NVRAM (mapped at 0xf1000004 and
used to store the MAC address) to the different kernel page,
but there is no reason for us to use different addresses.
(Note our bootloader already use the same address for both machines.)

This change will make (forthcoming) booted device check easier.
 1.12 23-Sep-2013  tsutsui Misc cleanup.

- use bool instead of int
- avoid an assignment as a value with extra parentheses
- use aprint_normal(9) for attach message
- remove parentheses from return value
 1.11 23-Sep-2013  tsutsui Remove trailing tabs.
 1.10 12-Nov-2011  tsutsui branches: 1.10.10; 1.10.14;
Finally complete LUNA-II support, after almost 12 years since
initial import of NetBSD/luna68k.

Note a working LUNA-II machine was found and provided by OMRON guys
after LUNA demonstration at Open Source Conference 2011 Kansai @ Kyoto:
http://mail-index.NetBSD.org/source-changes/2011/07/16/msg024675.html
and this resurrected LUNA-II which runs NetBSD/luna68k -current with Xserver
was also demonstrated on the NetBSD booth at Kansai Open Source 2011:
http://www.NetBSD.org/gallery/events.html#kansai-os-jp-2011

It's really pleasure to meet many OMRON LUNA developers and LUNA users
at the NetBSD booth. Thank you everyone!


Changes details:

luna68k/luna68k/locore.s
- don't use 68030 specific pflusha instruction in 68040 initialization path
- use TBIA() to invalidate TLB instead of 68030's pflusha
after MMU is turned on (as hp300 does)
(these two bugs are fatal at early bootstrap)
- pull loadustp() fixes from hp300/locore.s rev 1.82
(more flush ops are required in it otherwise causes random coredumps)
- specify correct %tt1 mask value
(the mask value means actually bit mask, not transparent range)

luna68k/luna68k/machdep.c
- use proper delay_divisor for 68040 25MHz LUNA-II

luna68k/luna68k/mainbus.c
- prepare and use per-model mainbus device lists for mainbus_attach_args

luna68k/conf/GENERIC
luna68k/conf/INSTALL
- enable options M68040 and FPSP
- enable secondary spc(4) on LUNA-II

luna68k/conf/Makefile.luna68k
- include arch/m68k/fpsp/Makefile.inc for FPSP

luna68k/dev/lcd.c
- promote LUNA-II model on LCD

XXX: old and slow SCSI-1 drives like Hitachi DK312 seems to have
XXX: some problem with spc(4) driver, even on the original LUNA
 1.9 05-Jun-2011  matt branches: 1.9.2;
struct device * -> device_t, struct cfdata * -> cfdata_t
CFATTACH_DECL(*, sizeof(struct device), -> CFATTACH_DECL_NEW(&, 0
 1.8 14-Mar-2009  dsl branches: 1.8.4; 1.8.6; 1.8.10;
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.7 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.6 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.5 28-Apr-2008  martin branches: 1.5.8; 1.5.14;
Remove clause 3 and 4 from TNF licenses
 1.4 01-Jan-2003  thorpej branches: 1.4.104; 1.4.106; 1.4.108;
Use aprint_normal() for cfprint routines.
 1.3 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 07-Jan-2000  nisimura branches: 1.2.6; 1.2.10; 1.2.14;
- Make SCSI work; by kludges of machine/bus.h. TEAC streamer tape drive
found to be tweaked. Need extensive verifications.
- Add wsmouse node under ws; not useful this moment.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.14.2 03-Jan-2003  thorpej Sync with HEAD.
 1.2.14.1 18-Oct-2002  nathanw Catch up to -current.
 1.2.10.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 07-Jan-2000  bouyer file mainbus.c was added on branch thorpej_scsipi on 2000-11-20 20:10:35 +0000
 1.4.108.2 04-May-2009  yamt sync with head.
 1.4.108.1 16-May-2008  yamt sync with head.
 1.4.106.1 18-May-2008  yamt sync with head.
 1.4.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.8.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8.4.1 12-Jun-2011  rmind sync with head
 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 17-Apr-2012  yamt sync with head
 1.10.14.1 18-May-2014  rmind sync with head
 1.10.10.2 03-Dec-2017  jdolecek update from HEAD
 1.10.10.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.12.1 18-Jan-2017  skrll Sync with netbsd-5
 1.13.10.2 20-Mar-2017  pgoyette Sync with HEAD
 1.13.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.13.6.2 28-Aug-2017  skrll Sync with HEAD
 1.13.6.1 05-Dec-2016  skrll Sync with HEAD
 1.13.4.1 06-Dec-2016  snj Pull up following revision(s) (requested by tsutsui in ticket #1283):
distrib/sets/lists/comp/md.luna68k: revision 1.21
etc/etc.luna68k/MAKEDEV.conf: revision 1.9
sys/arch/luna68k/conf/GENERIC: revision 1.120
sys/arch/luna68k/conf/files.luna68k: revision 1.25
sys/arch/luna68k/conf/majors.luna68k: revision 1.21
sys/arch/luna68k/dev/xp.c: revision 1.1
sys/arch/luna68k/include/Makefile: revision 1.19
sys/arch/luna68k/include/xpio.h: revision 1.1
sys/arch/luna68k/luna68k/mainbus.c: revision 1.14
Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).
Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
 1.14.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.15.28.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.15.18.2 19-Apr-2023  martin Backout accidental commit (branch/ticket mismatch)
 1.15.18.1 19-Apr-2023  martin Pull up following revision(s) (requested by tsutsui in ticket #1627):

sys/arch/luna68k/luna68k/mainbus.c: revision 1.20

Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.
 1.16.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.18.4.1 19-Apr-2023  martin Pull up following revision(s) (requested by tsutsui in ticket #142):

sys/arch/luna68k/luna68k/mainbus.c: revision 1.20

Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.
 1.17 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.16 08-Feb-2011  rmind branches: 1.16.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.15 14-Mar-2009  dsl branches: 1.15.2; 1.15.4; 1.15.6; 1.15.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.14 19-Dec-2008  cegger branches: 1.14.2;
use M_ZERO on malloc() and remove subsequent bzero().
 1.13 04-Mar-2007  tsutsui branches: 1.13.40; 1.13.44; 1.13.52;
Remove an unnecessary cast and use (char *) on pointer arith.
 1.12 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.26;
merge ktrace-lwp.
 1.10 07-Aug-2003  agc branches: 1.10.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 02-Apr-2003  thorpej branches: 1.9.2;
Use PAGE_SIZE rather than NBPG.
 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 27-Feb-2002  christos branches: 1.6.8;
- Use DEV_ constants, instead of documenting the numbers!
- Delete cdev_decl(mm); where appropriate, and other hand-crufting [hi powerpc!]
 1.5 10-Sep-2001  chris branches: 1.5.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.4 24-Apr-2001  thorpej branches: 1.4.2; 1.4.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.3 29-Jun-2000  mrg branches: 1.3.2; 1.3.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 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.1 05-Jan-2000  nisimura branches: 1.1.4;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.3.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 29-Jun-2000  bouyer file mem.c was added on branch thorpej_scsipi on 2000-11-20 20:10:35 +0000
 1.4.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.4.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.4.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.5.4.4 11-Nov-2002  nathanw Catch up to -current
 1.5.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.5.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.5.4.1 10-Sep-2001  nathanw file mem.c was added on branch nathanw_sa on 2002-02-28 04:10:33 +0000
 1.6.8.1 17-May-2002  gehenna Add the character device switch.
 1.9.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 03-Sep-2007  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.52.2 28-Apr-2009  skrll Sync with HEAD.
 1.13.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.44.1 04-May-2009  yamt sync with head.
 1.13.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.13.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.14.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.15.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.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.15.2.1 30-Oct-2010  uebayasi Implement pmap_physload_device(9) to replace xmd(4) MD backend.
Implement pmap_mmap(9) and use it from mem(4) and xmd(4).
 1.16.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.27 05-Nov-2002  chs merge pmap.c for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.26 14-Oct-2002  chs merge pte.h for m68k w/ motorola or compatible MMU
(only 4k-page platforms so far).
 1.25 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.24 22-May-2002  drochner Subtract vm_map_min(kernel_map) from kernel virtual addresses to get offsets
into kernel_object where this was missing.
This is a no-op on ports where VM_MIN_KERNEL_ADDRESS==0, ie all but
cesfic.
Confirmed and corrected by Chuck Silvers.
 1.23 08-Mar-2002  thorpej branches: 1.23.6;
Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map). Try to deal with this:

* Group all information about the backend allocator for a pool in a
separate structure. The pool references this structure, rather than
the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
to become available, but will still fail if it cannot callocate KVA
space for the pages. If this happens, carefully drain all pools using
the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
some pages, and use that information to make draining easier and more
efficient.
* Get rid of PR_URGENT. There was only one use of it, and it could be
dealt with by the caller.

From art@openbsd.org.
 1.22 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.21 16-Dec-2001  tsutsui Fix comments for ref-count of PT pages.
 1.20 13-Dec-2001  chs change the reference-counting of PT pages to start from zero instead of
one, so that we don't mess up the global count of wired pages by having
the page's wire_count be non-zero when we free the page.
pointed out by Michael Hitch.
 1.19 24-Nov-2001  isaki fix typo s/68551/68851/ in a comment.
 1.18 19-Nov-2001  chs allocate and free page table pages explicitly instead of abusing
uvm_fault_wire(). this allows us to make pt_map non-pageable,
but we need to be careful in pmap_remove() not to attempt to
reference PTEs after the PTP has been freed.
 1.17 29-Sep-2001  chs branches: 1.17.4;
fix typo in pmap_kremove() which was invalidating the wrong TLB entry.
from Hiroki Tanikawa in PR 14099.
 1.16 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.15 17-Aug-2001  chs branches: 1.15.2;
implement pmap_k{enter_pa,remove}() correctly.
remove various checks for impossible conditions.
other misc cleanup.
tested by tohru.
 1.14 02-Jun-2001  chs branches: 1.14.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.13 26-May-2001  chs 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 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.10 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.9 21-Apr-2001  thorpej pmap_update() should not be equated with "flush entire TLB", it is
used to process deferred pmap operations. Since these pmaps don't
defer anything, pmap_update() is a noop.
 1.8 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.7 14-Jan-2001  thorpej branches: 1.7.2;
splimp() -> splvm()
 1.6 13-Sep-2000  thorpej branches: 1.6.2;
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.5 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 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.3 26-Mar-2000  kleink Merge parts of chs-ubc2 into the trunk:
* Remove the casts to vaddr_t from the round_page() and trunc_page() macros to
make them type-generic, which is necessary i.e. to operate on file offsets
without truncating them.
* In due course, cast pointer arguments to these macros to an appropriate
integral type (paddr_t, vaddr_t).

Originally done by Chuck Silvers, updated by myself.
 1.2 11-Jan-2000  nisimura Use explicit 68040 calls for cache manipulations.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.6.2.5 23-Apr-2001  bouyer Sync with HEAD.
 1.6.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.6.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 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 13-Sep-2000  bouyer file pmap.c was added on branch thorpej_scsipi on 2000-11-20 20:10:35 +0000
 1.7.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.7.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.14.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.14.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.14.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.14.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.15.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.4.10 11-Nov-2002  nathanw Catch up to -current
 1.17.4.9 18-Oct-2002  nathanw Catch up to -current.
 1.17.4.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.17.4.7 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.17.4.6 20-Jun-2002  nathanw Catch up to -current.
 1.17.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.17.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.17.4.3 04-Dec-2001  scw Missed a s/proc/lwp/ with DEBUG defined.
Noted by Gregory McGarry in a commit messsage for hp300.
 1.17.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 1.17.4.1 29-Sep-2001  scw file pmap.c was added on branch nathanw_sa on 2001-11-18 18:10:20 +0000
 1.23.6.1 30-May-2002  gehenna Catch up with -current.
 1.38 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.37 22-Dec-2016  cherry physmem should be of type psize_t

Also, use PRIxPSIZE when printf(9)ing physmem.
 1.36 26-Jan-2013  tsutsui branches: 1.36.14; 1.36.18;
Whitespace nits.
 1.35 10-Feb-2012  mhitch branches: 1.35.6;
Sigh, it's been too long since I've done some of this. Fix the RELOC().
 1.34 10-Feb-2012  mhitch Oops - have to RELOC(physmem) here.
 1.33 10-Feb-2012  mhitch The recent kmem changes allocate a large kernel address space before
pmap_init() is called, and the initial kernel PT pages aren't enough
for the allocations pmap_init(). This fails because pmap_kenter_pa()
tries to allocate a new kernel PT page and traps because the pmap has
not been initialized. When computing the number if initial kernel PT
pages, include enough to allow kmem to map the physical memory. This
should fix PR/45915. OK by releng@. One mac68k system has been verified
to boot. Volunteers to test the others welcome. Amigas with at least
up to 128MB of memory were OK, but larger memory will need some adjusting.
 1.32 02-Jan-2011  tsutsui branches: 1.32.8; 1.32.12;
Tidy up common comments. (Yes, too many dup code...)
 1.31 02-Jan-2011  tsutsui Pull code that maps the kernel segment table cache invalidated for 040/060,
to reduce diffs from other m68k ports.

Compile test only. (any working machine for these port?)
 1.30 02-Jan-2011  tsutsui Misc cosmetics to reduce diff among hp300 derived m68k ports.
XXX: too many quirks to merge...
 1.29 02-Jan-2011  tsutsui Fix one more fatal typo. Umm.
 1.28 06-Jun-2010  mrg fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h. FPSP meantioned
in the PR has already been fixed, and i could not find any more.

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

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
 1.27 11-Dec-2009  tsutsui branches: 1.27.2; 1.27.4;
Use appropriate macro during pmap initialization:
- use SYSMAP_VA, SEGSHIFT for Sysmap address and table entries
- use TIA_SIZE, TIB_SIZE for sizes of table entries

Now page size dependent numbers are almost replaced with proper macro.

Tested on atari, hp300, and news68k.
 1.26 11-Dec-2009  tsutsui Fix (probably fatal) typo on yamt-km merge back on 2005.
 1.25 06-Dec-2009  tsutsui Move initialization of protection_codes[] and kernel_pmap()
from MD pmap bootstrap sources to common pmap_bootstrap_finalize().

Tested on atari, hp300, mac68k, and news68k.

XXX: Why is protection_codes[] array initialized at run time?
 1.24 06-Dec-2009  tsutsui Sync MMU table initialization with amiga and atari a bit:

- for 040/060, move L2 descs for Sysptmap from the last L2 block in segment
table pages to the contiguous block with ones for segment table mappings

- for 020/030, invalidate ste and pte entries separately since
ste size (TIA_SIZE) and pte size (TIB_SIZE) could be different
on 8KB/page systems

Tested on hp300 (040), mac68k (LC040), and news68k (030)
(and untested on others).

XXX: some more stuff in pmap_bootstrap.c could be moved into
XXX: common pmap_bootstrap_finalize()?
 1.23 05-Dec-2009  tsutsui Use proper macro, variable names, types, and assignments for readability.
 1.22 04-Dec-2009  tsutsui Allocate lwp0upa (PA of lwp0 uarea) right after kernel rather than
between other page tables to use different mappings for ste/pte pages
as well as amiga and atari. Should resolve XXX comments in next68k and x68k.

Tested on hp300 and mac68k.
 1.21 04-Dec-2009  tsutsui No need to initialize lwp0 u-area in pmap_bootstrap()
since it will be done in pmap_bootstrap_finalize().
 1.20 04-Dec-2009  tsutsui Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc.
Also update some comment.
Compile test only.
 1.19 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.18 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.17 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.16 17-Jan-2009  tsutsui branches: 1.16.2;
Move extern decls for Sysseg, Sysptmap, Sysptsize, mem_size, virtual_avail,
virtual_end, and protection_codes[] to common <m68k/pmap_motorola.h>,
and also make protection_codes[] unsigned.

XXX: avail_start and avail_end should also be moved, but it causes
XXX: -Wshadow warnings in uvm/uvm_page.c:uvm_page_physload() and
XXX: I don't have a good idea of alternative names for now.
 1.15 28-Dec-2008  tsutsui Use the global kernel_pmap_ptr pointer in each MD pmap_bootstrap.c
(where MMU is not enabled yet) and make kernel_pmap_store static again.
Also consistently use uintptr_t on address conversion in RELOC() macro.

Tested on hp300 (PA != VA) and news68k (PA == VA).
 1.14 17-Oct-2007  garbled branches: 1.14.16; 1.14.20; 1.14.28;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.13 18-May-2007  tsutsui branches: 1.13.10;
Update comments to sync yamt-km merge (Sysmap has been moved).

See also:
http://mail-index.netbsd.org/source-changes/2005/02/23/0004.html
 1.12 05-Mar-2007  tsutsui branches: 1.12.2; 1.12.4; 1.12.10;
Allocate msgbufaddr in pmap_bootstrap.c where it's initilized,
and move its declaration into <m68k/pmap_motorola.h>.
 1.11 04-Mar-2007  tsutsui - add missed '*'
- vmmap is (char *) in pmap_motorola.h
 1.10 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 11-Dec-2005  christos branches: 1.9.26;
merge ktrace-lwp.
 1.8 01-Apr-2005  yamt branches: 1.8.2;
merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.7 07-Aug-2003  agc branches: 1.7.8; 1.7.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 15-Jul-2003  lukem __KERNEL_RCSID()
 1.5 02-Apr-2003  thorpej branches: 1.5.2;
Use PAGE_SIZE rather than NBPG.
 1.4 05-Nov-2002  chs merge pmap.c for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.3 12-Dec-2000  nisimura branches: 1.3.8;
This file is a replicant of hp300. The following is peculair to
the original HPBSD implementation and HP hardware design.

* Portions of the last segment of KVA space (0xFFF00000 -
* 0xFFFFFFFF) are mapped for a couple of purposes. 0xFFF00000
* for UPAGES is used for mapping the current process u-area
* (u + kernel stack). The very last page (0xFFFFF000) is mapped
* to the last physical page of RAM to give us a region in which
* PA == VA. We use the first part of this page for enabling
* and disabling mapping. The last part of this page also contains
* info left by the boot ROM.

Nuke lptpa because that is irrelavant for LUNA.
Put #if defined(M68040) for consistency postponing efforts of LUNA-2.
 1.2 29-Jun-2000  mrg branches: 1.2.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 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 29-Jun-2000  bouyer file pmap_bootstrap.c was added on branch thorpej_scsipi on 2000-11-20 20:10:36 +0000
 1.3.8.1 11-Nov-2002  nathanw Catch up to -current
 1.5.2.4 01-Apr-2005  skrll Sync with HEAD.
 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.10.5 19-Mar-2005  yamt make this compilable.
 1.7.10.4 19-Mar-2005  yamt move Sysmap to avoid TTR ranges.
 1.7.10.3 27-Feb-2005  tsutsui Fix typo. (s/PG_/SG_/ fot Sysptmap ste)
 1.7.10.2 26-Feb-2005  yamt initialize the last ste for Sysmap.
 1.7.10.1 24-Feb-2005  yamt - remove stale(?) references to lkptpa in #if defined(M68040) block.
- change kernel va layout, following mac68k.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.2.1 03-Sep-2007  yamt sync with head.
 1.9.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.10.1 22-May-2007  matt Update to HEAD.
 1.12.4.1 11-Jul-2007  mjf Sync with head.
 1.12.2.1 27-May-2007  ad Sync with head.
 1.13.10.1 06-Nov-2007  matt sync with HEAD
 1.14.28.2 28-Apr-2009  skrll Sync with HEAD.
 1.14.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.20.3 11-Aug-2010  yamt sync with head.
 1.14.20.2 11-Mar-2010  yamt sync with head
 1.14.20.1 04-May-2009  yamt sync with head.
 1.14.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.16.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27.4.2 05-Mar-2011  rmind sync with head
 1.27.4.1 03-Jul-2010  rmind sync with head
 1.27.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.32.12.1 18-Feb-2012  mrg merge to -current.
 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 17-Apr-2012  yamt sync with head
 1.35.6.2 03-Dec-2017  jdolecek update from HEAD
 1.35.6.1 25-Feb-2013  tls resync with head
 1.36.18.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.36.14.1 05-Feb-2017  skrll Sync with HEAD
 1.4 14-Nov-2004  christos Delete copy of empty function.
 1.3 15-Jul-2003  lukem __KERNEL_RCSID()
 1.2 18-Jan-2001  tv branches: 1.2.24;
No-op commit to force update to a non-"-kk" revision.
 1.1 17-Jan-2001  fvdl branches: 1.1.2;
Add machdep file for procfs. Currently only used for linux-style
/proc/cpuinfo (only active when procfs is mounted with -o linux).
For ports other than the i386 this currently produces an empty
string.
 1.1.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.2.1 17-Jan-2001  bouyer file procfs_machdep.c was added on branch thorpej_scsipi on 2001-01-18 09:22:38 +0000
 1.2.24.4 29-Nov-2004  skrll Sync with HEAD.
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.5 03-Nov-2002  chs use a merged sys_machdep.c for all the motorola-MMU m68k platforms.
 1.4 13-Dec-2000  jdolecek branches: 1.4.8;
g/c obsolete vtrace(2) stuff
 1.3 29-Jun-2000  mrg branches: 1.3.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 11-Jan-2000  nisimura Use explicit 68040 calls for cache manipulations.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 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 29-Jun-2000  bouyer file sys_machdep.c was added on branch thorpej_scsipi on 2000-11-20 20:10:36 +0000
 1.4.8.4 11-Nov-2002  nathanw Catch up to -current
 1.4.8.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.4.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.4.8.1 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 1.80 20-Jan-2024  thorpej Largely unify the <machine/cpu.h> headers on the m68k platforms.
 1.79 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.78 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.77 17-Sep-2023  andvar fix KGDB enabled build for luna68k:
* include sys/kgdb.h in luna68k/trap.c for missing definitions.
* cast second kgdb_trap argument to (db_regs_t *).
* build m68k/kgdb_machdep.c in kgdb enable build for kgdb_trap() implementation.
 1.76 16-Sep-2023  andvar remove static from dumpssw() and dumpwb() declarations.

Fixes DEBUG enabled builds for luna68k and x68k.
 1.75 22-Apr-2023  tsutsui Remove ancient /*ARGSUSED*/ comments.
 1.74 15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.73 25-Sep-2021  tsutsui Call cnpollc(9) before cngetc(9) as the cons(9) man page says.

Affects only inside #ifdef DEBUG part on "trap during panic" in trap.c
derived from hp300.
 1.72 21-Nov-2019  ad mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.
 1.71 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.70 18-Feb-2019  thorpej Refactor the 68040 writeback() from each m68k port's trap handler into a
shared copy: m68040_writeback(). It is essentially a copy of the Atari
version, with some minor cosmetic tweaks and one small performance optimization
from the mvme68k port.

Tested by rjs@ on a Quadra 950. (Thanks!)
 1.69 04-Mar-2015  martin branches: 1.69.18;
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF
 1.68 19-Feb-2012  rmind branches: 1.68.2; 1.68.16;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.67 08-Feb-2011  rmind branches: 1.67.4; 1.67.8;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.66 17-Jan-2011  tsutsui branches: 1.66.2;
Explicitly include <machine/pcb.h> for struct pcb.
 1.65 20-Dec-2010  matt branches: 1.65.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.64 07-Jul-2010  chs implement ucas_* for m68k.
 1.63 06-Jun-2010  mrg fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h. FPSP meantioned
in the PR has already been fixed, and i could not find any more.

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

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
 1.62 20-Mar-2010  chs fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.61 23-Nov-2009  rmind branches: 1.61.2; 1.61.4;
Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.60 26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.59 18-Mar-2009  cegger bcopy -> memcpy
 1.58 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.57 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.56 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.55 27-Jan-2009  martin branches: 1.55.2;
Centralize fpu exception to siginfo code encoding for all m68k archs,
fixes a failure in the lib/libc/ieeefp/except regression test.
 1.54 19-Dec-2008  njoly Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.
 1.53 15-Oct-2008  wrstuden branches: 1.53.2; 1.53.4;
Merge wrstuden-revivesa into HEAD.
 1.52 24-Apr-2008  ad branches: 1.52.2; 1.52.4; 1.52.8;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.51 31-Dec-2007  ad branches: 1.51.6; 1.51.8;
Remove COMPAT_HPUX.
 1.50 03-Dec-2007  ad branches: 1.50.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.49 05-Nov-2007  ad branches: 1.49.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.48 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.47 01-Sep-2007  mhitch branches: 1.47.4;
68030 and 68040 processors consider the read portion of a read-modify-write
transfer as a write to ensure the memory is writable before starting any
transfer. The fault status information does not reflect this in the 'read'
status bit (i.e. it shows up as a read access), so faults with a RMW access
to non-writable memory was not getting the correct protection. The page would
be read-only and the instruction would fault over and over.

A specific example is when a process forks, and the child process attempts
to execute a RMW access to a data page, which is read-only because it's CoP
Copy-On-Write.

When checking if the page needs to be writablek, also check the locked transfer
and treat any locked transfer as a write.

68060 already handled this correctly, since it has separate read and write
fault bits, and both are set on a RMW access and the trap code was checking
the write status bit.

Fixes PR#36848.
 1.46 12-Jun-2007  mhitch branches: 1.46.4; 1.46.8; 1.46.10;
Pass a frame pointer to trap() rather than the 'entire frame' trick. Gcc4
was optimizing away modifications to the frame contents (it's not nice to
trick gcc). Pass the pointer as the first argument to reduce the number
of places that would be changed otherwise. Fixes the getcwd regression
test on most m68k ports.
 1.45 21-May-2007  tsutsui curlwp can't be NULL so no need to check it.
 1.44 20-May-2007  he Patterned after the changes to atari, restore the luna68k port to a
buildable state after the yamt-idlelwp merge.
Struct cpu_info now must contain ci_want_resched, so get rid of the
global want_resched.
The cpu_need_resched macro now takes two arguments.
We need to declare proc_trampoline() from for the new m68k vm_machdep.c.
The fields l_back and l_forw no longer exists in struct lwp, so excise
their definition from genassym.cf.
Remove the use of the apparently now obsolete m68k/proc_subr.s.
 1.43 04-Mar-2007  christos branches: 1.43.2; 1.43.4; 1.43.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.42 04-Mar-2007  tsutsui Add MI softintr(9) support for luna68k with common m68k/softintr.c.
Compile test only.
 1.41 28-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.40 09-Feb-2007  ad branches: 1.40.2;
Merge newlock2 to head.
 1.39 23-Jul-2006  ad branches: 1.39.4; 1.39.8; 1.39.10;
Use the LWP cached credentials where sane.
 1.38 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.37 15-May-2006  yamt include kauth.h for kauth_cred_geteuid.
 1.36 14-May-2006  elad integrate kauth.
 1.35 15-Mar-2006  drochner branches: 1.35.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument
 1.34 25-Feb-2006  wiz branches: 1.34.2; 1.34.4;
Fix some typos.
 1.33 11-Dec-2005  christos branches: 1.33.2; 1.33.4; 1.33.6;
merge ktrace-lwp.
 1.32 05-Jun-2005  he branches: 1.32.2;
Adapt to compiling with -Wcast-qual by sprinkling consts around.
 1.31 28-Aug-2004  jdolecek use uvm_grow() to update stack segment size on stack page fault instead
of MD code
 1.30 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.29 08-Nov-2003  tsutsui Remove obsolete comments about curproc.
 1.28 02-Nov-2003  cl Extend the #ifdef M68040 so that the `sig' variable declaration is moved
in as well, as it's otherwise not used. (from atari/atari/trap.c and
x68k/x68k/trap.c)
 1.27 31-Oct-2003  cl Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.
 1.26 08-Oct-2003  thorpej * Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
result of a trap. Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap. Expands to 0 if the ksiginfo_t was
not the result of a trap. This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern. Reviewed and OK's by Christos.
 1.25 22-Sep-2003  cl SA_SIGINFO support for m68k (port specific changes)
 1.24 17-Sep-2003  cl add MD part of SA/pthread pagefault handling on all m68k ports
 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 02-Apr-2003  thorpej branches: 1.22.2;
Use PAGE_SIZE rather than NBPG.
 1.21 28-Jan-2003  wiz success, not sucess. Noted by mjl.
 1.20 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.19 14-Feb-2002  chs branches: 1.19.12;
allow writing to write-only mappings. fixes PR 3493.
 1.18 10-Sep-2001  chris branches: 1.18.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.17 02-Jun-2001  chs branches: 1.17.2; 1.17.4;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.16 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.15 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.14 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.13 15-Jan-2001  thorpej branches: 1.13.2;
Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
 1.12 23-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.

XXX I wish m68k ports would share trap.c
 1.11 19-Dec-2000  scw Unification of the m68k syscall() function.
 1.10 22-Nov-2000  tsutsui e_sysent in struct emul has been const'fied.
 1.9 29-Jun-2000  mrg branches: 1.9.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.8 27-Jun-2000  mrg remove redudant <vm/pmap.h> includes. <vm/pmap.h> -> <uvm/uvm_pmap.h>
 1.7 06-Jun-2000  soren defopt SYSCALL_DEBUG.
 1.6 27-May-2000  sommerfeld branches: 1.6.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.5 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.4 24-May-2000  thorpej Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).
 1.3 11-Jan-2000  nisimura Use explicit 68040 calls for cache manipulations.
 1.2 07-Jan-2000  nisimura Make consistent with other m68k ports fixing updates.
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.6.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.9.2.5 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.9.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.9.2.3 08-Dec-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 29-Jun-2000  bouyer file trap.c was added on branch thorpej_scsipi on 2000-11-20 20:10:36 +0000
 1.13.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.13.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.17.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.17.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.18.4.9 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.18.4.8 05-Oct-2002  gmcgarry cpu_upcall() -> sa_upcall_userret()
 1.18.4.7 26-Sep-2002  nathanw Change "if (l->l_flag & L_SA_UPCALL)" to "while (l->l_flag & L_SA_UPCALL)"
in userret() functions or equivalent, to permit delivery of multiple upcalls
in a single kernel entry.

XXX It's getting crowded in here. Collapsing posting signals, upcalls, and
XXX kernel-exit handling into one mechanism would be nice.
 1.18.4.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.18.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.18.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.18.4.3 25-Nov-2001  scw Deal with `want_resched' with trap()'s T_ASTFLT case where it belongs
instead of in userret().
 1.18.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 1.18.4.1 10-Sep-2001  scw file trap.c was added on branch nathanw_sa on 2001-11-18 18:10:21 +0000
 1.19.12.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.22.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.22.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.2 03-Sep-2004  skrll Sync with HEAD
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.2.7 21-Jan-2008  yamt sync with head
 1.32.2.6 07-Dec-2007  yamt sync with head
 1.32.2.5 15-Nov-2007  yamt sync with head.
 1.32.2.4 03-Sep-2007  yamt sync with head.
 1.32.2.3 26-Feb-2007  yamt sync with head.
 1.32.2.2 30-Dec-2006  yamt sync with head.
 1.32.2.1 21-Jun-2006  yamt sync with head.
 1.33.6.2 01-Jun-2006  kardel Sync with head.
 1.33.6.1 22-Apr-2006  simonb Sync with head.
 1.33.4.1 09-Sep-2006  rpaulo sync with head
 1.33.2.1 01-Mar-2006  yamt sync with head.
 1.34.4.2 19-Apr-2006  elad sync with head - hopefully this will work
 1.34.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.34.2.3 11-Aug-2006  yamt sync with head
 1.34.2.2 24-May-2006  yamt sync with head.
 1.34.2.1 01-Apr-2006  yamt sync with head.
 1.35.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.39.10.2 23-Sep-2007  wrstuden Sync with somewhat-recent netbsd-4.
 1.39.10.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.39.8.2 11-Sep-2007  msaitoh Pull up following revision(s) (requested by mhitch in ticket #866):
sys/arch/atari/atari/trap.c: 1.92
sys/arch/mac68k/mac68k/trap.c: 1.129
sys/arch/amiga/amiga/trap.c: 1.116
sys/arch/mvme68k/mvme68k/trap.c: 1.91
sys/arch/news68k/news68k/trap.c: 1.54
sys/arch/sun3/sun3/trap.c: 1.131
sys/arch/next68k/next68k/trap.c: 1.68
sys/arch/luna68k/luna68k/trap.c: 1.47
sys/arch/cesfic/cesfic/trap.c: 1.36
sys/arch/x68k/x68k/trap.c: 1.90
sys/arch/hp300/hp300/trap.c: 1.132
68030 and 68040 processors consider the read portion of a read-modify-write
transfer as a write to ensure the memory is writable before starting any
transfer. The fault status information does not reflect this in the 'read'
status bit (i.e. it shows up as a read access), so faults with a RMW access
to non-writable memory was not getting the correct protection. The page would
be read-only and the instruction would fault over and over.
A specific example is when a process forks, and the child process attempts
to execute a RMW access to a data page, which is read-only because it's CoP
Copy-On-Write.
When checking if the page needs to be writablek, also check the locked transfer
and treat any locked transfer as a write.
68060 already handled this correctly, since it has separate read and write
fault bits, and both are set on a RMW access and the trap code was checking
the write status bit.
Fixes PR#36848.
 1.39.8.1 18-Jun-2007  liamjfoy Pull up following revision(s) (requested by mhitch in ticket #728):
sys/arch/mvme68k/mvme68k/locore.s: revision 1.98
sys/arch/mac68k/mac68k/trap.c: revision 1.128
sys/arch/next68k/next68k/locore.s: revision 1.48
sys/arch/mac68k/mac68k/locore.s: revision 1.152
sys/arch/sun3/sun3/locore.s: revision 1.88
sys/arch/sun2/sun2/locore.s: revision 1.19
sys/arch/sun2/sun2/trap.c: revision 1.32
sys/arch/m68k/m68k/db_trace.c: revision 1.51
sys/arch/mvme68k/mvme68k/trap.c: revision 1.90
sys/arch/news68k/news68k/trap.c: revision 1.53
sys/arch/luna68k/luna68k/locore.s: revision 1.27
sys/arch/atari/atari/locore.s: revision 1.99
sys/arch/sun3/sun3/trap.c: revision 1.130
sys/arch/x68k/x68k/trap.c: revision 1.89
sys/arch/next68k/next68k/trap.c: revision 1.67
sys/arch/x68k/x68k/locore.s: revision 1.79
sys/arch/news68k/news68k/locore.s: revision 1.43
sys/arch/luna68k/luna68k/trap.c: revision 1.46
sys/arch/hp300/hp300/locore.s: revision 1.140
sys/arch/cesfic/cesfic/locore.s: revision 1.15
sys/arch/cesfic/cesfic/trap.c: revision 1.35
sys/arch/m68k/m68k/trap_subr.s: revision 1.12
sys/arch/amiga/amiga/locore.s: revision 1.143
Pass a frame pointer to trap() rather than the 'entire frame' trick. Gcc4
was optimizing away modifications to the frame contents (it's not nice to
trick gcc). Pass the pointer as the first argument to reduce the number
of places that would be changed otherwise. Fixes the getcwd regression
test on most m68k ports.
 1.39.4.2 06-Feb-2007  ad Update m68k pasteware.
 1.39.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.40.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.43.10.3 03-Oct-2007  garbled Sync with HEAD
 1.43.10.2 26-Jun-2007  garbled Sync with HEAD.
 1.43.10.1 22-May-2007  matt Update to HEAD.
 1.43.4.1 11-Jul-2007  mjf Sync with head.
 1.43.2.4 03-Dec-2007  ad Sync with HEAD.
 1.43.2.3 09-Oct-2007  ad Sync with head.
 1.43.2.2 15-Jul-2007  ad Sync with head.
 1.43.2.1 27-May-2007  ad Sync with head.
 1.46.10.2 09-Jan-2008  matt sync with HEAD
 1.46.10.1 06-Nov-2007  matt sync with HEAD
 1.46.8.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.46.8.2 06-Nov-2007  joerg Sync with HEAD.
 1.46.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.46.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.47.4.1 13-Nov-2007  bouyer Sync with HEAD
 1.49.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.49.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.50.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.51.8.1 18-May-2008  yamt sync with head.
 1.51.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.51.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.52.8.1 19-Oct-2008  haad Sync with HEAD.
 1.52.4.4 30-Jun-2008  wrstuden Change how we make SA threads not generate upcalls. Instead of clearing
LW_SA, use a private flag, LP_SA_NOBLOCK, that we set when we want
to not generate upcalls. This means we do NOT need to lock (l)
(ourselves) to set it.

Adjust tests that look at LW_SA. Now, we are an upcall-generating
lwp if ((l->l_flag & LW_SA) && (~l->l_pflag & LP_SA_NOBLOCK)).

Introduce code pattern to set & remember this:

f = ~l->l_pflag & LP_SA_NOBLOCK;
l->l_pflag |= LP_SA_NOBLOCK;

...

/* f is now LP_SA_NOBLOCK if it wasn't set in l_pflag before */

l->l_pflag ^= f;

I updated a lot of the trap handlers to do trap handling iff LP_SA_NOBLOCK
is not set. I tried to figure out if the trap handler could be triggered
for user-based faults as opposed to kernel faults to user addresses, and
only look at LP_SA_NOBLOCK for the latter.

Above is a result of discussions with rmind at to reduce lock twiddling.

Also, per same discussions, add locking to sys_sa_preempt(). p_lock is
the lock we want.

Also, per same discussions, remove use of LSSUSPENDED as a thread state.
We needed to use it when we were emulating the 4.X and previous behavior
of hiding cached threads. For the moment, we now have them instead
remain visible to all and have them sleeping on the "lwpcache" wait
channel.

sa_newcachelwp(): sa_putcachelwp() wants savp_mutex held, not p_lock.

Tweak some comments.
 1.52.4.3 22-Jun-2008  wrstuden Re-add cpu_upcall() and page fault code. i386 kernels now compile.
They don't boot, but that seems to be a consequence of current from the
day this branch was started.
 1.52.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.52.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.52.2.3 11-Aug-2010  yamt sync with head.
 1.52.2.2 11-Mar-2010  yamt sync with head
 1.52.2.1 04-May-2009  yamt sync with head.
 1.53.4.1 02-Feb-2009  snj Pull up following revision(s) (requested by martin in ticket #332):
sys/arch/amiga/amiga/trap.c: revision 1.122
sys/arch/atari/atari/trap.c: revision 1.99
sys/arch/cesfic/cesfic/trap.c: revision 1.43
sys/arch/hp300/hp300/trap.c: revision 1.140
sys/arch/luna68k/luna68k/trap.c: revision 1.55
sys/arch/m68k/include/signal.h: revision 1.25
sys/arch/m68k/m68k/sig_machdep.c: revision 1.41
sys/arch/mac68k/mac68k/trap.c: revision 1.136 via patch
sys/arch/mvme68k/mvme68k/trap.c: revision 1.98
sys/arch/news68k/news68k/trap.c: revision 1.60
sys/arch/next68k/next68k/trap.c: revision 1.75
sys/arch/sun2/sun2/trap.c: revision 1.37
sys/arch/sun3/sun3/trap.c: revision 1.136
sys/arch/x68k/x68k/trap.c: revision 1.97
Centralize fpu exception to siginfo code encoding for all m68k archs,
fixes a failure in the lib/libc/ieeefp/except regression test.
 1.53.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.53.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.53.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.55.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.61.4.3 05-Mar-2011  rmind sync with head
 1.61.4.2 03-Jul-2010  rmind sync with head
 1.61.4.1 30-May-2010  rmind sync with head
 1.61.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.61.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.65.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.66.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.67.8.1 24-Feb-2012  mrg sync to -current.
 1.67.4.1 17-Apr-2012  yamt sync with head
 1.68.16.1 06-Apr-2015  skrll Sync with HEAD
 1.68.2.1 03-Dec-2017  jdolecek update from HEAD
 1.69.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.69.18.1 10-Jun-2019  christos Sync with HEAD
 1.5 14-Jan-2024  thorpej Switch luna68k over to the common m68k vector table.
 1.4 23-Sep-2013  tsutsui Remove trailing tabs.
 1.3 11-Dec-2005  christos branches: 1.3.112; 1.3.122; 1.3.128;
merge ktrace-lwp.
 1.2 22-Sep-2003  cl SA_SIGINFO support for m68k (port specific changes)
 1.1 05-Jan-2000  nisimura branches: 1.1.6; 1.1.30;
Introduce NetBSD/luna68k port into CVS repository.
 1.1.30.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.30.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.30.1 03-Aug-2004  skrll Sync with HEAD
 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 05-Jan-2000  bouyer file vectors.s was added on branch thorpej_scsipi on 2000-11-20 20:10:36 +0000
 1.3.128.1 18-May-2014  rmind sync with head
 1.3.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.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.12 20-Oct-2002  chs merge the 12 copies of vm_machdep.c on the m68k platforms.
clean up some other stuff along the way, including:
- use m68k/cacheops.*, remove duplicates from cpu.h.
- centralize a few declarations in (all the copies of) cpu.h.
- define M68K_VAC on platforms which have a VAC.
- switch the sun platforms to the (now common) proc_trampoline().
- do the phys_map thang on the sun platforms too, no reason not to.
 1.11 04-Mar-2002  simonb Don't need to declare phys_map - it is declared in <uvm/uvm_extern.h>.
 1.10 10-Sep-2001  chris branches: 1.10.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.9 19-Aug-2001  chs branches: 1.9.2;
add missing pmap_update().
 1.8 04-Aug-2001  chs use pmap_k* in pagemove() (ie. for buffer cache pages)
and in vmapbuf() and vunmapbuf() (since there's no VAC on this platform).
 1.7 02-Jun-2001  chs branches: 1.7.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.6 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.5 29-Jun-2000  mrg branches: 1.5.2; 1.5.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 26-Jun-2000  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.3 28-May-2000  thorpej Rather than starting init and creating kthreads by forking and then
doing a cpu_set_kpc(), just pass the entry point and argument all
the way down the fork path starting with fork1(). In order to
avoid special-casing the normal fork in every cpu_fork(), MI code
passes down child_return() and the child process pointer explicitly.

This fixes a race condition on multiprocessor systems; a CPU could
grab the newly created processes (which has been placed on a run queue)
before cpu_set_kpc() would be performed.
 1.2 20-Jan-2000  sommerfeld branches: 1.2.2;
Fix PR9240: comment above cpu_fork() out of synch with reality on most ports.
(comment change only, but was wrong for more than just i386).
 1.1 05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 29-Jun-2000  bouyer file vm_machdep.c was added on branch thorpej_scsipi on 2000-11-20 20:10:36 +0000
 1.7.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.7.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.7.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.9.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.10.4.7 11-Nov-2002  nathanw Catch up to -current
 1.10.4.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.10.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.10.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.10.4.3 08-Dec-2001  thorpej cpu_fork() -> cpu_lwp_fork(). This logically forks an LWP, not a
complete process. As noted by Gregory McGarry on tech-kern.
 1.10.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Luna68k.
Compile-tested only.
 1.10.4.1 10-Sep-2001  scw file vm_machdep.c was added on branch nathanw_sa on 2001-11-18 18:10:21 +0000
 1.1 06-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
Build and install resurrected luna68k bootloader.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 06-Jan-2013  tls file Makefile was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 06-Jan-2013  yamt file Makefile was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.2 12-Jan-2014  tsutsui Add empty LIBCRTI= as LIBCRT0 to build sa programs without installed DESTDIR.

XXX: probabry we should have bsd.saprog.mk or something.
 1.1 06-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
Build and install resurrected luna68k bootloader.
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 06-Jan-2013  tls file Makefile.inc was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 06-Jan-2013  yamt file Makefile.inc was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.18 15-Jun-2021  tsutsui Specify -fno-unwind-tables to shrink binary size. Tested on nono.
 1.17 24-May-2019  tsutsui branches: 1.17.14;
LUNA's firmware requires OMAGIC a.out.
 1.16 02-Jan-2019  christos use the right version of ELF2AOUT
 1.15 28-Sep-2018  isaki Add missing link message.
 1.14 12-Nov-2017  tsutsui branches: 1.14.2; 1.14.4;
Explicitly set NOPIE. GOT seems problematic on elf2aout(1) conversion.

Fixes silent hangup of luna68k boot.
Should be pulled up to netbsd-8.

Current bsd.own.mk sets NOPIE in case of BINDIR=/usr/mdec for standalone
programs and in luna68k case it's defined in ../Makefile.inc.
However, many bootloader Makefiles include bsd.own.mk first to override
CFLAGS etc. and Makefile.inc is not included (so BINDIR is not set) yet
at the point.
 1.13 08-Apr-2017  christos branches: 1.13.6;
centralize vers.c building for standalone programs.
 1.12 17-Jan-2016  tsutsui branches: 1.12.2; 1.12.4;
Enable LIBSA_CREAD_NOCRC. PR/50638

Also bump version to denote user visible change.
Tested on LUNA-II.
 1.11 16-Jan-2014  christos branches: 1.11.6;
eliminate use of bsd.sys.mk from Makefiles
 1.10 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.9 22-Jan-2013  tsutsui branches: 1.9.2; 1.9.4; 1.9.6;
Whitespace cleanup.
 1.8 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.7 20-Jan-2013  tsutsui Specify text address via Makefile rather than hardcoding in boot.ldscript.
 1.6 16-Jan-2013  tsutsui Enable and add ls command for ufs.
 1.5 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.4 10-Jan-2013  tsutsui Revert to using elf2aout(1) to build a.out binary.
a.out binary linked by ldscript doesn't work on some uncertain conditions.
 1.3 10-Jan-2013  tsutsui Link the target boot binary as a.out directly rather than using elf2aout(1).
Confirmed working on LUNA-I.
 1.2 09-Jan-2013  tsutsui Make sure to print proper bootprog name in banner.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.9.6.4 03-Dec-2017  jdolecek update from HEAD
 1.9.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.6.2 25-Feb-2013  tls resync with head
 1.9.6.1 22-Jan-2013  tls file Makefile was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.9.4.1 18-May-2014  rmind sync with head
 1.9.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.9.2.2 23-Jan-2013  yamt sync with head
 1.9.2.1 22-Jan-2013  yamt file Makefile was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.11.6.2 28-Aug-2017  skrll Sync with HEAD
 1.11.6.1 19-Mar-2016  skrll Sync with HEAD
 1.12.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.12.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.13.6.1 22-Nov-2017  martin Pull up following revision(s) (requested by tsutsui in ticket #376):
sys/arch/luna68k/stand/boot/Makefile: revision 1.14
Explicitly set NOPIE. GOT seems problematic on elf2aout(1) conversion.
Fixes silent hangup of luna68k boot.
Should be pulled up to netbsd-8.
Current bsd.own.mk sets NOPIE in case of BINDIR=/usr/mdec for standalone
programs and in luna68k case it's defined in ../Makefile.inc.
However, many bootloader Makefiles include bsd.own.mk first to override
CFLAGS etc. and Makefile.inc is not included (so BINDIR is not set) yet
at the point.
 1.14.4.1 10-Jun-2019  christos Sync with HEAD
 1.14.2.2 18-Jan-2019  pgoyette Synch with HEAD
 1.14.2.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.17.14.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.11 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.10 10-Jan-2014  tsutsui branches: 1.10.30;
Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.9 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.8 03-Jan-2014  tsutsui Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.7 22-Jan-2013  tsutsui branches: 1.7.2; 1.7.4; 1.7.6;
Whitespace cleanup.
 1.6 14-Jan-2013  tsutsui Use unsigned for device address.
 1.5 14-Jan-2013  tsutsui Remove hp300 specific select code and use proper hw address to match device.
 1.4 14-Jan-2013  tsutsui Remove unused hw_id and hw_id2 members from device info.
They are valid only on hp300.
 1.3 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 12-Jan-2013  tsutsui Fix warnings on DEBUG build.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.7.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.6.2 25-Feb-2013  tls resync with head
 1.7.6.1 22-Jan-2013  tls file autoconf.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.7.4.1 18-May-2014  rmind sync with head
 1.7.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.7.2.2 23-Jan-2013  yamt sync with head
 1.7.2.1 22-Jan-2013  yamt file autoconf.c was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.10.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1 21-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 21-Jan-2013  tls file awaitkey.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 21-Jan-2013  yamt file awaitkey.c was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.6 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.5 11-Jan-2014  tsutsui branches: 1.5.6;
Misc KNF and cosmetics.
 1.4 21-Jan-2013  tsutsui branches: 1.4.2; 1.4.4; 1.4.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.3 20-Jan-2013  tsutsui Remove unused bmcintr() function.
 1.2 20-Jan-2013  tsutsui No need to include <sys/systm.h> in standalone sources.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.4.6.4 03-Dec-2017  jdolecek update from HEAD
 1.4.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.6.2 25-Feb-2013  tls resync with head
 1.4.6.1 21-Jan-2013  tls file bmc.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.4.4.1 18-May-2014  rmind sync with head
 1.4.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.4.2.2 23-Jan-2013  yamt sync with head
 1.4.2.1 21-Jan-2013  yamt file bmc.c was added on branch yamt-pagecache on 2013-01-23 00:05:52 +0000
 1.5.6.1 06-Apr-2015  skrll Sync with HEAD
 1.10 05-Jul-2024  andvar fix various typos in comments and log messages, mainly s/hight/high/
s/hight/height/ and removing double m in time(ing).
 1.9 13-Oct-2023  tsutsui branches: 1.9.6;
Fix spelling. From OpenBSD/luna88k.
 1.8 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.7 14-Feb-2015  tsutsui branches: 1.7.18;
Make local functions and variables static.
 1.6 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.5 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.4 11-Jan-2014  tsutsui branches: 1.4.6;
Misc KNF and cosmetics.
 1.3 02-Jan-2014  tsutsui Misc cleanup. Mostly from OpenBSD/luna88k.

- fix isprint() macro
- hight -> height
- remove an unused function
- adjust tabs/spaces
- constify the bitmap font
- consistently use #define<space>
- use #if 0/#endif to disable code block
- u_long -> uint32_t, u_short -> uint16_t
- some KNF
 1.2 20-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
No need to include <sys/systm.h> in standalone sources.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 20-Jan-2013  tls file bmd.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.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.2.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 20-Jan-2013  yamt file bmd.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.4.6.1 06-Apr-2015  skrll Sync with HEAD
 1.7.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9.6.1 02-Aug-2025  perseant Sync with HEAD
 1.7 11-Jan-2014  tsutsui ctually remove all references to obsolete stinger.h.
 1.6 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.5 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.4 03-Jan-2014  tsutsui Disable unnecessary boot device check. From OpenBSD/luna88k.
 1.3 05-Mar-2013  tsutsui branches: 1.3.6;
Check netboot and set proper default boot device.
Also bump version.
 1.2 21-Jan-2013  tsutsui branches: 1.2.2; 1.2.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.3 23-Jun-2013  tls resync from head
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 21-Jan-2013  tls file boot.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.2.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.2.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 21-Jan-2013  yamt file boot.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.3.6.1 18-May-2014  rmind sync with head
 1.5 26-Jan-2013  tsutsui branches: 1.5.4;
Add proper padding to text section for elf2aout conversion.

The data and bss sections are 8 byte aligned on m68k ELF format,
but a.out header doesn't have section addresses and only
contains size values, so we have to pad size of text section
to make data section get aligned even after elf2aout.

Note elf2aout merges ELF data section into a.out text section
if binary is OMAGIC (i.e. text is writable too) so only
BSS section address was affected (and was almost harmless).
 1.4 20-Jan-2013  tsutsui branches: 1.4.2;
Specify text address via Makefile rather than hardcoding in boot.ldscript.
 1.3 10-Jan-2013  tsutsui Revert to using elf2aout(1) to build a.out binary.
a.out binary linked by ldscript doesn't work on some uncertain conditions.
 1.2 10-Jan-2013  tsutsui Link the target boot binary as a.out directly rather than using elf2aout(1).
Confirmed working on LUNA-I.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.4.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.4.2.2 23-Jan-2013  yamt sync with head
 1.4.2.1 20-Jan-2013  yamt file boot.ldscript was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.5.4.2 25-Feb-2013  tls resync with head
 1.5.4.1 26-Jan-2013  tls file boot.ldscript was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.4 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.3 16-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Add UFS2 support. Also bump version.
 1.2 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 16-Jan-2013  tls file conf.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 16-Jan-2013  yamt file conf.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.3 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.2 11-Jan-2014  tsutsui branches: 1.2.6;
Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file cons.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file cons.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.2.6.1 06-Apr-2015  skrll Sync with HEAD
 1.8 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.7 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.6 03-Jan-2014  tsutsui Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.5 14-Jan-2013  tsutsui branches: 1.5.2; 1.5.4; 1.5.6;
Use unsigned for device address.
 1.4 14-Jan-2013  tsutsui Remove hp300 specific select code and use proper hw address to match device.
 1.3 14-Jan-2013  tsutsui Remove unused hw_id and hw_id2 members from device info.
They are valid only on hp300.
 1.2 13-Jan-2013  tsutsui Remove unused function members from struct driver.
This makes adding other drivers easier.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.5.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.2 25-Feb-2013  tls resync with head
 1.5.6.1 14-Jan-2013  tls file device.h was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.5.4.1 18-May-2014  rmind sync with head
 1.5.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.5.2.2 23-Jan-2013  yamt sync with head
 1.5.2.1 14-Jan-2013  yamt file device.h was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.11 01-Sep-2015  tsutsui Use the default boot device if a kernel name without device is specificed.
 1.10 01-Sep-2015  tsutsui Fix indent.
 1.9 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.8 21-Apr-2014  tsutsui branches: 1.8.4;
Fix stupid botches in previous.

Use a proper device unit number if a unit number or non-default device
is specified on the boot command.
 1.7 16-Apr-2014  tsutsui Use booted device unit if no unit number is specified on boot command.

Bump version to denote a visible change.
 1.6 11-Jan-2014  tsutsui branches: 1.6.2;
Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.5 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.4 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- accept empty controller and partition numbers, as well as empty filenames,
and use defaults (0, 0 and "netbsd") instead of complaining the boot path
is invalid
- move a macro where actually necessary

Also bump version to denote the user visible change.
 1.3 16-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Add UFS2 support. Also bump version.
 1.2 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.4 03-Dec-2017  jdolecek update from HEAD
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 16-Jan-2013  tls file devopen.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 16-Jan-2013  yamt file devopen.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.6.2.1 10-Aug-2014  tls Rebase.
 1.8.4.2 22-Sep-2015  skrll Sync with HEAD
 1.8.4.1 06-Apr-2015  skrll Sync with HEAD
 1.10 14-Feb-2015  tsutsui Explicitly denote static functions.
 1.9 14-Feb-2015  tsutsui Don't use cnputc() directly in an application layer.
 1.8 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.7 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.6 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.5 24-Mar-2014  martin branches: 1.5.6;
PR port-luna68k/48677: fix some typos.
From shinnashi takeshi.
 1.4 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.3 22-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Whitespace cleanup.
 1.2 10-Jan-2013  tsutsui Make "disklabel" command print correct disklabel info.
- use exact-width interger types to define on-disk format
(daddr_t could be a different size)
- use proper LABELOFFSET to locate BSD disklabel
(LABELOFFSET for luna68k is 64 as 4.4BSD-Lite2 while other
ports that use sun_disklabel use 128)
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.4 03-Dec-2017  jdolecek update from HEAD
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 22-Jan-2013  tls file disklabel.c was added on branch tls-maxphys on 2013-02-25 00:28:48 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 22-Jan-2013  yamt file disklabel.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.5.6.1 06-Apr-2015  skrll Sync with HEAD
 1.3 02-Jan-2014  tsutsui Misc cleanup. Mostly from OpenBSD/luna88k.

- fix isprint() macro
- hight -> height
- remove an unused function
- adjust tabs/spaces
- constify the bitmap font
- consistently use #define<space>
- use #if 0/#endif to disable code block
- u_long -> uint32_t, u_short -> uint16_t
- some KNF
 1.2 20-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
No need to include <sys/systm.h> in standalone sources.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 20-Jan-2013  tls file font.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.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.2.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 20-Jan-2013  yamt file font.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.4 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.3 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- Bring getline() - a.k.a libsa gets() with a prompt prefix - in par with libsa
gets(), featurewise; this means support for ^u to clear the input.
- constify
 1.2 20-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Don't call internal cngetc() and cnputc() directly.
Use public getchar() and putchar() instead.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 20-Jan-2013  tls file getline.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.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.2.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 20-Jan-2013  yamt file getline.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.3 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.2 21-Nov-2014  christos branches: 1.2.20;
need clock_subr.h for bcdtobin()
 1.1 13-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1.6.3 03-Dec-2017  jdolecek update from HEAD
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 13-Jan-2013  tls file getsecs.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 13-Jan-2013  yamt file getsecs.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.2.20.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.6 11-Jan-2014  tsutsui branches: 1.6.30;
Misc KNF and cosmetics.
 1.5 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.4 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.3 22-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Whitespace cleanup.
 1.2 20-Jan-2013  tsutsui No need to include <sys/systm.h> in standalone sources.
 1.1 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 22-Jan-2013  tls file if_le.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 22-Jan-2013  yamt file if_le.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.6.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.17 24-Sep-2024  rin luna68k: stand: Silence GCC12 -Warray-bounds for main()

- LUNA1_BOOTINFOADDR (0x8c0) is in the 0-th page [0, 0x1000), which
causes -Warray-bounds for GCC12 and later.
- LUNA2_BOOTINFOADDR (0x1d80) is also in the 0-th page, if we switch to
8KB page.

Fix luna68k build with GCC12.
 1.16 14-Feb-2015  tsutsui branches: 1.16.54;
Explicitly denote static functions.
 1.15 21-Apr-2014  tsutsui branches: 1.15.4;
Fix stupid botches in previous.

Use a proper device unit number if a unit number or non-default device
is specified on the boot command.
 1.14 16-Apr-2014  tsutsui Use booted device unit if no unit number is specified on boot command.

Bump version to denote a visible change.
 1.13 11-Jan-2014  tsutsui branches: 1.13.2;
Misc KNF and cosmetics.
 1.12 11-Jan-2014  tsutsui ctually remove all references to obsolete stinger.h.
 1.11 11-Jan-2014  tsutsui Remove unused KernInter stuff.
 1.10 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.9 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.8 05-Jan-2014  tsutsui Detect boot device on PROM load command and set proper default boot device.

Also remove now unnecessary the old netboot check.

Note all addresses of boot device info set by monitor are checked by
memory dump on several LUNA ROM versions, and these addres might be
different on earlier monitor ROM versions.

Bump version to denote the visible change.
 1.7 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- Bring getline() - a.k.a libsa gets() with a prompt prefix - in par with libsa
gets(), featurewise; this means support for ^u to clear the input.
- constify
 1.6 05-Mar-2013  tsutsui branches: 1.6.6;
Check netboot and set proper default boot device.
Also bump version.
 1.5 21-Jan-2013  tsutsui branches: 1.5.2; 1.5.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.4 20-Jan-2013  tsutsui No need to include <sys/systm.h> in standalone sources.
 1.3 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.2 12-Jan-2013  tsutsui Check cputype and set machine type (LUNA-I or LUNA-II).
Tested on only LUNA-I for now.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.5.6.5 03-Dec-2017  jdolecek update from HEAD
 1.5.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.3 23-Jun-2013  tls resync from head
 1.5.6.2 25-Feb-2013  tls resync with head
 1.5.6.1 21-Jan-2013  tls file init_main.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.5.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.5.2.2 23-Jan-2013  yamt sync with head
 1.5.2.1 21-Jan-2013  yamt file init_main.c was added on branch yamt-pagecache on 2013-01-23 00:05:53 +0000
 1.6.6.1 18-May-2014  rmind sync with head
 1.13.2.1 10-Aug-2014  tls Rebase.
 1.15.4.1 06-Apr-2015  skrll Sync with HEAD
 1.16.54.1 02-Aug-2025  perseant Sync with HEAD
 1.6 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.5 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.4 03-Jan-2014  tsutsui Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.3 14-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 14-Jan-2013  tls file ioconf.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 14-Jan-2013  yamt file ioconf.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.5 03-Sep-2021  tsutsui Ignore mouse packets to avoid unexpected data handled as keyboard input.

Patch from moveccr.
 1.4 14-Feb-2015  tsutsui Make local readonly arrays static const.
 1.3 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.2 11-Jan-2014  tsutsui branches: 1.2.6;
Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file kbd.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file kbd.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.6.1 06-Apr-2015  skrll Sync with HEAD
 1.2 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file kbdreg.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file kbdreg.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.5 05-Dec-2021  msaitoh s/initialz/initializ/ in comment.
 1.4 04-Sep-2018  riastradh Fix some min/max -> uimin/uimax stragglers.

Confirmed by the 2018-09-04T04:40Z autobuild.
 1.3 16-Apr-2014  tsutsui branches: 1.3.26; 1.3.28;
Appease gcc 4.8 -Wunused-but-set-variable warnings.
 1.2 11-Jan-2014  tsutsui branches: 1.2.2;
Misc KNF and cosmetics.
 1.1 13-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 13-Jan-2013  tls file lance.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 13-Jan-2013  yamt file lance.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 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.1 13-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 13-Jan-2013  tls file lance.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 13-Jan-2013  yamt file lance.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.15 16-Mar-2022  andvar s/paniced/panicked/ and s/borken/broken/ in comments.
 1.14 28-Sep-2018  isaki Improve codes. No functional changes intended.
Confirmed on LUNA-I. OK'ed by tsutsui@.
 1.13 28-Sep-2018  isaki Remove unused variable.
OK'ed by tsutsui@.
 1.12 28-Sep-2018  isaki Fix a wrong comment.
 1.11 24-Mar-2014  martin branches: 1.11.28; 1.11.30;
PR port-luna68k/48677: fix some typos.
From shinnashi takeshi.
 1.10 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.9 22-Jan-2013  tsutsui branches: 1.9.2; 1.9.4; 1.9.6;
Whitespace cleanup.
 1.8 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.7 20-Jan-2013  tsutsui Use hex value rather than decimal for register and device macro.
 1.6 20-Jan-2013  tsutsui Add RCS Id.
 1.5 20-Jan-2013  tsutsui Specify text address via Makefile rather than hardcoding in boot.ldscript.
 1.4 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.3 12-Jan-2013  tsutsui Check cputype and set machine type (LUNA-I or LUNA-II).
Tested on only LUNA-I for now.
 1.2 10-Jan-2013  tsutsui Use proper asm symbol macro.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.9.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.6.2 25-Feb-2013  tls resync with head
 1.9.6.1 22-Jan-2013  tls file locore.S was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.9.4.1 18-May-2014  rmind sync with head
 1.9.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.9.2.2 23-Jan-2013  yamt sync with head
 1.9.2.1 22-Jan-2013  yamt file locore.S was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.11.30.1 10-Jun-2019  christos Sync with HEAD
 1.11.28.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.1 16-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
Enable and add ls command for ufs.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 16-Jan-2013  tls file ls.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 16-Jan-2013  yamt file ls.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.9 25-Sep-2024  rin luna68k/boot: Silence GCC12 -Warray-bounds for regdump()

Dereference to `(int *)(&rp) - 1` (SR in H/W exception frame) is
blamed by GCC12 and later. Just silence as done for m68k/regdump.c.

Finally fix luna68k build.
 1.8 27-Oct-2019  martin branches: 1.8.32;
Back out previous - fixed differently by rin already.
 1.7 27-Oct-2019  martin Define _KERNEL while including reg.h: we need the (now protected) register
names.
 1.6 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.5 14-Feb-2015  tsutsui branches: 1.5.18;
Explicitly denote static functions.
 1.4 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.3 16-Apr-2014  tsutsui branches: 1.3.4;
Appease gcc 4.8 -Wunused-but-set-variable warnings.
 1.2 11-Jan-2014  tsutsui branches: 1.2.2;
Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file machdep.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file machdep.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.3.4.1 06-Apr-2015  skrll Sync with HEAD
 1.5.18.1 10-Jun-2019  christos Sync with HEAD
 1.8.32.1 02-Aug-2025  perseant Sync with HEAD
 1.4 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.3 22-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Whitespace cleanup.
 1.2 10-Jan-2013  tsutsui Make "disklabel" command print correct disklabel info.
- use exact-width interger types to define on-disk format
(daddr_t could be a different size)
- use proper LABELOFFSET to locate BSD disklabel
(LABELOFFSET for luna68k is 64 as 4.4BSD-Lite2 while other
ports that use sun_disklabel use 128)
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 22-Jan-2013  tls file omron_disklabel.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 22-Jan-2013  yamt file omron_disklabel.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.8 25-Nov-2016  tsutsui Add a missing newline in help message.
 1.7 14-Feb-2015  tsutsui branches: 1.7.2;
Make local readonly arrays static const.
 1.6 11-Jan-2014  tsutsui branches: 1.6.6;
Misc KNF and cosmetics.
 1.5 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.4 22-Jan-2013  tsutsui branches: 1.4.2; 1.4.4; 1.4.6;
Whitespace cleanup.
 1.3 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.2 16-Jan-2013  tsutsui Enable and add ls command for ufs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.4.6.4 03-Dec-2017  jdolecek update from HEAD
 1.4.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.6.2 25-Feb-2013  tls resync with head
 1.4.6.1 22-Jan-2013  tls file parse.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.4.4.1 18-May-2014  rmind sync with head
 1.4.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.4.2.2 23-Jan-2013  yamt sync with head
 1.4.2.1 22-Jan-2013  yamt file parse.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.6.6.2 05-Dec-2016  skrll Sync with HEAD
 1.6.6.1 06-Apr-2015  skrll Sync with HEAD
 1.7.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.3 24-Mar-2014  martin PR port-luna68k/48677: fix some typos.
From shinnashi takeshi.
 1.2 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file preset.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file preset.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3 22-Jan-2013  tsutsui branches: 1.3.2; 1.3.6;
Whitespace cleanup.
 1.2 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 22-Jan-2013  tls file prf.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.3.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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 22-Jan-2013  yamt file prf.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.2 11-Jan-2014  tsutsui branches: 1.2.6;
Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file rcvbuf.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file rcvbuf.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.6.1 06-Apr-2015  skrll Sync with HEAD
 1.2 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file romcons.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file romcons.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file romvec.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file romvec.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.20 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.19 21-Apr-2014  tsutsui branches: 1.19.4;
Fix stupid botches in previous.

Use a proper device unit number if a unit number or non-default device
is specified on the boot command.
 1.18 16-Apr-2014  tsutsui Use booted device unit if no unit number is specified on boot command.

Bump version to denote a visible change.
 1.17 11-Jan-2014  tsutsui branches: 1.17.2;
Remove unused declarations.
 1.16 11-Jan-2014  tsutsui Add support to pass boothowto and bootdev info from bootloader to kernel.

Bootloader side changes:
- make boot command parse boothowto flags (-ads etc.)
- pass boothowto and bootdev info to the kernel via %d7 and %d6
as the old 4.4BSD/luna68k kernel expected
- remove unused and now unnecessary "howto" (how_to_boot) command
- export and tweak make_device() in devopen.c to prepare bootdev info
- remove unused and commented out get_boot_device()
 1.15 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.14 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.13 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- Bring getline() - a.k.a libsa gets() with a prompt prefix - in par with libsa
gets(), featurewise; this means support for ^u to clear the input.
- constify
 1.12 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- accept empty controller and partition numbers, as well as empty filenames,
and use defaults (0, 0 and "netbsd") instead of complaining the boot path
is invalid
- move a macro where actually necessary

Also bump version to denote the user visible change.
 1.11 02-Jan-2014  tsutsui Misc cleanup. Mostly from OpenBSD/luna88k.

- fix isprint() macro
- hight -> height
- remove an unused function
- adjust tabs/spaces
- constify the bitmap font
- consistently use #define<space>
- use #if 0/#endif to disable code block
- u_long -> uint32_t, u_short -> uint16_t
- some KNF
 1.10 05-Mar-2013  tsutsui branches: 1.10.6;
Check netboot and set proper default boot device.
Also bump version.
 1.9 22-Jan-2013  tsutsui branches: 1.9.2; 1.9.6;
Whitespace cleanup.
 1.8 21-Jan-2013  tsutsui Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.7 20-Jan-2013  tsutsui Remove unused bmcintr() function.
 1.6 16-Jan-2013  tsutsui Add UFS2 support. Also bump version.
 1.5 16-Jan-2013  tsutsui Enable and add ls command for ufs.
 1.4 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.3 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.2 12-Jan-2013  tsutsui Check cputype and set machine type (LUNA-I or LUNA-II).
Tested on only LUNA-I for now.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.9.6.5 03-Dec-2017  jdolecek update from HEAD
 1.9.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.6.3 23-Jun-2013  tls resync from head
 1.9.6.2 25-Feb-2013  tls resync with head
 1.9.6.1 22-Jan-2013  tls file samachdep.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.9.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.9.2.2 23-Jan-2013  yamt sync with head
 1.9.2.1 22-Jan-2013  yamt file samachdep.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.10.6.1 18-May-2014  rmind sync with head
 1.17.2.1 10-Aug-2014  tls Rebase.
 1.19.4.1 06-Apr-2015  skrll Sync with HEAD
 1.20 25-Sep-2024  rin luna68k/boot: XXX: Silence GCC12 -Warray-bounds for scident()

sensebuf and inqbuf may be uninitialized for some cases.

Real fix should be to check return values everywhere in
scsi_request_sense(), scsi_immed_command(), and functions
called from them.
 1.19 10-Dec-2021  andvar branches: 1.19.10;
s/occured/occurred/ in comments, log messages and man pages.
 1.18 15-Jun-2021  tsutsui Fix off-by-one of a number of blocks of probed disks.

The SCSI READ_CAPACITY command returns the last logical data block
address, so we have to increment it to get a number of blocks
as src/sys/dev/scsipi/sd.c does.

Bump revision to denote the change.
 1.17 09-Feb-2018  jakllsch branches: 1.17.20;
Explain what may seem to be a non-sensical assignment, but isn't.

closes PR 53000
 1.16 31-Oct-2017  christos undo - pointed out this is a register assignment.
 1.15 31-Oct-2017  christos PR/52680: David Binderman: Remove dedundant assignment.
 1.14 14-Feb-2015  tsutsui Explicitly denote static functions.
 1.13 14-Feb-2015  tsutsui Misc KNF and cosmetics.
 1.12 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.11 16-Apr-2014  tsutsui branches: 1.11.4;
Appease gcc 4.8 -Wunused-but-set-variable warnings.
 1.10 11-Jan-2014  tsutsui branches: 1.10.2;
Misc KNF and cosmetics.
 1.9 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.8 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.7 02-Jan-2014  tsutsui Replace broken (by SCCS) ISO-2022-JP comments with UTF-8.

Recovered and decoded by isaki@.
 1.6 02-Jan-2014  tsutsui Add bound check of a controller number in scrun().

Noticed by miod@openbsd.
 1.5 02-Jan-2014  tsutsui Change the SCSI select timeout from 2ms to 250ms as kernel spc(4) driver does.

Noticed by miod@openbsd.
 1.4 22-Jan-2013  tsutsui branches: 1.4.2; 1.4.4; 1.4.6;
Whitespace cleanup.
 1.3 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 13-Jan-2013  tsutsui Remove unused function members from struct driver.
This makes adding other drivers easier.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.4.6.4 03-Dec-2017  jdolecek update from HEAD
 1.4.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.6.2 25-Feb-2013  tls resync with head
 1.4.6.1 22-Jan-2013  tls file sc.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.4.4.1 18-May-2014  rmind sync with head
 1.4.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.4.2.2 23-Jan-2013  yamt sync with head
 1.4.2.1 22-Jan-2013  yamt file sc.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.10.2.1 10-Aug-2014  tls Rebase.
 1.11.4.1 06-Apr-2015  skrll Sync with HEAD
 1.17.20.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.19.10.1 02-Aug-2025  perseant Sync with HEAD
 1.2 11-Jan-2014  tsutsui Misc KNF and cosmetics.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file screen.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file screen.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.8 05-Jul-2024  andvar s/vender/vendor/ in comments, log message and fw ohci register property.
 1.7 14-Feb-2015  tsutsui branches: 1.7.54;
Misc KNF and cosmetics.
 1.6 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.5 11-Jan-2014  tsutsui branches: 1.5.6;
Misc KNF and cosmetics.
 1.4 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.3 02-Jan-2014  tsutsui Replace broken (by SCCS) ISO-2022-JP comments with UTF-8.

Recovered and decoded by isaki@.
 1.2 20-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Don't call internal cngetc() and cnputc() directly.
Use public getchar() and putchar() instead.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 20-Jan-2013  tls file scsi.c was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.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.2.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 20-Jan-2013  yamt file scsi.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.5.6.1 06-Apr-2015  skrll Sync with HEAD
 1.7.54.1 02-Aug-2025  perseant Sync with HEAD
 1.4 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.3 03-Jan-2014  tsutsui branches: 1.3.6;
Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.2 22-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Whitespace cleanup.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 22-Jan-2013  tls file scsireg.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.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.2.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 22-Jan-2013  yamt file scsireg.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3.6.1 06-Apr-2015  skrll Sync with HEAD
 1.4 02-Aug-2021  andvar fix various typos in comments and log messages.
 1.3 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.2 10-Jan-2014  tsutsui branches: 1.2.6;
Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.4 03-Dec-2017  jdolecek update from HEAD
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file scsivar.h was added on branch tls-maxphys on 2013-02-25 00:28:49 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file scsivar.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2.6.1 06-Apr-2015  skrll Sync with HEAD
 1.13 24-Jun-2023  tsutsui Fix a wrong cdb size of SCSI disk write command. From OpenBSD/luna88k.
 1.12 14-Feb-2015  tsutsui Explicitly denote static functions.
 1.11 16-Apr-2014  tsutsui branches: 1.11.4;
Check a status code and return proper errno in sdstrategy().

Suggested by gcc 4.8 -Wunused-but-set-variable warning to use the variable.
 1.10 11-Jan-2014  tsutsui branches: 1.10.2;
Misc KNF and cosmetics.
 1.9 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.8 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.7 03-Jan-2014  tsutsui Misc cleanup from OpenBSD/luna88k.

- remove unused code
- use proper prefix for structure members for readability
 1.6 03-Jan-2014  tsutsui Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.5 22-Jan-2013  tsutsui branches: 1.5.2; 1.5.4; 1.5.6;
Whitespace cleanup.
 1.4 21-Jan-2013  tsutsui Slightly modify sd attach message, as kernel does.

before:
sd0: HITACHI DK315C-14 rev H7H6, 2807459 512 byte blocks

after:
sd0: HITACHI DK315C-14 rev H7H6, 512 bytes/sect x 2807459 sectors
 1.3 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 13-Jan-2013  tsutsui Remove unused function members from struct driver.
This makes adding other drivers easier.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.5.6.4 03-Dec-2017  jdolecek update from HEAD
 1.5.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.2 25-Feb-2013  tls resync with head
 1.5.6.1 22-Jan-2013  tls file sd.c was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.5.4.1 18-May-2014  rmind sync with head
 1.5.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.5.2.2 23-Jan-2013  yamt sync with head
 1.5.2.1 22-Jan-2013  yamt file sd.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.10.2.1 10-Aug-2014  tls Rebase.
 1.11.4.1 06-Apr-2015  skrll Sync with HEAD
 1.5 30-Jun-2019  tsutsui Pull OpenBSD/luna88k board.h to define SX9100 board device addresses.

Also replace magic addresses with macro where appropriate.
 1.4 03-Jan-2014  tsutsui branches: 1.4.30;
Remove unused code (from OpenBSD/luna88k). Some KNF.
 1.3 21-Jan-2013  tsutsui branches: 1.3.2; 1.3.4; 1.3.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.2 12-Jan-2013  tsutsui Make sure to enable DTR and RTS on TX initialization for SIO console.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 21-Jan-2013  tls file sio.c was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.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.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 21-Jan-2013  yamt file sio.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.4.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.6 24-Jun-2023  tsutsui Add comments and remove nonexistent status registers.
 1.5 28-Mar-2023  andvar s/interrput/interrupt/ and s/accesss/access/ in comments.
 1.4 14-Feb-2015  tsutsui Use proper signedness and exact-width interger types.
 1.3 11-Jan-2014  tsutsui branches: 1.3.6;
Misc KNF and cosmetics.
 1.2 12-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Make sure to enable DTR and RTS on TX initialization for SIO console.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 12-Jan-2013  tls file sioreg.h was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.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.2.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 12-Jan-2013  yamt file sioreg.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3.6.1 06-Apr-2015  skrll Sync with HEAD
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file status.h was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file status.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.2 11-Jan-2014  tsutsui Remove unused KernInter stuff.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.4; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file stinger.h was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.1.4.1 18-May-2014  rmind sync with head
 1.1.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.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file stinger.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.3 22-Apr-2023  tsutsui Remove ancient /*ARGSUSED*/ comments.
 1.2 15-Jun-2021  tsutsui constify
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.6; 1.1.58;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.58.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file trap.c was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file trap.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.7 13-Oct-2023  tsutsui Fix typo. From OpenBSD/luna88k.
 1.6 17-May-2021  mrg include libkern.h to get moved dkcksum() definition.
 1.5 14-Feb-2015  tsutsui branches: 1.5.34; 1.5.36;
Use proper signedness and exact-width interger types.
 1.4 11-Jan-2014  tsutsui branches: 1.4.6;
Misc KNF and cosmetics.
 1.3 03-Jan-2014  tsutsui Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
 1.2 14-Jan-2013  tsutsui branches: 1.2.2; 1.2.4; 1.2.6;
Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.2.6.4 03-Dec-2017  jdolecek update from HEAD
 1.2.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 25-Feb-2013  tls resync with head
 1.2.6.1 14-Jan-2013  tls file ufs_disksubr.c was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.2.4.1 18-May-2014  rmind sync with head
 1.2.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.2.2.2 23-Jan-2013  yamt sync with head
 1.2.2.1 14-Jan-2013  yamt file ufs_disksubr.c was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.4.6.1 06-Apr-2015  skrll Sync with HEAD
 1.5.36.1 31-May-2021  cjep sync with head
 1.5.34.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1 05-Jan-2013  tsutsui branches: 1.1.2; 1.1.6;
First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.1.6.2 25-Feb-2013  tls resync with head
 1.1.6.1 05-Jan-2013  tls file vectors.h was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.1.2.2 23-Jan-2013  yamt sync with head
 1.1.2.1 05-Jan-2013  yamt file vectors.h was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.13 15-Jun-2021  tsutsui Fix off-by-one of a number of blocks of probed disks.

The SCSI READ_CAPACITY command returns the last logical data block
address, so we have to increment it to get a number of blocks
as src/sys/dev/scsipi/sd.c does.

Bump revision to denote the change.
 1.12 17-Jan-2016  tsutsui branches: 1.12.34;
Enable LIBSA_CREAD_NOCRC. PR/50638

Also bump version to denote user visible change.
Tested on LUNA-II.
 1.11 16-Apr-2014  tsutsui branches: 1.11.4;
Use booted device unit if no unit number is specified on boot command.

Bump version to denote a visible change.
 1.10 11-Jan-2014  tsutsui branches: 1.10.2;
Bump version to denote support to pass boothowto and bootdev to kernel.
 1.9 10-Jan-2014  tsutsui Reorgenize boot device configuration. The idea is taken from OpenBSD/luna88k.

- remove kernel-like autoconfiguration to probe bootable devices
- initialize SCSI and Ethernet controllers statically instead
- reorganize device softc structures per autoconf removal
- probe and print all SCSI disks (but don't assign unit numbers)
- make sdopen() to recheck the device and allocate softc dynamically
- use controller number and SCSI target ID (ctlr * 10 + id) to specify
the boot disk on the "boot" command arg
- bump version to denote changes

Now bootloader works as the following:
---
>> NetBSD/luna68k boot, Revision 1.8 (Wed Jan 8 22:13:12 JST 2014)
>> (based on Stinger ver 0.0 [Phase-31])

Machine model = LUNA-II
Physical Memory = 0x4000000 (64 MB)

sc0 at 0xe1000000: async, parity, ID 7
ID 3: TEAC FC-1 HGF 10 rev , 512 bytes/sect x 2879 sectors
ID 6: IBM DPES-31080 rev S31Q, 512 bytes/sect x 2118143 sectors
sc1 at 0xe1000040: async, parity, ID 7
ID 6: MELCO DSC-G rev 1.00, 512 bytes/sect x 62533295 sectors
le0: Am7990 LANCE Ethernet, mem at 0x71010000
le0: Ethernet address = 00:00:0a:03:42:77

Press return to boot now, any other key for boot menu
booting sd(16,0)netbsd - starting in 0 seconds.
auto-boot sd(16,0)netbsd
1911696+96040 [280480+159179]=0x255a30
:
 1.8 05-Jan-2014  tsutsui Detect boot device on PROM load command and set proper default boot device.

Also remove now unnecessary the old netboot check.

Note all addresses of boot device info set by monitor are checked by
memory dump on several LUNA ROM versions, and these addres might be
different on earlier monitor ROM versions.

Bump version to denote the visible change.
 1.7 03-Jan-2014  tsutsui Pull more fixes from OpenBSD/luna88k:

- accept empty controller and partition numbers, as well as empty filenames,
and use defaults (0, 0 and "netbsd") instead of complaining the boot path
is invalid
- move a macro where actually necessary

Also bump version to denote the user visible change.
 1.6 05-Mar-2013  tsutsui branches: 1.6.6;
Check netboot and set proper default boot device.
Also bump version.
 1.5 21-Jan-2013  tsutsui branches: 1.5.2; 1.5.6;
Add support for "await key" to abort autoboot and get boot menu.
Also add command help. Bump version.
 1.4 16-Jan-2013  tsutsui Add UFS2 support. Also bump version.
 1.3 14-Jan-2013  tsutsui Fix drivers to make secondary SPC SCSI on LUNA-II work properly.
Also bump version.

Now we can load a NetBSD kernel from external SCSI disks on LUNA-II.
(and netboot on LUNA-II also works)
 1.2 13-Jan-2013  tsutsui Add netboot support.
Based on ews4800mips, mvme68k, and x68k standalone drivers.
Also bump version.

Tested on LUNA-I.

XXX: We really need proper documents about libsa APIs.
 1.1 05-Jan-2013  tsutsui First cut at NetBSD/luna68k native bootloader.

Based on 4.4BSD-Lite2/luna68k "Stinger" loader revision "Phase-31"
http://svnweb.freebsd.org/csrg/sys/luna68k/stand/
and MI libsa glue stuff are taken from hp300 etc.

Tested on LUNA-I and old DK315C SCSI disk drive.

LUNA's monitor PROM can load only an a.out binary in 4.3BSD FFS partition
(i.e. created by "newfs -O 0") on disks with OMRON's UniOS disklabel,
but now we can load an ELF kernel in root partition via this bootloader.
(See luna68k/disksubr.c for details of UniOS label)

TODO:
- LUNA-II support (check 68040 to adjust cpuspeed for DELAY())
- secondary SCSI support for LUNA-II
- netboot via le(4) (should be trivial)
- support boot options on bootloader prompt
- bootinfo (passing info about booted device and kernel symbols)
- support "press return to boot now, any other key for boot menu" method
like x86 bootloader (needs cnscan() like functions)
- tapeboot (anyone wants it?)
 1.5.6.5 03-Dec-2017  jdolecek update from HEAD
 1.5.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.3 23-Jun-2013  tls resync from head
 1.5.6.2 25-Feb-2013  tls resync with head
 1.5.6.1 21-Jan-2013  tls file version was added on branch tls-maxphys on 2013-02-25 00:28:50 +0000
 1.5.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.5.2.2 23-Jan-2013  yamt sync with head
 1.5.2.1 21-Jan-2013  yamt file version was added on branch yamt-pagecache on 2013-01-23 00:05:54 +0000
 1.6.6.1 18-May-2014  rmind sync with head
 1.10.2.1 10-Aug-2014  tls Rebase.
 1.11.4.1 19-Mar-2016  skrll Sync with HEAD
 1.12.34.1 17-Jun-2021  thorpej Sync w/ HEAD.

RSS XML Feed