Home | History | Annotate | only in /src/sys/arch/powerpc/ibm4xx
History log of /src/sys/arch/powerpc/ibm4xx
RevisionDateAuthorComments
 1.8 31-May-2022  andvar fix various typos in comments, documentation and messages.
 1.7 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 07-Oct-2006  tsutsui branches: 1.6.4;
Fix an obvious typo. Patch from seebs in PR port-powerpc/33107.
 1.5 11-Dec-2005  christos branches: 1.5.20; 1.5.22;
merge ktrace-lwp.
 1.4 03-Aug-2003  eeh branches: 1.4.16;
Use %r<n> for register names.
 1.3 25-Jul-2003  scw Switch ibm4xx over to using the more flexible powerpc bus_space/bus_dma code.
 1.2 19-Dec-2002  thorpej branches: 1.2.2;
Merge the IBM 4xx into the common powerpc/locore_subr.S, and
eliminate all the duplicated context switch related code in
the IBM 4xx port.
 1.1 23-Aug-2002  scw branches: 1.1.2; 1.1.4; 1.1.6;
Split off common 4xx locore code so it can be re-used by other 4xx ports.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 23-Aug-2002  jdolecek file 4xx_locore.S was added on branch kqueue on 2002-09-06 08:39:01 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 23-Aug-2002  gehenna file 4xx_locore.S was added on branch gehenna-devsw on 2002-08-31 13:45:42 +0000
 1.1.2.4 19-Dec-2002  thorpej Sync with HEAD.
 1.1.2.3 19-Dec-2002  thorpej lwz -> lbz when loading the LWP priority.
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 23-Aug-2002  nathanw file 4xx_locore.S was added on branch nathanw_sa on 2002-08-27 23:45:05 +0000
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.2 03-Sep-2007  yamt sync with head.
 1.4.16.1 30-Dec-2006  yamt sync with head.
 1.5.22.1 22-Oct-2006  yamt sync with head
 1.5.20.1 18-Nov-2006  ad Sync with head.
 1.6.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.10 12-Sep-2022  rin Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.
 1.9 12-Jul-2020  rin Fix comment.

ibm4xx does not use powerpc/powerpc/trap_subr.S, but
powerpc/ibm4xx/trap_subr.S.
 1.8 01-Mar-2020  rin Implement workaround for IBM405 Errata 77 (aka CPU_210), where
interrupted stwcx. may errantly write data to memory:

https://elinux.org/images/1/1d/Ppc405gp-errata.pdf

This is because stwcx. is split into two pieces in the pipeline.

We need to
(1) insert dcbt before every stwcx. instruction, as well as
(2) insert sync before every rfi/rfci instruction.

It is unclear which processors are affected, but according to Linux,
all 405-based cores up until 405GPR and 405EP are affected:

https://github.com/torvalds/linux/blob/master/arch/powerpc/platforms/40x/Kconfig#L140

For kernel, this workaround can be restricted to affected processors.
However, for kernel modules and userland, we have to enable it for all
32bit powerpc archs in order to share common binaries as before.

Proposed on port-powerpc:

http://mail-index.netbsd.org/port-powerpc/2020/02/21/msg003583.html
 1.7 19-May-2011  kiyohara branches: 1.7.56; 1.7.60;
+ Load TLB-miss-address from SRR0, if ITMISS.
+ Remove a white space.
 1.6 18-Jan-2011  matt Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.
 1.5 11-Dec-2005  christos branches: 1.5.100; 1.5.104; 1.5.106;
merge ktrace-lwp.
 1.4 03-Aug-2003  eeh Use %r<n> for register names.
 1.3 11-Mar-2003  hannken branches: 1.3.2;
Add support for the IBM 403GCX cpu. Enabled with "options PPC_IBM403".

- different set of device control registers.
- non-standard access to the time base.
- 16 byte cache lines.

Approved by: Eduardo Horvath <eeh@netbsd.org>
 1.2 11-Jul-2002  simonb Clean up some white space niggles.
 1.1 13-Jun-2001  simonb branches: 1.1.2; 1.1.8; 1.1.16;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.
 1.1.16.1 16-Jul-2002  gehenna catch up with -current.
 1.1.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.8.1 13-Jun-2001  nathanw file 4xx_trap_subr.S was added on branch nathanw_sa on 2002-08-01 02:43:00 +0000
 1.1.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.104.1 07-Jan-2011  matt Deal with new powerpc world.
 1.5.100.2 31-May-2011  rmind sync with head
 1.5.100.1 05-Mar-2011  rmind sync with head
 1.7.60.1 03-Mar-2020  martin Pull up following revision(s) (requested by rin in ticket #755):

sys/arch/evbppc/conf/std.virtex: revision 1.4
sys/arch/powerpc/powerpc/trap_subr.S: revision 1.81
sys/arch/powerpc/ibm4xx/4xx_trap_subr.S: revision 1.8
sys/arch/evbppc/conf/std.walnut: revision 1.9
common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h: revision 1.7
sys/arch/powerpc/include/asm.h: revision 1.49
common/lib/libc/arch/powerpc/atomic/atomic_cas.S: revision 1.9
sys/arch/powerpc/ibm4xx/trap_subr.S: revision 1.28
sys/arch/powerpc/include/lock.h: revision 1.15
sys/arch/evbppc/conf/std.obs266: revision 1.3
common/lib/libc/arch/powerpc/atomic/atomic_swap.S: revision 1.8
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.61
sys/arch/powerpc/powerpc/lock_stubs.S: revision 1.12
sys/arch/evbppc/conf/std.obs200: revision 1.5

Implement workaround for IBM405 Errata 77 (aka CPU_210), where
interrupted stwcx. may errantly write data to memory:

https://elinux.org/images/1/1d/Ppc405gp-errata.pdf

This is because stwcx. is split into two pieces in the pipeline.

We need to
(1) insert dcbt before every stwcx. instruction, as well as
(2) insert sync before every rfi/rfci instruction.

It is unclear which processors are affected, but according to Linux,
all 405-based cores up until 405GPR and 405EP are affected:

https://github.com/torvalds/linux/blob/master/arch/powerpc/platforms/40x/Kconfig#L140

For kernel, this workaround can be restricted to affected processors.

However, for kernel modules and userland, we have to enable it for all
32bit powerpc archs in order to share common binaries as before.
Proposed on port-powerpc:

http://mail-index.netbsd.org/port-powerpc/2020/02/21/msg003583.html
 1.7.56.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 18-Mar-2005  shige Remove MD codes from arch/powerpc/ibm4xx.
 1.1 13-Jan-2005  shige branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10;
Add device_register machine-independent-glue.
 1.1.10.1 14-Sep-2005  tron Apply patch (requested by shige in ticket #763):
Synchronize OpenBlockS266 port with NetBSD-current for enhanced stability.
 1.1.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.4.3 01-Apr-2005  skrll Sync with HEAD.
 1.1.4.2 17-Jan-2005  skrll Sync with HEAD.
 1.1.4.1 13-Jan-2005  skrll file autoconf.c was added on branch ktrace-lwp on 2005-01-17 19:30:09 +0000
 1.1.2.1 29-Apr-2005  kent sync with -current
 1.4 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.3 05-May-2006  thorpej branches: 1.3.98;
Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
merge ktrace-lwp.
 1.1 17-Jan-2005  shige branches: 1.1.2; 1.1.10; 1.1.12; 1.1.14;
Add openbios-board related modules.
- openbios.c
getting board data memory image from openbios.
setting all board data to board properties database.
- board_prop.c
initialize board properties database.
(set/get board properties [macros in ibm4xx/cpu.h])
 1.1.14.2 15-Sep-2005  riz Pull up following revision(s) (requested by shige in ticket #5820):
distrib/evbppc/md-kernel/Makefile 1.3 via patch
etc/etc.evbppc/Makefile.inc 1.3 via patch
sys/arch/evbppc/conf/files.obs405 1.5-1.8 via patch
sys/arch/evbppc/conf/OPENBLOCKS266 1.22,1.25 via patch
sys/arch/evbppc/include/obs266.h 1.1 (new)
sys/arch/evbppc/include/obs405.h 1.1-1.5 (new)
sys/arch/evbppc/include/rbus_machdep.h 1.1 (new)
sys/arch/evbppc/obs405/consinit.c 1.2-1.4
sys/arch/evbppc/obs405/dev/x1226.c deleted
sys/arch/evbppc/obs405/dev/x1226reg.h deleted
sys/arch/evbppc/obs405/machdep.c deleted
sys/arch/evbppc/obs405/obs266_autoconf.c 1.1 (new)
sys/arch/evbppc/obs405/obs266_machdep.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_autoconf.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_machdep.c 1.1 (new)
sys/arch/evbppc/obs405/rbus_machdep.c 1.1 (new)
sys/arch/powerpc/conf/files.ibm4xx 1.6-1.7
sys/arch/powerpc/ibm4xx/board_prop.c 1.1 (new)
sys/arch/powerpc/ibm4xx/dev/com_opb.c 1.12
sys/arch/powerpc/ibm4xx/dev/comopbvar.h 1.1 (new)
sys/arch/powerpc/ibm4xx/ibm40x_machdep.c 1.3-1.4
sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 1.1-1.2 (new)
sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c 1.1-1.3 (new)
sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 1.2-1.3
sys/arch/powerpc/ibm4xx/openbios/openbios.c 1.1 (new)
sys/arch/powerpc/include/ibm4xx/cpu.h 1.7-1.10
sys/arch/powerpc/include/ibm4xx/openbios.h 1.1 (new)

Update OpenBlockS266 support to more modern, stable sources.
 1.1.14.1 17-Jan-2005  riz file board_prop.c was added on branch netbsd-2 on 2005-09-15 14:28:44 +0000
 1.1.12.1 21-Jun-2006  yamt sync with head.
 1.1.10.2 29-Apr-2005  kent sync with -current
 1.1.10.1 17-Jan-2005  kent file board_prop.c was added on branch kent-audio2 on 2005-04-29 11:28:19 +0000
 1.1.2.2 24-Jan-2005  skrll Sync with HEAD.
 1.1.2.1 17-Jan-2005  skrll file board_prop.c was added on branch ktrace-lwp on 2005-01-24 08:34:26 +0000
 1.2.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 11-May-2006  elad sync with head
 1.2.8.1 24-May-2006  yamt sync with head.
 1.2.6.1 01-Jun-2006  kardel Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.98.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.33 05-Oct-2022  rin Minor style fixes to asm codes. No binary changes.
 1.32 05-Mar-2021  rin For Explora 451, call calc_delayconst() before pckbc_cnattach(), which
depends on delay() and DELAY().

Unfortunately, proplib(9) API is not available for MD codes, that are
called before consinit() (since pool(9) is not initialized yet).

Therefore, hard-code CPU frequency to calc_delayconst() in case
"processor-frequency" is not initialized.
 1.31 18-Jan-2021  rin Invoke hardclock() and statclock() in the interrupt context.

Otherwise, entropy_enter() is used instead of entropy_enter_intr() in
statclock(), which results in KASSERT() failure.
 1.30 18-Jan-2021  rin Simplify and correct stale comment; nticks-th hardclock() had no longer
been special since rev 1.24:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/clock.c#rev1.24

No functional changes intended.
 1.29 06-Jul-2020  rin branches: 1.29.2;
Include missing opt_ppcarch.h.
 1.28 29-May-2020  rin For struct timecounter, use C99 initializers.
Compile tested. No functional changes intended.
 1.27 09-Jan-2012  kiyohara Reenable interrupt before was call pic_do_pending_int() by splx(), or KASSERT().
 1.26 20-Jun-2011  matt branches: 1.26.2; 1.26.6;
Change IBM4xx to use the common powerpc PIC framework.
Consolidate most ibm4xx initppc function into ibm4xx_init
and Make all IBM4xx use it.
Change explora to use initppc instead of bootstrap.
 1.25 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.24 18-Jan-2011  matt branches: 1.24.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.
 1.23 20-Dec-2010  matt branches: 1.23.2;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.22 25-Feb-2010  matt branches: 1.22.2;
Adapt to spr.h breakup.
 1.21 09-Jan-2008  simonb branches: 1.21.10; 1.21.30; 1.21.34;
Bump uvmexp.intrs when we get a clock or statclock interrupt.
 1.20 08-Jan-2008  joerg Mask is unsigned, add missing u.
 1.19 08-Jan-2008  joerg Finish conversion of ppc and evbppc to timecounter.
Tested by simonb@ on WALNUT.
 1.18 27-Sep-2006  freza branches: 1.18.28; 1.18.34; 1.18.42;
Make sure we mask statclock timer on ibm4xx systems. This avoids
pthread "related" panics like:

panic: remrunqueue: bit 18 not set
Stopped in pid 479.3 (exsprite) at netbsd:cpu_Debugger+0x10: lwz
r
0, r1, 0x14
db> bt
0x869abe00: at panic+0x1b4
0x869abe50: at remrunqueue+0x80
0x869abe60: at mi_switch+0x114
0x869abea0: at sa_unblock_userret+0x4e8
0x869abee0: at syscall_plain+0x224
0x869abf40: user SC trap #93 by 0x41949810: srr1=0xc030
r1=0x445fff40 cr=0x40000002 xer=0 ctr=0x41aae208 esr=0 pid=0x36

While there, cleanup IPL_ definitions somewhat and fix interrupt mask
calculation per spl(9).

OK by matt@
 1.17 30-Jun-2006  freza branches: 1.17.4; 1.17.6;
Bring ibm4xx interrupt code up to date:

- generic soft interrupts (ie. use powerpc/softintr.c)
- interrupt event counters (using the ones from powerpc/cpu.h:cpu_info
where appropriate)
- cleanup ibm4xx_intr.h, move implementation details to intr.c

Convert all affected evbppc platforms.

OK by simonb@, some points discussed with matt@
 1.16 05-May-2006  thorpej branches: 1.16.4;
Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.15 08-Mar-2006  lukem branches: 1.15.2;
Use the SI capitalization for "Hz", "kHz", and "MHz" in comments and strings.
Add a space between numbers and Hz unit.
 1.14 24-Dec-2005  perry branches: 1.14.4; 1.14.6; 1.14.8; 1.14.10;
bare asm -> __asm
 1.13 23-Nov-2005  nonaka In decr_intr(), update lasttb only when clock interrupt is not masked.
(sync with macppc/macppc/clock.c: rev.1.11 -> 1.12)
 1.12 03-Jun-2005  scw branches: 1.12.2; 1.12.8;
Appease the -Wshadow and -Wcast-qual gods.
 1.11 19-Jan-2005  simonb A more accurate microtime() implementation. Avoids precision
errors when the clock frequency doesn't divide nicely in to 10^9.
 1.10 02-Sep-2004  scw branches: 1.10.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().
 1.9 15-Jul-2003  lukem __KERNEL_RCSID()
 1.8 11-Mar-2003  hannken branches: 1.8.2;
Add support for the IBM 403GCX cpu. Enabled with "options PPC_IBM403".

- different set of device control registers.
- non-standard access to the time base.
- 16 byte cache lines.

Approved by: Eduardo Horvath <eeh@netbsd.org>
 1.7 27-Aug-2002  scw Don't need <machine/walnut.h> here.
 1.6 23-Aug-2002  scw Don't frob cpu-specific DCR registers in common code.
 1.5 06-Aug-2002  chs move more inlines to cpu.h: mftb(), mftbl() and mfpvr().
(the mftb() in pmap.c only wanted the lower 32 bits, so that's now mftbl()).
 1.4 03-Aug-2002  simonb Sprinkle a small amount of KNF.
 1.3 11-Jul-2002  simonb Clean up some white space niggles.
 1.2 15-Mar-2002  eeh branches: 1.2.4; 1.2.6; 1.2.10;
Use properties instead of board_info.
 1.1 13-Mar-2002  eeh This should be pretty standard.
 1.2.10.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.10.1 15-Mar-2002  jdolecek file clock.c was added on branch kqueue on 2002-06-23 17:39:38 +0000
 1.2.6.2 31-Aug-2002  gehenna catch up with -current.
 1.2.6.1 16-Jul-2002  gehenna catch up with -current.
 1.2.4.5 27-Aug-2002  nathanw Catch up to -current.
 1.2.4.4 06-Aug-2002  nathanw Catch up with powerpc rototilling.
 1.2.4.3 01-Aug-2002  nathanw Catch up to -current.
 1.2.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.1 15-Mar-2002  nathanw file clock.c was added on branch nathanw_sa on 2002-04-01 07:42:01 +0000
 1.8.2.7 11-Dec-2005  christos Sync with head.
 1.8.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.8.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.2 03-Sep-2004  skrll Sync with HEAD
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.10.4.1 29-Apr-2005  kent sync with -current
 1.12.8.1 29-Nov-2005  yamt 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.14.10.2 11-May-2006  elad sync with head
 1.14.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.14.8.3 11-Aug-2006  yamt sync with head
 1.14.8.2 24-May-2006  yamt sync with head.
 1.14.8.1 13-Mar-2006  yamt sync with head.
 1.14.6.2 01-Jun-2006  kardel Sync with head.
 1.14.6.1 22-Apr-2006  simonb Sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.16.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.17.6.1 22-Oct-2006  yamt sync with head
 1.17.4.1 18-Nov-2006  ad Sync with head.
 1.18.42.2 10-Jan-2008  bouyer Sync with HEAD
 1.18.42.1 08-Jan-2008  bouyer Sync with HEAD
 1.18.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.18.28.2 23-Mar-2008  matt sync with HEAD
 1.18.28.1 09-Jan-2008  matt sync with HEAD
 1.21.34.1 07-Jan-2011  matt Deal with new powerpc world.
 1.21.30.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.21.10.1 11-Mar-2010  yamt sync with head
 1.22.2.1 05-Mar-2011  rmind sync with head
 1.23.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.24.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.26.6.1 18-Feb-2012  mrg merge to -current.
 1.26.2.1 17-Apr-2012  yamt sync with head
 1.29.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.24 05-Oct-2022  rin Minor style fixes to asm codes. No binary changes.
 1.23 05-Oct-2022  rin copy{in,out}str: As a tiny optimization, drop redundant mtpid.

No regression for ATF on 405. 403 seems to work fine.
 1.22 04-Oct-2022  rin copy{in,out}str: Consistently use tmp as scratch register. NFC.
 1.21 04-Oct-2022  rin copy{in,out}str: "insn[TAB]operands;" for inline asm codes.
 1.20 04-Oct-2022  rin copy{in,out}str: Style sync with copy{in,out}. No binary changes.
 1.19 04-Oct-2022  rin copy{in,out}{,str}: Drop needless dcbst.

Data cache is purely physical for 40[53] with 16KB pages, and therefore
no need to flush cache before context switch.

This significantly improves copy{in,out} against small data; for example,
bytebench on DHT becomes:

-Pipe Throughput 12440.0 8826.1 7.1
+Pipe Throughput 12440.0 18364.8 14.8

No performance/ATF regression observed on 405. 403 boots successfully
into multiuser mode, and builds some packages.
 1.18 03-Oct-2022  rin copy{in,out}str: Add cr0 and ctr to list of clobbered registers.
 1.17 03-Oct-2022  rin copy{in,out}str: Consistently use uaddr instead of udaddr.
Note that we use kaddr, not kdaddr, for kernel data address.
 1.16 03-Oct-2022  rin copy{in,out}str: Tidy up inline asm's:
- Use %[foo], %[bar], ... instead of %0, %1, ...
- One instruction per line.
- Paragraph grouped instructions.
- Fix wrong comments.
No binary changes.
 1.15 12-Sep-2022  rin Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.
 1.14 19-Jun-2020  rin Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.
 1.13 05-Mar-2020  rin Cosmetic changes. No binary changes.
 1.12 05-Mar-2020  rin Use dcbst instead of dcbf to flush cache; the former does not invalidate
the cache line, which should be used immediately in most cases.
 1.11 05-Mar-2020  rin copy{in,out}str: Correctly return ENAMETOOLONG if source is not
NUL-terminated.
 1.10 05-Mar-2020  rin copy{in,out}str: sync style with booke.

- early return in case of len == 0
- *done = 0 on fault
 1.9 20-Mar-2010  chs branches: 1.9.60; 1.9.64;
fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.8 24-Dec-2005  perry branches: 1.8.78; 1.8.98; 1.8.100;
bare asm -> __asm
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 02-Sep-2004  scw branches: 1.6.12;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().
 1.5 20-Oct-2003  simonb Remove some numeric asm labels that aren't used.
 1.4 15-Jul-2003  lukem __KERNEL_RCSID()
 1.3 02-Feb-2003  matt branches: 1.3.2;
Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.
 1.2 11-Jul-2002  simonb Clean up some white space niggles.
 1.1 13-Jun-2001  simonb branches: 1.1.2; 1.1.8; 1.1.16;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.
 1.1.16.1 16-Jul-2002  gehenna catch up with -current.
 1.1.8.5 01-Aug-2002  nathanw Catch up to -current.
 1.1.8.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.1.8.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.1.8.2 05-Nov-2001  briggs Initial SA support for ppc. Test-booted on sandpoint, macppc, & walnut.
mcontext and cpu_getmcontext()/cpu_setmcontext() from Klaus Klein
<kleink@netbsd.org>.
 1.1.8.1 13-Jun-2001  briggs file copyinstr.c was added on branch nathanw_sa on 2001-11-05 19:46:15 +0000
 1.1.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.2 03-Sep-2004  skrll Sync with HEAD
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.12.1 21-Jun-2006  yamt sync with head.
 1.8.100.1 30-May-2010  rmind sync with head
 1.8.98.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.8.78.1 11-Aug-2010  yamt sync with head.
 1.9.64.1 09-Mar-2020  martin Pull up following revision(s) (requested by rin in ticket #772):

sys/arch/powerpc/ibm4xx/copyinstr.c: revision 1.12
sys/arch/powerpc/ibm4xx/copyinstr.c: revision 1.13
sys/arch/powerpc/ibm4xx/copyoutstr.c: revision 1.10
sys/arch/powerpc/ibm4xx/copyoutstr.c: revision 1.11
sys/arch/powerpc/ibm4xx/copyoutstr.c: revision 1.12
sys/arch/powerpc/ibm4xx/copyoutstr.c: revision 1.13
sys/arch/powerpc/ibm4xx/copyinstr.c: revision 1.10
sys/arch/powerpc/ibm4xx/copyinstr.c: revision 1.11

copy{in,out}str: sync style with booke.
- early return in case of len == 0
- *done = 0 on fault

copy{in,out}str: Correctly return ENAMETOOLONG if source is not
NUL-terminated.

Use dcbst instead of dcbf to flush cache; the former does not invalidate
the cache line, which should be used immediately in most cases.

Cosmetic changes. No binary changes.
 1.9.60.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.24 05-Oct-2022  rin Minor style fixes to asm codes. No binary changes.
 1.23 05-Oct-2022  rin copy{in,out}str: As a tiny optimization, drop redundant mtpid.

No regression for ATF on 405. 403 seems to work fine.
 1.22 04-Oct-2022  rin copy{in,out}str: Consistently use tmp as scratch register. NFC.
 1.21 04-Oct-2022  rin copy{in,out}str: "insn[TAB]operands;" for inline asm codes.
 1.20 04-Oct-2022  rin copy{in,out}str: Style sync with copy{in,out}. No binary changes.
 1.19 04-Oct-2022  rin copy{in,out}{,str}: Drop needless dcbst.

Data cache is purely physical for 40[53] with 16KB pages, and therefore
no need to flush cache before context switch.

This significantly improves copy{in,out} against small data; for example,
bytebench on DHT becomes:

-Pipe Throughput 12440.0 8826.1 7.1
+Pipe Throughput 12440.0 18364.8 14.8

No performance/ATF regression observed on 405. 403 boots successfully
into multiuser mode, and builds some packages.
 1.18 03-Oct-2022  rin copy{in,out}str: Add cr0 and ctr to list of clobbered registers.
 1.17 03-Oct-2022  rin copy{in,out}str: Consistently use uaddr instead of udaddr.
Note that we use kaddr, not kdaddr, for kernel data address.
 1.16 03-Oct-2022  rin copy{in,out}str: Tidy up inline asm's:
- Use %[foo], %[bar], ... instead of %0, %1, ...
- One instruction per line.
- Paragraph grouped instructions.
- Fix wrong comments.
No binary changes.
 1.15 12-Sep-2022  rin Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.
 1.14 19-Jun-2020  rin Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.
 1.13 05-Mar-2020  rin Cosmetic changes. No binary changes.
 1.12 05-Mar-2020  rin Use dcbst instead of dcbf to flush cache; the former does not invalidate
the cache line, which should be used immediately in most cases.
 1.11 05-Mar-2020  rin copy{in,out}str: Correctly return ENAMETOOLONG if source is not
NUL-terminated.
 1.10 05-Mar-2020  rin copy{in,out}str: sync style with booke.

- early return in case of len == 0
- *done = 0 on fault
 1.9 20-Mar-2010  chs branches: 1.9.60; 1.9.64;
fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.8 24-Dec-2005  perry branches: 1.8.78; 1.8.98; 1.8.100;
bare asm -> __asm
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 02-Sep-2004  scw branches: 1.6.12;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().
 1.5 20-Oct-2003  simonb Remove some numeric asm labels that aren't used.
 1.4 15-Jul-2003  lukem __KERNEL_RCSID()
 1.3 02-Feb-2003  matt branches: 1.3.2;
Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.
 1.2 11-Jul-2002  simonb Clean up some white space niggles.
 1.1 13-Jun-2001  simonb branches: 1.1.2; 1.1.8; 1.1.16;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.
 1.1.16.1 16-Jul-2002  gehenna catch up with -current.
 1.1.8.5 01-Aug-2002  nathanw Catch up to -current.
 1.1.8.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.1.8.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.1.8.2 05-Nov-2001  briggs Initial SA support for ppc. Test-booted on sandpoint, macppc, & walnut.
mcontext and cpu_getmcontext()/cpu_setmcontext() from Klaus Klein
<kleink@netbsd.org>.
 1.1.8.1 13-Jun-2001  briggs file copyoutstr.c was added on branch nathanw_sa on 2001-11-05 19:46:15 +0000
 1.1.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.2 03-Sep-2004  skrll Sync with HEAD
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.12.1 21-Jun-2006  yamt sync with head.
 1.8.100.1 30-May-2010  rmind sync with head
 1.8.98.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.8.78.1 11-Aug-2010  yamt sync with head.
 1.9.64.1 09-Mar-2020  martin Pull up following revision(s) (requested by rin in ticket #772):

sys/arch/powerpc/ibm4xx/copyinstr.c: revision 1.12
sys/arch/powerpc/ibm4xx/copyinstr.c: revision 1.13
sys/arch/powerpc/ibm4xx/copyoutstr.c: revision 1.10
sys/arch/powerpc/ibm4xx/copyoutstr.c: revision 1.11
sys/arch/powerpc/ibm4xx/copyoutstr.c: revision 1.12
sys/arch/powerpc/ibm4xx/copyoutstr.c: revision 1.13
sys/arch/powerpc/ibm4xx/copyinstr.c: revision 1.10
sys/arch/powerpc/ibm4xx/copyinstr.c: revision 1.11

copy{in,out}str: sync style with booke.
- early return in case of len == 0
- *done = 0 on fault

copy{in,out}str: Correctly return ENAMETOOLONG if source is not
NUL-terminated.

Use dcbst instead of dcbf to flush cache; the former does not invalidate
the cache line, which should be used immediately in most cases.

Cosmetic changes. No binary changes.
 1.9.60.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.39 05-Oct-2022  rin Minor style fixes to asm codes. No binary changes.
 1.38 30-Mar-2021  simonb Fix nearly 20 year old type - cache sizes are 2048 bytes, not 2848 bytes.
 1.37 30-Mar-2021  rin According to "PPC405GP Embedded Processor User’s Manual",
405GP has 16KB instruction cache, not 8KB.
 1.36 05-Mar-2021  rin branches: 1.36.2;
Show PVR as 8-digit hex.
 1.35 05-Mar-2021  rin Add 403 family processors other than 403GCX.
 1.34 05-Mar-2020  rin branches: 1.34.4;
Cosmetic change. No binary changes.
 1.33 24-Mar-2014  christos branches: 1.33.30; 1.33.34;
use cpu_{g,s}etmodel
 1.32 21-Jun-2011  matt branches: 1.32.2; 1.32.12; 1.32.16;
Reap the ci_ev_soft* evcnts since every variant implements __HAVE_FAST_SOFTINTS
 1.31 18-Jun-2011  matt Constify cputab.
 1.30 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.29 05-Jun-2011  matt struct device * -> device_t, struct cfdata * -> cfdata_t
CFATTACH_DECL(*, sizeof(struct device), -> CFATTACH_DECL_NEW(&, 0
 1.28 18-Mar-2010  kiyohara branches: 1.28.2; 1.28.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.27 18-Mar-2009  cegger branches: 1.27.2; 1.27.4;
Ansify function definitions w/o arguments. Generated with sed.
 1.26 19-Nov-2007  ad branches: 1.26.18; 1.26.26; 1.26.32;
Set curlwp for the boot CPU before entering main().
 1.25 31-Aug-2006  freza branches: 1.25.12; 1.25.30; 1.25.32; 1.25.36; 1.25.38;
* add PVR values for Xilinx 405 cores
* don't try to decode vendor-specific PVR, print raw value instead.
* panic() if we see cache wasn't probed, we'd crash later anyway.
* rework the way PVR gets translated to core name.
* while there, normalize printf format ("%s: ...", device_xname(self), ...).

OK by matt@
 1.24 30-Jun-2006  freza Bring ibm4xx interrupt code up to date:

- generic soft interrupts (ie. use powerpc/softintr.c)
- interrupt event counters (using the ones from powerpc/cpu.h:cpu_info
where appropriate)
- cleanup ibm4xx_intr.h, move implementation details to intr.c

Convert all affected evbppc platforms.

OK by simonb@, some points discussed with matt@
 1.23 05-May-2006  thorpej branches: 1.23.4;
Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.22 24-Dec-2005  perry branches: 1.22.4; 1.22.6; 1.22.8; 1.22.10; 1.22.12;
bare asm -> __asm
 1.21 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.20 11-Dec-2005  christos merge ktrace-lwp.
 1.19 03-Jun-2005  scw branches: 1.19.2;
Appease -Wshadow and -Wcast-qual
 1.18 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.17 23-Sep-2003  shige Add global cpu_model variable.
 1.16 15-Jul-2003  lukem __KERNEL_RCSID()
 1.15 13-Jun-2003  simonb branches: 1.15.2;
Sprinkle some TABs to line up the columns in the cputab models array.
 1.14 13-Jun-2003  msaitoh Add support IBM 405GPr
 1.13 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.12 11-Mar-2003  hannken Add support for the IBM 403GCX cpu. Enabled with "options PPC_IBM403".

- different set of device control registers.
- non-standard access to the time base.
- 16 byte cache lines.

Approved by: Eduardo Horvath <eeh@netbsd.org>
 1.11 02-Feb-2003  matt Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.
 1.10 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.9 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8 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.7 23-Aug-2002  scw Add "ecc at plb" device.
Add an "irq" locator to the plb device.
This gets rid of the original hack where ecc support was wedged into
the cpu driver.
 1.6 23-Aug-2002  simonb Show the IRQ we attach the ECC handler to.
 1.5 23-Aug-2002  scw Install the ECC error interrupt handler at the level specified by
a "4xx-ecc-irq" property.
If the property isn't defined, assume the hardware has no ECC support.
This should, ideally, be a config file option.
 1.4 12-Aug-2002  simonb Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.3 11-Jul-2002  simonb Clean up some white space niggles.
 1.2 15-Mar-2002  eeh branches: 1.2.2; 1.2.6; 1.2.8;
Use properties instead of board_info.
 1.1 13-Mar-2002  eeh Add cache_info to cpu_info which provides details about D$ and I$
sizes and line sizes. This is needed for cache flusing, clearing
memory, and several other operations. This information is accessible
from userland through a new CPU_CACHEINFO sysctl.
 1.2.8.2 31-Aug-2002  gehenna catch up with -current.
 1.2.8.1 16-Jul-2002  gehenna catch up with -current.
 1.2.6.6 18-Oct-2002  nathanw Catch up to -current.
 1.2.6.5 27-Aug-2002  nathanw Catch up to -current.
 1.2.6.4 13-Aug-2002  nathanw Catch up to -current.
 1.2.6.3 01-Aug-2002  nathanw Catch up to -current.
 1.2.6.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.6.1 15-Mar-2002  nathanw file cpu.c was added on branch nathanw_sa on 2002-04-01 07:42:01 +0000
 1.2.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.2.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.2.1 15-Mar-2002  jdolecek file cpu.c was added on branch kqueue on 2002-03-16 15:59:15 +0000
 1.15.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.2.3 07-Dec-2007  yamt sync with head
 1.19.2.2 30-Dec-2006  yamt sync with head.
 1.19.2.1 21-Jun-2006  yamt sync with head.
 1.22.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.22.10.1 11-May-2006  elad sync with head
 1.22.8.3 03-Sep-2006  yamt sync with head.
 1.22.8.2 11-Aug-2006  yamt sync with head
 1.22.8.1 24-May-2006  yamt sync with head.
 1.22.6.1 01-Jun-2006  kardel Sync with head.
 1.22.4.1 09-Sep-2006  rpaulo sync with head
 1.23.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.25.38.1 08-Dec-2007  mjf Sync with HEAD.
 1.25.36.1 21-Nov-2007  bouyer Sync with HEAD
 1.25.32.1 09-Jan-2008  matt sync with HEAD
 1.25.30.1 21-Nov-2007  joerg Sync with HEAD.
 1.25.12.1 03-Dec-2007  ad Sync with HEAD.
 1.26.32.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.26.26.1 28-Apr-2009  skrll Sync with HEAD.
 1.26.18.2 11-Aug-2010  yamt sync with head.
 1.26.18.1 04-May-2009  yamt sync with head.
 1.27.4.2 12-Jun-2011  rmind sync with head
 1.27.4.1 30-May-2010  rmind sync with head
 1.27.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.28.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.28.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.32.16.1 18-May-2014  rmind sync with head
 1.32.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.33.34.1 09-Mar-2020  martin Pull up following revision(s) (requested by rin in ticket #774):

sys/arch/powerpc/ibm4xx/cpu.c: revision 1.34
sys/arch/powerpc/ibm4xx/pic_uic.c: revision 1.5

Cosmetic change. No binary changes.

Remove unused macros.
 1.33.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.34.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.36.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.24 15-Jul-2018  maxv Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
 1.23 20-Jun-2011  matt branches: 1.23.52; 1.23.54;
Don't include *pmap.h in assembly files. Get the needed definitions
from "assym.h".
 1.22 20-Jun-2011  matt Make struct cpu_info the same size if building MODULAR
kernels or compiling a module.
 1.21 18-Jun-2011  matt Make a common genassym.cf (powerpc/genassym.cf) and then
only put specific stuff in foo/genassym.cf
 1.20 18-Jun-2011  matt Add things needed for __HAVE_FAST_SOFTINTRS
 1.19 05-Jun-2011  matt Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.
 1.18 18-Jan-2011  matt branches: 1.18.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.
 1.17 20-Mar-2010  chs branches: 1.17.2;
fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.16 10-Dec-2009  rmind branches: 1.16.2; 1.16.4;
Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.15 23-Feb-2008  matt branches: 1.15.4; 1.15.26;
Add MTX_* and RW_* definitions
 1.14 17-Oct-2007  garbled branches: 1.14.12; 1.14.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.13 18-May-2007  rjs branches: 1.13.10;
Fix for yamt-idlelwp merge.
 1.12 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.11 11-Dec-2005  christos branches: 1.11.26; 1.11.30; 1.11.32; 1.11.38;
merge ktrace-lwp.
 1.10 19-Jan-2005  matt branches: 1.10.8;
Split the hw-dependent powermanglement into its own function and make
Idle call that. Add a ci_idlespin function pointer to cpu_info.
Update INIT_CPUINFO to initialize it to a naked 'blr' instruction.
In oea/cpu_subr.c, add cpu_idlespin and make ci_idlespin point to it.
 1.9 26-Nov-2003  simonb branches: 1.9.8;
Need offset of ci_curpm in struct cpu_info on 4xx as well.
 1.8 27-Aug-2003  matt Move SFRAMELEN to frame.h and use it in vm_machdep.c. In setfunc, setup
callframe linkages correctly. Restore use of ldptr to locore_subr.S
[pthreads and gdb no longer crash/hang the system]
 1.7 12-Aug-2003  matt Cleanup/rework cpu_switch*, switch_exit, Idle routine. Remove pcb_psl
since it was write-only. When setting up a process, make sure the fake
callframes are properly linked together.

Only lower SPL when in Idle loop. Raise spl to previous level (which would
be IPL_SCHED) when exiting Idle loop. Never lower SPL anyplace else.
 1.6 12-Aug-2003  matt Nuke ci_curpm and curpm. Nuke pcb_pmreal. Those were use for spill stacks
and those no longer exist. for few uses that need CURPM, use CURPCB/PCB_PM
 1.5 11-Aug-2003  chs catch up with changes elsewhere.
 1.4 04-Aug-2003  matt Add SFRAME_USER_SR (even though the 4XX doesn't have one).
 1.3 03-Aug-2003  matt Add each register in trapframe, switchframe, and faultbuf.
 1.2 16-Jul-2003  simonb SZ_BOARD_CFG_DATA is not used anywhere, remove it.
 1.1 04-Mar-2003  matt branches: 1.1.2;
Re-arrange things in evbppc & powerpc to support OEA-based eval boards
in evbppc. OEA-based board(s) to be added later.
 1.1.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.1.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.8.2 27-Feb-2008  yamt sync with head.
 1.10.8.1 03-Sep-2007  yamt sync with head.
 1.11.38.2 02-Aug-2007  macallan sync with HEAD
 1.11.38.1 22-May-2007  matt Update to HEAD.
 1.11.32.1 11-Jul-2007  mjf Sync with head.
 1.11.30.1 27-May-2007  ad Sync with head.
 1.11.26.1 03-Apr-2007  matt Adapt powerpc to yamt-idlelwp. Nuke cpu_setfunc.
Don't define _HAVE_BITENDIAN_BITOPS. Misc cleanups.
 1.13.10.2 23-Mar-2008  matt sync with HEAD
 1.13.10.1 06-Nov-2007  matt sync with HEAD
 1.14.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.14.12.1 24-Mar-2008  keiichi sync with head.
 1.15.26.2 17-Jan-2011  matt Add SPE (signal processing engine) support for mpc85xx/booke. Think of it
as AltiVec-lite (really lite). Genercize AltiVec support so that it could
the same interface could support SPE as well. Rework the FPU support along
the same lines. Move the __asm() to their own XXX_subr.S (altivec, fpu, spe).
 1.15.26.1 07-Jan-2011  matt Deal with new powerpc world.
 1.15.4.2 11-Aug-2010  yamt sync with head.
 1.15.4.1 11-Mar-2010  yamt sync with head
 1.16.4.3 12-Jun-2011  rmind sync with head
 1.16.4.2 05-Mar-2011  rmind sync with head
 1.16.4.1 30-May-2010  rmind sync with head
 1.16.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.18.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.23.54.1 10-Jun-2019  christos Sync with HEAD
 1.23.52.1 28-Jul-2018  pgoyette Sync with HEAD
 1.6 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.5 11-Dec-2005  christos branches: 1.5.110;
merge ktrace-lwp.
 1.4 18-Jan-2005  shige Arrange some machine-dependent code.
- ibm40x_machdep.c: ibm40x specific
. ibm40x_memsize_init
. mem_regions
. other functions are moved to machdep.c or ibm4xx_machdep.c.
- ibm4xx_machdep.c: ibm4xx specific
. ibm4xx_init (moved from ibm40x_machdep.c)
. ibm4xx_install_extint (moved from ibm40x_machdep.c)
. ibm4xx_cpu_startup (moved from ibm40x_machdep.c:ibm4xx_startup)
. ibm4xx_dumpsys
 1.3 17-Jan-2005  shige Remove openbios dependent code from ibm4xx/ibm40x dependent module.
 1.2 30-Dec-2003  pk branches: 1.2.4; 1.2.8; 1.2.10;
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.1 23-Sep-2003  shige Add IBM40x specific machdep functions.
 1.2.10.1 29-Apr-2005  kent sync with -current
 1.2.8.1 15-Sep-2005  riz Pull up following revision(s) (requested by shige in ticket #5820):
distrib/evbppc/md-kernel/Makefile 1.3 via patch
etc/etc.evbppc/Makefile.inc 1.3 via patch
sys/arch/evbppc/conf/files.obs405 1.5-1.8 via patch
sys/arch/evbppc/conf/OPENBLOCKS266 1.22,1.25 via patch
sys/arch/evbppc/include/obs266.h 1.1 (new)
sys/arch/evbppc/include/obs405.h 1.1-1.5 (new)
sys/arch/evbppc/include/rbus_machdep.h 1.1 (new)
sys/arch/evbppc/obs405/consinit.c 1.2-1.4
sys/arch/evbppc/obs405/dev/x1226.c deleted
sys/arch/evbppc/obs405/dev/x1226reg.h deleted
sys/arch/evbppc/obs405/machdep.c deleted
sys/arch/evbppc/obs405/obs266_autoconf.c 1.1 (new)
sys/arch/evbppc/obs405/obs266_machdep.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_autoconf.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_machdep.c 1.1 (new)
sys/arch/evbppc/obs405/rbus_machdep.c 1.1 (new)
sys/arch/powerpc/conf/files.ibm4xx 1.6-1.7
sys/arch/powerpc/ibm4xx/board_prop.c 1.1 (new)
sys/arch/powerpc/ibm4xx/dev/com_opb.c 1.12
sys/arch/powerpc/ibm4xx/dev/comopbvar.h 1.1 (new)
sys/arch/powerpc/ibm4xx/ibm40x_machdep.c 1.3-1.4
sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 1.1-1.2 (new)
sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c 1.1-1.3 (new)
sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 1.2-1.3
sys/arch/powerpc/ibm4xx/openbios/openbios.c 1.1 (new)
sys/arch/powerpc/include/ibm4xx/cpu.h 1.7-1.10
sys/arch/powerpc/include/ibm4xx/openbios.h 1.1 (new)

Update OpenBlockS266 support to more modern, stable sources.
 1.2.4.5 24-Jan-2005  skrll Sync with HEAD.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 30-Dec-2003  skrll file ibm40x_machdep.c was added on branch ktrace-lwp on 2004-08-03 10:39:28 +0000
 1.5.110.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.2 24-Sep-2003  shige Delete this file because filename includes uppercase letters.
 1.1 23-Sep-2003  shige Copy IBM4xxGPx specific autoconf code from evbppc/walnut/autoconf.c.
 1.17 29-Mar-2021  rin Set com(4) frequency in ibm4xx_device_register() in order to dedup codes.
 1.16 29-Mar-2021  rin Centralize cpu_rootconf().
 1.15 18-Jun-2011  matt branches: 1.15.66; 1.15.68;
Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.14 17-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.13 18-Mar-2010  kiyohara branches: 1.13.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.12 22-Jan-2010  martin branches: 1.12.2; 1.12.4;
Unify the name of the device property to hold a MAC address - there was
no clear majority for either "mac-addr" vs. "mac-address", but a quick
gallup poll among developers selected the latter.
 1.11 22-Feb-2007  thorpej branches: 1.11.46;
TRUE -> true, FALSE -> false
 1.10 05-May-2006  thorpej branches: 1.10.14;
Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.9 28-Mar-2006  thorpej Use opb_instance instead of dv->dv_unit when checking if we should set
the mac-addr property.
 1.8 28-Feb-2006  simonb branches: 1.8.2; 1.8.4; 1.8.6;
Fix fallout from obviously untested device_is_a() rototill.
 1.7 26-Feb-2006  thorpej Use device_is_a()
 1.6 23-Feb-2006  thorpej Use device_parent().
 1.5 21-Feb-2006  thorpej Add an "instance" member to opb_attach_args and use it when fetching
the mac-address property from board_info. port-powerpc/32862
 1.4 18-Feb-2006  thorpej - Don't expose dev_propdb directly -- provide devprop_*() wrappers instead.
- Rework the ARMADILLO / epe device properties interaction so that it actually
associates the MAC address property with the epe device instance.
 1.3 11-Dec-2005  christos branches: 1.3.2; 1.3.4; 1.3.6;
merge ktrace-lwp.
 1.2 17-Jan-2005  shige branches: 1.2.2; 1.2.10; 1.2.12;
Remove openbios dependent code from ibm4xx/ibm40x dependent module.
 1.1 13-Jan-2005  shige branches: 1.1.2;
Add device_register function for all ibm4xx machine.
 1.1.2.1 29-Apr-2005  kent sync with -current
 1.2.12.2 15-Sep-2005  riz Pull up following revision(s) (requested by shige in ticket #5820):
distrib/evbppc/md-kernel/Makefile 1.3 via patch
etc/etc.evbppc/Makefile.inc 1.3 via patch
sys/arch/evbppc/conf/files.obs405 1.5-1.8 via patch
sys/arch/evbppc/conf/OPENBLOCKS266 1.22,1.25 via patch
sys/arch/evbppc/include/obs266.h 1.1 (new)
sys/arch/evbppc/include/obs405.h 1.1-1.5 (new)
sys/arch/evbppc/include/rbus_machdep.h 1.1 (new)
sys/arch/evbppc/obs405/consinit.c 1.2-1.4
sys/arch/evbppc/obs405/dev/x1226.c deleted
sys/arch/evbppc/obs405/dev/x1226reg.h deleted
sys/arch/evbppc/obs405/machdep.c deleted
sys/arch/evbppc/obs405/obs266_autoconf.c 1.1 (new)
sys/arch/evbppc/obs405/obs266_machdep.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_autoconf.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_machdep.c 1.1 (new)
sys/arch/evbppc/obs405/rbus_machdep.c 1.1 (new)
sys/arch/powerpc/conf/files.ibm4xx 1.6-1.7
sys/arch/powerpc/ibm4xx/board_prop.c 1.1 (new)
sys/arch/powerpc/ibm4xx/dev/com_opb.c 1.12
sys/arch/powerpc/ibm4xx/dev/comopbvar.h 1.1 (new)
sys/arch/powerpc/ibm4xx/ibm40x_machdep.c 1.3-1.4
sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 1.1-1.2 (new)
sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c 1.1-1.3 (new)
sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 1.2-1.3
sys/arch/powerpc/ibm4xx/openbios/openbios.c 1.1 (new)
sys/arch/powerpc/include/ibm4xx/cpu.h 1.7-1.10
sys/arch/powerpc/include/ibm4xx/openbios.h 1.1 (new)

Update OpenBlockS266 support to more modern, stable sources.
 1.2.12.1 17-Jan-2005  riz file ibm4xx_autoconf.c was added on branch netbsd-2 on 2005-09-15 14:28:44 +0000
 1.2.10.2 26-Feb-2007  yamt sync with head.
 1.2.10.1 21-Jun-2006  yamt sync with head.
 1.2.2.3 24-Jan-2005  skrll Sync with HEAD.
 1.2.2.2 17-Jan-2005  skrll Sync with HEAD.
 1.2.2.1 17-Jan-2005  skrll file ibm4xx_autoconf.c was added on branch ktrace-lwp on 2005-01-17 19:30:09 +0000
 1.3.6.2 01-Jun-2006  kardel Sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.2 01-Mar-2006  yamt sync with head.
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.8.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.8.4.2 11-May-2006  elad sync with head
 1.8.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.8.2.2 24-May-2006  yamt sync with head.
 1.8.2.1 01-Apr-2006  yamt sync with head.
 1.10.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.11.46.2 11-Aug-2010  yamt sync with head.
 1.11.46.1 11-Mar-2010  yamt sync with head
 1.12.4.1 30-May-2010  rmind sync with head
 1.12.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.13.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.15.68.1 03-Apr-2021  thorpej Sync with HEAD.
 1.15.66.1 03-Apr-2021  thorpej Sync with HEAD.
 1.39 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.38 05-Oct-2022  rin Minor style fixes to asm codes. No binary changes.
 1.37 30-Mar-2021  rin Use ``for (;;)'' for infinite loop, as required by style.
No binary changes.
 1.36 30-Mar-2021  rin Centralize cpu_reboot().
 1.35 06-Mar-2021  rin branches: 1.35.2;
For booke and ibm4xx, switch to software-based single-stepping for PT_STEP
ptrace(2) command from broken hardware-based implementation.

As described in proposal on port-powerpc@,

http://mail-index.netbsd.org/port-powerpc/2021/02/26/msg003597.html

hardware debug facilities of booke and 4xx use critical interrupts, that
are difficult to handle for this purpose; they are not automatically masked
when entering kernel mode via system call trap or hardware interrupt.
See my proposal above for more details.

Now, hardware debug facilities are exclusively usable by kernel itself.
They are much more functional than PSL_SE MSR bit of oea, and should be
useful to, e.g., support byte-granular watchpoint for DDB in the future.
 1.34 18-Jan-2021  rin white space --> tab
 1.33 06-Jan-2021  rin Sort headers. No functional changes intended.
 1.32 06-Jul-2020  rin branches: 1.32.2;
Set cpu_psluserset, cpu_pslusermod, cpu_pslusermask for MODULAR.
 1.31 06-Jul-2020  rin Drop unused opt_compat_netbsd.h include.
 1.30 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.29 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.28 31-Dec-2019  ad Rename uvm_free() -> uvm_availmem().
 1.27 21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.26 15-Jul-2018  maxv Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
 1.25 26-Dec-2016  rin branches: 1.25.14; 1.25.16;
Assert that the size of a trap handler does not exceed its room.

XXX
The debug exception is critical for ibm4xx. Since rev 1.24, we use the critical
trap hundler for it. Sorry for the wrong commit log for rev 1.24.
 1.24 26-Dec-2016  rin No need to have same trap handlers in trap_subr.S.
No functional changes.
 1.23 26-Dec-2016  rin We cannot have DDB and IPKDB at the same time.
 1.22 22-Dec-2016  cherry switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.
 1.21 16-Dec-2016  rin Fix typo: s/IPKBD/IPKDB/
 1.20 16-Dec-2016  rin Fix comments. No functional changes.
 1.19 15-Dec-2016  rin Fix build without DDB.
 1.18 12-Dec-2011  kiyohara branches: 1.18.6; 1.18.24; 1.18.28;
Remove white-spaces.
Indents.
 1.17 20-Jun-2011  matt branches: 1.17.2; 1.17.6;
Change IBM4xx to use the common powerpc PIC framework.
Consolidate most ibm4xx initppc function into ibm4xx_init
and Make all IBM4xx use it.
Change explora to use initppc instead of bootstrap.
 1.16 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.15 18-Jan-2011  matt branches: 1.15.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.
 1.14 17-Jan-2011  matt branches: 1.14.2;
Add a #include <machine/pcb.h>
 1.13 25-Feb-2010  matt branches: 1.13.2;
Adapt to spr.h breakup.
 1.12 27-Nov-2009  rmind branches: 1.12.2;
- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.
 1.11 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.10 21-Nov-2009  rmind Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.9 07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.8 02-Jul-2008  ad branches: 1.8.18;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.
 1.7 04-Mar-2007  christos branches: 1.7.40; 1.7.44; 1.7.46; 1.7.48;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.5 24-Dec-2005  perry branches: 1.5.26;
bare asm -> __asm
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 25-Apr-2005  lukem branches: 1.3.2; 1.3.4; 1.3.6;
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.2 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.1 18-Jan-2005  shige branches: 1.1.2; 1.1.4;
Arrange some machine-dependent code.
- ibm40x_machdep.c: ibm40x specific
. ibm40x_memsize_init
. mem_regions
. other functions are moved to machdep.c or ibm4xx_machdep.c.
- ibm4xx_machdep.c: ibm4xx specific
. ibm4xx_init (moved from ibm40x_machdep.c)
. ibm4xx_install_extint (moved from ibm40x_machdep.c)
. ibm4xx_cpu_startup (moved from ibm40x_machdep.c:ibm4xx_startup)
. ibm4xx_dumpsys
 1.1.4.1 28-Jan-2005  yamt convert arch/powerpc to new apis.
 1.1.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.3 01-Apr-2005  skrll Sync with HEAD.
 1.1.2.2 24-Jan-2005  skrll Sync with HEAD.
 1.1.2.1 18-Jan-2005  skrll file ibm4xx_machdep.c was added on branch ktrace-lwp on 2005-01-24 08:34:26 +0000
 1.3.6.2 15-Sep-2005  riz Pull up following revision(s) (requested by shige in ticket #5820):
distrib/evbppc/md-kernel/Makefile 1.3 via patch
etc/etc.evbppc/Makefile.inc 1.3 via patch
sys/arch/evbppc/conf/files.obs405 1.5-1.8 via patch
sys/arch/evbppc/conf/OPENBLOCKS266 1.22,1.25 via patch
sys/arch/evbppc/include/obs266.h 1.1 (new)
sys/arch/evbppc/include/obs405.h 1.1-1.5 (new)
sys/arch/evbppc/include/rbus_machdep.h 1.1 (new)
sys/arch/evbppc/obs405/consinit.c 1.2-1.4
sys/arch/evbppc/obs405/dev/x1226.c deleted
sys/arch/evbppc/obs405/dev/x1226reg.h deleted
sys/arch/evbppc/obs405/machdep.c deleted
sys/arch/evbppc/obs405/obs266_autoconf.c 1.1 (new)
sys/arch/evbppc/obs405/obs266_machdep.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_autoconf.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_machdep.c 1.1 (new)
sys/arch/evbppc/obs405/rbus_machdep.c 1.1 (new)
sys/arch/powerpc/conf/files.ibm4xx 1.6-1.7
sys/arch/powerpc/ibm4xx/board_prop.c 1.1 (new)
sys/arch/powerpc/ibm4xx/dev/com_opb.c 1.12
sys/arch/powerpc/ibm4xx/dev/comopbvar.h 1.1 (new)
sys/arch/powerpc/ibm4xx/ibm40x_machdep.c 1.3-1.4
sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 1.1-1.2 (new)
sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c 1.1-1.3 (new)
sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 1.2-1.3
sys/arch/powerpc/ibm4xx/openbios/openbios.c 1.1 (new)
sys/arch/powerpc/include/ibm4xx/cpu.h 1.7-1.10
sys/arch/powerpc/include/ibm4xx/openbios.h 1.1 (new)

Update OpenBlockS266 support to more modern, stable sources.
 1.3.6.1 25-Apr-2005  riz file ibm4xx_machdep.c was added on branch netbsd-2 on 2005-09-15 14:28:44 +0000
 1.3.4.3 03-Sep-2007  yamt sync with head.
 1.3.4.2 26-Feb-2007  yamt sync with head.
 1.3.4.1 21-Jun-2006  yamt sync with head.
 1.3.2.2 29-Apr-2005  kent sync with -current
 1.3.2.1 25-Apr-2005  kent file ibm4xx_machdep.c was added on branch kent-audio2 on 2005-04-29 11:28:19 +0000
 1.5.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.5.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.7.48.1 03-Jul-2008  simonb Sync with head.
 1.7.46.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.44.2 11-Mar-2010  yamt sync with head
 1.7.44.1 04-May-2009  yamt sync with head.
 1.7.40.1 02-Jul-2008  mjf Sync with HEAD.
 1.8.18.2 17-Jan-2011  matt Add SPE (signal processing engine) support for mpc85xx/booke. Think of it
as AltiVec-lite (really lite). Genercize AltiVec support so that it could
the same interface could support SPE as well. Rework the FPU support along
the same lines. Move the __asm() to their own XXX_subr.S (altivec, fpu, spe).
 1.8.18.1 07-Jan-2011  matt Deal with new powerpc world.
 1.12.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.13.2.1 05-Mar-2011  rmind sync with head
 1.14.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.17.6.1 18-Feb-2012  mrg merge to -current.
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.18.28.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.18.24.1 05-Feb-2017  skrll Sync with HEAD
 1.18.6.1 03-Dec-2017  jdolecek update from HEAD
 1.25.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.25.16.1 10-Jun-2019  christos Sync with HEAD
 1.25.14.1 28-Jul-2018  pgoyette Sync with HEAD
 1.32.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.35.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 15-May-2006  shige Move cpu_configure to evbppc/*.c.
(Remove ibm4xxgpx_autoconf.c)
I'm sorry for my wrong thinking.
 1.5 24-Dec-2005  perry branches: 1.5.4; 1.5.6; 1.5.8; 1.5.12;
bare asm -> __asm
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 13-Jan-2005  shige branches: 1.3.10;
Remove device_register, cpu_rootconf functions.
These functions are moved to ibm4xx/autoconf.c.
 1.2 23-Oct-2004  thorpej Centralize the declaration of booted_device and booted_partition.
 1.1 24-Sep-2003  shige branches: 1.1.4; 1.1.6;
Copy IBM4xxGPx specific autoconf code from evbppc/walnut/autoconf.c.
 1.1.6.1 15-Sep-2005  riz Pull up following revision(s) (requested by shige in ticket #5820):
distrib/evbppc/md-kernel/Makefile 1.3 via patch
etc/etc.evbppc/Makefile.inc 1.3 via patch
sys/arch/evbppc/conf/files.obs405 1.5-1.8 via patch
sys/arch/evbppc/conf/OPENBLOCKS266 1.22,1.25 via patch
sys/arch/evbppc/include/obs266.h 1.1 (new)
sys/arch/evbppc/include/obs405.h 1.1-1.5 (new)
sys/arch/evbppc/include/rbus_machdep.h 1.1 (new)
sys/arch/evbppc/obs405/consinit.c 1.2-1.4
sys/arch/evbppc/obs405/dev/x1226.c deleted
sys/arch/evbppc/obs405/dev/x1226reg.h deleted
sys/arch/evbppc/obs405/machdep.c deleted
sys/arch/evbppc/obs405/obs266_autoconf.c 1.1 (new)
sys/arch/evbppc/obs405/obs266_machdep.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_autoconf.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_machdep.c 1.1 (new)
sys/arch/evbppc/obs405/rbus_machdep.c 1.1 (new)
sys/arch/powerpc/conf/files.ibm4xx 1.6-1.7
sys/arch/powerpc/ibm4xx/board_prop.c 1.1 (new)
sys/arch/powerpc/ibm4xx/dev/com_opb.c 1.12
sys/arch/powerpc/ibm4xx/dev/comopbvar.h 1.1 (new)
sys/arch/powerpc/ibm4xx/ibm40x_machdep.c 1.3-1.4
sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 1.1-1.2 (new)
sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c 1.1-1.3 (new)
sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 1.2-1.3
sys/arch/powerpc/ibm4xx/openbios/openbios.c 1.1 (new)
sys/arch/powerpc/include/ibm4xx/cpu.h 1.7-1.10
sys/arch/powerpc/include/ibm4xx/openbios.h 1.1 (new)

Update OpenBlockS266 support to more modern, stable sources.
 1.1.4.6 17-Jan-2005  skrll Sync with HEAD.
 1.1.4.5 02-Nov-2004  skrll Sync with HEAD.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 24-Sep-2003  skrll file ibm4xxgpx_autoconf.c was added on branch ktrace-lwp on 2004-08-03 10:39:28 +0000
 1.3.10.1 21-Jun-2006  yamt sync with head.
 1.5.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.8.1 24-May-2006  yamt sync with head.
 1.5.6.1 01-Jun-2006  kardel Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.26 20-Jun-2011  matt Change IBM4xx to use the common powerpc PIC framework.
Consolidate most ibm4xx initppc function into ibm4xx_init
and Make all IBM4xx use it.
Change explora to use initppc instead of bootstrap.
 1.25 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.24 20-Dec-2010  matt branches: 1.24.6;
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.23 18-Mar-2010  kiyohara Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.22 25-Feb-2010  matt branches: 1.22.2;
Adapt to spr.h breakup.
 1.21 04-Jan-2009  tsutsui branches: 1.21.4;
Account ci->ci_idepth on calling handlers in ext_intr() as well as
powerpc/pic/intr.c:pic_handle_intr(). Closes PR port-evbppc/40288.

Should be pulled up to netbsd-5.
 1.20 02-Jan-2008  ad branches: 1.20.6; 1.20.10; 1.20.18; 1.20.20;
Merge vmlocking2 to head.
 1.19 03-Dec-2007  ad branches: 1.19.2; 1.19.6;
Interrupt handling changes, in discussion since February:

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

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.17 24-Jul-2007  hannken branches: 1.17.4; 1.17.6;
Handle IST_LEVEL interrupts better. Disable interrupt while it is
processed and enable afterwards. Up to now IST_LEVEL interrupts always
fired again during processing leaving unnecessary pending interrupts.

Tested on EXPLORA451.

Ok: Simon Burge <simonb@netbsd.org>
 1.16 15-Feb-2007  ad branches: 1.16.6; 1.16.14; 1.16.16; 1.16.18;
Make these compile again.
 1.15 02-Dec-2006  freza Welcome to evbppc/virtex -- port to Xilinx Virtex series FPGA's with embedded
ibm405d5 core.

OK by Simon Burge
 1.14 27-Sep-2006  freza Make sure we mask statclock timer on ibm4xx systems. This avoids
pthread "related" panics like:

panic: remrunqueue: bit 18 not set
Stopped in pid 479.3 (exsprite) at netbsd:cpu_Debugger+0x10: lwz
r
0, r1, 0x14
db> bt
0x869abe00: at panic+0x1b4
0x869abe50: at remrunqueue+0x80
0x869abe60: at mi_switch+0x114
0x869abea0: at sa_unblock_userret+0x4e8
0x869abee0: at syscall_plain+0x224
0x869abf40: user SC trap #93 by 0x41949810: srr1=0xc030
r1=0x445fff40 cr=0x40000002 xer=0 ctr=0x41aae208 esr=0 pid=0x36

While there, cleanup IPL_ definitions somewhat and fix interrupt mask
calculation per spl(9).

OK by matt@
 1.13 10-Jul-2006  freza branches: 1.13.4; 1.13.6;
Fix recent ibm4xx/intr.c rework:

- Recalculate masks _after_ new interrupt handler is enqueued, otherwise
the very last one won't ever be enabled (from hannken@)

- We can't use splhigh() to protect intr_calculatemasks() since it would
use soon-to-be-invalid mask. Instead, fiddle PSL_EE directly as we do
in other places.

Reviewed and tested (evbppc/explora) by hannken@
 1.12 30-Jun-2006  freza Bring ibm4xx interrupt code up to date:

- generic soft interrupts (ie. use powerpc/softintr.c)
- interrupt event counters (using the ones from powerpc/cpu.h:cpu_info
where appropriate)
- cleanup ibm4xx_intr.h, move implementation details to intr.c

Convert all affected evbppc platforms.

OK by simonb@, some points discussed with matt@
 1.11 13-Jun-2006  freza branches: 1.11.2;
Merge multiple definitions of cntlzw() ("count leading zeros")
instruction-wrapper to <powerpc/cpu.h>.

OK by briggs@
 1.10 24-Dec-2005  perry branches: 1.10.4; 1.10.8; 1.10.14;
bare asm -> __asm
 1.9 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 03-Jun-2005  scw branches: 1.7.2;
Appease -Wcast-qual
 1.6 15-Jul-2003  lukem __KERNEL_RCSID()
 1.5 16-Jun-2003  thorpej branches: 1.5.2;
Rename IPL_IMP -> IPL_VM.
 1.4 11-Mar-2003  hannken Add support for the IBM 403GCX cpu. Enabled with "options PPC_IBM403".

- different set of device control registers.
- non-standard access to the time base.
- 16 byte cache lines.

Approved by: Eduardo Horvath <eeh@netbsd.org>
 1.3 11-Jul-2002  simonb Clean up some white space niggles.
 1.2 13-May-2002  matt branches: 1.2.2;
Remove redundant declarations.
 1.1 13-Mar-2002  eeh branches: 1.1.2; 1.1.6;
Generalized IBM UIC driver.
 1.1.6.4 01-Aug-2002  nathanw Catch up to -current.
 1.1.6.3 20-Jun-2002  nathanw Catch up to -current.
 1.1.6.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.6.1 13-Mar-2002  nathanw file intr.c was added on branch nathanw_sa on 2002-04-01 07:42:01 +0000
 1.1.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.1 13-Mar-2002  jdolecek file intr.c was added on branch kqueue on 2002-03-16 15:59:15 +0000
 1.2.2.1 16-Jul-2002  gehenna catch up with -current.
 1.5.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.2.6 21-Jan-2008  yamt sync with head
 1.7.2.5 07-Dec-2007  yamt sync with head
 1.7.2.4 03-Sep-2007  yamt sync with head.
 1.7.2.3 26-Feb-2007  yamt sync with head.
 1.7.2.2 30-Dec-2006  yamt sync with head.
 1.7.2.1 21-Jun-2006  yamt sync with head.
 1.10.14.1 19-Jun-2006  chap Sync with head.
 1.10.8.2 11-Aug-2006  yamt sync with head
 1.10.8.1 26-Jun-2006  yamt sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.13.6.2 10-Dec-2006  yamt sync with head.
 1.13.6.1 22-Oct-2006  yamt sync with head
 1.13.4.2 12-Jan-2007  ad Sync with head.
 1.13.4.1 18-Nov-2006  ad Sync with head.
 1.16.18.1 15-Aug-2007  skrll Sync with HEAD.
 1.16.16.1 07-Aug-2007  matt Sync with HEAD.
 1.16.14.2 03-Oct-2007  garbled Sync with HEAD
 1.16.14.1 02-Aug-2007  macallan sync with HEAD
 1.16.6.3 03-Dec-2007  ad Sync with HEAD.
 1.16.6.2 03-Dec-2007  ad Sync with HEAD.
 1.16.6.1 20-Aug-2007  ad Sync with HEAD.
 1.17.6.2 09-Jan-2008  matt sync with HEAD
 1.17.6.1 06-Nov-2007  matt sync with HEAD
 1.17.4.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.18.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.18.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.19.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.2.1 27-Dec-2007  ad locking changes for macppc. Please test.
 1.20.20.1 14-Jan-2009  snj branches: 1.20.20.1.8;
Pull up following revision(s) (requested by tsutsui in ticket #246):
sys/arch/powerpc/ibm4xx/intr.c: revision 1.21
Account ci->ci_idepth on calling handlers in ext_intr() as well as
powerpc/pic/intr.c:pic_handle_intr(). Closes PR port-evbppc/40288.
Should be pulled up to netbsd-5.
 1.20.20.1.8.1 07-Jan-2011  matt Deal with new powerpc world.
 1.20.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.20.10.3 11-Aug-2010  yamt sync with head.
 1.20.10.2 11-Mar-2010  yamt sync with head
 1.20.10.1 04-May-2009  yamt sync with head.
 1.20.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.21.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.22.2.2 05-Mar-2011  rmind sync with head
 1.22.2.1 30-May-2010  rmind sync with head
 1.24.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3 18-Mar-2005  shige Remove MD codes from arch/powerpc/ibm4xx.
 1.2 21-Jan-2005  shige branches: 1.2.2; 1.2.4; 1.2.8;
Add consinit() and md_consinit funcptr to ibm4xx/machdep.c.
Rename consinit() to obs405_consinit() at evbppc/obs405/consinit.c.

Set md_consinit to obs405_consinit() at initppc().
Consinit fuction calls a function stored at md_consinit pointer.
 1.1 18-Jan-2005  shige Add ibm4xx family common module.
- machine-dependent global variables
- cpu_startup glue
- softnet/softserial (copy from ibm40x_machdep.c)
 1.2.8.1 14-Sep-2005  tron Apply patch (requested by shige in ticket #763):
Synchronize OpenBlockS266 port with NetBSD-current for enhanced stability.
 1.2.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.2.3 01-Apr-2005  skrll Sync with HEAD.
 1.2.2.2 24-Jan-2005  skrll Sync with HEAD.
 1.2.2.1 21-Jan-2005  skrll file machdep.c was added on branch ktrace-lwp on 2005-01-24 08:34:26 +0000
 1.3 12-Aug-2002  simonb Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.2 11-Jul-2002  simonb Clean up some white space niggles.
 1.1 13-Mar-2002  eeh branches: 1.1.2; 1.1.6; 1.1.8;
Generic mainbus driver.
 1.1.8.2 31-Aug-2002  gehenna catch up with -current.
 1.1.8.1 16-Jul-2002  gehenna catch up with -current.
 1.1.6.4 13-Aug-2002  nathanw Catch up to -current.
 1.1.6.3 01-Aug-2002  nathanw Catch up to -current.
 1.1.6.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.6.1 13-Mar-2002  nathanw file mainbus.c was added on branch nathanw_sa on 2002-04-01 07:42:02 +0000
 1.1.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.1 13-Mar-2002  jdolecek file mainbus.c was added on branch kqueue on 2002-03-16 15:59:15 +0000
 1.9 05-Mar-2021  rin Fix hard freeze in pic_handle_intr() for PPC_IBM403.

Not clearly documented in reference manual, but DCR_EXISR register is
not updated immediately after some bits are cleared by mtdcr, no matter
whether sync (= eieio) and/or isync are issued.

Therefore, we have to manage our own status mask in the interrupt handler.
This is what we did in obsoleted powerpc/ibm4xx/intr.c.

With this change, my Explora 451 works just fine with serial console!
Fix for framebuffer console will be committed soon.
 1.8 27-Feb-2021  rin Switch to intr_establish_xname().
 1.7 06-Jul-2020  rin branches: 1.7.2;
Include missing opt_ppcarch.h and opt_uic.h.
 1.6 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.5 05-Mar-2020  rin Remove unused macros.
 1.4 19-Nov-2013  kiyohara branches: 1.4.30; 1.4.34;
Fix IPL for cascading pic to HIGH.
 1.3 01-Feb-2012  matt branches: 1.3.6; 1.3.10;
Use kmem instead of malloc. Remove unneeded <sys/malloc.h> includes.
 1.2 13-Dec-2011  kiyohara Fix the mistake in level and type.
 1.1 20-Jun-2011  matt branches: 1.1.2; 1.1.4; 1.1.8;
Change IBM4xx to use the common powerpc PIC framework.
Consolidate most ibm4xx initppc function into ibm4xx_init
and Make all IBM4xx use it.
Change explora to use initppc instead of bootstrap.
 1.1.8.1 18-Feb-2012  mrg merge to -current.
 1.1.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.1.4.1 17-Apr-2012  yamt sync with head
 1.1.2.2 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.1.2.1 20-Jun-2011  cherry file pic_uic.c was added on branch cherry-xenmp on 2011-06-23 14:19:29 +0000
 1.3.10.1 18-May-2014  rmind sync with head
 1.3.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.34.1 09-Mar-2020  martin Pull up following revision(s) (requested by rin in ticket #774):

sys/arch/powerpc/ibm4xx/cpu.c: revision 1.34
sys/arch/powerpc/ibm4xx/pic_uic.c: revision 1.5

Cosmetic change. No binary changes.

Remove unused macros.
 1.4.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.110 01-Feb-2024  andvar s/againt/against/ in comment.
 1.109 05-Oct-2022  rin ppc4xx_tlb_enter: One more style sync. No binary changes.

Use hi and lo instead of th and tl for TLBHI and TLBLO, respectively,
as done for other functions in pmap.c.
 1.108 05-Oct-2022  rin Use %[foo], %[bar], ... instead of %0, %1, ... for asm codes.
Unify variable names if possible. No binary changes.
 1.107 05-Oct-2022  rin Minor style fixes to asm codes. No binary changes.
 1.106 12-Sep-2022  rin Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.
 1.105 08-Sep-2021  rin pte_enter() and pmap_enter_pv(): return zero for success, and
non-zero value for failure, as normally expected.
 1.104 05-Sep-2021  rin Now, ctx_flush() never fails. So, make this function void.
 1.103 05-Sep-2021  rin pmap_enter_pv(): At the moment, this function is always called with
pmap_initialized. So, convert test for this condition to KASSERT.
 1.102 05-Sep-2021  rin pmap_enter_pv(): No need to initialize npv to NULL.

No functional changes intended.
 1.101 05-Sep-2021  rin pmap_testout(): Use pmap_{protect,remove}() for va to (va + PAGE_SIZE),
instead of (va + 1).

No functional changes for the current implementation. Also, this affects
only when the function is manually called from DDB on DEBUG kernel.
 1.100 05-Sep-2021  rin if (cond) panic() or Debugger() in #ifdef DIAGNOSTIC ---> KASSERT(!cond)

There is no regression observed during a full ATF run.
 1.99 04-Sep-2021  rin Style. No binary changes.

Also, remove old #if-0'ed code block copied from oea (and therefore
will never be enabled).
 1.98 15-Apr-2021  rin Use uvm_km_alloc(9) with UVM_KMF_NOWAIT flag in pte_enter(), in order not to
sleep in pmap_enter(9) and pmap_kenter_pa(9), which can result in dead lock.

In most cases, pmap_enter(9) is used with PMAP_CANFAIL flag. In this case,
if pte_enter() fails due to uvm_km_alloc(9), we can safely return ENOMEM.
UVM layer will take care of it.

uvm_km_alloc(9) fails for pmap_enter(9) without PMAP_CANFAIL or for
pmap_kenter_pa(9), we have no choice but to panic there.

However, my testbeds for 403 and 405 survive more than a week at least
without hitting this panic.
 1.97 14-Apr-2021  rin Style fixes:

- Add "static inline" to pte_enter(), to match with its declaration.
- Remove parentheses from return.
- Use NULL instead of 0 for pointer initialization.

No binary changes.
 1.96 30-Mar-2021  rin G/C misleading <evbppc/tlb.h>. Use <powerpc/ibm4xx/tlb.h> directly.
 1.95 10-Sep-2020  rin branches: 1.95.2; 1.95.4;
Tiny cosmetic fix for previous. No functional changes.
 1.94 10-Sep-2020  rin Real fix for pmap_procwr(), attempted in revs 1.85 and 1.87:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.85
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.87

ibm4xx has VIPT icache and operations in pmap_procwr() should be done with
DMMU enabled (write back dcache into memory and invalidate icache).

When p == curproc, this is trivial. However, p != curproc needs a special
care; we cannot rely upon TLB miss handler in user context. Therefore,
extract pa and operate against it.

Note that va below VM_MIN_KERNEL_ADDRESS (== 2GB at the moment) is reserved
for direct mapping.

Tested by gdb with WIP software single stepping for ibm4xx.
 1.93 10-Sep-2020  rin Introduce PMAP_TLBDEBUG option for ibm4xx: clear only TLBHI[V] bit when
TLB entry is invalidated, instead of clearing entire TLBHI register.
 1.92 10-Sep-2020  rin pmap_kenter_pa: Remove comment which says ``Have to remove any existing
mapping first.'' Contrary to this comment, pmap_kremove(9) has never
been called there since rev 1.1, and we don't for other ports also.
 1.91 10-Sep-2020  rin Introduce PV_VA() macro to extract va from pv->pv_va by clearing
PV_WIRED flag, and use it where appropriate.

There should be no functional changes. Only for safety in future.
 1.90 06-Jul-2020  rin Include missing opt_ddb.h.
 1.89 29-Jun-2020  rin Remove evcnt(9) counter for tlbhit; there's no way to observe TLB hits
from kernel, and it just counted intersection b/w tlbmiss and tlbenter.
 1.88 19-Jun-2020  rin Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.
 1.87 19-Jun-2020  rin Oops, commit log was missing. It should be:

Revert rev 1.85:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.85

Not clearly documented in reference manual, but the previous code seems
correct; the operations must be carried out with DMMU disabled. Otherwise,
WIP software single step for userland does not work correctly (stalled
indefinitely at pmap_procwr()).

XXX
pullup to netbsd-9
 1.86 19-Jun-2020  rin *** empty log message ***
 1.85 05-Mar-2020  rin Fix pmap_procwr().

While we need to turn off IMMU, DMMU should be kept on. Otherwise,
dcbst (and also icbi probably, though not documented clearly both
for 405 and 403) should not work correctly.
 1.84 05-Mar-2020  rin Retire tlbpid_t (u_short):

- PID (ctx, ASID) is 8-bit length, not half word.
- For struct pmap, no need to use integer types smaller than word as
pm_ctx because of alignment.
- For ppc4xx_tlb_enter(), we need word-length storage for pid (and msr).

XXX
Better to rewrite pmap module with more suggestive integer types rather
than char, int, long, and so on.
 1.83 05-Mar-2020  rin pmap_procwr(): use dcbst instead of dcbf as a tiny optimization.
 1.82 05-Mar-2020  rin ppc4xx_tlb_enter(): invalidate entry after clearing MSR for sure.
 1.81 05-Mar-2020  rin Misc non-critical fixes.

- __asm --> __asm volatile for sure
- turn DEBUG code in __asm into DIAGNOSTIC code in C
- style
 1.80 21-Feb-2020  rin In ppc4xx_tlb_find_victim(), mark kernel stack page TLBF_REF instead of
TLBF_USED. This should be originally intended behavior of this code
segment, because

- TLBF_USED is already checked just before, so marking this page
TLBF_USED is no-op.
- TLBF_REF flag exempts that page from being flushed from TLB in next
scan, when kernel stack may be still there with high probability.
 1.79 20-Feb-2020  rin Clear ti_ctx when flushing a TLB entry for clarity.
 1.78 20-Feb-2020  rin Fix off-by-one error for ctx (ASID).

Note that NUM_CTX = 256 = 0 stands for disabling protection by ASID.
 1.77 20-Feb-2020  rin Fix NULL dereference; "pap" argument of pmap_extract(9) can be NULL.
 1.76 24-Dec-2016  cherry branches: 1.76.16; 1.76.20; 1.76.22;
Conform API use of uvm_hotplug(9) to documented behaviour:

When testing for an invalid uvm_physseg_t,
compare with UVM_PHYSSEG_TYPE_INVALID which is implementation agnostic.
 1.75 24-Dec-2016  cherry introduce evbppc pmap to the uvm_hotplug(9) API

Should fix build.
 1.74 23-Dec-2016  cherry "Make NetBSD great again!"

Introduce uvm_hotplug(9) to the kernel.

Many thanks, in no particular order to:

TNF, for funding the project.

Chuck Silvers - for multiple API reviews and feedback.
Nick Hudson - for testing on multiple architectures and bugfix patches.
Everyone who helped with boot testing.

KeK (http://www.kek.org.in) for hosting the primary developers.
 1.73 22-Dec-2016  cherry switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.
 1.72 27-Jan-2012  para branches: 1.72.6; 1.72.24; 1.72.28;
extending vmem(9) to be able to allocated resources for it's own needs.
simplifying uvm_map handling (no special kernel entries anymore no relocking)
make malloc(9) a thin wrapper around kmem(9)
(with private interface for interrupt safety reasons)

releng@ acknowledged
 1.71 09-Jan-2012  kiyohara Move spl from ppc4xx_tlb_enter() to pmap_enter(). Don't call splx() on
I/DTLBMISS.
 1.70 30-Jun-2011  matt branches: 1.70.2; 1.70.6;
Modify mapiodev to take a third argument indicating whether the space
should be prefetchable (true) or not (false).
 1.69 21-Jun-2011  matt Switch to using dcache_wbinv_page
 1.68 20-Jun-2011  matt Get rid of extern inline.
Cleanup includes.
Rearrange pv_entry so that are pointers are first.
 1.67 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.66 07-Feb-2011  matt branches: 1.66.2;
Use EVCNT_ATTACH_STATIC
 1.65 14-Jan-2011  rmind branches: 1.65.2; 1.65.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.64 10-Nov-2010  uebayasi Use more VM_PHYSMEM_*() accessors. No functional changes.
 1.63 06-Nov-2010  uebayasi Merge from uebayasi-xip:
 1.60.2.5 14-Aug-2010  uebayasi Teach TLB miss handler (pmap_tlbmiss()) to map "Expansion ROM" area as
PA == VA. Now we don't need to reserve a TLB entry for it.
 1.62 25-Feb-2010  matt branches: 1.62.2;
Adapt to spr.h breakup.
 1.61 25-Feb-2010  skrll s/cpu_fork/cpu_lwp_fork/ in comment
 1.60 21-Nov-2009  rmind branches: 1.60.2;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.59 07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.58 21-Oct-2009  rmind Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.
 1.57 18-Aug-2009  thorpej Add a real API for testing if a page is a managed page, and adjust callers
to stop relying on vm_physseg_find() for this purpose.
 1.56 11-Aug-2009  matt Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)
 1.55 11-May-2009  he Follow up the changed prototype of pmap_enter(), flag from int to u_int.
 1.54 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.53 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.52 10-Dec-2008  pooka branches: 1.52.2;
Make kernel_pmap_ptr a const. Requested by steve_martin.
 1.51 09-Dec-2008  pooka Make pmap_kernel() a MI macro for struct pmap *kernel_pmap_ptr,
which is now the "API" provided by the pmap module. pmap_kernel()
remains as the syntactic sugar.

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

Thanks to Greg Oster for providing cpu muscle for doing test builds.
 1.50 17-Oct-2007  garbled branches: 1.50.16; 1.50.20; 1.50.26; 1.50.28; 1.50.40;
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.49 24-Jul-2007  hannken branches: 1.49.6;
Use PR_NOWAIT in in pmap_enter_pv() and take care of PMAP_CANFAIL. Built
after powerpc/oea/pmap.c. Now a LOCKDEBUG kernel runs on EXPLORA451.

Ok: Simon Burge <simonb@netbsd.org>
 1.48 12-Mar-2007  ad branches: 1.48.8; 1.48.10; 1.48.12;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.47 04-Mar-2007  christos branches: 1.47.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.46 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.45 21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.44 29-Nov-2006  freza branches: 1.44.4;
Instead of mapping whole RAM with reserved TLB entries, map just enough
to ensure trap code will work (that is 0 upto ${endkernel}) and leave the
rest to pmap_tlbmiss(). Mapping whole physmem into the kernel wired way
too many TLB entries, see

http://mail-index.netbsd.org/port-powerpc/2006/10/27/0000.html

for performance analysis. While there, be a bit more descriptive in
pmap_tlbmiss() comment and use macro instead of numeric constant.

OK by Simon Burge
 1.43 16-Oct-2006  kiyohara * convert ibm4xx-based evbppc from reserved-TLB entry allocation to recently
introduced ppc4xx_tlb_reserve() API.
 1.42 31-Aug-2006  freza branches: 1.42.2; 1.42.4;
* ppc4xx_tlb_reserve(): allocate "reserved" TLB entries dynamically
* ppc4xx_tlb_mapiodev(): resolve pa to va from reserved TLB entries

OK by matt@

XXX we'll keep TLB_NRESERVED defined until we fix explora to use new API
 1.41 12-Jul-2006  simonb Remove unused ppc4xx_tlb_unpin() function.
 1.40 04-Jul-2006  simonb Remove some unused variables.
 1.39 24-Dec-2005  perry branches: 1.39.4; 1.39.8; 1.39.16;
bare asm -> __asm
 1.38 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.37 11-Dec-2005  christos merge ktrace-lwp.
 1.36 03-Jun-2005  scw branches: 1.36.2;
Appease the -Wshadow and -Wcast-qual gods.
 1.35 07-Apr-2005  yamt pmap_testout: fix too many arguments for pmap_kenter_pa.
from Shoichi Miyake. PR/29914.
 1.34 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.33 02-Mar-2005  chs fix two bugs with wiring:
(1) in pmap_enter_pv(), we would always mark the header entry wired, even if
the new entry wasn't put there. noticed by Juergen Hannken-Illjes.
(2) in pmap_unwire(), we would never examine the header entry.
noticed by me.

while I'm here, move the counter increment in the pmap_enter() path to be
next to the corresponding PV_WIRE() call so it's more obvious they match.
 1.32 25-Feb-2005  simonb KNF: put "if (...)" and following statement on separate lines.
 1.31 27-Jan-2005  simonb Fix a typo in a printf string.
 1.30 16-Jan-2005  chs branches: 1.30.2;
implement pmap_wired_count(). fix some places we would forget to splx().
move the parts of pte.h that were used into pmap.c (since they were really
pmap-internal details) and delete ibm4xx/pte.h. other misc cleanup.
 1.29 31-Jul-2004  simonb branches: 1.29.4;
Remove some debug printf()s.
Reorder an evcnt_attach_static().
 1.28 18-Dec-2003  pk Use uvm_km_zalloc(...) instead of uvm_km_alloc1(...,1).
 1.27 20-Oct-2003  simonb Need Data Relocate in the MSR for the dcbf in pmap_procwr().
From Matt Thomas.
 1.26 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.25 12-Aug-2003  matt Nuke ci_curpm and curpm. Nuke pcb_pmreal. Those were use for spill stacks
and those no longer exist. for few uses that need CURPM, use CURPCB/PCB_PM
 1.24 19-Jul-2003  simonb Remove an unused variable.
 1.23 15-Jul-2003  lukem __KERNEL_RCSID()
 1.22 03-Jul-2003  scw Fix resident page accounting for the kernel pmap.
 1.21 10-May-2003  thorpej branches: 1.21.2;
Back out the following chagne:
http://mail-index.netbsd.org/source-changes/2003/05/08/0068.html

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

Fixes PR kern/21517.
 1.20 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.19 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.18 11-Mar-2003  hannken Add support for the IBM 403GCX cpu. Enabled with "options PPC_IBM403".

- different set of device control registers.
- non-standard access to the time base.
- 16 byte cache lines.

Approved by: Eduardo Horvath <eeh@netbsd.org>
 1.17 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.16 06-Jan-2003  wiz writable, not writeable.
 1.15 04-Jan-2003  thorpej Make this compile without DDB.
 1.14 24-Nov-2002  thorpej Use EVCNT_TYPE_TRAP.
 1.13 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.12 11-Jul-2002  simonb Clean up some white space niggles.
 1.11 28-Mar-2002  eeh branches: 1.11.2;
Follow the post-UBC semantics of resetting ref/mod collection inside of
pmap_clear_{reference,modify}().
 1.10 13-Mar-2002  eeh pmap improvements:

Remove the cache flush routines that have been moved to cpu.c

Make sure we clear out the unused PA bits in the TTE which causes breakage
on some MMU models.
 1.9 08-Mar-2002  thorpej Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map). Try to deal with this:

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

From art@openbsd.org.
 1.8 26-Nov-2001  thorpej Rename NOCACHE -> PPC_4XX_NOCACHE to avoid conflict with the namei
flag of the same name.

From Frank van der Linden <fvdl@wasabisystems.com>.
 1.7 26-Nov-2001  thorpej Reset the unused RPN bits in a TLBLO to 0, as specified by the PPC401B3
user's manual, page 8-40.

From Frank van der Linden <fvdl@wasabisystems.com>.
 1.6 06-Nov-2001  simonb In pmap_enter(), sync the instruction cache if VM_PROT_EXECUTE. Fixes
problems when executing programs where text is copied to a page without
a dma sync (like NFS data bcopy'd to a buffer cache page).

From discussion with Jason Thorpe and Eduardo Horvath.
 1.5 11-Sep-2001  eeh branches: 1.5.2; 1.5.4;
Implement pmap_growkernel().
 1.4 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.3 22-Jul-2001  wiz branches: 1.3.2;
Replace memcpy's of obviously overlapping regions with memmove.
Noted by Izumi Tsutsui.
 1.2 22-Jul-2001  wiz bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.1 13-Jun-2001  simonb branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.
 1.1.2.7 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.2.1 03-Aug-2001  lukem update to -current
 1.3.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.4.11 07-Jan-2003  thorpej Sync with head.
 1.5.4.10 11-Dec-2002  thorpej Sync with HEAD.
 1.5.4.9 18-Oct-2002  nathanw Catch up to -current.
 1.5.4.8 01-Aug-2002  nathanw Catch up to -current.
 1.5.4.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.5.4.6 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.5.4.5 17-Apr-2002  nathanw Catch up to -current.
 1.5.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.5.4.2 05-Nov-2001  briggs Initial SA support for ppc. Test-booted on sandpoint, macppc, & walnut.
mcontext and cpu_getmcontext()/cpu_setmcontext() from Klaus Klein
<kleink@netbsd.org>.
 1.5.4.1 11-Sep-2001  briggs file pmap.c was added on branch nathanw_sa on 2001-11-05 19:46:16 +0000
 1.5.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.11.2.1 16-Jul-2002  gehenna catch up with -current.
 1.21.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.7 01-Apr-2005  skrll Sync with HEAD.
 1.21.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.21.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.21.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1 03-Aug-2004  skrll Sync with HEAD
 1.29.4.1 29-Apr-2005  kent sync with -current
 1.30.2.3 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.30.2.2 12-Feb-2005  yamt sync with head.
 1.30.2.1 28-Jan-2005  yamt convert arch/powerpc to new apis.
 1.36.2.4 03-Sep-2007  yamt sync with head.
 1.36.2.3 26-Feb-2007  yamt sync with head.
 1.36.2.2 30-Dec-2006  yamt sync with head.
 1.36.2.1 21-Jun-2006  yamt sync with head.
 1.39.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.39.8.2 03-Sep-2006  yamt sync with head.
 1.39.8.1 11-Aug-2006  yamt sync with head
 1.39.4.1 09-Sep-2006  rpaulo sync with head
 1.42.4.2 10-Dec-2006  yamt sync with head.
 1.42.4.1 22-Oct-2006  yamt sync with head
 1.42.2.2 12-Jan-2007  ad Sync with head.
 1.42.2.1 18-Nov-2006  ad Sync with head.
 1.44.4.3 24-Mar-2007  yamt sync with head.
 1.44.4.2 12-Mar-2007  rmind Sync with HEAD.
 1.44.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.47.2.2 20-Aug-2007  ad Sync with HEAD.
 1.47.2.1 13-Mar-2007  ad Sync with head.
 1.48.12.1 15-Aug-2007  skrll Sync with HEAD.
 1.48.10.1 07-Aug-2007  matt Sync with HEAD.
 1.48.8.2 03-Oct-2007  garbled Sync with HEAD
 1.48.8.1 02-Aug-2007  macallan sync with HEAD
 1.49.6.1 06-Nov-2007  matt sync with HEAD
 1.50.40.1 07-Jan-2011  matt Deal with new powerpc world.
 1.50.28.2 28-Apr-2009  skrll Sync with HEAD.
 1.50.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.50.26.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.50.20.4 11-Mar-2010  yamt sync with head
 1.50.20.3 19-Aug-2009  yamt sync with head.
 1.50.20.2 16-May-2009  yamt sync with head
 1.50.20.1 04-May-2009  yamt sync with head.
 1.50.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.52.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.60.2.8 04-Nov-2010  uebayasi Split physical device segment pages from "managed" to "managed
device". Cache that information as a flag PG_DEVICE so that callers
don't need to walk physsegs everytime.

Remove PQ_FIXED, which means that page daemon doesn't need to know
device segment pages at all. But still fault handlers need to know
them.

I think this is what I can do best now.
 1.60.2.7 31-Oct-2010  uebayasi We already have a flag PMAP_NOCACHE. s/PMAP_UNMANAGED/PMAN_NOCACHE/.
Pointed out by Chuck Silvers, thanks.
 1.60.2.6 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.60.2.5 14-Aug-2010  uebayasi Teach TLB miss handler (pmap_tlbmiss()) to map "Expansion ROM" area as
PA == VA. Now we don't need to reserve a TLB entry for it.
 1.60.2.4 11-Aug-2010  uebayasi Support XIP; look up "device" vm_physseg for managed pages. Initialize
vm_physseg MD part.
 1.60.2.3 30-Apr-2010  uebayasi Sync with HEAD.
 1.60.2.2 28-Apr-2010  uebayasi Always use struct vm_physseg *vm_physmem_ptrs[] in MD code.
 1.60.2.1 27-Apr-2010  uebayasi Support PMAP_UNMANAGED in some pmaps.

(Others should be converted eventually, but no problem while managed
device page is not used.)
 1.62.2.1 05-Mar-2011  rmind sync with head
 1.65.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.65.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.66.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.70.6.1 18-Feb-2012  mrg merge to -current.
 1.70.2.1 17-Apr-2012  yamt sync with head
 1.72.28.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.72.24.1 05-Feb-2017  skrll Sync with HEAD
 1.72.6.1 03-Dec-2017  jdolecek update from HEAD
 1.76.22.1 29-Feb-2020  ad Sync with head.
 1.76.20.2 09-Mar-2020  martin Pull up following revision(s) (requested by rin in ticket #773):

sys/arch/powerpc/ibm4xx/pmap.c: revision 1.81
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.82
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.83
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.84
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.85
sys/arch/powerpc/include/ibm4xx/tlb.h: revision 1.6
sys/arch/powerpc/include/ibm4xx/pmap.h: revision 1.20

Misc non-critical fixes.
- __asm --> __asm volatile for sure
- turn DEBUG code in __asm into DIAGNOSTIC code in C
- style

ppc4xx_tlb_enter(): invalidate entry after clearing MSR for sure.

pmap_procwr(): use dcbst instead of dcbf as a tiny optimization.

Retire tlbpid_t (u_short):
- PID (ctx, ASID) is 8-bit length, not half word.
- For struct pmap, no need to use integer types smaller than word as
pm_ctx because of alignment.
- For ppc4xx_tlb_enter(), we need word-length storage for pid (and msr).
XXX
Better to rewrite pmap module with more suggestive integer types rather
than char, int, long, and so on.

Fix pmap_procwr().
While we need to turn off IMMU, DMMU should be kept on. Otherwise,
dcbst (and also icbi probably, though not documented clearly both
for 405 and 403) should not work correctly.
 1.76.20.1 27-Feb-2020  martin Pull up following revision(s) (requested by rin in ticket #731):

sys/arch/powerpc/ibm4xx/pmap.c: revision 1.80
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.77
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.78
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.79

Fix NULL dereference; "pap" argument of pmap_extract(9) can be NULL.

-

Fix off-by-one error for ctx (ASID).

-

Note that NUM_CTX = 256 = 0 stands for disabling protection by ASID.
Clear ti_ctx when flushing a TLB entry for clarity.

-

In ppc4xx_tlb_find_victim(), mark kernel stack page TLBF_REF instead of
TLBF_USED. This should be originally intended behavior of this code
segment, because
- TLBF_USED is already checked just before, so marking this page
TLBF_USED is no-op.
- TLBF_REF flag exempts that page from being flushed from TLB in next
scan, when kernel stack may be still there with high probability.
 1.76.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.95.4.2 17-Apr-2021  thorpej Sync with HEAD.
 1.95.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.95.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1 17-Aug-2010  uebayasi branches: 1.1.2;
file pmap.c.work was initially added on branch uebayasi-xip.
 1.1.2.2 22-Oct-2010  uebayasi Merge botch.
 1.1.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.102 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.101 05-Oct-2022  rin Minor style fixes to asm codes. No binary changes.
 1.100 04-Oct-2022  rin copy{in,out}{,str}: Drop needless dcbst.

Data cache is purely physical for 40[53] with 16KB pages, and therefore
no need to flush cache before context switch.

This significantly improves copy{in,out} against small data; for example,
bytebench on DHT becomes:

-Pipe Throughput 12440.0 8826.1 7.1
+Pipe Throughput 12440.0 18364.8 14.8

No performance/ATF regression observed on 405. 403 boots successfully
into multiuser mode, and builds some packages.
 1.99 12-Sep-2022  rin Work around clang 13.0.0 bug; copy{in,out}() are miscompiled with -O[12],
by which /sbin/init cannot be executed.
 1.98 12-Sep-2022  rin Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.
 1.97 12-Sep-2022  rin copy{in,out}(): Minor clean up:
- No need to supply count (== 0).
- %r0 can be used as %[ctx] and %[len].
 1.96 12-Sep-2022  rin copyin(): Remove one more needless mtpid. No regression for full ATF.
 1.95 11-Sep-2022  rin copyin(): Fix comment. No binary changes.
 1.94 11-Sep-2022  rin copy{in,out}(): Tiny optimizations for __asm codes.
No regressions for full ATF run.

- Use {l,st}swx instead of loop for remaining bytes.
- Drop needless "mtpid %[x]; isync;".
 1.93 11-Sep-2022  rin copy{in,out}(): Add missing clobber registers to __asm codes.
 1.92 11-Sep-2022  rin copy{in,out}(): Add missing ``if (count == 0) goto done;''.
 1.91 11-Sep-2022  rin copy{in,out}(): Consistently use %[tmp] as scratch register. NFC.
 1.90 11-Sep-2022  rin copyin(): Fix copy-paste in comment. No binary changes.
 1.89 11-Sep-2022  rin copy{in,out}(): Cosmetic changes to __asm codes. No binary changes.

- Editor-friendly indentation.
- One insn per line.
- Group insns with logical blocks.
 1.88 11-Sep-2022  rin s/udaddr/uaddr/g for consistency; we use kaddr for kernel data address.
No binary changes.
 1.87 30-May-2022  rin For IBM_PPC403, emulate unaligned memory access for userland process.
 1.86 06-Mar-2021  rin For booke and ibm4xx, switch to software-based single-stepping for PT_STEP
ptrace(2) command from broken hardware-based implementation.

As described in proposal on port-powerpc@,

http://mail-index.netbsd.org/port-powerpc/2021/02/26/msg003597.html

hardware debug facilities of booke and 4xx use critical interrupts, that
are difficult to handle for this purpose; they are not automatically masked
when entering kernel mode via system call trap or hardware interrupt.
See my proposal above for more details.

Now, hardware debug facilities are exclusively usable by kernel itself.
They are much more functional than PSL_SE MSR bit of oea, and should be
useful to, e.g., support byte-granular watchpoint for DDB in the future.
 1.85 15-Jul-2020  rin branches: 1.85.2;
For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).
 1.84 15-Jul-2020  rin Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.
 1.83 06-Jul-2020  rin - Drop unused opt_altivec.h.
- Include missing opt_ppcarch.h.
 1.82 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.81 19-Jun-2020  rin Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.
 1.80 19-Jun-2020  rin Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.
 1.79 19-Jun-2020  rin Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.
 1.78 21-Feb-2020  rin Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49
 1.77 21-Feb-2020  rin Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.
 1.76 21-Feb-2020  rin Cosmetic changes for assembler codes. No binary changes.
 1.75 21-Feb-2020  rin Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.
 1.74 20-Feb-2020  rin Oops, sort header again. My bad...
 1.73 20-Feb-2020  rin Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.
 1.72 20-Feb-2020  rin Sort more headers...
 1.71 20-Feb-2020  rin Sort headers.
 1.70 07-Apr-2019  thorpej branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.
 1.69 26-Dec-2016  rin branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.
 1.68 16-Dec-2016  rin Remove needless goto's. No functional changes.
 1.67 18-Oct-2014  snj branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.66 23-Aug-2013  matt Get rid of MDLWP_USED{FPU,VEC}
 1.65 23-Jul-2012  matt branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.
 1.64 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.63 13-Dec-2011  kiyohara Remove white-spaces.
 1.62 21-Jun-2011  matt branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.
 1.61 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.60 14-Jun-2011  matt Make startlwp and upcallret common instead of having 3 mostly identical copies.
 1.59 05-Jun-2011  matt Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.
 1.58 18-Jan-2011  matt branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.
 1.57 20-Dec-2010  matt branches: 1.57.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.56 23-Apr-2010  rmind Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.
 1.55 20-Mar-2010  chs fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.54 25-Feb-2010  matt branches: 1.54.2;
Adapt to spr.h breakup.
 1.53 21-Nov-2009  rmind branches: 1.53.2;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.52 21-Oct-2009  rmind Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.
 1.51 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.50 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.49 15-Oct-2008  wrstuden branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.
 1.48 02-Jan-2008  ad branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.
 1.47 28-Nov-2007  simonb branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.
 1.46 22-Nov-2007  hpeyerl Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).
 1.45 05-Nov-2007  ad branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.44 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.43 09-Jul-2007  ad branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.42 22-May-2007  rjs Fix for yamt-idlelwp merge.
 1.41 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.40 04-Mar-2007  christos branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.39 15-Feb-2007  ad branches: 1.39.2;
Make these compile again.
 1.38 09-Feb-2007  ad Merge newlock2 to head.
 1.37 05-Oct-2006  chs add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).
 1.36 23-Jul-2006  ad branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.
 1.35 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.34 15-May-2006  yamt include kauth.h for kauth_cred_geteuid.
 1.33 14-May-2006  elad integrate kauth.
 1.32 15-Mar-2006  drochner branches: 1.32.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument
 1.31 07-Mar-2006  thorpej branches: 1.31.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
 1.30 07-Mar-2006  thorpej Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.29 24-Dec-2005  perry branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm
 1.28 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.27 11-Dec-2005  christos merge ktrace-lwp.
 1.26 03-Jun-2005  scw branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.
 1.25 25-Feb-2005  simonb KNF: put "if (...)" and following statement on separate lines.
 1.24 19-Jan-2005  simonb branches: 1.24.2;
White space nit.
 1.23 02-Sep-2004  scw branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().
 1.22 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.21 24-Feb-2004  drochner deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)
 1.20 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.19 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.18 26-Sep-2003  eeh Define ksi.
 1.17 25-Sep-2003  matt Add siginfo support for PowerPC.
 1.16 19-Sep-2003  cl add MD part of SA/pthread pagefault handling on powerpc
 1.15 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.14 15-Jul-2003  lukem __KERNEL_RCSID()
 1.13 28-Jun-2003  simonb branches: 1.13.2;
Sprinkle some KNF.
 1.12 07-Feb-2003  thorpej Fix some printf formats.
 1.11 02-Feb-2003  matt Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.
 1.10 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.9 25-Nov-2002  thorpej branches: 1.9.2;
Statements after labels.
 1.8 02-Aug-2002  chs use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.
 1.7 11-Jul-2002  simonb Clean up some white space niggles.
 1.6 05-Jul-2002  matt Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.
 1.5 17-Jun-2002  christos apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.
 1.4 17-Jun-2002  christos MD systrace gluons.
 1.3 14-Feb-2002  chs branches: 1.3.8;
allow writing to write-only mappings. fixes PR 3493.
 1.2 22-Jul-2001  wiz branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.1 13-Jun-2001  simonb branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.
 1.1.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.1 03-Aug-2001  lukem update to -current
 1.2.6.15 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.2.6.14 11-Dec-2002  thorpej Sync with HEAD.
 1.2.6.13 06-Oct-2002  gmcgarry upcallret() takes struct *lwp.
 1.2.6.12 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.2.6.11 29-Aug-2002  nathanw Replace the old-fashioned P_WEXIT checking with p_userret hook handling.
 1.2.6.10 06-Aug-2002  nathanw Catch up with powerpc rototilling.
 1.2.6.9 01-Aug-2002  nathanw Catch up to -current.
 1.2.6.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.2.6.7 03-Jul-2002  nathanw Do p->p_userret handling rather than the old P_WEXIT check in trap().
 1.2.6.6 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.2.6.5 20-Jun-2002  nathanw Catch up to -current.
 1.2.6.4 28-Feb-2002  nathanw Catch up to -current.
 1.2.6.3 17-Dec-2001  nathanw cpu_upcall() -> sa_upcall_userret().
 1.2.6.2 05-Nov-2001  briggs Initial SA support for ppc. Test-booted on sandpoint, macppc, & walnut.
mcontext and cpu_getmcontext()/cpu_setmcontext() from Klaus Klein
<kleink@netbsd.org>.
 1.2.6.1 22-Jul-2001  briggs file trap.c was added on branch nathanw_sa on 2001-11-05 19:46:16 +0000
 1.3.8.3 31-Aug-2002  gehenna catch up with -current.
 1.3.8.2 16-Jul-2002  gehenna catch up with -current.
 1.3.8.1 15-Jul-2002  gehenna catch up with -current.
 1.9.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.13.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.13.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.13.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.13.2.2 03-Sep-2004  skrll Sync with HEAD
 1.13.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.4.1 29-Apr-2005  kent sync with -current
 1.24.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.26.2.8 21-Jan-2008  yamt sync with head
 1.26.2.7 07-Dec-2007  yamt sync with head
 1.26.2.6 15-Nov-2007  yamt sync with head.
 1.26.2.5 27-Oct-2007  yamt sync with head.
 1.26.2.4 03-Sep-2007  yamt sync with head.
 1.26.2.3 26-Feb-2007  yamt sync with head.
 1.26.2.2 30-Dec-2006  yamt sync with head.
 1.26.2.1 21-Jun-2006  yamt sync with head.
 1.29.8.4 11-Aug-2006  yamt sync with head
 1.29.8.3 24-May-2006  yamt sync with head.
 1.29.8.2 01-Apr-2006  yamt sync with head.
 1.29.8.1 13-Mar-2006  yamt sync with head.
 1.29.6.2 01-Jun-2006  kardel Sync with head.
 1.29.6.1 22-Apr-2006  simonb Sync with head.
 1.29.4.1 09-Sep-2006  rpaulo sync with head
 1.31.2.3 19-Apr-2006  elad sync with head - hopefully this will work
 1.31.2.2 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.31.2.1 07-Mar-2006  elad file trap.c was added on branch elad-kernelauth on 2006-03-08 00:43:13 +0000
 1.32.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.36.6.1 22-Oct-2006  yamt sync with head
 1.36.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.36.4.1 18-Nov-2006  ad Sync with head.
 1.39.2.2 03-Apr-2007  matt Adapt powerpc to yamt-idlelwp. Nuke cpu_setfunc.
Don't define _HAVE_BITENDIAN_BITOPS. Misc cleanups.
 1.39.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.40.10.5 03-Oct-2007  garbled Sync with HEAD
 1.40.10.4 02-Aug-2007  macallan sync with HEAD
 1.40.10.3 26-Jun-2007  garbled Sync with HEAD.
 1.40.10.2 28-May-2007  freza Add KGDB support to evbppc/virtex port. From Jean-Francois Boudreault,
cosmetics by me.

While there, generalize virtex_console_tag() to virtex_bus_space_tag()
and fix one instance of yamt-idlelwp fallout (ci_need_resched renamed
to ci_want_resched).

XXX Only compile tested since my access to suitable Virtex HW is sporadic
XXX at best.
 1.40.10.1 22-May-2007  matt Update to HEAD.
 1.40.4.1 11-Jul-2007  mjf Sync with head.
 1.40.2.3 03-Dec-2007  ad Sync with HEAD.
 1.40.2.2 23-Oct-2007  ad Sync with head.
 1.40.2.1 15-Jul-2007  ad Sync with head.
 1.43.14.3 22-Nov-2007  bouyer Sync with HEAD
 1.43.14.2 13-Nov-2007  bouyer Sync with HEAD
 1.43.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.43.12.1 18-Oct-2007  yamt sync with head.
 1.43.10.2 09-Jan-2008  matt sync with HEAD
 1.43.10.1 06-Nov-2007  matt sync with HEAD
 1.43.8.4 03-Dec-2007  joerg Sync with HEAD.
 1.43.8.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.43.8.2 06-Nov-2007  joerg Sync with HEAD.
 1.43.8.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.45.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.45.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.47.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.47.2.1 27-Dec-2007  ad locking changes for macppc. Please test.
 1.48.16.1 19-Oct-2008  haad Sync with HEAD.
 1.48.12.3 30-Jun-2008  wrstuden Change how we make SA threads not generate upcalls. Instead of clearing
LW_SA, use a private flag, LP_SA_NOBLOCK, that we set when we want
to not generate upcalls. This means we do NOT need to lock (l)
(ourselves) to set it.

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

Introduce code pattern to set & remember this:

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

...

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

l->l_pflag ^= f;

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

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

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

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

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

Tweak some comments.
 1.48.12.2 22-Jun-2008  wrstuden Re-add cpu_upcall() and page fault code. i386 kernels now compile.
They don't boot, but that seems to be a consequence of current from the
day this branch was started.
 1.48.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.48.10.3 11-Aug-2010  yamt sync with head.
 1.48.10.2 11-Mar-2010  yamt sync with head
 1.48.10.1 04-May-2009  yamt sync with head.
 1.48.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.49.16.2 17-Jan-2011  matt Add SPE (signal processing engine) support for mpc85xx/booke. Think of it
as AltiVec-lite (really lite). Genercize AltiVec support so that it could
the same interface could support SPE as well. Rework the FPU support along
the same lines. Move the __asm() to their own XXX_subr.S (altivec, fpu, spe).
 1.49.16.1 07-Jan-2011  matt Deal with new powerpc world.
 1.49.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.49.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.53.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.54.2.3 12-Jun-2011  rmind sync with head
 1.54.2.2 05-Mar-2011  rmind sync with head
 1.54.2.1 30-May-2010  rmind sync with head
 1.57.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.58.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.62.6.2 24-Feb-2012  mrg sync to -current.
 1.62.6.1 18-Feb-2012  mrg merge to -current.
 1.62.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.62.2.2 30-Oct-2012  yamt sync with head
 1.62.2.1 17-Apr-2012  yamt sync with head
 1.65.4.1 28-Aug-2013  rmind sync with head
 1.65.2.2 03-Dec-2017  jdolecek update from HEAD
 1.65.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.67.4.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.67.2.1 05-Feb-2017  skrll Sync with HEAD
 1.69.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.69.16.1 10-Jun-2019  christos Sync with HEAD
 1.70.6.1 29-Feb-2020  ad Sync with head.
 1.70.4.1 27-Feb-2020  martin Pull up following revision(s) (requested by rin in ticket #735):

sys/arch/powerpc/ibm4xx/trap.c: revision 1.71
sys/arch/powerpc/ibm4xx/trap.c: revision 1.72
sys/arch/powerpc/ibm4xx/trap.c: revision 1.73
sys/arch/powerpc/ibm4xx/trap.c: revision 1.74
sys/arch/powerpc/ibm4xx/trap.c: revision 1.75
sys/arch/powerpc/ibm4xx/trap.c: revision 1.76
sys/arch/powerpc/ibm4xx/trap.c: revision 1.77
sys/arch/powerpc/ibm4xx/trap.c: revision 1.78

Sort headers.
-
Sort more headers...
-
Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.
-
Oops, sort header again. My bad...
-
Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.
-
Cosmetic changes for assembler codes. No binary changes.
-
Tiny improvements to copyin() and copyout():
- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.
- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.
-
Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49
 1.85.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.30 12-Sep-2022  rin Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.
 1.29 06-Jul-2020  rin Include required opt_*.h for sure.
 1.28 01-Mar-2020  rin Implement workaround for IBM405 Errata 77 (aka CPU_210), where
interrupted stwcx. may errantly write data to memory:

https://elinux.org/images/1/1d/Ppc405gp-errata.pdf

This is because stwcx. is split into two pieces in the pipeline.

We need to
(1) insert dcbt before every stwcx. instruction, as well as
(2) insert sync before every rfi/rfci instruction.

It is unclear which processors are affected, but according to Linux,
all 405-based cores up until 405GPR and 405EP are affected:

https://github.com/torvalds/linux/blob/master/arch/powerpc/platforms/40x/Kconfig#L140

For kernel, this workaround can be restricted to affected processors.
However, for kernel modules and userland, we have to enable it for all
32bit powerpc archs in order to share common binaries as before.

Proposed on port-powerpc:

http://mail-index.netbsd.org/port-powerpc/2020/02/21/msg003583.html
 1.27 15-Jul-2018  maxv branches: 1.27.4;
Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
 1.26 28-Dec-2016  rin branches: 1.26.14; 1.26.16;
PR port-powerpc/51367: kernel panic for powerpc/ibm4xx with "option DDB"

Stop using ddbstk/ipkdbstk to make nested traps possible, which avoids
kernel panics reported in the PR.

Suggested and approved by matt.
 1.25 26-Dec-2016  rin No need to have same trap handlers in trap_subr.S.
No functional changes.
 1.24 09-Feb-2013  kiyohara branches: 1.24.14; 1.24.18;
Fix KASSERT(l == curlwp)ed in mi_switch(). Don't use INTSTK of cpu_info in
INTR_PROLOG when user-mode. Interrupted user context switches to newlwp, if
sched tick. This context must save to USPACE.
When use our INTSTK?
 1.23 29-Jan-2013  kiyohara Set SRR1 to r31 in intr_exit. Not cpuinfo.
 1.22 22-Dec-2011  kiyohara branches: 1.22.6;
Check PSL_PR instead of CI_IDEPTH in INTR_PROLOG.
 1.21 15-Dec-2011  kiyohara Like intrleave_to_user:, intrleave_to_kernel: should also restore PID.
Moreover, disable transration.
 1.20 15-Dec-2011  kiyohara Store r30 and r31 beforehand to restore.
 1.19 14-Dec-2011  kiyohara Indent.
Remove white-spaces and unnecessary semi-collons.
 1.18 28-Jun-2011  kiyohara branches: 1.18.2; 1.18.6;
Must need srr0 and srr1 in FRAME_SETUP and trapexit.
parentheses is good.
Remove no-need 'addi FRAME_TF'.
 1.17 24-Jun-2011  kiyohara Fix broken stack. The r4 points cpu_info in ddb_trap. (not test)
 1.16 15-Jun-2011  cliff - FRAME_SAVE_CALLEE() starts at r14 (not r13, which is curlwp) (from matt@)
- INTR_SAVE() must also save r13 (from matt@).
- fitint must pass clock frame, not trap frame
- fix comment in pitint and fitint to indicate passing clock frame, not intr frame
 1.15 05-Jun-2011  matt Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.
 1.14 02-May-2011  kiyohara branches: 1.14.2;
Fix broken stack. The r1 is stack pointer. Not cpu_info pointer.
 1.13 18-Jan-2011  matt Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.
 1.12 05-Jan-2011  matt branches: 1.12.2;
Use regnames (%rX %crX), use m[ft]sprg[0-9]. No binary difference.
 1.11 17-Oct-2007  garbled branches: 1.11.42; 1.11.46;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.10 11-Dec-2005  christos branches: 1.10.30; 1.10.38; 1.10.48; 1.10.50; 1.10.52; 1.10.54;
merge ktrace-lwp.
 1.9 11-Aug-2003  chs branches: 1.9.16;
catch up with changes elsewhere.
 1.8 09-Jul-2003  matt Enhance db_trace to understand syscalls and print the syscall number
that the user requested. For example:

0xd5c56f40: SC trap #240 by 0x15668c60: srr1=0xd032
r1=0xffffe470 cr=0x44000045 xer=0 ctr=0xeff27ab8
 1.7 02-Feb-2003  matt branches: 1.7.2;
Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.
 1.6 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.5 02-Aug-2002  chs use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.
 1.4 11-Jul-2002  simonb Clean up some white space niggles.
 1.3 13-Mar-2002  eeh branches: 1.3.4;
Add a vector for machine check traps.
 1.2 17-Jun-2001  simonb branches: 1.2.2; 1.2.8;
Globalise "trapexit" for new ddb tracing changes.
 1.1 13-Jun-2001  simonb Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.
 1.2.8.4 06-Aug-2002  nathanw Catch up with powerpc rototilling.
 1.2.8.3 01-Aug-2002  nathanw Catch up to -current.
 1.2.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.8.1 17-Jun-2001  nathanw file trap_subr.S was added on branch nathanw_sa on 2002-04-01 07:42:02 +0000
 1.2.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.4.2 31-Aug-2002  gehenna catch up with -current.
 1.3.4.1 16-Jul-2002  gehenna catch up with -current.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 27-Oct-2007  yamt sync with head.
 1.10.54.1 25-Oct-2007  bouyer Sync with HEAD.
 1.10.52.1 18-Oct-2007  yamt sync with head.
 1.10.50.1 06-Nov-2007  matt sync with HEAD
 1.10.48.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.10.38.1 28-May-2007  freza Add KGDB support to evbppc/virtex port. From Jean-Francois Boudreault,
cosmetics by me.

While there, generalize virtex_console_tag() to virtex_bus_space_tag()
and fix one instance of yamt-idlelwp fallout (ci_need_resched renamed
to ci_want_resched).

XXX Only compile tested since my access to suitable Virtex HW is sporadic
XXX at best.
 1.10.30.1 23-Oct-2007  ad Sync with head.
 1.11.46.1 07-Jan-2011  matt Deal with new powerpc world.
 1.11.42.3 12-Jun-2011  rmind sync with head
 1.11.42.2 31-May-2011  rmind sync with head
 1.11.42.1 05-Mar-2011  rmind sync with head
 1.12.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.18.6.1 18-Feb-2012  mrg merge to -current.
 1.18.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.18.2.1 17-Apr-2012  yamt sync with head
 1.22.6.2 03-Dec-2017  jdolecek update from HEAD
 1.22.6.1 25-Feb-2013  tls resync with head
 1.24.18.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.24.14.1 05-Feb-2017  skrll Sync with HEAD
 1.26.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.26.16.1 10-Jun-2019  christos Sync with HEAD
 1.26.14.1 28-Jul-2018  pgoyette Sync with HEAD
 1.27.4.1 03-Mar-2020  martin Pull up following revision(s) (requested by rin in ticket #755):

sys/arch/evbppc/conf/std.virtex: revision 1.4
sys/arch/powerpc/powerpc/trap_subr.S: revision 1.81
sys/arch/powerpc/ibm4xx/4xx_trap_subr.S: revision 1.8
sys/arch/evbppc/conf/std.walnut: revision 1.9
common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h: revision 1.7
sys/arch/powerpc/include/asm.h: revision 1.49
common/lib/libc/arch/powerpc/atomic/atomic_cas.S: revision 1.9
sys/arch/powerpc/ibm4xx/trap_subr.S: revision 1.28
sys/arch/powerpc/include/lock.h: revision 1.15
sys/arch/evbppc/conf/std.obs266: revision 1.3
common/lib/libc/arch/powerpc/atomic/atomic_swap.S: revision 1.8
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.61
sys/arch/powerpc/powerpc/lock_stubs.S: revision 1.12
sys/arch/evbppc/conf/std.obs200: revision 1.5

Implement workaround for IBM405 Errata 77 (aka CPU_210), where
interrupted stwcx. may errantly write data to memory:

https://elinux.org/images/1/1d/Ppc405gp-errata.pdf

This is because stwcx. is split into two pieces in the pipeline.

We need to
(1) insert dcbt before every stwcx. instruction, as well as
(2) insert sync before every rfi/rfci instruction.

It is unclear which processors are affected, but according to Linux,
all 405-based cores up until 405GPR and 405EP are affected:

https://github.com/torvalds/linux/blob/master/arch/powerpc/platforms/40x/Kconfig#L140

For kernel, this workaround can be restricted to affected processors.

However, for kernel modules and userland, we have to enable it for all
32bit powerpc archs in order to share common binaries as before.
Proposed on port-powerpc:

http://mail-index.netbsd.org/port-powerpc/2020/02/21/msg003583.html
 1.5 12-Aug-2002  simonb Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.4 13-Mar-2002  eeh branches: 1.4.4;
Adapt to the new, separate mainbus.
 1.3 08-Mar-2002  simonb Include libkern.h for strcmp() prototype.
 1.2 29-Oct-2001  simonb branches: 1.2.2;
Don't return at the end of a void function.
 1.1 24-Jun-2001  simonb branches: 1.1.2; 1.1.6;
Move on-chip 405GP devices to powerpc/ibm4xx/dev.
 1.1.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.3 13-Aug-2002  nathanw Catch up to -current.
 1.2.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.1 29-Oct-2001  nathanw file com_mainbus.c was added on branch nathanw_sa on 2002-04-01 07:42:03 +0000
 1.4.4.1 31-Aug-2002  gehenna catch up with -current.
 1.25 27-Feb-2021  rin Switch to intr_establish_xname().
 1.24 06-Jul-2020  rin branches: 1.24.2;
Style and cosmetic changes. No binary changes intended.
 1.23 15-Dec-2019  rin Belatedly catch up with MI com(4) change in com.c rev. 1.351:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ic/com.c#rev1.351

XXX
pullup to netbsd-9
 1.22 08-Dec-2018  thorpej branches: 1.22.4;
Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.21 18-Jun-2011  matt branches: 1.21.52; 1.21.54;
Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.20 14-Mar-2008  cube branches: 1.20.36;
Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend). Use proper types and ansify where appropriate.
 1.19 22-Feb-2007  thorpej branches: 1.19.22; 1.19.38; 1.19.42;
TRUE -> true, FALSE -> false
 1.18 13-Jul-2006  gdamore branches: 1.18.10;
Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

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

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

Approved by core@. Fixes PR port-evbmips/32362.
 1.17 10-Jul-2006  thorpej Put appropriate prefixes on property names to reduce chances of name
collisions.
 1.16 07-May-2006  simonb branches: 1.16.4;
Unwrap not-too-long long.
 1.15 05-May-2006  thorpej Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.14 18-Feb-2006  thorpej branches: 1.14.2; 1.14.4; 1.14.6;
- Don't expose dev_propdb directly -- provide devprop_*() wrappers instead.
- Rework the ARMADILLO / epe device properties interaction so that it actually
associates the MAC address property with the epe device instance.
 1.13 11-Dec-2005  christos branches: 1.13.2; 1.13.4; 1.13.6;
merge ktrace-lwp.
 1.12 24-Dec-2004  shige branches: 1.12.10;
Add functions:
- com_opb_cnattach
- com_opb_device_register
 1.11 15-Jul-2003  lukem branches: 1.11.6;
__KERNEL_RCSID()
 1.10 14-Jul-2003  simonb Check return value of prop_get() correctly; serial ports now attach on
a walnut, but don't seem to accept input(?!).
 1.9 04-Jul-2003  thorpej Consult the "frequency" property associated with the device in the
dev_propdb, rather than using "board_info".
 1.8 02-Oct-2002  thorpej branches: 1.8.6;
Add trailing ; to CFATTACH_DECL.
 1.7 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.4 23-Aug-2002  scw branches: 1.4.2; 1.4.4;
Don't assume all com ports run at "COM_FREQ", or a multiple thereof.
Use a board-specific property instead.
 1.3 14-Aug-2002  simonb Remove the "comfound < 2" bogosity.
 1.2 14-Aug-2002  simonb Remove an unused global variable (that was marked with an XXX!).
 1.1 12-Aug-2002  simonb branches: 1.1.2;
Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.1.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.3 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 12-Aug-2002  nathanw file com_opb.c was added on branch nathanw_sa on 2002-08-13 02:18:43 +0000
 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 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.4.1 23-Aug-2002  jdolecek file com_opb.c was added on branch kqueue on 2002-09-06 08:39:06 +0000
 1.4.2.2 31-Aug-2002  gehenna catch up with -current.
 1.4.2.1 23-Aug-2002  gehenna file com_opb.c was added on branch gehenna-devsw on 2002-08-31 13:45:43 +0000
 1.8.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.11.6.1 15-Sep-2005  riz Pull up following revision(s) (requested by shige in ticket #5820):
distrib/evbppc/md-kernel/Makefile 1.3 via patch
etc/etc.evbppc/Makefile.inc 1.3 via patch
sys/arch/evbppc/conf/files.obs405 1.5-1.8 via patch
sys/arch/evbppc/conf/OPENBLOCKS266 1.22,1.25 via patch
sys/arch/evbppc/include/obs266.h 1.1 (new)
sys/arch/evbppc/include/obs405.h 1.1-1.5 (new)
sys/arch/evbppc/include/rbus_machdep.h 1.1 (new)
sys/arch/evbppc/obs405/consinit.c 1.2-1.4
sys/arch/evbppc/obs405/dev/x1226.c deleted
sys/arch/evbppc/obs405/dev/x1226reg.h deleted
sys/arch/evbppc/obs405/machdep.c deleted
sys/arch/evbppc/obs405/obs266_autoconf.c 1.1 (new)
sys/arch/evbppc/obs405/obs266_machdep.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_autoconf.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_machdep.c 1.1 (new)
sys/arch/evbppc/obs405/rbus_machdep.c 1.1 (new)
sys/arch/powerpc/conf/files.ibm4xx 1.6-1.7
sys/arch/powerpc/ibm4xx/board_prop.c 1.1 (new)
sys/arch/powerpc/ibm4xx/dev/com_opb.c 1.12
sys/arch/powerpc/ibm4xx/dev/comopbvar.h 1.1 (new)
sys/arch/powerpc/ibm4xx/ibm40x_machdep.c 1.3-1.4
sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 1.1-1.2 (new)
sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c 1.1-1.3 (new)
sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 1.2-1.3
sys/arch/powerpc/ibm4xx/openbios/openbios.c 1.1 (new)
sys/arch/powerpc/include/ibm4xx/cpu.h 1.7-1.10
sys/arch/powerpc/include/ibm4xx/openbios.h 1.1 (new)

Update OpenBlockS266 support to more modern, stable sources.
 1.12.10.4 17-Mar-2008  yamt sync with head.
 1.12.10.3 26-Feb-2007  yamt sync with head.
 1.12.10.2 30-Dec-2006  yamt sync with head.
 1.12.10.1 21-Jun-2006  yamt sync with head.
 1.13.6.2 01-Jun-2006  kardel Sync with head.
 1.13.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.1 18-Feb-2006  yamt sync with head.
 1.14.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.14.4.1 11-May-2006  elad sync with head
 1.14.2.2 11-Aug-2006  yamt sync with head
 1.14.2.1 24-May-2006  yamt sync with head.
 1.16.4.4 13-Jul-2006  gdamore Merge from HEAD.
 1.16.4.3 16-Jun-2006  gdamore Adapt to KNF changes per simonb.
 1.16.4.2 16-Jun-2006  simonb Fix order of arguments to COM_INIT_REGS macro. Fixes console problems
on a Walnut.
 1.16.4.1 15-Jun-2006  gdamore Initial work for PowerPC-specific com(4) rewhack. Compile tested, but I
lack hardware to test. If someone wants to validate, would be appreciated.
(Compile tested for WALNUT, EXPLORA451, and EV64260 kernels.)
 1.18.10.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.19.42.1 03-Apr-2008  mjf Sync with HEAD.
 1.19.38.1 24-Mar-2008  keiichi sync with head.
 1.19.22.1 23-Mar-2008  matt sync with HEAD
 1.20.36.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.21.54.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.21.54.1 10-Jun-2019  christos Sync with HEAD
 1.21.52.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.22.4.1 25-Feb-2020  martin Pull up following revision(s) (requested by rin in ticket #728):

sys/arch/powerpc/ibm4xx/dev/com_opb.c: revision 1.23

Belatedly catch up with MI com(4) change in com.c rev. 1.351:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ic/com.c#rev1.351

XXX
pullup to netbsd-9
 1.24.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 17-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.2 11-Dec-2005  christos branches: 1.2.110;
merge ktrace-lwp.
 1.1 24-Dec-2004  shige branches: 1.1.4; 1.1.14;
Add functions:
- com_opb_cnattach
- com_opb_device_register
 1.1.14.2 15-Sep-2005  riz Pull up following revision(s) (requested by shige in ticket #5820):
distrib/evbppc/md-kernel/Makefile 1.3 via patch
etc/etc.evbppc/Makefile.inc 1.3 via patch
sys/arch/evbppc/conf/files.obs405 1.5-1.8 via patch
sys/arch/evbppc/conf/OPENBLOCKS266 1.22,1.25 via patch
sys/arch/evbppc/include/obs266.h 1.1 (new)
sys/arch/evbppc/include/obs405.h 1.1-1.5 (new)
sys/arch/evbppc/include/rbus_machdep.h 1.1 (new)
sys/arch/evbppc/obs405/consinit.c 1.2-1.4
sys/arch/evbppc/obs405/dev/x1226.c deleted
sys/arch/evbppc/obs405/dev/x1226reg.h deleted
sys/arch/evbppc/obs405/machdep.c deleted
sys/arch/evbppc/obs405/obs266_autoconf.c 1.1 (new)
sys/arch/evbppc/obs405/obs266_machdep.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_autoconf.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_machdep.c 1.1 (new)
sys/arch/evbppc/obs405/rbus_machdep.c 1.1 (new)
sys/arch/powerpc/conf/files.ibm4xx 1.6-1.7
sys/arch/powerpc/ibm4xx/board_prop.c 1.1 (new)
sys/arch/powerpc/ibm4xx/dev/com_opb.c 1.12
sys/arch/powerpc/ibm4xx/dev/comopbvar.h 1.1 (new)
sys/arch/powerpc/ibm4xx/ibm40x_machdep.c 1.3-1.4
sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 1.1-1.2 (new)
sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c 1.1-1.3 (new)
sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 1.2-1.3
sys/arch/powerpc/ibm4xx/openbios/openbios.c 1.1 (new)
sys/arch/powerpc/include/ibm4xx/cpu.h 1.7-1.10
sys/arch/powerpc/include/ibm4xx/openbios.h 1.1 (new)

Update OpenBlockS266 support to more modern, stable sources.
 1.1.14.1 24-Dec-2004  riz file comopbvar.h was added on branch netbsd-2 on 2005-09-15 14:28:44 +0000
 1.1.4.2 17-Jan-2005  skrll Sync with HEAD.
 1.1.4.1 24-Dec-2004  skrll file comopbvar.h was added on branch ktrace-lwp on 2005-01-17 19:30:09 +0000
 1.2.110.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.7 24-Apr-2021  thorpej branches: 1.7.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.6 27-Feb-2021  rin branches: 1.6.2;
Switch to intr_establish_xname().
 1.5 23-Apr-2016  skrll branches: 1.5.30;
Merge nick-nhusb

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

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.6.1 21-Nov-2013  yamt file dwctwo_plb.c was added on branch yamt-pagecache on 2014-05-22 11:40:04 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 21-Nov-2013  rmind file dwctwo_plb.c was added on branch rmind-smpnet on 2014-05-18 17:45:22 +0000
 1.3.2.2 22-Sep-2015  skrll Sync with HEAD
 1.3.2.1 03-Dec-2014  skrll The grand renaming of structure members.

No functional change.
 1.5.30.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6.2.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.7.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.16 27-Feb-2021  rin Switch to intr_establish_xname().
 1.15 25-Feb-2014  martin branches: 1.15.42;
Remove unused variable
 1.14 18-Jun-2011  matt branches: 1.14.2; 1.14.12; 1.14.16;
Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.13 17-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.12 18-Mar-2010  kiyohara branches: 1.12.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.11 05-May-2006  thorpej branches: 1.11.66; 1.11.86; 1.11.88;
Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.10 24-Dec-2005  perry branches: 1.10.4; 1.10.6; 1.10.8; 1.10.10; 1.10.12;
bare asm -> __asm
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 15-Jul-2003  lukem branches: 1.8.16;
__KERNEL_RCSID()
 1.7 11-Mar-2003  hannken branches: 1.7.2;
Add support for the IBM 403GCX cpu. Enabled with "options PPC_IBM403".

- different set of device control registers.
- non-standard access to the time base.
- 16 byte cache lines.

Approved by: Eduardo Horvath <eeh@netbsd.org>
 1.6 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.5 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.2 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.1 23-Aug-2002  scw branches: 1.1.2; 1.1.4; 1.1.6;
Add "ecc at plb" device.
Add an "irq" locator to the plb device.
This gets rid of the original hack where ecc support was wedged into
the cpu driver.
 1.1.6.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 23-Aug-2002  jdolecek file ecc_plb.c was added on branch kqueue on 2002-09-06 08:39:06 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 23-Aug-2002  gehenna file ecc_plb.c was added on branch gehenna-devsw on 2002-08-31 13:45:44 +0000
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 23-Aug-2002  nathanw file ecc_plb.c was added on branch nathanw_sa on 2002-08-27 23:45:07 +0000
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.10.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.10.10.1 11-May-2006  elad sync with head
 1.10.8.1 24-May-2006  yamt sync with head.
 1.10.6.1 01-Jun-2006  kardel Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.88.1 30-May-2010  rmind sync with head
 1.11.86.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.11.66.1 11-Aug-2010  yamt sync with head.
 1.12.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.14.16.1 18-May-2014  rmind sync with head
 1.14.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.42.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 02-Nov-2024  andvar s/aboce/above/ and s/Abobe/Above/ in comments.
 1.5 30-Mar-2021  rin branches: 1.5.22;
Support OPB running @ 33MHz for 405GP based boards.
No need to modify EMAC_MR1 register this case
(STACR_OPBC fields are reserved for 405GP).
 1.4 06-Jul-2020  rin branches: 1.4.2; 1.4.4;
Style and cosmetic changes. No binary changes intended.
 1.3 18-Mar-2010  kiyohara Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.2 16-Oct-2006  kiyohara branches: 1.2.56; 1.2.76; 1.2.78;
do bus_space_map() to get bus space handle in emacs_attach()
 1.1 13-Aug-2002  simonb branches: 1.1.2; 1.1.4; 1.1.6; 1.1.28; 1.1.58; 1.1.60;
Split out device register definitions to their own files as the are
common across many of the 4xx parts. Leaves ibm405gp.h with device
address information specific to the 405GP CPU. Now allows opb.c to
support multiple 4xx CPU types.
 1.1.60.1 22-Oct-2006  yamt sync with head
 1.1.58.1 18-Nov-2006  ad Sync with head.
 1.1.28.1 30-Dec-2006  yamt sync with head.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 13-Aug-2002  jdolecek file emacreg.h was added on branch kqueue on 2002-09-06 08:39:07 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 13-Aug-2002  gehenna file emacreg.h was added on branch gehenna-devsw on 2002-08-31 13:45:44 +0000
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 13-Aug-2002  nathanw file emacreg.h was added on branch nathanw_sa on 2002-08-27 23:45:08 +0000
 1.2.78.1 30-May-2010  rmind sync with head
 1.2.76.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.2.56.1 11-Aug-2010  yamt sync with head.
 1.4.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.4.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.5.22.1 02-Aug-2025  perseant Sync with HEAD
 1.5 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.4 24-Apr-2021  thorpej branches: 1.4.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.3 17-Jun-2011  matt branches: 1.3.68;
struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.2 06-Nov-2010  uebayasi branches: 1.2.2; 1.2.8; 1.2.10;
Add IBM405GPr "External Bus" driver.
 1.1 11-Aug-2010  uebayasi branches: 1.1.2;
file exb.c was initially added on branch uebayasi-xip.
 1.1.2.2 19-Aug-2010  uebayasi Define FlashROM addresses in board specific code.
 1.1.2.1 11-Aug-2010  uebayasi Implement 405GPr's "External Bus" as exb(4).
 1.2.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.2.8.2 05-Mar-2011  rmind sync with head
 1.2.8.1 06-Nov-2010  rmind file exb.c was added on branch rmind-uvmplock on 2011-03-05 20:51:36 +0000
 1.2.2.2 10-Jan-2011  jym Sync with HEAD
 1.2.2.1 06-Nov-2010  jym file exb.c was added on branch jym-xensuspend on 2011-01-10 00:37:36 +0000
 1.3.68.2 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.3.68.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.4.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 06-Nov-2010  uebayasi branches: 1.2.2; 1.2.8;
Add IBM405GPr "External Bus" driver.
 1.1 11-Aug-2010  uebayasi branches: 1.1.2;
file exbvar.h was initially added on branch uebayasi-xip.
 1.1.2.1 11-Aug-2010  uebayasi Implement 405GPr's "External Bus" as exb(4).
 1.2.8.2 05-Mar-2011  rmind sync with head
 1.2.8.1 06-Nov-2010  rmind file exbvar.h was added on branch rmind-uvmplock on 2011-03-05 20:51:36 +0000
 1.2.2.2 10-Jan-2011  jym Sync with HEAD
 1.2.2.1 06-Nov-2010  jym file exbvar.h was added on branch jym-xensuspend on 2011-01-10 00:37:36 +0000
 1.1 11-Aug-2010  uebayasi branches: 1.1.2;
file flash_exb.c was initially added on branch uebayasi-xip.
 1.1.2.1 11-Aug-2010  uebayasi Implement flash(4) glue at exb(4).
 1.13 15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.12 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.11 24-Apr-2021  thorpej branches: 1.11.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.10 22-Dec-2019  thorpej branches: 1.10.10;
Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.9 18-Jun-2011  matt branches: 1.9.54;
Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.8 17-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.7 12-Jun-2011  kiyohara Initialize i2cbus_attach_args before call config_found(). It has other member.
 1.6 12-Jul-2008  tsutsui branches: 1.6.26;
- if SDA is set to low during DIR(INPUT) in gpiic_set_bits(),
store the SDA status into softc and enable it once after
DIR() is changed to OUTPUT in gpiic_set_dir()
- remove "Read in output mode" warning in gpiic_read_bits()
since it's a vaild operation (to read SCL during SDA output is low)

Tested by kiyohara@ on OPENBLOCKS266.
 1.5 06-Dec-2007  ad branches: 1.5.12; 1.5.16; 1.5.18; 1.5.20; 1.5.22;
lockmgr -> mutex
 1.4 26-Jun-2006  drochner branches: 1.4.18; 1.4.32; 1.4.34; 1.4.40; 1.4.44;
use the "i2cbus" interface attribute rather than putting a string name
into the i2cbus attach args
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.8; 1.3.16;
merge ktrace-lwp.
 1.2 06-Oct-2003  scw branches: 1.2.4; 1.2.18;
Gah. Pick up the MI i2c headers from the right place.
Pointed out by Shigeyuki Fukushima on port-powerpc@.
 1.1 06-Oct-2003  scw MD i2c glue for the 405GP's onboard IIC controller.
Bit-bang only for now.
 1.2.18.2 07-Dec-2007  yamt sync with head
 1.2.18.1 30-Dec-2006  yamt sync with head.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 06-Oct-2003  skrll file gpiic_opb.c was added on branch ktrace-lwp on 2004-08-03 10:39:28 +0000
 1.3.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.3.8.1 11-Aug-2006  yamt sync with head
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.44.1 08-Dec-2007  ad Sync with head.
 1.4.40.1 08-Dec-2007  mjf Sync with HEAD.
 1.4.34.1 09-Jan-2008  matt sync with HEAD
 1.4.32.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.4.18.1 09-Dec-2007  reinoud Pullup to HEAD
 1.5.22.1 19-Oct-2008  haad Sync with HEAD.
 1.5.20.1 18-Jul-2008  simonb Sync with head.
 1.5.18.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.16.1 04-May-2009  yamt sync with head.
 1.5.12.1 28-Sep-2008  mjf Sync with HEAD.
 1.6.26.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.9.54.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.10.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.11.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 24-Dec-2022  andvar s/Reqest/Request/ and adding apostrophe for don't and didn't in comments.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 06-Oct-2003  scw branches: 1.1.4;
MD i2c glue for the 405GP's onboard IIC controller.
Bit-bang only for now.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 06-Oct-2003  skrll file gpiicreg.h was added on branch ktrace-lwp on 2004-08-03 10:39:28 +0000
 1.10 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.9 24-Apr-2021  thorpej branches: 1.9.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.8 17-Jun-2011  matt branches: 1.8.68;
struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.7 18-Mar-2010  kiyohara branches: 1.7.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.6 06-Feb-2007  simonb branches: 1.6.48; 1.6.68; 1.6.70;
Fix a tyop in a comment.
 1.5 13-Mar-2006  shige branches: 1.5.10;
IBM4xx on-chip GPIO controller apllying MI GPIO framework.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10;
merge ktrace-lwp.
 1.3 16-Oct-2005  he Complete the renaming gpio -> ppcgpio for evbppc, to make room for
the MI gpio. Internal static functions in gpio_opb.c are not
renamed here, but the softc type is renamed together with the attach
declaration data.
 1.2 26-Aug-2005  drochner s/locdesc_t/int/g
 1.1 23-Jan-2005  shige branches: 1.1.2; 1.1.10; 1.1.12;
Add driver for On-chip General Purpose I/O.
 1.1.12.2 26-Feb-2007  yamt sync with head.
 1.1.12.1 21-Jun-2006  yamt sync with head.
 1.1.10.2 29-Apr-2005  kent sync with -current
 1.1.10.1 23-Jan-2005  kent file gpio_opb.c was added on branch kent-audio2 on 2005-04-29 11:28:20 +0000
 1.1.2.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.2 24-Jan-2005  skrll Sync with HEAD.
 1.1.2.1 23-Jan-2005  skrll file gpio_opb.c was added on branch ktrace-lwp on 2005-01-24 08:34:26 +0000
 1.4.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.4.8.1 01-Apr-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.10.1 09-Feb-2007  ad Sync with HEAD.
 1.6.70.1 30-May-2010  rmind sync with head
 1.6.68.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.6.48.1 11-Aug-2010  yamt sync with head.
 1.7.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8.68.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.9.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 13-Mar-2006  shige IBM4xx on-chip GPIO controller apllying MI GPIO framework.
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8; 1.3.10;
merge ktrace-lwp.
 1.2 23-Jan-2005  shige branches: 1.2.8;
Add driver for On-chip General Purpose I/O.
 1.1 13-Aug-2002  simonb branches: 1.1.2; 1.1.4; 1.1.6; 1.1.12; 1.1.20;
Split out device register definitions to their own files as the are
common across many of the 4xx parts. Leaves ibm405gp.h with device
address information specific to the 405GP CPU. Now allows opb.c to
support multiple 4xx CPU types.
 1.1.20.1 29-Apr-2005  kent sync with -current
 1.1.12.1 24-Jan-2005  skrll Sync with HEAD.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 13-Aug-2002  jdolecek file gpioreg.h was added on branch kqueue on 2002-09-06 08:39:07 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 13-Aug-2002  gehenna file gpioreg.h was added on branch gehenna-devsw on 2002-08-31 13:45:44 +0000
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 13-Aug-2002  nathanw file gpioreg.h was added on branch nathanw_sa on 2002-08-27 23:45:09 +0000
 1.2.8.1 21-Jun-2006  yamt sync with head.
 1.3.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.3.8.1 01-Apr-2006  yamt sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3 13-Mar-2006  shige IBM4xx on-chip GPIO controller applying MI GPIO framework.
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.10;
merge ktrace-lwp.
 1.1 23-Jan-2005  shige branches: 1.1.2; 1.1.10; 1.1.12;
Add driver for On-chip General Purpose I/O.
 1.1.12.1 21-Jun-2006  yamt sync with head.
 1.1.10.2 29-Apr-2005  kent sync with -current
 1.1.10.1 23-Jan-2005  kent file gpiovar.h was added on branch kent-audio2 on 2005-04-29 11:28:20 +0000
 1.1.2.2 24-Jan-2005  skrll Sync with HEAD.
 1.1.2.1 23-Jan-2005  skrll file gpiovar.h was added on branch ktrace-lwp on 2005-01-24 08:34:27 +0000
 1.2.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.2.8.1 01-Apr-2006  yamt sync with head.
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.8 19-Oct-2016  nonaka Added MSI/MSI-X and interrupt_distribute(9) support for powerpc.
 1.7 17-Aug-2011  matt branches: 1.7.12; 1.7.30; 1.7.34;
First pass of the new PCI MSI/MSI ABI definitions. (return EOPNOTSUPP for
now).
 1.6 22-Jun-2011  matt Add support pci_intr_setattr.
Export non-inline version of pci api for modules (_MODULE is defined).
Fix definition of pc_conf_hook and pc_conf_interrupt.
Switch to using inlines instead of macros.
Switch ibm4xx to use <powerpc/pci_machdep.h>
 1.5 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.4 11-Dec-2005  christos branches: 1.4.110;
merge ktrace-lwp.
 1.3 25-Jul-2003  scw Switch ibm4xx over to using the more flexible powerpc bus_space/bus_dma code.
 1.2 15-Jul-2003  lukem __KERNEL_RCSID()
 1.1 09-Dec-2002  scw branches: 1.1.2; 1.1.8;
Changes/additions to support evbppc.
 1.1.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.8.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 09-Dec-2002  thorpej file ibm405gp.c was added on branch nathanw_sa on 2002-12-11 06:11:39 +0000
 1.4.110.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.7.34.1 04-Nov-2016  pgoyette Sync with HEAD
 1.7.30.1 05-Dec-2016  skrll Sync with HEAD
 1.7.12.1 03-Dec-2017  jdolecek update from HEAD
 1.60 04-Oct-2025  thorpej Add a shared function to query the common properties used for configuring
an Ethernet address.
 1.59 10-Feb-2024  andvar s/alloted/allotted/ in comments.
 1.58 02-Feb-2024  andvar fix typos, mainly s/unsupport/unsupported/ in log messages.
 1.57 18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.56 30-Mar-2021  rin Support OPB running @ 33MHz for 405GP based boards.
No need to modify EMAC_MR1 register this case
(STACR_OPBC fields are reserved for 405GP).
 1.55 27-Feb-2021  rin branches: 1.55.2;
Switch to intr_establish_xname().
 1.54 24-Jan-2021  rin Add rnd(9) support.
 1.53 06-Jul-2020  rin branches: 1.53.2;
Style and cosmetic changes. No binary changes intended.
 1.52 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.51 28-May-2019  msaitoh branches: 1.51.4;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.50 23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.49 22-Jan-2019  msaitoh Change MII PHY read/write API from:

int (*mii_readreg_t)(device_t, int, int);
void (*mii_writereg_t)(device_t, int, int, int);
to:

int (*mii_readreg_t)(device_t, int, int, uint16_t *);
int (*mii_writereg_t)(device_t, int, int, uint16_t);

Now we can test if a read/write operation failed or not by the return value.

In 802.3 spec says that the PHY shall not respond to read/write transaction
to the unimplemented register(22.2.4.3). Detecting timeout can be used to
check whether a register is implemented or not (if the register conforms to
the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.

Note that I noticed that the following code do infinite loop in the
read/wirte function. If it accesses unimplemented PHY register, it will hang.
It should be fixed:

arm/at91/at91emac.c
arm/ep93xx/epe.c
arm/omap/omapl1x_emac.c
mips/ralink/ralink_eth.c
arch/powerpc/booke/dev/pq3etsec.c(read)
dev/cadence/if_cemac.c <- hkenken
dev/ic/lan9118.c


Tested with the following device:

axe+ukphy
axe+rgephy
axen+rgephy (tested by Andrius V)
wm+atphy
wm+ukphy
wm+igphy
wm+ihphy
wm+makphy
sk+makphy
sk+brgphy
sk+gentbi
msk+makphy
sip+icsphy
sip+ukphy
re+rgephy
bge+brgphy
bnx+brgphy
gsip+gphyter
rtk+rlphy
fxp+inphy (tested by Andrius V)
tlp+acphy
ex+exphy
epic+qsphy
vge+ciphy (tested by Andrius V)
vr+ukphy (tested by Andrius V)
vte+ukphy (tested by Andrius V)

Not tested (MAC):
arm:at91emac
arm:cemac
arm:epe
arm:geminigmac
arm:enet
arm:cpsw
arm:emac(omac)
arm:emac(sunxi)
arm:npe
evbppc:temac
macppc:bm
macppc:gm
mips:aumac
mips:ae
mips:cnmac
mips:reth
mips:sbmac
playstation2:smap
powerpc:tsec
powerpc:emac(ibm4xx)
sgimips:mec
sparc:be
sf
ne(ax88190, dl10019)
awge
ep
gem
hme
smsh
mtd
sm
age
alc
ale
bce
cas
et
jme
lii
nfe
pcn
ste
stge
tl
xi
aue
mue
smsc
udav
url

Not tested (PHY):
amhphy
bmtphy
dmphy
etphy
glxtphy
ikphy
iophy
lxtphy
nsphyter
pnaphy
rdcphy
sqphy
tlphy
tqphy
urlphy
 1.48 26-Jun-2018  msaitoh branches: 1.48.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.47 15-Dec-2016  ozaki-r branches: 1.47.14;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

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

Proposed on tech-kern and tech-net
 1.46 08-Dec-2016  ozaki-r Apply deferred if_start framework

if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.
 1.45 10-Jun-2016  ozaki-r branches: 1.45.2;
Introduce m_set_rcvif and m_reset_rcvif

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

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

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

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

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

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

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.43 16-Oct-2014  snj branches: 1.43.2;
fix typo in comment
 1.42 26-Jun-2014  msaitoh Pass MIIF_DOPAUSE mask to mii_attach() in if_emac.c. emac(4) change a
register from IFM_FLOW flag, so this change is required to control the
setting via ifconfig. PR#48950. OK'd by matt@.
 1.41 22-Jul-2012  matt branches: 1.41.2; 1.41.12;
Fix mii_statchg to take a 'struct ifnet *' instead of device_t. This fixes
problem with a common MDIO bus used for multiple interfaces.
Some drivers converted to CFATTACL_DECL_NEW.
 1.40 24-Jun-2012  kiyohara Flush current empty descriptor in emac_rxeob_intr().
 1.39 18-Jun-2011  matt branches: 1.39.2;
Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.38 17-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.37 05-Apr-2010  joerg branches: 1.37.6;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.36 18-Mar-2010  kiyohara Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.35 22-Jan-2010  martin branches: 1.35.2; 1.35.4;
Unify the name of the device property to hold a MAC address - there was
no clear majority for either "mac-addr" vs. "mac-address", but a quick
gallup poll among developers selected the latter.
 1.34 19-Jan-2010  pooka Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

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

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.33 08-Jul-2008  kiyohara Initialize the member sc_callout before call callout_reset().
 1.32 22-Jan-2008  he branches: 1.32.6; 1.32.10; 1.32.12; 1.32.14; 1.32.16;
Delete a now-unused local variable.
 1.31 19-Jan-2008  dyoung Make many ethernet drivers share the common code for MII media
handling, ether_mediastatus() and ether_mediachange(). Check for
a non-ENXIO error return from mii_mediachg(). (ENXIO indicates
that a PHY is suspended.)

This patch shrinks the source code size by 979 lines. There was
a 5100-byte savings on the NetBSD/i386 kernel configuration, ALL.

I have made a few miscellaneous changes, too:

gem(4): use LIST_EMPTY(), LIST_FOREACH().
mtd(4): handle media ioctls, for a change!
axe(4): do not track link status in sc->axe_link any longer
nfe(4), aue(4), axe(4), udav(4), url(4): do not reset all PHYs
on a change of media

Except for the change to mtd(4), no functional changes are intended.

XXX This patch affects more architectures than I can feasibly
XXX compile and run. I have compiled macppc, sparc64, i386. I
XXX have run the patches on i386 boxen with bnx(4) and sip(4).
XXX Compiling and running on evbmips (MERAKI, ADM5120) is in
XXX progress.
 1.30 17-Oct-2007  garbled branches: 1.30.2; 1.30.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.29 26-Aug-2007  dyoung branches: 1.29.2;
Constify.
 1.28 04-Mar-2007  christos branches: 1.28.2; 1.28.10; 1.28.14; 1.28.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27 16-Oct-2006  kiyohara branches: 1.27.4;
do bus_space_map() to get bus space handle in emacs_attach()
 1.26 05-May-2006  thorpej branches: 1.26.8; 1.26.10;
Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.25 20-Feb-2006  thorpej branches: 1.25.2; 1.25.4; 1.25.6;
Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
 1.24 18-Feb-2006  thorpej - Don't expose dev_propdb directly -- provide devprop_*() wrappers instead.
- Rework the ARMADILLO / epe device properties interaction so that it actually
associates the MAC address property with the epe device instance.
 1.23 11-Dec-2005  christos branches: 1.23.2; 1.23.4; 1.23.6;
merge ktrace-lwp.
 1.22 30-Jan-2005  thorpej branches: 1.22.6;
Eliminate use of M_HASFCS.
 1.21 21-Jan-2005  simonb branches: 1.21.2;
Set up last segment descriptor to send an interrupt after that
descriptor is transmitted, and bypass existing Tx descriptor reaping
method (for now...).

Fixes problems with bad NFS write performance.
 1.20 21-Jan-2005  simonb In emac_txeob_intr():
- return 1 if we processed any completed tx packets.
- try to get more packets going by calling emac_start().
 1.19 30-Oct-2004  thorpej branches: 1.19.4;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.18 24-Mar-2004  simonb branches: 1.18.4;
Add promiscuous and multicast support.

From KIYOHARA Takashi in PR port-powerpc/23892.
 1.17 27-Oct-2003  simonb Keep bogus gcc -Wuninitialised warnings happy.
 1.16 15-Oct-2003  simonb Correct a test for setting IFF_OACTIVE on the interface.
 1.15 15-Jul-2003  lukem __KERNEL_RCSID()
 1.14 04-Jul-2003  thorpej Consult the "mac-addr" property associated with the emac device in
the dev_propdb rather than referencing board_data.
 1.13 02-Oct-2002  thorpej branches: 1.13.6;
Add trailing ; to CFATTACH_DECL.
 1.12 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.11 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.9 13-Aug-2002  simonb Use the base space tag from the attach args, don't recreate it all the
time.
Clean up some include files.
 1.8 13-Aug-2002  simonb Use "ibm4xx" instead of "galaxy"; galaxy was an early code name for the
405GP.
 1.7 13-Aug-2002  simonb Fix include file location botch in previous.
 1.6 13-Aug-2002  simonb Split out device register definitions to their own files as the are
common across many of the 4xx parts. Leaves ibm405gp.h with device
address information specific to the 405GP CPU. Now allows opb.c to
support multiple 4xx CPU types.
 1.5 12-Aug-2002  simonb Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.4 09-Aug-2002  simonb Fix for when EMAC_EVENT_COUNTERS isn't defined. Problem reported by
Allen Briggs.
 1.3 09-Aug-2002  simonb Add a driver the for IBM 405gp (and possibly other IBM 4xx cpus) ethernet
MAC (emac). Much thanks to Jason Thorpe for debugging help writing this
driver. Tested on the walnut, and an earlier version of this driver works
on the OpenBlockSS.
 1.2 15-Mar-2002  eeh branches: 1.2.4;
Use new non-PCI mainbus.
 1.1 24-Jun-2001  simonb branches: 1.1.2; 1.1.8;
Move on-chip 405GP devices to powerpc/ibm4xx/dev.
 1.1.8.5 18-Oct-2002  nathanw Catch up to -current.
 1.1.8.4 27-Aug-2002  nathanw Catch up to -current.
 1.1.8.3 13-Aug-2002  nathanw Catch up to -current.
 1.1.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.8.1 24-Jun-2001  nathanw file if_emac.c was added on branch nathanw_sa on 2002-04-01 07:42:03 +0000
 1.1.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.1.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.1 31-Aug-2002  gehenna catch up with -current.
 1.13.6.6 04-Feb-2005  skrll Sync with HEAD.
 1.13.6.5 24-Jan-2005  skrll Sync with HEAD.
 1.13.6.4 02-Nov-2004  skrll Sync with HEAD.
 1.13.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.13.6.1 03-Aug-2004  skrll Sync with HEAD
 1.18.4.1 24-Jan-2005  he Pull up revision 1.19 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.21.2.1 12-Feb-2005  yamt sync with head.
 1.22.6.5 04-Feb-2008  yamt sync with head.
 1.22.6.4 21-Jan-2008  yamt sync with head
 1.22.6.3 03-Sep-2007  yamt sync with head.
 1.22.6.2 30-Dec-2006  yamt sync with head.
 1.22.6.1 21-Jun-2006  yamt sync with head.
 1.23.6.2 01-Jun-2006  kardel Sync with head.
 1.23.6.1 22-Apr-2006  simonb Sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.23.2.2 01-Mar-2006  yamt sync with head.
 1.23.2.1 18-Feb-2006  yamt sync with head.
 1.25.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.25.4.1 11-May-2006  elad sync with head
 1.25.2.1 24-May-2006  yamt sync with head.
 1.26.10.1 22-Oct-2006  yamt sync with head
 1.26.8.1 18-Nov-2006  ad Sync with head.
 1.27.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.28.18.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.28.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.28.10.1 03-Oct-2007  garbled Sync with HEAD
 1.28.2.1 09-Oct-2007  ad Sync with head.
 1.29.2.2 23-Mar-2008  matt sync with HEAD
 1.29.2.1 06-Nov-2007  matt sync with HEAD
 1.30.8.2 23-Jan-2008  bouyer Sync with HEAD.
 1.30.8.1 20-Jan-2008  bouyer Sync with HEAD
 1.30.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.32.16.1 19-Oct-2008  haad Sync with HEAD.
 1.32.14.1 18-Jul-2008  simonb Sync with head.
 1.32.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.10.3 11-Aug-2010  yamt sync with head.
 1.32.10.2 11-Mar-2010  yamt sync with head
 1.32.10.1 04-May-2009  yamt sync with head.
 1.32.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.35.4.1 30-May-2010  rmind sync with head
 1.35.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.37.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.39.2.1 30-Oct-2012  yamt sync with head
 1.41.12.1 10-Aug-2014  tls Rebase.
 1.41.2.2 03-Dec-2017  jdolecek update from HEAD
 1.41.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.2.3 05-Feb-2017  skrll Sync with HEAD
 1.43.2.2 09-Jul-2016  skrll Sync with HEAD
 1.43.2.1 19-Mar-2016  skrll Sync with HEAD
 1.45.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.47.14.2 26-Jan-2019  pgoyette Sync with HEAD
 1.47.14.1 28-Jul-2018  pgoyette Sync with HEAD
 1.48.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.48.2.1 10-Jun-2019  christos Sync with HEAD
 1.51.4.1 29-Feb-2020  ad Sync with head.
 1.53.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.55.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1 24-Jun-2001  simonb branches: 1.1.8;
Move on-chip 405GP devices to powerpc/ibm4xx/dev.
 1.1.8.2 24-Jun-2001  simonb Move on-chip 405GP devices to powerpc/ibm4xx/dev.
 1.1.8.1 24-Jun-2001  simonb file if_emacreg.h was added on branch nathanw_sa on 2001-06-24 02:13:38 +0000
 1.1 18-Mar-2010  kiyohara branches: 1.1.2; 1.1.4; 1.1.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 18-Mar-2010  yamt file if_emacvar.h was added on branch yamt-nfs-mp on 2010-08-11 22:52:33 +0000
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 18-Mar-2010  rmind file if_emacvar.h was added on branch rmind-uvmplock on 2010-05-30 05:17:02 +0000
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 18-Mar-2010  uebayasi file if_emacvar.h was added on branch uebayasi-xip on 2010-04-30 14:39:42 +0000
 1.2 06-Oct-2003  scw MD i2c glue for the 405GP's onboard IIC controller.
Bit-bang only for now.
 1.1 23-Sep-2003  shige Add on-chip IIC driver.
Add some definitions for IIC driver.
 1.4 06-Oct-2003  scw MD i2c glue for the 405GP's onboard IIC controller.
Bit-bang only for now.
 1.3 23-Sep-2003  shige Add on-chip IIC driver.
Add some definitions for IIC driver.
 1.2 01-May-2003  scw branches: 1.2.2;
Add bit definitions for some registers.
 1.1 13-Aug-2002  simonb branches: 1.1.2; 1.1.4; 1.1.6;
Split out device register definitions to their own files as the are
common across many of the 4xx parts. Leaves ibm405gp.h with device
address information specific to the 405GP CPU. Now allows opb.c to
support multiple 4xx CPU types.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 13-Aug-2002  jdolecek file iicreg.h was added on branch kqueue on 2002-09-06 08:39:08 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 13-Aug-2002  gehenna file iicreg.h was added on branch gehenna-devsw on 2002-08-31 13:45:44 +0000
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 13-Aug-2002  nathanw file iicreg.h was added on branch nathanw_sa on 2002-08-27 23:45:11 +0000
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.2 06-Oct-2003  scw MD i2c glue for the 405GP's onboard IIC controller.
Bit-bang only for now.
 1.1 23-Sep-2003  shige Add on-chip IIC driver.
Add some definitions for IIC driver.
 1.5 19-Jun-2023  msaitoh Fix typo. unknwon -> unknown
 1.4 27-Feb-2021  rin Switch to intr_establish_xname().
 1.3 18-Jun-2011  matt branches: 1.3.66;
Use __builtin_clz instead of our own cntlzw
 1.2 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.1 18-Mar-2010  kiyohara branches: 1.1.2; 1.1.4; 1.1.6; 1.1.12;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.1.12.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 18-Mar-2010  yamt file mal.c was added on branch yamt-nfs-mp on 2010-08-11 22:52:33 +0000
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 18-Mar-2010  rmind file mal.c was added on branch rmind-uvmplock on 2010-05-30 05:17:02 +0000
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 18-Mar-2010  uebayasi file mal.c was added on branch uebayasi-xip on 2010-04-30 14:39:42 +0000
 1.3.66.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1 18-Mar-2010  kiyohara branches: 1.1.2; 1.1.4; 1.1.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 18-Mar-2010  yamt file malvar.h was added on branch yamt-nfs-mp on 2010-08-11 22:52:33 +0000
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 18-Mar-2010  rmind file malvar.h was added on branch rmind-uvmplock on 2010-05-30 05:17:02 +0000
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 18-Mar-2010  uebayasi file malvar.h was added on branch uebayasi-xip on 2010-04-30 14:39:42 +0000
 1.29 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.28 24-Apr-2021  thorpej branches: 1.28.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.27 06-Jul-2020  rin branches: 1.27.4;
Style and cosmetic changes. No binary changes intended.
 1.26 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.25 18-Mar-2010  kiyohara branches: 1.25.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.24 25-Feb-2010  matt branches: 1.24.2;
Adapt to spr.h breakup.
 1.23 13-Mar-2006  shige branches: 1.23.68; 1.23.88; 1.23.92;
IBM4xx on-chip GPIO controller apllying MI GPIO framework.
 1.22 21-Feb-2006  thorpej branches: 1.22.2; 1.22.4;
Add an "instance" member to opb_attach_args and use it when fetching
the mac-address property from board_info. port-powerpc/32862
 1.21 11-Dec-2005  christos branches: 1.21.2; 1.21.4; 1.21.6;
merge ktrace-lwp.
 1.20 26-Aug-2005  drochner s/locdesc_t/int/g
 1.19 03-Jul-2005  he branches: 1.19.2;
We need to name parameters in function declaration...
 1.18 28-Jun-2005  drochner 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.17 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.16 06-Oct-2003  scw MD i2c glue for the 405GP's onboard IIC controller.
Bit-bang only for now.
 1.15 23-Sep-2003  shige Add devices info for IBM405GPR.
 1.14 25-Jul-2003  scw Switch ibm4xx over to using the more flexible powerpc bus_space/bus_dma code.
 1.13 15-Jul-2003  lukem __KERNEL_RCSID()
 1.12 01-Jan-2003  thorpej branches: 1.12.2;
Use aprint_normal() for cfprint routines.
 1.11 10-Oct-2002  jdolecek fix typo - driver name is 'opb', not 'obp'
 1.10 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.9 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 27-Sep-2002  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.6 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.5 13-Aug-2002  simonb branches: 1.5.2; 1.5.4;
Use the base space tag from the attach args, don't recreate it all the
time.
Clean up some include files.
 1.4 13-Aug-2002  simonb Use "ibm4xx" instead of "galaxy"; galaxy was an early code name for the
405GP.
 1.3 13-Aug-2002  simonb Split out device register definitions to their own files as the are
common across many of the 4xx parts. Leaves ibm405gp.h with device
address information specific to the 405GP CPU. Now allows opb.c to
support multiple 4xx CPU types.
 1.2 12-Aug-2002  simonb branches: 1.2.2;
Add a pvr field to 'struct opb_dev', to allow the opb_devs array to
contain info about on-chip devices for more than one CPU type.
 1.1 12-Aug-2002  simonb Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.2.2.5 03-Jan-2003  thorpej Sync with HEAD.
 1.2.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.3 27-Aug-2002  nathanw Catch up to -current.
 1.2.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.2.2.1 12-Aug-2002  nathanw file opb.c was added on branch nathanw_sa on 2002-08-13 02:18:43 +0000
 1.5.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.5.4.1 13-Aug-2002  jdolecek file opb.c was added on branch kqueue on 2002-09-06 08:39:08 +0000
 1.5.2.2 31-Aug-2002  gehenna catch up with -current.
 1.5.2.1 13-Aug-2002  gehenna file opb.c was added on branch gehenna-devsw on 2002-08-31 13:45:44 +0000
 1.12.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.2.1 21-Jun-2006  yamt sync with head.
 1.21.6.1 22-Apr-2006  simonb Sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.21.2.1 01-Mar-2006  yamt sync with head.
 1.22.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.22.2.1 01-Apr-2006  yamt sync with head.
 1.23.92.1 07-Jan-2011  matt Deal with new powerpc world.
 1.23.88.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.23.68.2 11-Aug-2010  yamt sync with head.
 1.23.68.1 11-Mar-2010  yamt sync with head
 1.24.2.1 30-May-2010  rmind sync with head
 1.25.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.27.4.2 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.27.4.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.28.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 18-Mar-2010  kiyohara Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.1 13-Aug-2002  simonb branches: 1.1.2; 1.1.4; 1.1.6; 1.1.118; 1.1.138; 1.1.140;
Split out device register definitions to their own files as the are
common across many of the 4xx parts. Leaves ibm405gp.h with device
address information specific to the 405GP CPU. Now allows opb.c to
support multiple 4xx CPU types.
 1.1.140.1 30-May-2010  rmind sync with head
 1.1.138.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.118.1 11-Aug-2010  yamt sync with head.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 13-Aug-2002  jdolecek file opbreg.h was added on branch kqueue on 2002-09-06 08:39:09 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 13-Aug-2002  gehenna file opbreg.h was added on branch gehenna-devsw on 2002-08-31 13:45:45 +0000
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 13-Aug-2002  nathanw file opbreg.h was added on branch nathanw_sa on 2002-08-27 23:45:12 +0000
 1.6 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.5 18-Mar-2010  kiyohara branches: 1.5.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.4 21-Feb-2006  thorpej branches: 1.4.72; 1.4.92; 1.4.94;
Add an "instance" member to opb_attach_args and use it when fetching
the mac-address property from board_info. port-powerpc/32862
 1.3 11-Dec-2005  christos branches: 1.3.2; 1.3.4; 1.3.6;
merge ktrace-lwp.
 1.2 25-Jul-2003  scw branches: 1.2.16;
Switch ibm4xx over to using the more flexible powerpc bus_space/bus_dma code.
 1.1 12-Aug-2002  simonb branches: 1.1.2; 1.1.4; 1.1.6; 1.1.12;
Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.1.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.12.1 03-Aug-2004  skrll Sync with HEAD
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 12-Aug-2002  jdolecek file opbvar.h was added on branch kqueue on 2002-09-06 08:39:09 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 12-Aug-2002  gehenna file opbvar.h was added on branch gehenna-devsw on 2002-08-31 13:45:45 +0000
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 12-Aug-2002  nathanw file opbvar.h was added on branch nathanw_sa on 2002-08-13 02:18:43 +0000
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.1 01-Mar-2006  yamt sync with head.
 1.4.94.1 30-May-2010  rmind sync with head
 1.4.92.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.4.72.1 11-Aug-2010  yamt sync with head.
 1.5.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.2 24-Jun-2023  msaitoh Fix typo in comment.
 1.1 13-Aug-2002  simonb branches: 1.1.2; 1.1.4; 1.1.6;
Split out device register definitions to their own files as the are
common across many of the 4xx parts. Leaves ibm405gp.h with device
address information specific to the 405GP CPU. Now allows opb.c to
support multiple 4xx CPU types.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 13-Aug-2002  jdolecek file pcicreg.h was added on branch kqueue on 2002-09-06 08:39:10 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 13-Aug-2002  gehenna file pcicreg.h was added on branch gehenna-devsw on 2002-08-31 13:45:45 +0000
 1.1.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 13-Aug-2002  nathanw file pcicreg.h was added on branch nathanw_sa on 2002-08-27 23:45:13 +0000
 1.25 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.24 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.23 24-Apr-2021  thorpej branches: 1.23.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.22 06-Jul-2020  rin branches: 1.22.4;
Style and cosmetic changes. No binary changes intended.
 1.21 21-Nov-2013  kiyohara Support Synopsys DesigneWave OTG on PowerPC 405EX.
 1.20 18-Jun-2011  matt branches: 1.20.2; 1.20.12; 1.20.16;
Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.19 06-Jun-2011  matt More device_t, cfdata, CFATTACH_DECL_NEW cleanup.
 1.18 13-Dec-2010  kiyohara branches: 1.18.6;
Fix PR#43911.
 1.17 09-Nov-2010  uebayasi Whitespace.
 1.16 06-Nov-2010  uebayasi Add IBM405GPr "External Bus" driver.
 1.15 18-Mar-2010  kiyohara Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.14 11-Dec-2005  christos branches: 1.14.78; 1.14.98; 1.14.100;
merge ktrace-lwp.
 1.13 28-Jun-2005  drochner convert remaining autoconf bus "submatch" functions to use the new
signature (passing locators), and remove some which obviously don't
serve any purpose
(untested, sorry)
 1.12 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.11 25-Jul-2003  scw Fix the default bus dma tag.
 1.10 25-Jul-2003  scw Switch ibm4xx over to using the more flexible powerpc bus_space/bus_dma code.
 1.9 15-Jul-2003  lukem __KERNEL_RCSID()
 1.8 01-Jan-2003  thorpej branches: 1.8.2;
Use aprint_normal() for cfprint routines.
 1.7 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.6 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 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.3 23-Aug-2002  scw branches: 1.3.2; 1.3.4;
Add "ecc at plb" device.
Add an "irq" locator to the plb device.
This gets rid of the original hack where ecc support was wedged into
the cpu driver.
 1.2 13-Aug-2002  simonb Use "ibm4xx" instead of "galaxy"; galaxy was an early code name for the
405GP.
 1.1 12-Aug-2002  simonb branches: 1.1.2;
Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.1.2.5 03-Jan-2003  thorpej Sync with HEAD.
 1.1.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.3 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 12-Aug-2002  nathanw file plb.c was added on branch nathanw_sa on 2002-08-13 02:18:44 +0000
 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 23-Aug-2002  jdolecek file plb.c was added on branch kqueue on 2002-09-06 08:39:10 +0000
 1.3.2.2 31-Aug-2002  gehenna catch up with -current.
 1.3.2.1 23-Aug-2002  gehenna file plb.c was added on branch gehenna-devsw on 2002-08-31 13:45:45 +0000
 1.8.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.100.3 12-Jun-2011  rmind sync with head
 1.14.100.2 05-Mar-2011  rmind sync with head
 1.14.100.1 30-May-2010  rmind sync with head
 1.14.98.4 09-Nov-2010  uebayasi Sync with HEAD.
 1.14.98.3 09-Nov-2010  uebayasi Sync with HEAD.
 1.14.98.2 11-Aug-2010  uebayasi Implement 405GPr's "External Bus" as exb(4).
 1.14.98.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.14.78.1 11-Aug-2010  yamt sync with head.
 1.18.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.16.1 18-May-2014  rmind sync with head
 1.20.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.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.22.4.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.23.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.7 21-Nov-2013  kiyohara Support Synopsys DesigneWave OTG on PowerPC 405EX.
 1.6 18-Jun-2011  matt branches: 1.6.2; 1.6.12; 1.6.16;
Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.5 18-Mar-2010  kiyohara branches: 1.5.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.4 11-Dec-2005  christos branches: 1.4.78; 1.4.98; 1.4.100;
merge ktrace-lwp.
 1.3 25-Jul-2003  scw Switch ibm4xx over to using the more flexible powerpc bus_space/bus_dma code.
 1.2 23-Aug-2002  scw branches: 1.2.2; 1.2.4; 1.2.10;
Add "ecc at plb" device.
Add an "irq" locator to the plb device.
This gets rid of the original hack where ecc support was wedged into
the cpu driver.
 1.1 12-Aug-2002  simonb branches: 1.1.2;
Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.1.2.3 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 12-Aug-2002  nathanw file plbvar.h was added on branch nathanw_sa on 2002-08-13 02:18:44 +0000
 1.2.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.10.1 03-Aug-2004  skrll Sync with HEAD
 1.2.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.1 23-Aug-2002  jdolecek file plbvar.h was added on branch kqueue on 2002-09-06 08:39:11 +0000
 1.2.2.2 31-Aug-2002  gehenna catch up with -current.
 1.2.2.1 23-Aug-2002  gehenna file plbvar.h was added on branch gehenna-devsw on 2002-08-31 13:45:45 +0000
 1.4.100.1 30-May-2010  rmind sync with head
 1.4.98.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.4.78.1 11-Aug-2010  yamt sync with head.
 1.5.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 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.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 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.1 18-Mar-2010  kiyohara branches: 1.1.2; 1.1.4; 1.1.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 18-Mar-2010  yamt file rgmii.c was added on branch yamt-nfs-mp on 2010-08-11 22:52:33 +0000
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 18-Mar-2010  rmind file rgmii.c was added on branch rmind-uvmplock on 2010-05-30 05:17:02 +0000
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 18-Mar-2010  uebayasi file rgmii.c was added on branch uebayasi-xip on 2010-04-30 14:39:42 +0000
 1.1 18-Mar-2010  kiyohara branches: 1.1.2; 1.1.4; 1.1.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 18-Mar-2010  yamt file rgmiireg.h was added on branch yamt-nfs-mp on 2010-08-11 22:52:33 +0000
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 18-Mar-2010  rmind file rgmiireg.h was added on branch rmind-uvmplock on 2010-05-30 05:17:02 +0000
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 18-Mar-2010  uebayasi file rgmiireg.h was added on branch uebayasi-xip on 2010-04-30 14:39:42 +0000
 1.1 18-Mar-2010  kiyohara branches: 1.1.2; 1.1.4; 1.1.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 18-Mar-2010  yamt file rmiivar.h was added on branch yamt-nfs-mp on 2010-08-11 22:52:33 +0000
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 18-Mar-2010  rmind file rmiivar.h was added on branch rmind-uvmplock on 2010-05-30 05:17:02 +0000
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 18-Mar-2010  uebayasi file rmiivar.h was added on branch uebayasi-xip on 2010-04-30 14:39:42 +0000
 1.5 18-Sep-2006  gdamore Conversion of evbppc to generic TODR. ok freza@
 1.4 11-Dec-2005  christos branches: 1.4.20; 1.4.22;
merge ktrace-lwp.
 1.3 04-Jun-2005  he branches: 1.3.2;
Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*". Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>. This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
 1.2 03-Jun-2005  scw Appease -Wcast-qual
 1.1 06-Oct-2003  shige branches: 1.1.4;
Add Real time clock support code.
 1.1.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 06-Oct-2003  skrll file rtc.c was added on branch ktrace-lwp on 2004-08-03 10:39:28 +0000
 1.3.2.1 30-Dec-2006  yamt sync with head.
 1.4.22.1 22-Oct-2006  yamt sync with head
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.4 17-Sep-2006  gdamore Remove unused todclock files -- these are left overs from pre-generic-TODR.
 1.3 11-Dec-2005  christos branches: 1.3.20;
merge ktrace-lwp.
 1.2 05-Jul-2004  pk branches: 1.2.2; 1.2.14;
Call inittodr() from main(). Let file system code set the recorded `last
update' time (if any) through the new function setrootfstime().
 1.1 23-Sep-2003  shige Move todclock driver from evbppc/walnut/dev.
 1.2.14.1 30-Dec-2006  yamt sync with head.
 1.2.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.2 03-Aug-2004  skrll Sync with HEAD
 1.2.2.1 05-Jul-2004  skrll file todclock.c was added on branch ktrace-lwp on 2004-08-03 10:39:28 +0000
 1.3.20.1 18-Nov-2006  ad Sync with head.
 1.3 17-Sep-2006  gdamore Remove unused todclock files -- these are left overs from pre-generic-TODR.
 1.2 11-Dec-2005  christos branches: 1.2.20;
merge ktrace-lwp.
 1.1 23-Sep-2003  shige branches: 1.1.4; 1.1.18;
Move todclock driver from evbppc/walnut/dev.
 1.1.18.1 30-Dec-2006  yamt sync with head.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 23-Sep-2003  skrll file todclockvar.h was added on branch ktrace-lwp on 2004-08-03 10:39:28 +0000
 1.2.20.1 18-Nov-2006  ad Sync with head.
 1.12 18-Jun-2011  matt Use aprint_normal include sys/cpu.h
 1.11 17-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.10 25-Feb-2010  matt branches: 1.10.8;
Adapt to spr.h breakup.
 1.9 05-May-2006  thorpej branches: 1.9.66; 1.9.86; 1.9.90;
Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.6; 1.8.8; 1.8.10; 1.8.12;
merge ktrace-lwp.
 1.7 15-Jul-2003  lukem branches: 1.7.16;
__KERNEL_RCSID()
 1.6 02-Oct-2002  thorpej branches: 1.6.6;
Add trailing ; to CFATTACH_DECL.
 1.5 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 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.2 12-Aug-2002  simonb branches: 1.2.2; 1.2.4;
Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.1 01-Aug-2002  simonb branches: 1.1.2;
Add driver for 405gp (and other 4xx?) watchdog timer.
 1.1.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.3 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.2 06-Aug-2002  nathanw Catch up with powerpc rototilling.
 1.1.2.1 01-Aug-2002  nathanw file wdog.c was added on branch nathanw_sa on 2002-08-06 22:47:09 +0000
 1.2.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.1 12-Aug-2002  jdolecek file wdog.c was added on branch kqueue on 2002-09-06 08:39:12 +0000
 1.2.2.2 31-Aug-2002  gehenna catch up with -current.
 1.2.2.1 12-Aug-2002  gehenna file wdog.c was added on branch gehenna-devsw on 2002-08-31 13:45:45 +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.1 21-Jun-2006  yamt sync with head.
 1.8.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.10.1 11-May-2006  elad sync with head
 1.8.8.1 24-May-2006  yamt sync with head.
 1.8.6.1 01-Jun-2006  kardel Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.9.90.1 07-Jan-2011  matt Deal with new powerpc world.
 1.9.86.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.9.66.1 11-Mar-2010  yamt sync with head
 1.10.8.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.1 20-Mar-2010  kiyohara branches: 1.1.2; 1.1.4; 1.1.6;
Fix build failed.
Add forgot zmiireg.h since support 405EX.
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 20-Mar-2010  yamt file zmiireg.h was added on branch yamt-nfs-mp on 2010-08-11 22:52:33 +0000
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 20-Mar-2010  rmind file zmiireg.h was added on branch rmind-uvmplock on 2010-05-30 05:17:02 +0000
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 20-Mar-2010  uebayasi file zmiireg.h was added on branch uebayasi-xip on 2010-04-30 14:39:42 +0000
 1.17 30-Mar-2021  rin Use mnemonic "bdneq". Add missing register prefix.

No binary changes.
 1.16 07-Mar-2021  simonb branches: 1.16.2;
Remove unused/unreferenced legacy intrcnt/intrnames.
 1.15 06-Jul-2020  rin branches: 1.15.2;
Do not silently #undef PPC_4XX_NOCACHE, which results in terrible confusion.
Raise #error instead.
 1.14 06-Jul-2020  rin Drop unused opt_lockdebug.h, opt_multiprocessor.h, and opt_ppcarch.h.
 1.13 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.12 15-Jul-2018  maxv Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
 1.11 05-Aug-2014  joerg branches: 1.11.26; 1.11.28;
The argument of stwu is displacement(register), but GAS translates the
%rX mnemonic very early into plain X, so it seemingly accepts
%register(displacement) as well. Be consistent in the formatting for
human consumption.
 1.10 20-Jun-2011  matt branches: 1.10.12; 1.10.26;
Don't include *pmap.h in assembly files. Get the needed definitions
from "assym.h".
 1.9 17-Jan-2011  matt branches: 1.9.4;
Kill _NOREGNAMES. Everything should be using %rX now. If it doesn't it
soon will.
 1.8 18-Mar-2010  kiyohara branches: 1.8.2;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.7 25-Feb-2010  matt branches: 1.7.2;
Adapt to spr.h breakup.
 1.6 26-Nov-2009  matt branches: 1.6.2;
Kill proc0paddr. Use lwp0.l_addr instead.
 1.5 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.4 13-Nov-2008  ad branches: 1.4.4;
LKM -> MODULAR
 1.3 16-Oct-2006  kiyohara branches: 1.3.52; 1.3.56; 1.3.62; 1.3.64; 1.3.74;
* convert ibm4xx-based evbppc from reserved-TLB entry allocation to recently
introduced ppc4xx_tlb_reserve() API.
* ibm405gp UART0 used to be linear mapped. The VA happens to be inside kernel
segment, giving us the possibility of multiple VA matches in the TLB. This
is considered "programming error" by 405 core and results in "undefined
behaviour". We now avoid mapping peripherals in kernel segment.
* Some boards used to map hardwired RAM size. We now use the real size as
passed in by boot firmware.
 1.2 11-Dec-2005  christos branches: 1.2.20; 1.2.22;
merge ktrace-lwp.
 1.1 23-Sep-2003  shige branches: 1.1.4; 1.1.18;
Copy IBM4XX OpenBIOS locore.S from evbppc/walnut.
 1.1.18.1 30-Dec-2006  yamt sync with head.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 23-Sep-2003  skrll file locore.S was added on branch ktrace-lwp on 2004-08-03 10:39:28 +0000
 1.2.22.1 22-Oct-2006  yamt sync with head
 1.2.20.1 18-Nov-2006  ad Sync with head.
 1.3.74.1 07-Jan-2011  matt Deal with new powerpc world.
 1.3.64.2 03-Mar-2009  skrll Sync with HEAD.
 1.3.64.1 19-Jan-2009  skrll Sync with HEAD.
 1.3.62.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.3.56.3 11-Aug-2010  yamt sync with head.
 1.3.56.2 11-Mar-2010  yamt sync with head
 1.3.56.1 04-May-2009  yamt sync with head.
 1.3.52.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.7.2.2 05-Mar-2011  rmind sync with head
 1.7.2.1 30-May-2010  rmind sync with head
 1.8.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.26.1 10-Aug-2014  tls Rebase.
 1.10.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.28.1 10-Jun-2019  christos Sync with HEAD
 1.11.26.1 28-Jul-2018  pgoyette Sync with HEAD
 1.15.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.16.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.7 30-Mar-2021  rin - Document IBM/AMCC Walnut is supported by this file.
- Misc style fixes.
 1.6 30-Mar-2021  rin Remove unused "startkernel" argument for openbios_board_init().
 1.5 18-Jun-2011  matt branches: 1.5.66; 1.5.68;
Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.4 22-Feb-2007  thorpej branches: 1.4.78;
TRUE -> true, FALSE -> false
 1.3 05-May-2006  thorpej branches: 1.3.14;
Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
merge ktrace-lwp.
 1.1 17-Jan-2005  shige branches: 1.1.2; 1.1.10; 1.1.12; 1.1.14;
Add openbios-board related modules.
- openbios.c
getting board data memory image from openbios.
setting all board data to board properties database.
- board_prop.c
initialize board properties database.
(set/get board properties [macros in ibm4xx/cpu.h])
 1.1.14.2 15-Sep-2005  riz Pull up following revision(s) (requested by shige in ticket #5820):
distrib/evbppc/md-kernel/Makefile 1.3 via patch
etc/etc.evbppc/Makefile.inc 1.3 via patch
sys/arch/evbppc/conf/files.obs405 1.5-1.8 via patch
sys/arch/evbppc/conf/OPENBLOCKS266 1.22,1.25 via patch
sys/arch/evbppc/include/obs266.h 1.1 (new)
sys/arch/evbppc/include/obs405.h 1.1-1.5 (new)
sys/arch/evbppc/include/rbus_machdep.h 1.1 (new)
sys/arch/evbppc/obs405/consinit.c 1.2-1.4
sys/arch/evbppc/obs405/dev/x1226.c deleted
sys/arch/evbppc/obs405/dev/x1226reg.h deleted
sys/arch/evbppc/obs405/machdep.c deleted
sys/arch/evbppc/obs405/obs266_autoconf.c 1.1 (new)
sys/arch/evbppc/obs405/obs266_machdep.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_autoconf.c 1.1 (new, plus patch)
sys/arch/evbppc/obs405/obs405_machdep.c 1.1 (new)
sys/arch/evbppc/obs405/rbus_machdep.c 1.1 (new)
sys/arch/powerpc/conf/files.ibm4xx 1.6-1.7
sys/arch/powerpc/ibm4xx/board_prop.c 1.1 (new)
sys/arch/powerpc/ibm4xx/dev/com_opb.c 1.12
sys/arch/powerpc/ibm4xx/dev/comopbvar.h 1.1 (new)
sys/arch/powerpc/ibm4xx/ibm40x_machdep.c 1.3-1.4
sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 1.1-1.2 (new)
sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c 1.1-1.3 (new)
sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 1.2-1.3
sys/arch/powerpc/ibm4xx/openbios/openbios.c 1.1 (new)
sys/arch/powerpc/include/ibm4xx/cpu.h 1.7-1.10
sys/arch/powerpc/include/ibm4xx/openbios.h 1.1 (new)

Update OpenBlockS266 support to more modern, stable sources.
 1.1.14.1 17-Jan-2005  riz file openbios.c was added on branch netbsd-2 on 2005-09-15 14:28:44 +0000
 1.1.12.2 26-Feb-2007  yamt sync with head.
 1.1.12.1 21-Jun-2006  yamt sync with head.
 1.1.10.2 29-Apr-2005  kent sync with -current
 1.1.10.1 17-Jan-2005  kent file openbios.c was added on branch kent-audio2 on 2005-04-29 11:28:20 +0000
 1.1.2.2 24-Jan-2005  skrll Sync with HEAD.
 1.1.2.1 17-Jan-2005  skrll file openbios.c was added on branch ktrace-lwp on 2005-01-24 08:34:27 +0000
 1.2.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 11-May-2006  elad sync with head
 1.2.8.1 24-May-2006  yamt sync with head.
 1.2.6.1 01-Jun-2006  kardel Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.4.78.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.5.68.1 03-Apr-2021  thorpej Sync with HEAD.
 1.5.66.1 03-Apr-2021  thorpej Sync with HEAD.
 1.17 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.16 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.15 24-Apr-2021  thorpej branches: 1.15.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.14 07-Jul-2020  thorpej branches: 1.14.4;
Overhaul the interface to pci_configure_bus():
- Don't expose how PCI bus configuration resource management is implemented.
Provide a new resource provider API:

==> pciconf_resource_init() -- Initialize a PCI configuration resources
container.
==> pciconf_resource_add() -- Add a PCI configuration resource to the
container (I/O, MEM, or prefetchable MEM). Multiple resources of
each type may be added.
==> pciconf_resource_fini() -- Tear down the PCI configurtation resources
container once the bus has been configured.

This is much easier to use than the previous method of providing an
extent map for each kind of resource, and works better for e.g. ACPI
platforms that provide potentially multiple PCI resources in tables
provided by firmware.

- Re-implement PCI configuration resource management using vmem arenas,
rather than extent maps.
 1.13 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.12 14-Jun-2020  chs replace EX_NOWAIT with EX_WAITOK in device attach methods.
remove checks for failures that can no longer occur.
 1.11 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.10 22-Jun-2011  matt branches: 1.10.2; 1.10.6;
Add support pci_intr_setattr.
Export non-inline version of pci api for modules (_MODULE is defined).
Fix definition of pc_conf_hook and pc_conf_interrupt.
Switch to using inlines instead of macros.
Switch ibm4xx to use <powerpc/pci_machdep.h>
 1.9 17-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.8 06-Jun-2011  matt More device_t, cfdata, CFATTACH_DECL_NEW cleanup.
 1.7 17-May-2011  dyoung branches: 1.7.2;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.6 04-May-2008  martin branches: 1.6.22; 1.6.28;
Move to standard TNF 2 clause license
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.76; 1.5.78;
merge ktrace-lwp.
 1.4 04-Sep-2005  kiyohara Support the 'PCMCIA adapter BOX' for OpenBlockS266.
 1.3 30-Aug-2004  drochner branches: 1.3.10; 1.3.12;
Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.2 24-Apr-2004  kleink branches: 1.2.2;
Update for new pci_devinfo(9) signature.
 1.1 23-Sep-2003  shige Copy PCI codes for IBM405GPx from evbppc/walnut/pci/{pchb.c,pci_machdep.c}.
 1.2.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.3 03-Sep-2004  skrll Sync with HEAD
 1.2.2.2 03-Aug-2004  skrll Sync with HEAD
 1.2.2.1 24-Apr-2004  skrll file pchb.c was added on branch ktrace-lwp on 2004-08-03 10:39:29 +0000
 1.3.12.1 21-Jun-2006  yamt sync with head.
 1.3.10.1 14-Sep-2005  tron Apply patch (requested by shige in ticket #763):
Synchronize OpenBlockS266 port with NetBSD-current for enhanced stability.
 1.5.78.1 16-May-2008  yamt sync with head.
 1.5.76.1 18-May-2008  yamt sync with head.
 1.5.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.22.2 12-Jun-2011  rmind sync with head
 1.6.22.1 31-May-2011  rmind sync with head
 1.7.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.6.1 18-Feb-2012  mrg merge to -current.
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.14.4.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.15.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.13 15-Oct-2022  rin DHT Walnut: Fix failure to attach on-board pdcide(4) for cold boot.

U-Boot seems to initialize pdcide(4) to compatible mode. Therefore, we
need to reinitialize it to native-PCI mode in pci_conf_hook(). Otherwise,
we will fail to configure IO registers for native-PCI mode during
PCI_NETBSD_CONFIGURE.
 1.12 06-Jul-2020  rin Include missing opt_pci.h
 1.11 02-Oct-2015  msaitoh PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.10 22-Jun-2011  matt branches: 1.10.12; 1.10.30;
Add support pci_intr_setattr.
Export non-inline version of pci api for modules (_MODULE is defined).
Fix definition of pc_conf_hook and pc_conf_interrupt.
Switch to using inlines instead of macros.
Switch ibm4xx to use <powerpc/pci_machdep.h>
 1.9 18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.8 17-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.7 18-Mar-2010  kiyohara branches: 1.7.6;
Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.6 30-May-2008  ad branches: 1.6.18; 1.6.20;
pci_intr_setattr(), allows PCI interrupts to be marked MPSAFE on x86, and
other platforms if the code is added.

pci_intr_map(...)
pci_intr_setattr(pc, ih, PCI_INTR_MPSAFE, 1);
pci_intr_establish(...)
 1.5 30-Jun-2006  freza branches: 1.5.58; 1.5.60; 1.5.62; 1.5.64;
Bring ibm4xx interrupt code up to date:

- generic soft interrupts (ie. use powerpc/softintr.c)
- interrupt event counters (using the ones from powerpc/cpu.h:cpu_info
where appropriate)
- cleanup ibm4xx_intr.h, move implementation details to intr.c

Convert all affected evbppc platforms.

OK by simonb@, some points discussed with matt@
 1.4 29-Mar-2006  shige branches: 1.4.4;
Move pci_intr_map and pci_conf_interrupt functions to MD codes.
Change Max PCI devices from 5 to 31.
 1.3 10-Feb-2006  gdamore branches: 1.3.2; 1.3.4; 1.3.6;
PCI_NETBSD_CONFIGURE should allocate (but not map) address space expansion
ROMS by default. Full discussion at
http://mail-index.netbsd.org/tech-kern/2005/12/16/0023.html
Closes PR kern/32467
Reviewed by briggs@
 1.2 11-Dec-2005  christos branches: 1.2.2; 1.2.4; 1.2.6;
merge ktrace-lwp.
 1.1 23-Sep-2003  shige branches: 1.1.4; 1.1.18;
Copy PCI codes for IBM405GPx from evbppc/walnut/pci/{pchb.c,pci_machdep.c}.
 1.1.18.2 30-Dec-2006  yamt sync with head.
 1.1.18.1 21-Jun-2006  yamt sync with head.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 23-Sep-2003  skrll file pci_machdep.c was added on branch ktrace-lwp on 2004-08-03 10:39:29 +0000
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 18-Feb-2006  yamt sync with head.
 1.3.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.3.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.3.2.2 11-Aug-2006  yamt sync with head
 1.3.2.1 01-Apr-2006  yamt sync with head.
 1.4.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.5.64.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5.62.2 11-Aug-2010  yamt sync with head.
 1.5.62.1 04-May-2009  yamt sync with head.
 1.5.60.1 04-Jun-2008  yamt sync with head
 1.5.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.20.1 30-May-2010  rmind sync with head
 1.6.18.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.7.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.30.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.10.12.1 03-Dec-2017  jdolecek update from HEAD

RSS XML Feed