Home | History | Annotate | only in /src/sys/arch/powerpc/oea
History log of /src/sys/arch/powerpc/oea
RevisionDateAuthorComments
 1.35 15-Jun-2024  mrg don't do anything in vec_restore_from_mcontext() if no altivec.

fixes a crash seen on netbsd-10 in PR#58283.

XXX: pullup-10.
 1.34 30-Oct-2021  thorpej branches: 1.34.4;
- In vec_restore_from_mcontext() and vec_save_to_mcontext(), allows the
mcontext argument to be NULL.
- In sendsig_sigcontext(), don't set PSL_VEC in the saved MSR; we can't
actually round-trip the AltiVec registers. At least get them saved
into the PCB by calling vec_save_to_mcontext() (with a NULL mcontext
argument).
- In compat_16_sys___sigreturn14(), call vec_restore_from_mcontext()
with a NULL mcontext argument, which will force any subsequent use
of AltiVec to re-load the AltiVec registers from the PCB.

This isn't ideal, but it's the best we can do with the limited capability
of sigcontext.

Fixes PR port-powerpc/56471.
 1.33 06-Jul-2020  rin Drop unused opt_multiprocessor.h includes.
 1.32 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.31 16-Mar-2017  chs allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
 1.30 06-Jul-2015  matt branches: 1.30.2; 1.30.4;
Don't reload if just re-enabling
 1.29 16-May-2014  rmind branches: 1.29.2; 1.29.4;
pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.
 1.28 23-Aug-2013  matt branches: 1.28.2;
Get rid of MDLWP_USED{FPU,VEC}
 1.27 22-Aug-2013  drochner -extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt
 1.26 26-Dec-2012  matt branches: 1.26.2;
Update to new pcu_state_{load,state,release} definitions
 1.25 07-Jun-2011  matt branches: 1.25.2; 1.25.8; 1.25.12;
zero PCU area when loading used area.
 1.24 25-May-2011  matt branches: 1.24.2;
Set PSL_VEC in the right place.
 1.23 02-May-2011  matt Make sure to enable the vector unit in the PSL when returning to userland.
 1.22 02-May-2011  matt Move powerpc to use pcu to manage FPU/AltiVec/SPE.
 1.21 08-Feb-2011  matt Powerpc send_ipi use ci_cpuid, not cpu_index
 1.20 23-Jan-2011  matt Clear ownership bit after saving contents to PCB.
 1.19 18-Jan-2011  matt branches: 1.19.2;
Fix some fallout from building the macppc GENERIC.MP.
 1.18 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.17 14-Jan-2011  rmind branches: 1.17.2;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.16 25-Feb-2010  matt branches: 1.16.2;
Adapt to spr.h breakup.
 1.15 21-Nov-2009  rmind branches: 1.15.2;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.14 08-Apr-2008  garbled branches: 1.14.4; 1.14.6; 1.14.26;
SMP support for ofppc. (finally) Much thanks to Matt Thomas for help in
figuring out all the crazy nuances of getting this working, and to
Michael Lorenz for testing/fixing my changes on macppc. Tested with a
quad-proc 7044-270.
Summary of changes:

Bumped CPU_MAXNUM to 16 on ofppc.
Added md_* routines to ofppc/cpu.c, to sync the timebase, and awaken the CPUs.
Fixed a bug in the test for a 64bit bridge cpu early in locore.S
Added code to set the interrupt priority for all CPUs with an openpic.
Change rtas to probe before cpus, to allow use of the rtas freeze/thaw
timebase code routines.
Fix CPU_INFO_FOREACH macro to iterate through detected cpus, not CPU_MAXNUM.
Change most uses of ci_cpuid to ci_index, to deal with CPUs that do not allow
writing to SPR_PIR. Don't write SPR_PIR unless the secondary cpu identifies
itself as 0.
Change the hatchstack/interrupt stack allocations to allocate a 8192byte
interrupt stack, and a 4096 byte hatch stack, align them to 16 bytes, and
allocate them no lower than 0x10000. Allocate them separately to prevent the
hatch stack corrupting the interrupt stack later on.
If the CPU is a 64bit cpu, copy SPR_ASR in cpu_hatch()
Set the idle stack to ci->ci_data.cpu_idlelwp->l_addr->u_pcb.pcb_sp.
Add OF_start_cpu(). Add a routine to ofwoea_initppc to spin up secondary
procs early, and place them into a spinloop waiting for the hatch routines
to be ready.
Modify the ipi routines to deal with openpics that reverse byte order on read
from an ipi register. (such as on the 7044)
Change the rtas setup to allocate the rtas physical base address above
the kernel, to avoid mucking up the hatch/interrupt stacks.
 1.13 17-Oct-2007  garbled branches: 1.13.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.12 09-Feb-2007  ad branches: 1.12.6; 1.12.14; 1.12.22; 1.12.24; 1.12.26; 1.12.28;
Merge newlock2 to head.
 1.11 24-Dec-2005  perry branches: 1.11.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 11-Apr-2005  nathanw branches: 1.9.2;
Rewrite the inner loop of vcopypage() and vzeropage() to be entirely
in inline asm and include turning the DMMU off and back on. This
prevents the compiler (especially gcc -O0) from inserting accesses to
locations in virtual address space when such accesses would fail.
 1.8 22-Feb-2005  matt Don't clear PCB_FPU/PCB_ALTIVEC when releasing the FPU/AltiVec unit. Add
new flags to indicate whether the PCB currently owns the FPU/AltiVec unit.
 1.7 16-Apr-2004  matt branches: 1.7.4; 1.7.6;
Add a SAVE/DISCARD flag to save_{fpu,vec}_lwp. Use it appropriately.
Nuke struct fpu and use struct fpreg instead (except for the names, they
were identical). On MP machines, this will avoid an unneeded IPI to save
the register contents that are about to discarded.
 1.6 15-Apr-2004  matt Revamp how user MSR/SRR1 are dealt with.
Add a PSL_USEROK_P(psl) macro which valids the bits (replaces the use of
PSL_USERSTATIC).
Add a PSL_USERSRR1 mask which is used to mask out status bits in the upper
half of SRR1.
Make sure PSL_VEC is set appropriately in userret(). PSL_VEC is in the same
region as SSR1 status bits so it's not preserved on exceptions. Thus we
need to make to set it.
When returning a MSR/SRR1 to userland, always clear the status bits.
Add emulation of the mfpvr, mtmsr, and mfmsr instructions.
 1.5 15-Jul-2003  lukem __KERNEL_RCSID()
 1.4 23-Jun-2003  martin branches: 1.4.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.3 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.2 05-Mar-2003  matt Make AltiVec registers available via ptrace/procfs. Simplify AltiVec
processing. Add a "common" procfs_machdep.c for PowerPC platforms.
Even though it is supposed to be port specific, most (if not all)
PowerPC ports can just use the common one.
 1.1 03-Feb-2003  matt Rename PPC_MPC6XX to PPC_OEA (and any mpc6xx reference to oea).
 1.4.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.9.2.3 27-Oct-2007  yamt sync with head.
 1.9.2.2 26-Feb-2007  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.11.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.12.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.12.26.1 18-Oct-2007  yamt sync with head.
 1.12.24.1 06-Nov-2007  matt sync with HEAD
 1.12.22.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.12.14.1 11-Oct-2007  garbled Move a bunch of the macppc SMP code out of macppc, and down into the
generic OEA code. Add a set of md callbacks into these shared routines,
that any oeappc SMP machine needs to provide. This allows for generally
shared SMP startup code, but still allows for machine-specific
differences in the setup and kicking of the new CPU.

Convert macppc to this new layout. Tested by Macallan.

Add an initial attempt at SMP to prep. Tested on UP machine only,
untested on SMP yet.
 1.12.6.1 23-Oct-2007  ad Sync with head.
 1.13.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.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.14.26.1 07-Jan-2011  matt Deal with new powerpc world.
 1.14.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.14.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.14.4.1 11-Mar-2010  yamt sync with head
 1.15.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.16.2.3 12-Jun-2011  rmind sync with head
 1.16.2.2 31-May-2011  rmind sync with head
 1.16.2.1 05-Mar-2011  rmind sync with head
 1.17.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.24.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.25.12.3 03-Dec-2017  jdolecek update from HEAD
 1.25.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.12.1 25-Feb-2013  tls resync with head
 1.25.8.3 19-Nov-2015  bouyer Revert ticket 1310 (second try):
> sys/arch/powerpc/include/psl.h 1.20
> sys/arch/powerpc/include/userret.h 1.29, 1.30
> sys/arch/powerpc/oea/altivec.c 1.30
> sys/arch/powerpc/oea/oea_machdep.c 1.72
> sys/arch/powerpc/powerpc/fpu.c 1.36
>
> powerpc PCU fixes

because it breaks the build:
http://releng.netbsd.org/builds/netbsd-6/201511152000Z/
 1.25.8.2 16-Nov-2015  bouyer Revert ticket 1310:
> sys/arch/powerpc/include/psl.h 1.20
> sys/arch/powerpc/include/userret.h 1.29, 1.30
> sys/arch/powerpc/oea/altivec.c 1.30
> sys/arch/powerpc/oea/oea_machdep.c 1.72
> sys/arch/powerpc/powerpc/fpu.c 1.36
>
> powerpc PCU fixes

because it breaks the build:
http://releng.netbsd.org/builds/netbsd-6/201511152000Z/
 1.25.8.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by matt in ticket #1310):
sys/arch/powerpc/include/userret.h: revision 1.30
sys/arch/powerpc/powerpc/fpu.c: revision 1.36
sys/arch/powerpc/include/psl.h: revision 1.20
sys/arch/powerpc/include/userret.h: revision 1.29
sys/arch/powerpc/oea/oea_machdep.c: revision 1.72
sys/arch/powerpc/oea/altivec.c: revision 1.30
Add a check to make sure that if PSL_FP is set, we own the FPU.
Don't clear PSL_FP/PSL_VEC
Don't reload if just re-enabling
Don't reload the FPU register if this is just a re-enable.
Remove PSL_SPV from BOOKE PSL_USERMOD
Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext.
 1.25.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.25.2.1 23-Jan-2013  yamt sync with head
 1.26.2.2 18-May-2014  rmind sync with head
 1.26.2.1 28-Aug-2013  rmind sync with head
 1.28.2.1 10-Aug-2014  tls Rebase.
 1.29.4.2 28-Aug-2017  skrll Sync with HEAD
 1.29.4.1 22-Sep-2015  skrll Sync with HEAD
 1.29.2.1 17-Jul-2015  snj Pull up following revision(s) (requested by matt in ticket #868):
sys/arch/powerpc/include/psl.h: revision 1.20
sys/arch/powerpc/include/userret.h: revisions 1.29, 1.30
sys/arch/powerpc/oea/altivec.c: revision 1.30
sys/arch/powerpc/oea/oea_machdep.c: revision 1.72
sys/arch/powerpc/powerpc/fpu.c: revision 1.36
Add a check to make sure that if PSL_FP is set, we own the FPU.
--
Don't clear PSL_FP/PSL_VEC
--
Don't reload if just re-enabling
--
Don't reload the FPU register if this is just a re-enable.
--
Remove PSL_SPV from BOOKE PSL_USERMOD
--
Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext.
 1.30.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.30.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.34.4.1 03-Jul-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #732):

sys/arch/powerpc/oea/altivec.c: revision 1.35

don't do anything in vec_restore_from_mcontext() if no altivec.
fixes a crash seen on netbsd-10 in PR#58283.
 1.3 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.2 18-Jan-2011  matt branches: 1.2.4; 1.2.8;
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.1 17-Jan-2011  matt branches: 1.1.2;
file altivec_subr.S was initially added on branch matt-nb5-pq3.
 1.1.2.1 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.2.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.8.1 18-Jan-2011  jruoho file altivec_subr.S was added on branch jruoho-x86intr on 2011-06-06 09:06:29 +0000
 1.2.4.2 05-Mar-2011  rmind sync with head
 1.2.4.1 18-Jan-2011  rmind file altivec_subr.S was added on branch rmind-uvmplock on 2011-03-05 20:51:39 +0000
 1.3 06-Jul-2020  rin Drop unused opt_ppcparam.h.
 1.2 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.1 01-Jun-2018  macallan branches: 1.1.2;
add clock speed control for 970MP CPUs
 1.1.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.1.2.1 01-Jun-2018  pgoyette file cpu_speedctl.c was added on branch pgoyette-compat on 2018-06-25 07:25:45 +0000
 1.111 17-Feb-2025  jmcneill powerpc: Identify Broadway CPU.

Use hex to report Broadway revision and ignore TAU as it does not exist
on this processor.
 1.110 08-Sep-2024  andvar Use console_debbuger() or DDB guards for Debugger() and db_stack_trace_print().

Should allow to build these files without DDB enabled option.
 1.109 20-Jan-2024  jmcneill branches: 1.109.2;
powerpc: oea: Decode IBM750CL L2 cache information.
 1.108 21-Mar-2021  rin branches: 1.108.16;
Fix copy-paste.
 1.107 26-Feb-2021  thorpej branches: 1.107.2;
Split cpu_model_init() into cpu_features_probe() and cpu_features_enable()
so that early bootstrap can do those two steps independently, if needed.

Continue to provide a cpu_model_init() wrapper for now.
 1.106 26-Feb-2021  thorpej Declare oeacpufeat once, in powerpc/oea/cpu_subr.c, rather than in
N different locore.S files.
 1.105 24-Feb-2021  thorpej Add a provision for a per-cpu battable. Each CPU starts with the global
one, but this allows CPUs to temporarily switch to an alternate battable
if needed.
 1.104 06-Jul-2020  rin branches: 1.104.2;
Include missing opt_ppcarch.h.
 1.103 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.102 25-Oct-2019  macallan register the IPI before spinning up CPUs, and make sure to do it exactly once
with this, and previous commits, G5s with four CPUs work
tested by Romain Dolbeau
 1.101 20-Sep-2019  macallan don't enable NAP mode on 7450 CPUs - my Quicksilver has two of those and we
hang hard shortly after boot with NAP enabled, even on UP kernels
 1.100 02-Aug-2019  macallan first step to address PR54331:
poll h->hatch_running for a bit instead of blindly relying on a fixed timeout
for secondary CPUs to wake up and get ready

needs more testing, possibly pullup
 1.99 06-Feb-2019  mrg - add or adjust fallthru comments
 1.98 06-Jan-2019  phx Only execute dssall when the CPU has the Altivec instruction set extension.
 1.97 15-Jun-2018  uwe branches: 1.97.2;
Fix fmttab value for L2CR_L2PE (parity enabled) so that we don't print
self-contradictory "no parity parity enabled".
 1.96 08-Jun-2018  macallan when switching CPU speed using DFS, only use xcalls on MULTIPROCESSOR kernels
 1.95 01-Jun-2018  macallan add clock speed control for 970MP CPUs
 1.94 25-May-2018  macallan copy HID1 from the boot CPU to secondary CPUs as well on 64bit CPUs
now the 2nd CPU on my G5s runs at full speed
 1.93 04-May-2018  macallan save & restore HID4 and HID5, zero SPR_HIOR on 970
 1.92 29-Mar-2018  macallan fix build for 32bit non-bridge SMP kernels
 1.91 22-Mar-2018  macallan first step towards G5 SMP:
- only save/restore BATs on CPUs that have them
- treat HID0 as 64bit on 64bit CPUs
 1.90 04-Mar-2018  mrg branches: 1.90.2;
avoid 32 bit only code in 64 bit mode.
 1.89 16-Feb-2018  macallan use mtspr64() in bridge mode
 1.88 21-Jan-2018  mrg fix ofppc/pegasosII (and maybe others).

don't assume PPC_OEA64_BRIDGE means we have a 64 bit cpu (code
for 64 bit in bridge and normal 32 bit can co-exist due to
fixups the early boot code does has, and ofppc builds GENERIC
this way):
- fix mtmsr()/mfmsr() to use the right method based upon the
actually cpu booted on.
- fix cpu_setup() to have 32 bit and 64 bit hid0 variables
and operate on the right one based upon the current cpu.
restore a minor optimisation of not writing hid0 if it
didn't change.

in set_timebase() check if OF_finddevice("/cpus/@0") failed
and returned -1 before using it for OF_getprop().
 1.87 06-Jan-2018  snj fix a few typos in comments
 1.86 30-Sep-2017  macallan use 7450 HID0 bitmask on 7447A and 7448 as well
 1.85 11-Jul-2017  maya inline HAVE_64BIT_HID0 and remove macro definition.

Fixes llvm INSTALL kernel build, which failed with:
error: macro expansion producing 'defined' has undefined behavior
 1.84 07-Jul-2017  macallan remove accidential debug printf()
 1.83 07-Jul-2017  macallan deal with ppc970's HID0
 1.82 24-Mar-2014  christos branches: 1.82.6;
use cpu_{g,s}etmodel
 1.81 14-Mar-2014  mrg remove various set-but-unused variables.
 1.80 03-Nov-2013  mrg - remove set but unused variables
- move some variables inside their relevant use #ifdef
 1.79 22-Sep-2013  matt Fix c&p bug.
 1.78 22-Sep-2013  matt Disable XBSEN for the 7450.
 1.77 22-Sep-2013  matt Make sure ABE/SYNCBE are enabled in HID1 for the 7450 CPUs
Enable XBSEN for the 7450.
 1.76 20-Oct-2012  kiyohara branches: 1.76.2;
Support Cache Protocol 'MEI' with MULTIPROCESSOR.
 1.75 20-Oct-2012  kiyohara Fix broken cpu_hatch_stack.
And define macro HATCH_STACK_SIZE.
 1.74 20-Oct-2012  kiyohara Remove white-spaces. And remove unused 'extern void tlbia()'.
 1.73 01-Feb-2012  matt branches: 1.73.6;
Use kmem instead of malloc. Remove unneeded <sys/malloc.h> includes.
 1.72 01-Feb-2012  matt Enable XBSEN and HIGHBAT for OEA 7455 and related CPUs.
The BAT entries now have a resolution of 8MB. (Adjacent entries are merged
up to a total of 2GB per entry).
 1.71 23-Jan-2012  phx Insert some missing aprint_naive().
 1.70 29-Jun-2011  matt branches: 1.70.2; 1.70.6;
Cleanup hatch names.
Add cpuset_info.
 1.69 21-Jun-2011  matt Reap the ci_ev_soft* evcnts since every variant implements __HAVE_FAST_SOFTINTS
 1.68 20-Jun-2011  pgoyette Initialize sensor state before registering.
 1.67 20-Jun-2011  matt <arch/powerpc/... -> <powerpc/...
 1.66 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.65 16-Jun-2011  matt Make sure to set curlwp (aka r13) in cpu_hatch
 1.64 12-Jun-2011  matt Use mtsprg0 instead of mtsprg 0,r
 1.63 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.62 12-Feb-2011  matt branches: 1.62.2;
Add support for the IBM750GX (from Bob Lee).
 1.61 18-Jan-2011  matt branches: 1.61.2;
Fix some fallout from building the macppc GENERIC.MP.
 1.60 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.59 06-Nov-2010  uebayasi branches: 1.59.2;
Machine dependent code is considered as part of UVM. Include
internal API header.
 1.58 05-Nov-2010  phx Only read from HID1 when a G3 CPU was detected in cpu_get_dfs(), otherwise
the access might cause a PGM trap.
 1.57 28-Oct-2010  macallan Use nap mode on 750-ish CPUs
 1.56 20-Oct-2010  phx Support sysctl machdep.cpu_speed for 7447A and 7448 based Macs. On those
machines the CPU's DFS (Dynamic Frequency Switching) feature is used instead
of a GPIO to control the speed.
Two new functions in powerpc/oea/cpu_subr.c were introduced to support
reading and writing of DFS: cpu_get_dfs() and cpu_set_dfs(). Also works
for multiple CPUs, but not before interrupts are enabled.
 1.55 25-Feb-2010  matt branches: 1.55.2;
Adapt to spr.h breakup.
 1.54 21-Nov-2009  rmind branches: 1.54.2;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.53 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.52 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.51 16-Dec-2008  christos branches: 1.51.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.50 14-Oct-2008  macallan branches: 1.50.2; 1.50.14;
Some fixes to the TAU support code:
- set the ADC time according to clock speed, not some magic number
- move some mtspr()s which we really only need to do once
- make our envsys_data_t static, this should fix PR 39411
 1.49 04-Oct-2008  chs in cpu_hatch(), set PIR when the current value is not what we need
rather than only when it's zero.
 1.48 23-Sep-2008  macallan properly 'probe' the MPC7400's L1 caches - before we'd fall through to
setting both to PAGE_SIZE
 1.47 25-May-2008  chs branches: 1.47.4;
add IBM970MP (used in the last model of powermac G5).
 1.46 08-Apr-2008  garbled branches: 1.46.2; 1.46.4; 1.46.6;
SMP support for ofppc. (finally) Much thanks to Matt Thomas for help in
figuring out all the crazy nuances of getting this working, and to
Michael Lorenz for testing/fixing my changes on macppc. Tested with a
quad-proc 7044-270.
Summary of changes:

Bumped CPU_MAXNUM to 16 on ofppc.
Added md_* routines to ofppc/cpu.c, to sync the timebase, and awaken the CPUs.
Fixed a bug in the test for a 64bit bridge cpu early in locore.S
Added code to set the interrupt priority for all CPUs with an openpic.
Change rtas to probe before cpus, to allow use of the rtas freeze/thaw
timebase code routines.
Fix CPU_INFO_FOREACH macro to iterate through detected cpus, not CPU_MAXNUM.
Change most uses of ci_cpuid to ci_index, to deal with CPUs that do not allow
writing to SPR_PIR. Don't write SPR_PIR unless the secondary cpu identifies
itself as 0.
Change the hatchstack/interrupt stack allocations to allocate a 8192byte
interrupt stack, and a 4096 byte hatch stack, align them to 16 bytes, and
allocate them no lower than 0x10000. Allocate them separately to prevent the
hatch stack corrupting the interrupt stack later on.
If the CPU is a 64bit cpu, copy SPR_ASR in cpu_hatch()
Set the idle stack to ci->ci_data.cpu_idlelwp->l_addr->u_pcb.pcb_sp.
Add OF_start_cpu(). Add a routine to ofwoea_initppc to spin up secondary
procs early, and place them into a spinloop waiting for the hatch routines
to be ready.
Modify the ipi routines to deal with openpics that reverse byte order on read
from an ipi register. (such as on the 7044)
Change the rtas setup to allocate the rtas physical base address above
the kernel, to avoid mucking up the hatch/interrupt stacks.
 1.45 23-Feb-2008  matt Detect HIGHBAT/XBSEN/HIGHSPRG to MPC74[45]x where x > 1
Enable above as appropriate.
 1.44 14-Feb-2008  garbled branches: 1.44.2; 1.44.6;
Some powerpc cleanup. Remove unneeded/bad usage of extern oeacpufeat.
Convert asm code to use %r register format. Done by comparison to
disassembled output, double checked with diff of dissasembled output
before and after, and test booted on my 7044.
 1.43 05-Feb-2008  garbled Replace as much of the hardcoded CACHELINESIZE with
curcpu()->ci_ci.dcache_line_size as I can. With this change, an ofppc kernel
compiled with both PPC_OEA and PPC_OEA64_BRIDGE defined, boots.
 1.42 05-Feb-2008  garbled Rewrite a big chunk of the pmap and locore code for powerpc to better
deal with the 64bit bridge mode. pmap changes by Matt Thomas, rest by myself.

Change pmap.c to work similar to exec_elf.c to allow us to compile in
multiple pmaps to a single kernel. This allows the pmap for bridge64 to
co-exist with the 32bit pmap.

Yank __HAVE_PMAP_PHYSSEG from all the oea code.

Add a new global, "oeacpufeat", which is used early in locore to determine
certain cpu features. This allows us to conditionalize code early in the boot
for certain CPUs that have special needs.

Yank most of the ifdef PPC_OEA_BRIDGE64 code from almost every file it was
found in. Some of it seemed incorrect, and my 7044 booted just fine
without it. It would appear that the bridge cpus treat BAT instructions
as nops, so they seem to be safe.

In ofppc, check the oeacpufeat, and if we are on a 64bit proc, clear
MSR[SF], and ASR[V].

With all of these changes, a kernel with both PPC_OEA and PPC_OEA_BRIDGE64
will boot on the POWERIII-2 cpu. However, it will not yet boot on a 32bit
cpu, because of CACHELINESIZE. Work remains to be done there to fix that.
 1.41 17-Jan-2008  garbled Add support to ofppc for the IBM 7044-270 machine. This is a POWER3-II
based machine. Currently the kernel to run on this machine is
incompatible with the standard GENERIC kernel, so for now, we have a
separate GENERIC_B64. Eventually, I hope to combine the two.

Please note, this is a port of 32bit ofppc, not a powerpc64 port.

Thanks to Matt Thomas and Kevin Bowling for helping to make this port
possible.

Summary of changes:

Change ofwpci to use the ofmethod config for configuring the PCI bus,
rather than indirect configuration.
Move the wiring of the interrupt controllers from at the start of the
boot, into the configuration of the first PCI bus.
Rewrite the map_isa_ioregs() hack to work on a machine without BATs
Fix a ton of bugs in the genofw_find_pics routine, and in the map_space code.
Split the pic_openpic into openpic_common and pic_openpic.
Create a new pic_distopenpic driver, for the distributed openpic found on
some newer IBM machines.
Fix a bad panic in pmap_extract on 64bit bridge mode
 1.40 31-Dec-2007  garbled On the 745x cpu, you have to invalidate cache slightly differently than
you do on the other cpus. Add an if statement that takes this into account.
 1.39 31-Dec-2007  macallan 'never try to fix more than one thing at once, especially if one is a crash'
backout bogus G4 CPU revision 'fix'
 1.38 30-Dec-2007  macallan Remove a superfluous /* FALLTHROUGH */
Also switch back to waiting for L2CR_L2IP in cpu_enable_l2cr() - now my 2nd
G4 spins up again.
 1.37 30-Dec-2007  macallan Fix a logic botch when setting up L3 cache - don't attempt to do so on CPUs
that can't have L3 cache. While there also fix revision reporting for MPC7400
so what we report matches MacOS X.
 1.36 27-Dec-2007  garbled Lots and lots of fixes to the cpu identification code, and dealing with
L2 and L3 cache initialization. Mostly to get the L2 enabled on the
pegasos, but since I had the manual, I fixed a few other things I saw
while I was there.
 1.35 17-Nov-2007  kefren branches: 1.35.6;
Initialize sensor's state
on behalf of xtraeme
 1.34 16-Nov-2007  xtraeme Extend the envsys2 API (one more time, sorry) as defined in:

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

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

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

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

Update all users and documentation to reflect these changes.
 1.33 17-Oct-2007  garbled branches: 1.33.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.32 01-Jul-2007  xtraeme branches: 1.32.8; 1.32.10; 1.32.12; 1.32.14;
Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

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

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.31 25-Jun-2007  aymeric Recognize the Freescale G2 cores: initialize cache line size, and doze mode
While there, fix the way the major version of a PowerPC processor is computed
 1.30 02-Jun-2007  nisimura - add MPC8245 to cpuname table.
 1.29 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.28 30-Oct-2006  garbled branches: 1.28.4; 1.28.8; 1.28.10; 1.28.16;
Make these files compile with -Wextra -Wno-unused.
 1.27 05-Aug-2006  sanjayl branches: 1.27.4; 1.27.6;
1st cut of Powermac G5 support (uses bridge mode).
 1.26 24-Dec-2005  perry branches: 1.26.4; 1.26.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.25 11-Dec-2005  christos merge ktrace-lwp.
 1.24 02-Jun-2005  he branches: 1.24.2;
Fix shadowing and cast qualification warnings.
 1.23 03-Feb-2005  briggs Keep track of the CPU's current speed (in kHz) in the cpu info structure,
if we can get it. May want to expand this in the future to include min
and max speeds for systems where we can adjust the speed.
 1.22 21-Jan-2005  matt branches: 1.22.2;
Add more support for MPC7447A/MPC7448.
 1.21 20-Jan-2005  matt Add entry for MPC7447A
 1.20 19-Jan-2005  matt 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.19 11-Jan-2005  chs branches: 1.19.2;
enable powersave mode on 7450 and family.
also, the HID0_DOZE bit in this context doesn't mean "doze",
it's actually "enable extra BATs". add an alias for this bit
and use it as appropriate.
 1.18 07-Jan-2005  briggs Allow MSR[POW] off for power saving on 604-era CPUs. From Tim Kelly.
XXX -- needs benchmarking
 1.17 07-Jan-2005  briggs Don't attempt to probe the cache with l2cr on 604ev. From Tim Kelly.
 1.16 08-Dec-2004  briggs Add MPC7400 to the list of CPUs for which we try to measure the speed.
Noticed missing by Tim Kelly.
 1.15 06-Dec-2004  briggs Minor (old) patch from me to correct CPU ID of 604e vs. 604ev.
Tested by Tim Kelly.
Also patched from Tim to
- Delay longer for second CPU spinup.
- Only attempt to print CPU speed and cache configuration on certain
CPU types.
 1.14 26-Jun-2004  kleink On OEA, turn PSL_USER* into runtime values appropriate for the CPU model
we're executing on; besides dealing with the bits not implemented in the
601's MSR it also removes the silent failure behaviour when passing
PSL_VEC set on a CPU not implementing it.

Also, fix those masks for the 4xx again.
 1.13 11-Mar-2004  christos PR/24741: Aymeric Vincent: Variable sme_flags isn't initialized to zero
 1.12 17-Feb-2004  matt Don't waste space on likely unused sysmon structure.
Instead malloc them as needed.
 1.11 09-Oct-2003  matt Add support for MPC74[45]7
 1.10 04-Aug-2003  matt Make that OEA based kernels can properly deal with kernel ISI faults. Now
that LKMs are supported, it is possible for a LKM page to be "outspilled"
resulting in a possible ISI fault. Try to spill the page back in.
 1.9 15-Jul-2003  lukem __KERNEL_RCSID()
 1.8 10-Apr-2003  scw branches: 1.8.2;
Re-read L2CR after enabling the L2 cache to avoid returning without
printing the cache details.
 1.7 04-Apr-2003  matt Rework l2cr/l3cr enabling/printing code. Make printing table driven.
 1.6 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.5 29-Mar-2003  matt Make sure to turn on the speed knobs in HID0 on the 745x.
 1.4 15-Mar-2003  matt s;backside;; and report L2CR_L2DO & L2CR_L2IO
 1.3 14-Mar-2003  matt Use aprint_normal. Print 2MB L2 sizes with 7410.
 1.2 26-Feb-2003  jklos Added L3CR_CONFIG for support of 745x G4 L3 cache configuration.
 1.1 03-Feb-2003  matt Rename PPC_MPC6XX to PPC_OEA (and any mpc6xx reference to oea).
 1.8.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.7 04-Feb-2005  skrll Sync with HEAD.
 1.8.2.6 24-Jan-2005  skrll Sync with HEAD.
 1.8.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.8.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.2.1 29-Apr-2005  kent sync with -current
 1.22.2.1 12-Feb-2005  yamt sync with head.
 1.24.2.8 27-Feb-2008  yamt sync with head.
 1.24.2.7 11-Feb-2008  yamt sync with head.
 1.24.2.6 21-Jan-2008  yamt sync with head
 1.24.2.5 07-Dec-2007  yamt sync with head
 1.24.2.4 27-Oct-2007  yamt sync with head.
 1.24.2.3 03-Sep-2007  yamt sync with head.
 1.24.2.2 30-Dec-2006  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.26.8.1 11-Aug-2006  yamt sync with head
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.27.6.1 10-Dec-2006  yamt sync with head.
 1.27.4.1 18-Nov-2006  ad Sync with head.
 1.28.16.7 11-Oct-2007  garbled Fix the NOTICE: curlwp should be set before main() on OEA machines.
 1.28.16.6 11-Oct-2007  garbled Move a bunch of the macppc SMP code out of macppc, and down into the
generic OEA code. Add a set of md callbacks into these shared routines,
that any oeappc SMP machine needs to provide. This allows for generally
shared SMP startup code, but still allows for machine-specific
differences in the setup and kicking of the new CPU.

Convert macppc to this new layout. Tested by Macallan.

Add an initial attempt at SMP to prep. Tested on UP machine only,
untested on SMP yet.
 1.28.16.5 04-Oct-2007  macallan add event counters for IPIs received on each CPU
 1.28.16.4 03-Oct-2007  garbled Sync with HEAD
 1.28.16.3 02-Aug-2007  macallan sync with HEAD
 1.28.16.2 26-Jun-2007  garbled Sync with HEAD.
 1.28.16.1 22-May-2007  matt Update to HEAD.
 1.28.10.1 11-Jul-2007  mjf Sync with head.
 1.28.8.5 03-Dec-2007  ad Sync with HEAD.
 1.28.8.4 23-Oct-2007  ad Sync with head.
 1.28.8.3 15-Jul-2007  ad Sync with head.
 1.28.8.2 09-Jun-2007  ad Sync with head.
 1.28.8.1 27-May-2007  ad Sync with head.
 1.28.4.1 03-Apr-2007  matt Adapt powerpc to yamt-idlelwp. Nuke cpu_setfunc.
Don't define _HAVE_BITENDIAN_BITOPS. Misc cleanups.
 1.32.14.2 18-Nov-2007  bouyer Sync with HEAD
 1.32.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.32.12.1 18-Oct-2007  yamt sync with head.
 1.32.10.3 23-Mar-2008  matt sync with HEAD
 1.32.10.2 09-Jan-2008  matt sync with HEAD
 1.32.10.1 06-Nov-2007  matt sync with HEAD
 1.32.8.2 21-Nov-2007  joerg Sync with HEAD.
 1.32.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.33.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.33.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.35.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.35.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.44.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.44.6.4 05-Oct-2008  mjf Sync with HEAD.
 1.44.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.44.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.44.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.44.2.1 24-Mar-2008  keiichi sync with head.
 1.46.6.2 10-Oct-2008  skrll Sync with HEAD.
 1.46.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.46.4.2 11-Mar-2010  yamt sync with head
 1.46.4.1 04-May-2009  yamt sync with head.
 1.46.2.1 04-Jun-2008  yamt sync with head
 1.47.4.1 19-Oct-2008  haad Sync with HEAD.
 1.50.14.4 12-Feb-2011  matt Add IBM750GX support (from Bob Lee).
 1.50.14.3 28-Jan-2011  matt IBM750FX has HIGHBAT (BATs >= 4)
 1.50.14.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.50.14.1 07-Jan-2011  matt Deal with new powerpc world.
 1.50.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.50.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.51.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.54.2.4 06-Nov-2010  uebayasi Sync with HEAD.
 1.54.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.54.2.2 27-May-2010  uebayasi Fix build.
 1.54.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.55.2.2 12-Jun-2011  rmind sync with head
 1.55.2.1 05-Mar-2011  rmind sync with head
 1.59.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.61.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.62.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.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.70.2.2 30-Oct-2012  yamt sync with head
 1.70.2.1 17-Apr-2012  yamt sync with head
 1.73.6.3 03-Dec-2017  jdolecek update from HEAD
 1.73.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.73.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.76.2.1 18-May-2014  rmind sync with head
 1.82.6.1 28-Aug-2017  skrll Sync with HEAD
 1.90.2.4 18-Jan-2019  pgoyette Synch with HEAD
 1.90.2.3 25-Jun-2018  pgoyette Sync with HEAD
 1.90.2.2 21-May-2018  pgoyette Sync with HEAD
 1.90.2.1 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.97.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.97.2.1 10-Jun-2019  christos Sync with HEAD
 1.104.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.107.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.108.16.2 22-Feb-2025  martin Pull up following revision(s) (requested by jmcneill in ticket #1057):

distrib/utils/embedded/conf/evbppc.conf: revision 1.4
sys/arch/powerpc/oea/cpu_subr.c: revision 1.111
sys/arch/evbppc/wii/pic_pi.c: revision 1.2
sys/arch/evbppc/conf/WII: revision 1.9
sys/arch/evbppc/wii/dev/bwai.c: revision 1.4

wii: Simplify Processor Interface pic code.

wii: Audio playback improvements.
Instead of resetting the byte counter for every block (which is racy),
increment the interrupt timing register by the exact byte count for
each block. Should do better at keeping things in sync.

powerpc: Identify Broadway CPU.
Use hex to report Broadway revision and ignore TAU as it does not exist
on this processor.

wii: Remove some options to save memory.

wii: Disable ntpd by default.
It takes up a lot of memory.
 1.108.16.1 03-Feb-2024  martin Pull up following revision(s) (requested by jmcneill in ticket #561):

etc/etc.evbppc/Makefile.inc: revision 1.15
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.1
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.2
sys/arch/evbppc/wii/dev/bwdsp.c: revision 1.1
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.3
sys/arch/evbppc/wii/dev/bwdsp.c: revision 1.2
distrib/utils/embedded/files/evbppc_wii_icon.png: revision 1.1
usr.sbin/sysinst/arch/evbppc/md.h: revision 1.4
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.4
sys/arch/evbppc/wii/dev/viio.h: revision 1.1
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.5
sys/arch/evbppc/wii/dev/mainbus.h: revision 1.1
distrib/utils/embedded/conf/wii.conf: revision 1.1
distrib/utils/embedded/conf/wii.conf: revision 1.2
distrib/utils/embedded/conf/wii.conf: revision 1.3
sys/dev/sdmmc/sdhcvar.h: revision 1.34
sys/dev/sdmmc/sdhc.c: revision 1.118
sys/arch/evbppc/wii/dev/resetbtn.c: revision 1.1
distrib/utils/embedded/conf/evbppc.conf: revision 1.1
sys/dev/wsfb/genfb.c: revision 1.91
sys/arch/evbppc/wii/dev/resetbtn.c: revision 1.2
sys/dev/wscons/wsconsio.h: revision 1.127
sys/arch/powerpc/oea/oea_machdep.c: revision 1.85
sys/arch/evbppc/wii/dev/hollywood.h: revision 1.1
sys/arch/evbppc/conf/std.wii: revision 1.1
sys/arch/evbppc/wii/dev/hollywood.h: revision 1.2
sys/arch/evbppc/wii/dev/hollywood.c: revision 1.1
sys/arch/evbppc/conf/std.wii: revision 1.2
sys/arch/evbppc/wii/dev/hollywood.c: revision 1.2
sys/arch/evbppc/conf/std.wii: revision 1.3
sys/arch/powerpc/oea/cpu_subr.c: revision 1.109
sys/arch/evbppc/wii/wii_mmuinit.S: revision 1.1
sys/dev/usb/usb.h: revision 1.124
sys/arch/evbppc/wii/machdep.c: revision 1.1
sys/arch/evbppc/wii/dev/rtcsram.c: revision 1.1
sys/arch/powerpc/include/oea/hid.h: revision 1.14
sys/arch/evbppc/wii/mainbus.c: revision 1.1
sys/arch/evbppc/wii/machdep.c: revision 1.2
sys/arch/evbppc/wii/dev/ehci_hollywood.c: revision 1.1
sys/arch/evbppc/wii/mainbus.c: revision 1.2
sys/arch/evbppc/wii/machdep.c: revision 1.3
sys/arch/evbppc/wii/dev/ehci_hollywood.c: revision 1.2
sys/arch/evbppc/wii/mainbus.c: revision 1.3
sys/arch/evbppc/wii/machdep.c: revision 1.4
sys/arch/evbppc/wii/dev/hwgpio.c: revision 1.1
sys/arch/evbppc/wii/dev/sdhc_hollywood.c: revision 1.1
sys/arch/evbppc/wii/dev/sdhc_hollywood.c: revision 1.2
sys/arch/evbppc/wii/wii_locore.S: revision 1.1
sys/arch/evbppc/conf/files.wii: revision 1.1
sys/arch/evbppc/wii/wii_locore.S: revision 1.2
sys/arch/evbppc/include/wii.h: revision 1.1
sys/arch/evbppc/conf/files.wii: revision 1.2
sys/arch/evbppc/wii/dev/exi.c: revision 1.1
sys/arch/evbppc/include/wii.h: revision 1.2
sys/arch/evbppc/conf/files.wii: revision 1.3
sys/arch/powerpc/powerpc/clock.c: revision 1.18
sys/arch/evbppc/include/wii.h: revision 1.3
sys/arch/evbppc/conf/files.wii: revision 1.4
sys/arch/evbppc/include/wii.h: revision 1.4
sys/arch/evbppc/wii/dev/exi.h: revision 1.1
sys/arch/evbppc/wii/dev/avenc.c: revision 1.1
sys/arch/evbppc/include/wii.h: revision 1.5
sys/arch/evbppc/include/wii.h: revision 1.6
sys/arch/evbppc/include/wii.h: revision 1.7
sys/arch/evbppc/wii/dev/avenc.h: revision 1.1
distrib/utils/embedded/mkimage: revision 1.79
sys/arch/evbppc/conf/WII: revision 1.1
sys/arch/evbppc/conf/INSTALL_WII: revision 1.1
distrib/utils/embedded/files/evbppc_wii_meta.xml: revision 1.1
sys/arch/evbppc/wii/dev/vireg.h: revision 1.1
sys/arch/evbppc/conf/WII: revision 1.2
distrib/utils/embedded/files/evbppc_wii_meta.xml: revision 1.2
sys/arch/evbppc/wii/dev/vireg.h: revision 1.2
sys/arch/evbppc/conf/WII: revision 1.3
sys/arch/evbppc/conf/WII: revision 1.4
usr.sbin/sysinst/arch/evbppc/md.c: revision 1.11
sys/arch/evbppc/wii/dev/ohci_hollywood.c: revision 1.1
sys/dev/usb/ehcivar.h: revision 1.52
sys/arch/evbppc/wii/pic_pi.c: revision 1.1
sys/arch/evbppc/wii/dev/ohci_hollywood.c: revision 1.2
etc/etc.evbppc/ttys: revision 1.8
sys/arch/evbppc/wii/dev/bwai.c: revision 1.1
sys/arch/evbppc/wii/dev/bwai.c: revision 1.2
sys/arch/evbppc/wii/dev/bwai.c: revision 1.3
sys/arch/evbppc/wii/autoconf.c: revision 1.1
sys/arch/evbppc/conf/Makefile.wii.inc: revision 1.1
sys/arch/evbppc/wii/dev/bwai.h: revision 1.1
sys/arch/evbppc/wii/autoconf.c: revision 1.2
sys/arch/evbppc/conf/Makefile.wii.inc: revision 1.2

powerpc: oea: Fix prefetchable mappings
Prefetchable mappings need PMAP_NOCACHE to get write-combine semantics.
powerpc: oea: Decode IBM750CL L2 cache information.
sdmmc: add support for optional delay after register write
wscons: Add HOLLYWOOD display and YUY2 pixel format types
wsfb: add support for optional "devcmap" property
A hardware driver can supply a pointer to a 16x 32-bit array to override
the default rasops device colour map in the "devcmap" property.
ehci: add EHCIF_32BIT_ACCESS flag to force 32-bit MMIO
fix comments: HID0 ICFI/DCFI are "flash invalidate", not "flush invalidate"
powerpc: fix delay for large (> ~5sec) values
When calculating the target timebase, promote '1000' on the RHS to ULL
to force 64-bit calculation, otherwise 'n * 1000' will overflow.
usb: increase USB_PORT_RESET_RECOVERY from 10ms to 20ms
I changed this from 250ms to 10ms back in 2021 based on a similar FreeBSD
change, but it seems to be a bit too aggressive for some platforms.
evbppc: Add initial support for the Nintendo Wii
wii: support RB_POWERDOWN
build fix: use dd with count=1 for compat with NetBSD dd(1)
wii: Add NTSC 480p support.
In addition to this, add VIIO_{GET,SET}REGS ioctl support to allow for
poking at video interface registers from userland. This is helpful for
debugging display issues.
wii: Add 128x48 icon to SD card image
wii: Fix a comment
wii: Add drivers for Broadway DSP and Audio interface.
0: [*] audio0 @ bwdsp0: Broadway DSP
playback: 16, 2ch, 48000Hz
record: unavailable
(P-) slinear_be 16/16, 2ch, { 48000 }
wii: Add screenblank support.
wii: Use screen dimming register for screen blanking.
wii: Add GPIO, I2C, and basic A/V encoder driver.
wii: Use A/V encoder volume controls instead of using a software filter.
wii: Simply DSP driver - no interrupt handler required.
wii: provide device names to intr_establish
wii$ intrctl list
interrupt id CPU0 device name(s)
pi irq 14 64769* hollywood0
hollywood irq 36 5872* ehci0
hollywood irq 39 58907* sdhc0
hollywood irq 40 4* sdhc1
hollywood irq 49 0* resetbtn0
pi irq 5 0* bwai0
wii: Add support for passing boot options to the kernel.
wii: Add External interface bus and RTC support
wii: Remove objcopy after kernel build.
HBC will do the right thing.
Add wsvt25 entries (off by default) for ttyE0-ttyE3.
Add support for "PAL" (576i) mode on Wii.
 1.109.2.1 02-Aug-2025  perseant Sync with HEAD
 1.29 24-Feb-2021  thorpej Add a provision for a per-cpu battable. Each CPU starts with the global
one, but this allows CPUs to temporarily switch to an alternate battable
if needed.
 1.28 06-Jul-2020  rin branches: 1.28.2;
Style and cosmetic changes. No binary changes intended.
 1.27 15-Jul-2018  maxv Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
 1.26 01-Feb-2012  matt branches: 1.26.46; 1.26.48;
Enable XBSEN and HIGHBAT for OEA 7455 and related CPUs.
The BAT entries now have a resolution of 8MB. (Adjacent entries are merged
up to a total of 2GB per entry).
 1.25 20-Jun-2011  matt branches: 1.25.2; 1.25.6;
Don't include *pmap.h in assembly files. Get the needed definitions
from "assym.h".
 1.24 20-Jun-2011  matt Make struct cpu_info the same size if building MODULAR
kernels or compiling a module.
 1.23 18-Jun-2011  matt Make a common genassym.cf (powerpc/genassym.cf) and then
only put specific stuff in foo/genassym.cf
 1.22 17-Jun-2011  matt Add IPL_HIGH and IPL_SCHED so locore.S can use them.
 1.21 16-Jun-2011  matt ifdef / define / endif can't be the first thing. So move that block down.
 1.20 16-Jun-2011  matt Make __HAVE_FAST_SOFTINTS appear in assym.h so all oeas don't need to include
<powerpc/intr.h>
XXX <powerpc/intr.h> should be <powerpc/oea/intr.h>
 1.19 16-Jun-2011  macallan enable FAST_SOFTINTR support for all ports that use powerpc/pic/
This has been successfully tested on macppc
TODO:
- ibm4xx needs to be adapted
- SMP doesn't work yet, 2nd CPU crashes when trying to leave the idle loop
 1.18 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.17 18-Jan-2011  matt branches: 1.17.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.16 20-Mar-2010  chs branches: 1.16.2;
fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.15 10-Dec-2009  rmind branches: 1.15.2; 1.15.4;
Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.14 23-Feb-2008  matt branches: 1.14.4; 1.14.26;
Add MTX_* and RW_* definitions
 1.13 05-Feb-2008  garbled branches: 1.13.2; 1.13.6;
Rewrite a big chunk of the pmap and locore code for powerpc to better
deal with the 64bit bridge mode. pmap changes by Matt Thomas, rest by myself.

Change pmap.c to work similar to exec_elf.c to allow us to compile in
multiple pmaps to a single kernel. This allows the pmap for bridge64 to
co-exist with the 32bit pmap.

Yank __HAVE_PMAP_PHYSSEG from all the oea code.

Add a new global, "oeacpufeat", which is used early in locore to determine
certain cpu features. This allows us to conditionalize code early in the boot
for certain CPUs that have special needs.

Yank most of the ifdef PPC_OEA_BRIDGE64 code from almost every file it was
found in. Some of it seemed incorrect, and my 7044 booted just fine
without it. It would appear that the bridge cpus treat BAT instructions
as nops, so they seem to be safe.

In ofppc, check the oeacpufeat, and if we are on a 64bit proc, clear
MSR[SF], and ASR[V].

With all of these changes, a kernel with both PPC_OEA and PPC_OEA_BRIDGE64
will boot on the POWERIII-2 cpu. However, it will not yet boot on a 32bit
cpu, because of CACHELINESIZE. Work remains to be done there to fix that.
 1.12 17-Oct-2007  garbled branches: 1.12.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.11 18-May-2007  rjs branches: 1.11.10;
Fix for yamt-idlelwp merge.
 1.10 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.9 11-Dec-2005  christos branches: 1.9.26; 1.9.30; 1.9.32; 1.9.38;
merge ktrace-lwp.
 1.8 19-Jan-2005  matt branches: 1.8.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.7 21-Nov-2003  matt branches: 1.7.8;
Restore ci_curpm since it re-enables 603 to working state.
 1.6 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.5 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.4 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.3 08-Aug-2003  matt Nuke ci_spillstk/CI_SPILLSTK. No longer needed.
 1.2 03-Aug-2003  matt Add CPUSAVE_* and each register in the saveframe and faultbuf.
 1.1 03-Feb-2003  matt branches: 1.1.2;
Rename PPC_MPC6XX to PPC_OEA (and any mpc6xx reference to oea).
 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.7.8.1 29-Apr-2005  kent sync with -current
 1.8.8.3 27-Feb-2008  yamt sync with head.
 1.8.8.2 11-Feb-2008  yamt sync with head.
 1.8.8.1 03-Sep-2007  yamt sync with head.
 1.9.38.2 02-Aug-2007  macallan sync with HEAD
 1.9.38.1 22-May-2007  matt Update to HEAD.
 1.9.32.1 11-Jul-2007  mjf Sync with head.
 1.9.30.1 27-May-2007  ad Sync with head.
 1.9.26.1 03-Apr-2007  matt Adapt powerpc to yamt-idlelwp. Nuke cpu_setfunc.
Don't define _HAVE_BITENDIAN_BITOPS. Misc cleanups.
 1.11.10.2 23-Mar-2008  matt sync with HEAD
 1.11.10.1 06-Nov-2007  matt sync with HEAD
 1.12.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.13.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.2.1 24-Mar-2008  keiichi sync with head.
 1.14.26.3 26-Jan-2011  matt Change battable to have a granularity of 8MB.
 1.14.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.14.26.1 07-Jan-2011  matt Deal with new powerpc world.
 1.14.4.2 11-Aug-2010  yamt sync with head.
 1.14.4.1 11-Mar-2010  yamt sync with head
 1.15.4.3 12-Jun-2011  rmind sync with head
 1.15.4.2 05-Mar-2011  rmind sync with head
 1.15.4.1 30-May-2010  rmind sync with head
 1.15.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.16.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.25.6.1 18-Feb-2012  mrg merge to -current.
 1.25.2.1 17-Apr-2012  yamt sync with head
 1.26.48.1 10-Jun-2019  christos Sync with HEAD
 1.26.46.1 28-Jul-2018  pgoyette Sync with HEAD
 1.28.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.2 17-Oct-2007  garbled branches: 1.2.2; 1.2.4; 1.2.8; 1.2.26; 1.2.34; 1.2.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.1 09-May-2007  garbled branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10;
file kgdb_glue.c was initially added on branch ppcoea-renovation.
 1.1.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.1.8.1 18-Oct-2007  yamt sync with head.
 1.1.6.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.1.2.1 09-May-2007  garbled Bebox, mvmeppc, pmppc and sandpoint all have this file, and they are all
identical. Put it in one place for all to find.
 1.2.40.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.34.1 28-Apr-2009  skrll Sync with HEAD.
 1.2.26.1 04-May-2009  yamt sync with head.
 1.2.8.2 06-Nov-2007  matt sync with HEAD
 1.2.8.1 17-Oct-2007  matt file kgdb_glue.c was added on branch matt-armv6 on 2007-11-06 23:20:44 +0000
 1.2.4.2 27-Oct-2007  yamt sync with head.
 1.2.4.1 17-Oct-2007  yamt file kgdb_glue.c was added on branch yamt-lazymbuf on 2007-10-27 11:27:53 +0000
 1.2.2.2 23-Oct-2007  ad Sync with head.
 1.2.2.1 17-Oct-2007  ad file kgdb_glue.c was added on branch vmlocking on 2007-10-23 20:36:08 +0000
 1.85 20-Jan-2024  jmcneill powerpc: oea: Fix prefetchable mappings

Prefetchable mappings need PMAP_NOCACHE to get write-combine semantics.
 1.84 07-Aug-2022  andvar branches: 1.84.4;
fix typos in comments.
 1.83 05-Dec-2021  msaitoh s/specificed/specified/ in comment.
 1.82 27-Feb-2021  thorpej Rather than putting it on the caller, just let oea_iobat_add() decide
whether to call mpc601_ioseg_add().
 1.81 06-Jul-2020  rin branches: 1.81.2;
Drop unused opt_compat_netbsd.h include.
 1.80 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.79 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.78 31-Dec-2019  ad Rename uvm_free() -> uvm_availmem().
 1.77 21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.76 06-Feb-2019  mrg - add or adjust fallthru comments
 1.75 15-Jul-2018  maxv Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
 1.74 11-Feb-2018  mrg branches: 1.74.2; 1.74.4;
introduce a inline function to set a value to zero while
hiding this fact from GCC. this allows the PPC code that
writes to address zero to actually work rather than cause
GCC to emit an explicit "trap" instruction, which in early
boot means hang on my pegasosII. use this in oae_init()
for both rfid->rfi and also setting the jump-to-zero trap.

found with a lot of debugging, but GCC 6's new warning
-Wnull-dereference found it when i was informed of its
existence. unfortunately, there are dozens of other
violations in our kernel today so simply enabling that
option for everything is not a good idea, but is a goal.
 1.73 30-May-2016  chs allocate cpuset structures needed by MP DDB.
 1.72 06-Jul-2015  matt Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext.
 1.71 24-Mar-2014  christos branches: 1.71.4; 1.71.6;
use cpu_{g,s}etmodel
 1.70 03-Mar-2014  macallan support ppc601
from scole_mail, ok matt@
 1.69 28-Feb-2014  matt Use more appropriate type.
 1.68 03-Nov-2013  mrg - remove set but unused variables
- move some variables inside their relevant use #ifdef
 1.67 31-Aug-2013  matt convert rfid to rfi in exception handlers.
 1.66 31-Aug-2013  matt Move the pmap_setup to the start oea_init (no non-OFW ports can use it).
If PPC_OEA64_BRIDGE is defined, add code so that when OEACPU_64_BRIDGE is not
present, it replaces the rfid with rfi and mfmsr/rldicl/mtmsrd sequence
with NOPs. This allows plain OEA kernels to work. (tested on PMPPC with
PPC_OEA64_BRIDGE option added).
 1.65 04-Jul-2013  joerg When trying to write into page 0, use volatile to force the compiler to
actually create this access.
 1.64 16-Feb-2012  matt branches: 1.64.2; 1.64.4;
Allow use of large (>256MB) bats for iobats. If XBSEN isn't present, they
will be "downsized" into multiple 256MB bats. Tested by riz.
 1.63 15-Feb-2012  macallan branches: 1.63.2;
fix crash during early startup - we can't call OpenFirmware between zapping
the BATs and complete setting them up again
ok releng
 1.62 01-Feb-2012  matt Use kmem instead of malloc. Remove unneeded <sys/malloc.h> includes.
 1.61 01-Feb-2012  matt Enable XBSEN and HIGHBAT for OEA 7455 and related CPUs.
The BAT entries now have a resolution of 8MB. (Adjacent entries are merged
up to a total of 2GB per entry).
 1.60 17-Jul-2011  joerg branches: 1.60.2; 1.60.6;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.59 30-Jun-2011  matt Modify mapiodev to take a third argument indicating whether the space
should be prefetchable (true) or not (false).
 1.58 20-Jun-2011  matt Cleanup includes. (<net/netisr.h> is handled by softints, not MD anymore,
so this can be nuked).
 1.57 18-Jun-2011  matt Call cpu_fixup_stubs at the end of oea_machdep
 1.56 18-Jan-2011  matt branches: 1.56.4;
Fix some fallout from building the macppc GENERIC.MP.
 1.55 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.54 14-Jan-2011  rmind branches: 1.54.2;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.53 25-Feb-2010  matt branches: 1.53.2;
Adapt to spr.h breakup.
 1.52 08-Feb-2010  joerg Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.51 27-Nov-2009  rmind branches: 1.51.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.50 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.49 21-Nov-2009  rmind Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.48 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.47 07-Jun-2009  phx MSGBUFADDR creates a msgbuf at a fixed address, usually defined by the port's
config file.
The use of MSGBUGADDR was already prepared in powerpc/oea/pmap.c years ago,
but was never used and missing powerpc/oea/oea_machdep.c. The option will
be used by port amigappc.
 1.46 02-Jul-2008  ad branches: 1.46.18;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.
 1.45 24-May-2008  phx branches: 1.45.2;
Make oea_init() support systems with high-vector configurations (i.e exception
vectors at 0xfff00000), and trap_subr.S allows the kernel to be in a memory
region which is not reachable by absolute branch instructions (ba and bla).

High-vector support can be enabled by option PPC_HIGH_VEC, and long-branches
to the kernel are enabled by the option DISTANT_KERNEL.
 1.44 14-Feb-2008  garbled branches: 1.44.6; 1.44.8; 1.44.10; 1.44.12;
Some powerpc cleanup. Remove unneeded/bad usage of extern oeacpufeat.
Convert asm code to use %r register format. Done by comparison to
disassembled output, double checked with diff of dissasembled output
before and after, and test booted on my 7044.
 1.43 07-Feb-2008  garbled Code to disable BAT use on cpu's that either don't have BAT's, or don't
gain any benefit from them. This nets a small speedup on the POWER3, and
is probably needed for POWER5, which might not emulate BATs like the 3 does.
Also, thanks to Matt Thomas, who suggested re-using alitrap rather than
writing a new dsinobattrap that would have looked remarkably identical
when finished.
 1.42 07-Feb-2008  matt Cleanup a few 601 ifdefs.
 1.41 06-Feb-2008  garbled Some minor cleanup in the PPC_OEA601 code, and a fix for bridge-mode
cpus, which apparently still need the non-601 code to zap various
instructions into nops.
 1.40 05-Feb-2008  garbled Ifdef out all the MPC601 code with PPC_OEA601. Now only arches that have the
possibility of running on an MPC601, are infected with all the extra code
and nops that it added.

Also, fix compilation that I broke with the pmap code, by adding
oeacpufeat to the locores of various ppc arches. Noted by mlelstv.
 1.39 28-Jan-2008  garbled Apparently BRIDGE mode allows BAT registers, so re-enable that code.
Change the pegasos PCI_NETBSD_CONFIGURE arguments around to wire up mem
space into the correct area, and move the io regs a little to make it
work properly. Just avoid the secondary PCI entirely.
Change the list of things that we fiddle with in pci_conf_hook. Map mem
on the fwohci, avoid display cards, avoid IO on the auvia.
Change some printf's to aprint_*
Yank a call to genppc_pci_indirect_make_tag and change it to the
bus-independant pci call instead. (in pci_conf_hook)
 1.38 09-Jan-2008  garbled Make this compile when compiling in bridge mode w/o ALTIVEC
 1.37 03-Dec-2007  ad branches: 1.37.6;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.36 17-Oct-2007  garbled branches: 1.36.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.35 14-Jul-2007  ad branches: 1.35.8; 1.35.10; 1.35.12; 1.35.14;
Generic soft interrupts are mandatory.
 1.34 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.33 04-Mar-2007  macallan branches: 1.33.2; 1.33.4; 1.33.10;
make this compile again
 1.32 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.31 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.30 09-Feb-2007  ad branches: 1.30.2;
Merge newlock2 to head.
 1.29 18-Sep-2006  sanjayl Remove debug printf
 1.28 31-Aug-2006  freza branches: 1.28.2; 1.28.4;
* move the "cheating" conditional into unmapiodev() implementation
itself (instead of memio_unmap()), as it differs between OEA and
ibm4xx.

OK by matt@
 1.27 31-Aug-2006  matt Add unmapiodev(vaddr_t, vsize_t) (to be used by bus_space_unmap)
 1.26 05-Aug-2006  sanjayl 1st cut of Powermac G5 support (uses bridge mode).
 1.25 04-Jun-2006  mrg undef memset before calling it with a destination address of 0.
GCC4.1 complains about this when using the builtin, so force
this to call the real function normally.
 1.24 24-Dec-2005  perry branches: 1.24.4; 1.24.6; 1.24.8; 1.24.14;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.23 11-Dec-2005  christos merge ktrace-lwp.
 1.22 02-Jun-2005  he branches: 1.22.2;
Fix variable shadowing warnings by renaming the innermost variables.
 1.21 25-Apr-2005  lukem Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.
 1.20 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.19 26-Jun-2004  kleink branches: 1.19.4; 1.19.6;
On OEA, turn PSL_USER* into runtime values appropriate for the CPU model
we're executing on; besides dealing with the bits not implemented in the
601's MSR it also removes the silent failure behaviour when passing
PSL_VEC set on a CPU not implementing it.

Also, fix those masks for the 4xx again.
 1.18 23-Jun-2004  kleink On MPC601s, rewrite any (unimplemented) tlbsync instruction as a sync.
 1.17 09-Jun-2004  kleink Get rid of the silly CPU601 hooks and move BAT register restoration and
obliteration to RESTORE_{KERN,USER}_SRS, respectively; have oea_init()
patch these sequences to be skipped on non-MPC601s. The code sequence
matching heuristic isn't as pretty as the one for VRSAVE and MQ but works
well enough with the current structure of the trap code, and can be easily
updated when necessary.
 1.16 01-Apr-2004  matt Remove softintr__init call.
 1.15 24-Mar-2004  matt branches: 1.15.2;
Add latent generic soft interrupt initialization.
 1.14 31-Jan-2004  uebayasi Typo typo.
 1.13 30-Dec-2003  pk Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.
 1.12 21-Nov-2003  matt Restore ci_curpm since it re-enables 603 to working state.
 1.11 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.10 08-Aug-2003  matt Nuke ci_spillstk/CI_SPILLSTK. No longer needed.
 1.9 15-Jul-2003  lukem __KERNEL_RCSID()
 1.8 02-Apr-2003  thorpej branches: 1.8.2;
Use PAGE_SIZE rather than NBPG.
 1.7 29-Mar-2003  matt Allow oea_batinit to be called with either the MMU on or off.
(don't reset the BATs if the MMU is off).
 1.6 15-Mar-2003  matt Add LINTSTUBs and make oea_init() agree with them.
 1.5 05-Mar-2003  matt Make AltiVec registers available via ptrace/procfs. Simplify AltiVec
processing. Add a "common" procfs_machdep.c for PowerPC platforms.
Even though it is supposed to be port specific, most (if not all)
PowerPC ports can just use the common one.
 1.4 08-Feb-2003  matt Don't try to reserve DEAD zone unless the kernel address space encompasses it.
 1.3 06-Feb-2003  matt Add oea_iobat_remove(paddr_t).
 1.2 05-Feb-2003  matt Make things a bit more LP64 friendly.
 1.1 03-Feb-2003  matt Rename PPC_MPC6XX to PPC_OEA (and any mpc6xx reference to oea).
 1.8.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.2.1 01-Apr-2004  jmc Pullup rev 1.16 (requested by matt in ticket #44)

Move to softintr__init to cpu_startup and remove softintr__init call for oea.
 1.19.6.1 28-Jan-2005  yamt convert arch/powerpc to new apis.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.22.2.10 27-Feb-2008  yamt sync with head.
 1.22.2.9 11-Feb-2008  yamt sync with head.
 1.22.2.8 04-Feb-2008  yamt sync with head.
 1.22.2.7 21-Jan-2008  yamt sync with head
 1.22.2.6 07-Dec-2007  yamt sync with head
 1.22.2.5 27-Oct-2007  yamt sync with head.
 1.22.2.4 03-Sep-2007  yamt sync with head.
 1.22.2.3 26-Feb-2007  yamt sync with head.
 1.22.2.2 30-Dec-2006  yamt sync with head.
 1.22.2.1 21-Jun-2006  yamt sync with head.
 1.24.14.1 19-Jun-2006  chap Sync with head.
 1.24.8.3 03-Sep-2006  yamt sync with head.
 1.24.8.2 11-Aug-2006  yamt sync with head
 1.24.8.1 26-Jun-2006  yamt sync with head.
 1.24.6.1 07-Jun-2006  kardel Sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.28.4.1 22-Oct-2006  yamt sync with head
 1.28.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.28.2.1 18-Nov-2006  ad Sync with head.
 1.30.2.3 03-Apr-2007  matt Install a "call to 0" panic routine rather than falling through to trap.
 1.30.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.30.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.33.10.5 17-Oct-2007  garbled Back out most of the PIC rennovation on ev64260, it was not completed,
and can be completed post-merge. With these changes, ev64260 compiles
again on the branch. Untested.
 1.33.10.4 03-Oct-2007  garbled Sync with HEAD
 1.33.10.3 02-Aug-2007  macallan sync with HEAD
 1.33.10.2 22-May-2007  matt Update to HEAD.
 1.33.10.1 10-May-2007  garbled HAVE_GENERIC_SOFTINTRS is no longer optional. Delete ifndef'd code from
oea_machdep.c, and move softintr__init() to oea_startup(). Remove
softintr__init from every port's cpu_startup().
 1.33.4.1 11-Jul-2007  mjf Sync with head.
 1.33.2.4 03-Dec-2007  ad Sync with HEAD.
 1.33.2.3 23-Oct-2007  ad Sync with head.
 1.33.2.2 15-Jul-2007  ad Sync with head.
 1.33.2.1 27-May-2007  ad Sync with head.
 1.35.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.35.12.1 18-Oct-2007  yamt sync with head.
 1.35.10.3 23-Mar-2008  matt sync with HEAD
 1.35.10.2 09-Jan-2008  matt sync with HEAD
 1.35.10.1 06-Nov-2007  matt sync with HEAD
 1.35.8.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.35.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.36.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.36.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.37.6.1 10-Jan-2008  bouyer Sync with HEAD
 1.44.12.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.44.12.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.44.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.44.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.44.10.3 11-Mar-2010  yamt sync with head
 1.44.10.2 20-Jun-2009  yamt sync with head
 1.44.10.1 04-May-2009  yamt sync with head.
 1.44.8.1 04-Jun-2008  yamt sync with head
 1.44.6.2 02-Jul-2008  mjf Sync with HEAD.
 1.44.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.45.2.1 03-Jul-2008  simonb Sync with head.
 1.46.18.4 28-Jan-2011  matt If a CPU has HIGHBAT, then use them. We dynamically change dsitrap to
select between bats 4-7 when HIGHBAT is detected.
 1.46.18.3 26-Jan-2011  matt Change battable to have a granularity of 8MB.
 1.46.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.46.18.1 07-Jan-2011  matt Deal with new powerpc world.
 1.51.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.53.2.1 05-Mar-2011  rmind sync with head
 1.54.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.56.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.60.6.1 18-Feb-2012  mrg merge to -current.
 1.60.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.60.2.1 17-Apr-2012  yamt sync with head
 1.63.2.4 18-May-2016  martin Pull up following revision(s) (requested by matt in ticket #1310):
sys/arch/powerpc/include/userret.h: revision 1.29-1.30
sys/arch/powerpc/include/psl.h: revision 1.20
sys/arch/powerpc/oea/oea_machdep.c: revision 1.72
(via patch)

Add a check to make sure that if PSL_FP is set, we own the FPU.
Don't clear PSL_FP/PSL_VEC
Remove PSL_SPV from BOOKE PSL_USERMOD
Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext.
 1.63.2.3 19-Nov-2015  bouyer Revert ticket 1310 (second try):
> sys/arch/powerpc/include/psl.h 1.20
> sys/arch/powerpc/include/userret.h 1.29, 1.30
> sys/arch/powerpc/oea/altivec.c 1.30
> sys/arch/powerpc/oea/oea_machdep.c 1.72
> sys/arch/powerpc/powerpc/fpu.c 1.36
>
> powerpc PCU fixes

because it breaks the build:
http://releng.netbsd.org/builds/netbsd-6/201511152000Z/
 1.63.2.2 16-Nov-2015  bouyer Revert ticket 1310:
> sys/arch/powerpc/include/psl.h 1.20
> sys/arch/powerpc/include/userret.h 1.29, 1.30
> sys/arch/powerpc/oea/altivec.c 1.30
> sys/arch/powerpc/oea/oea_machdep.c 1.72
> sys/arch/powerpc/powerpc/fpu.c 1.36
>
> powerpc PCU fixes

because it breaks the build:
http://releng.netbsd.org/builds/netbsd-6/201511152000Z/
 1.63.2.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by matt in ticket #1310):
sys/arch/powerpc/include/userret.h: revision 1.30
sys/arch/powerpc/powerpc/fpu.c: revision 1.36
sys/arch/powerpc/include/psl.h: revision 1.20
sys/arch/powerpc/include/userret.h: revision 1.29
sys/arch/powerpc/oea/oea_machdep.c: revision 1.72
sys/arch/powerpc/oea/altivec.c: revision 1.30
Add a check to make sure that if PSL_FP is set, we own the FPU.
Don't clear PSL_FP/PSL_VEC
Don't reload if just re-enabling
Don't reload the FPU register if this is just a re-enable.
Remove PSL_SPV from BOOKE PSL_USERMOD
Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext.
 1.64.4.2 18-May-2014  rmind sync with head
 1.64.4.1 28-Aug-2013  rmind sync with head
 1.64.2.2 03-Dec-2017  jdolecek update from HEAD
 1.64.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.71.6.2 09-Jul-2016  skrll Sync with HEAD
 1.71.6.1 22-Sep-2015  skrll Sync with HEAD
 1.71.4.1 17-Jul-2015  snj Pull up following revision(s) (requested by matt in ticket #868):
sys/arch/powerpc/include/psl.h: revision 1.20
sys/arch/powerpc/include/userret.h: revisions 1.29, 1.30
sys/arch/powerpc/oea/altivec.c: revision 1.30
sys/arch/powerpc/oea/oea_machdep.c: revision 1.72
sys/arch/powerpc/powerpc/fpu.c: revision 1.36
Add a check to make sure that if PSL_FP is set, we own the FPU.
--
Don't clear PSL_FP/PSL_VEC
--
Don't reload if just re-enabling
--
Don't reload the FPU register if this is just a re-enable.
--
Remove PSL_SPV from BOOKE PSL_USERMOD
--
Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext.
 1.74.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.74.4.1 10-Jun-2019  christos Sync with HEAD
 1.74.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.81.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.84.4.1 03-Feb-2024  martin Pull up following revision(s) (requested by jmcneill in ticket #561):

etc/etc.evbppc/Makefile.inc: revision 1.15
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.1
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.2
sys/arch/evbppc/wii/dev/bwdsp.c: revision 1.1
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.3
sys/arch/evbppc/wii/dev/bwdsp.c: revision 1.2
distrib/utils/embedded/files/evbppc_wii_icon.png: revision 1.1
usr.sbin/sysinst/arch/evbppc/md.h: revision 1.4
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.4
sys/arch/evbppc/wii/dev/viio.h: revision 1.1
sys/arch/evbppc/wii/dev/wiifb.c: revision 1.5
sys/arch/evbppc/wii/dev/mainbus.h: revision 1.1
distrib/utils/embedded/conf/wii.conf: revision 1.1
distrib/utils/embedded/conf/wii.conf: revision 1.2
distrib/utils/embedded/conf/wii.conf: revision 1.3
sys/dev/sdmmc/sdhcvar.h: revision 1.34
sys/dev/sdmmc/sdhc.c: revision 1.118
sys/arch/evbppc/wii/dev/resetbtn.c: revision 1.1
distrib/utils/embedded/conf/evbppc.conf: revision 1.1
sys/dev/wsfb/genfb.c: revision 1.91
sys/arch/evbppc/wii/dev/resetbtn.c: revision 1.2
sys/dev/wscons/wsconsio.h: revision 1.127
sys/arch/powerpc/oea/oea_machdep.c: revision 1.85
sys/arch/evbppc/wii/dev/hollywood.h: revision 1.1
sys/arch/evbppc/conf/std.wii: revision 1.1
sys/arch/evbppc/wii/dev/hollywood.h: revision 1.2
sys/arch/evbppc/wii/dev/hollywood.c: revision 1.1
sys/arch/evbppc/conf/std.wii: revision 1.2
sys/arch/evbppc/wii/dev/hollywood.c: revision 1.2
sys/arch/evbppc/conf/std.wii: revision 1.3
sys/arch/powerpc/oea/cpu_subr.c: revision 1.109
sys/arch/evbppc/wii/wii_mmuinit.S: revision 1.1
sys/dev/usb/usb.h: revision 1.124
sys/arch/evbppc/wii/machdep.c: revision 1.1
sys/arch/evbppc/wii/dev/rtcsram.c: revision 1.1
sys/arch/powerpc/include/oea/hid.h: revision 1.14
sys/arch/evbppc/wii/mainbus.c: revision 1.1
sys/arch/evbppc/wii/machdep.c: revision 1.2
sys/arch/evbppc/wii/dev/ehci_hollywood.c: revision 1.1
sys/arch/evbppc/wii/mainbus.c: revision 1.2
sys/arch/evbppc/wii/machdep.c: revision 1.3
sys/arch/evbppc/wii/dev/ehci_hollywood.c: revision 1.2
sys/arch/evbppc/wii/mainbus.c: revision 1.3
sys/arch/evbppc/wii/machdep.c: revision 1.4
sys/arch/evbppc/wii/dev/hwgpio.c: revision 1.1
sys/arch/evbppc/wii/dev/sdhc_hollywood.c: revision 1.1
sys/arch/evbppc/wii/dev/sdhc_hollywood.c: revision 1.2
sys/arch/evbppc/wii/wii_locore.S: revision 1.1
sys/arch/evbppc/conf/files.wii: revision 1.1
sys/arch/evbppc/wii/wii_locore.S: revision 1.2
sys/arch/evbppc/include/wii.h: revision 1.1
sys/arch/evbppc/conf/files.wii: revision 1.2
sys/arch/evbppc/wii/dev/exi.c: revision 1.1
sys/arch/evbppc/include/wii.h: revision 1.2
sys/arch/evbppc/conf/files.wii: revision 1.3
sys/arch/powerpc/powerpc/clock.c: revision 1.18
sys/arch/evbppc/include/wii.h: revision 1.3
sys/arch/evbppc/conf/files.wii: revision 1.4
sys/arch/evbppc/include/wii.h: revision 1.4
sys/arch/evbppc/wii/dev/exi.h: revision 1.1
sys/arch/evbppc/wii/dev/avenc.c: revision 1.1
sys/arch/evbppc/include/wii.h: revision 1.5
sys/arch/evbppc/include/wii.h: revision 1.6
sys/arch/evbppc/include/wii.h: revision 1.7
sys/arch/evbppc/wii/dev/avenc.h: revision 1.1
distrib/utils/embedded/mkimage: revision 1.79
sys/arch/evbppc/conf/WII: revision 1.1
sys/arch/evbppc/conf/INSTALL_WII: revision 1.1
distrib/utils/embedded/files/evbppc_wii_meta.xml: revision 1.1
sys/arch/evbppc/wii/dev/vireg.h: revision 1.1
sys/arch/evbppc/conf/WII: revision 1.2
distrib/utils/embedded/files/evbppc_wii_meta.xml: revision 1.2
sys/arch/evbppc/wii/dev/vireg.h: revision 1.2
sys/arch/evbppc/conf/WII: revision 1.3
sys/arch/evbppc/conf/WII: revision 1.4
usr.sbin/sysinst/arch/evbppc/md.c: revision 1.11
sys/arch/evbppc/wii/dev/ohci_hollywood.c: revision 1.1
sys/dev/usb/ehcivar.h: revision 1.52
sys/arch/evbppc/wii/pic_pi.c: revision 1.1
sys/arch/evbppc/wii/dev/ohci_hollywood.c: revision 1.2
etc/etc.evbppc/ttys: revision 1.8
sys/arch/evbppc/wii/dev/bwai.c: revision 1.1
sys/arch/evbppc/wii/dev/bwai.c: revision 1.2
sys/arch/evbppc/wii/dev/bwai.c: revision 1.3
sys/arch/evbppc/wii/autoconf.c: revision 1.1
sys/arch/evbppc/conf/Makefile.wii.inc: revision 1.1
sys/arch/evbppc/wii/dev/bwai.h: revision 1.1
sys/arch/evbppc/wii/autoconf.c: revision 1.2
sys/arch/evbppc/conf/Makefile.wii.inc: revision 1.2

powerpc: oea: Fix prefetchable mappings
Prefetchable mappings need PMAP_NOCACHE to get write-combine semantics.
powerpc: oea: Decode IBM750CL L2 cache information.
sdmmc: add support for optional delay after register write
wscons: Add HOLLYWOOD display and YUY2 pixel format types
wsfb: add support for optional "devcmap" property
A hardware driver can supply a pointer to a 16x 32-bit array to override
the default rasops device colour map in the "devcmap" property.
ehci: add EHCIF_32BIT_ACCESS flag to force 32-bit MMIO
fix comments: HID0 ICFI/DCFI are "flash invalidate", not "flush invalidate"
powerpc: fix delay for large (> ~5sec) values
When calculating the target timebase, promote '1000' on the RHS to ULL
to force 64-bit calculation, otherwise 'n * 1000' will overflow.
usb: increase USB_PORT_RESET_RECOVERY from 10ms to 20ms
I changed this from 250ms to 10ms back in 2021 based on a similar FreeBSD
change, but it seems to be a bit too aggressive for some platforms.
evbppc: Add initial support for the Nintendo Wii
wii: support RB_POWERDOWN
build fix: use dd with count=1 for compat with NetBSD dd(1)
wii: Add NTSC 480p support.
In addition to this, add VIIO_{GET,SET}REGS ioctl support to allow for
poking at video interface registers from userland. This is helpful for
debugging display issues.
wii: Add 128x48 icon to SD card image
wii: Fix a comment
wii: Add drivers for Broadway DSP and Audio interface.
0: [*] audio0 @ bwdsp0: Broadway DSP
playback: 16, 2ch, 48000Hz
record: unavailable
(P-) slinear_be 16/16, 2ch, { 48000 }
wii: Add screenblank support.
wii: Use screen dimming register for screen blanking.
wii: Add GPIO, I2C, and basic A/V encoder driver.
wii: Use A/V encoder volume controls instead of using a software filter.
wii: Simply DSP driver - no interrupt handler required.
wii: provide device names to intr_establish
wii$ intrctl list
interrupt id CPU0 device name(s)
pi irq 14 64769* hollywood0
hollywood irq 36 5872* ehci0
hollywood irq 39 58907* sdhc0
hollywood irq 40 4* sdhc1
hollywood irq 49 0* resetbtn0
pi irq 5 0* bwai0
wii: Add support for passing boot options to the kernel.
wii: Add External interface bus and RTC support
wii: Remove objcopy after kernel build.
HBC will do the right thing.
Add wsvt25 entries (off by default) for ttyE0-ttyE3.
Add support for "PAL" (576i) mode on Wii.
 1.28 04-Oct-2025  thorpej No longer need to copy "local-mac-address" and "shared-pins" into
the properties dictionary; they can be queried from the device tree
directly now.
 1.27 21-Sep-2025  thorpej Give each PowerPC OFW platform its own device_register(), which calls
into the common ofw_device_register(). ofppc's is a simple wrapper.

macppc's, on the other hand, takes care of looking up environmental
sensor descriptive information in the OFW device tree and adds those
properties directly to the sensor device property dictionaries. This
single implementation will replace the duplicated code that's scattered
across multiple macppc i2c controller drivers.
 1.26 23-Sep-2023  andvar add ifdef NWSDISPLAY > 0 around rascons_* functions usage,
otherwise implementation is not available, which breaks macppc MAMBO config.

potentially better solution to provide empty implementation, comments welcome.
 1.25 14-Dec-2022  macallan if we have the ROM font, make it available to wsdisplay
needs testing on non-macppc
 1.24 27-Nov-2019  joerg Add a hack for qemu/macppc. OF_finddevice calls will crash depending on
the boot loader and kernel being used. This patch allows using
-prom-env qemu_boot_hack=y to disable the lookup.
 1.23 21-Nov-2018  scole branches: 1.23.4;
don't bother reading ofw properties for platinumfb
 1.22 17-Aug-2018  macallan parse G5 device paths
 1.21 04-Mar-2018  macallan branches: 1.21.2; 1.21.4;
detect if we netboot and set booted_device accordingly
 1.20 18-Feb-2014  macallan branches: 1.20.22;
when looking for SCSI disks in canonicalize_bootpath() also match 'disk@'
since that's what at least some Adaptec firmware uses
 1.19 12-May-2013  macallan branches: 1.19.2;
move console_node and console_instance to ofw_consinit.c where they're
actually used
 1.18 28-Apr-2013  macallan some macppc boxes have onboard devices where parts or the whole PCI interrupt
register is hardwired to zero - fix this up here
 1.17 29-Jul-2012  mlelstv branches: 1.17.2;
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.

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

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

Make cpu_rootconf(9) describe the calling order.
 1.16 24-May-2012  macallan copy properties for valkyriefb as well
 1.15 17-Jul-2011  joerg branches: 1.15.2; 1.15.6; 1.15.8;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.14 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 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 09-Jun-2010  kiyohara branches: 1.12.6;
Support MV64361 on PegasosII by gt(4).
+ Support gtpci@gt instead of pegasospci more smartly.
+ Support Gigabit Ethernet by mvgbe@gt.
 1.11 20-Jan-2010  macallan branches: 1.11.2; 1.11.4;
pass some OF properties as device properties for network devices
namely local-mac-address and shared-pins needed by gem
 1.10 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.9 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.8 25-Sep-2008  macallan branches: 1.8.2; 1.8.8;
recognize ATY,DDparent as display device so the rest of the code can find
the nodes for each individual display
 1.7 11-Jan-2008  mrg branches: 1.7.6; 1.7.10; 1.7.12; 1.7.16;
several changes to make boot device work for disks, at least
on my pegasos:

- don't chop off the 2nd part of the OFW address, it makes it
match pcib (ISA bridge - dev 12 fn 0) instead of viaide (dev 12
fn 1).
- now that it's available, provide an "addr2" that has the
second address present.
- for pci devices match against device and function, not just
function.
- remove the special case and actually broken check in the
"pciide" section, and use the now generic "addr2" and check
against the drive and channel number if provided.
- support "viaide" and "slide" in here, as well as "pciide".
(is there a good way to say "any ide adapter"?)
 1.6 09-Jan-2008  aymeric probe as console devices which have a "class-code" property corresponding to
PCI_CLASS_DISPLAY, and not just those which have a "display" device_type.
In the case where each head is a subnode of the graphics card, it's the heads
which have a "display" device_type.

Maybe only testing "class-code" would make sense if this property is defined
on any openfirmware based PowerPC platform.
 1.5 16-Dec-2007  phx branches: 1.5.2;
At least under certain (mis)configurations (e.g. on the "Pegasos" board)
the VT8231-IDE's native mode only works with irq 14/15, and cannot be
programmed to use a single native PCI irq alone. So we install an interrupt
handler for each channel, as in compatibility mode.
This behaviour has to be activated by the "use-compat-native-irq" property,
otherwise the driver works as before.
 1.4 26-Nov-2007  macallan branches: 1.4.2; 1.4.4; 1.4.8;
repeat after me: I will not test OF nodes for validity by checking for >0
since node numbers may well have 0x80000000 set
 1.3 26-Nov-2007  garbled Apply a set of patches from Frank Wille to make the genfb attachment work
better on ofppc. In doing so, we also move a few functions around in
macppc and the generic ofw powerpc stuff to allow better sharing of code.
Also, introduce a model_init function.

move ofb_cons.c from macppc/dev to powerpc/oea and rename it to rascons.
This gets rid of some naming confusion, and makes it OFW-MI rather than
macppc specific.
 1.2 07-Nov-2007  garbled branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
Convert macppc to shared ofw_autoconf.c. Compile tested only.
 1.1 07-Nov-2007  garbled Create a new ofw_autoconf.c based almost entirely on the one from macppc.
 1.2.8.5 18-Feb-2008  mjf Sync with HEAD.
 1.2.8.4 27-Dec-2007  mjf Sync with HEAD.
 1.2.8.3 08-Dec-2007  mjf Sync with HEAD.
 1.2.8.2 19-Nov-2007  mjf Sync with HEAD.
 1.2.8.1 07-Nov-2007  mjf file ofw_autoconf.c was added on branch mjf-devfs on 2007-11-19 00:46:45 +0000
 1.2.6.4 21-Jan-2008  yamt sync with head
 1.2.6.3 07-Dec-2007  yamt sync with head
 1.2.6.2 15-Nov-2007  yamt sync with head.
 1.2.6.1 07-Nov-2007  yamt file ofw_autoconf.c was added on branch yamt-lazymbuf on 2007-11-15 11:43:17 +0000
 1.2.4.2 13-Nov-2007  bouyer Sync with HEAD
 1.2.4.1 07-Nov-2007  bouyer file ofw_autoconf.c was added on branch bouyer-xenamd64 on 2007-11-13 15:59:07 +0000
 1.2.2.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.2.2.2 11-Nov-2007  joerg Sync with HEAD.
 1.2.2.1 07-Nov-2007  joerg file ofw_autoconf.c was added on branch jmcneill-pm on 2007-11-11 16:46:50 +0000
 1.4.8.3 11-Jan-2008  bouyer Sync with HEAD
 1.4.8.2 10-Jan-2008  bouyer Sync with HEAD
 1.4.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.4.4.1 26-Dec-2007  ad Sync with head.
 1.4.2.2 03-Dec-2007  ad Sync with HEAD.
 1.4.2.1 26-Nov-2007  ad file ofw_autoconf.c was added on branch vmlocking on 2007-12-03 19:03:59 +0000
 1.5.2.3 23-Mar-2008  matt sync with HEAD
 1.5.2.2 09-Jan-2008  matt sync with HEAD
 1.5.2.1 16-Dec-2007  matt file ofw_autoconf.c was added on branch matt-armv6 on 2008-01-09 01:47:51 +0000
 1.7.16.1 19-Oct-2008  haad Sync with HEAD.
 1.7.12.1 10-Oct-2008  skrll Sync with HEAD.
 1.7.10.3 11-Aug-2010  yamt sync with head.
 1.7.10.2 11-Mar-2010  yamt sync with head
 1.7.10.1 04-May-2009  yamt sync with head.
 1.7.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.8.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.11.4.1 03-Jul-2010  rmind sync with head
 1.11.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.12.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.15.8.1 08-Aug-2012  martin Pull up following revision(s) (requested by mlelstv in ticket #466):
sys/arch/amiga/amiga/autoconf.c: revision 1.113
sys/arch/rs6000/rs6000/autoconf.c: revision 1.4
sys/arch/emips/emips/autoconf.c: revision 1.6
sys/arch/sandpoint/sandpoint/autoconf.c: revision 1.27
sys/arch/evbmips/alchemy/autoconf.c: revision 1.18
sys/arch/sgimips/sgimips/autoconf.c: revision 1.43
sys/arch/atari/atari/autoconf.c: revision 1.63
sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.17
sys/arch/mmeye/mmeye/autoconf.c: revision 1.9
distrib/sets/lists/comp/mi: revision 1.1771
sys/arch/mipsco/mipsco/autoconf.c: revision 1.25
sys/arch/iyonix/iyonix/autoconf.c: revision 1.14
sys/arch/hp300/hp300/autoconf.c: revision 1.100
sys/kern/init_main.c: revision 1.445
sys/arch/pmax/pmax/autoconf.c: revision 1.79
sys/arch/netwinder/netwinder/autoconf.c: revision 1.11
sys/arch/dreamcast/dreamcast/autoconf.c: revision 1.10
sys/arch/ibmnws/ibmnws/autoconf.c: revision 1.12
sys/arch/evbppc/ev64260/autoconf.c: revision 1.17
sys/arch/evbmips/gdium/autoconf.c: revision 1.5
sys/arch/algor/algor/autoconf.c: revision 1.21
share/man/man9/Makefile: revision 1.367
sys/arch/ews4800mips/ews4800mips/autoconf.c: revision 1.9
sys/arch/amigappc/amigappc/autoconf.c: revision 1.5
sys/arch/x86/x86/x86_autoconf.c: revision 1.65
sys/arch/acorn26/acorn26/autoconf.c: revision 1.9
sys/arch/mvmeppc/mvmeppc/autoconf.c: revision 1.13
sys/arch/vax/vax/autoconf.c: revision 1.94
sys/arch/usermode/dev/cpu.c: revision 1.72
sys/arch/evbppc/virtex/autoconf.c: revision 1.5
sys/arch/next68k/next68k/autoconf.c: revision 1.26
sys/arch/mac68k/mac68k/autoconf.c: revision 1.73
sys/arch/ia64/ia64/autoconf.c: revision 1.6
sys/arch/evbppc/obs405/obs405_autoconf.c: revision 1.6
share/man/man9/cpu_rootconf.9: revision 1.7
sys/arch/landisk/landisk/autoconf.c: revision 1.6
sys/arch/evbmips/malta/autoconf.c: revision 1.16
sys/arch/sun3/sun3/autoconf.c: revision 1.76
sys/arch/evbppc/explora/autoconf.c: revision 1.13
sys/arch/sun3/sun3/autoconf.c: revision 1.77
sys/arch/evbmips/loongson/autoconf.c: revision 1.3
sys/arch/evbmips/atheros/autoconf.c: revision 1.11
sys/arch/sparc64/sparc64/autoconf.c: revision 1.188
sys/arch/acorn32/acorn32/autoconf.c: revision 1.18
sys/arch/evbarm/evbarm/autoconf.c: revision 1.13
sys/arch/cobalt/cobalt/autoconf.c: revision 1.30
sys/arch/mvme68k/mvme68k/autoconf.c: revision 1.46
sys/arch/hp700/hp700/autoconf.c: revision 1.48
sys/arch/evbmips/adm5120/autoconf.c: revision 1.5
sys/arch/hpcmips/hpcmips/autoconf.c: revision 1.25
sys/arch/alpha/alpha/autoconf.c: revision 1.52
sys/arch/sparc/sparc/autoconf.c: revision 1.244
sys/arch/evbppc/pmppc/autoconf.c: revision 1.7
sys/arch/bebox/bebox/autoconf.c: revision 1.25
sys/arch/luna68k/luna68k/autoconf.c: revision 1.13
sys/arch/hpcarm/hpcarm/autoconf.c: revision 1.20
sys/arch/evbppc/walnut/autoconf.c: revision 1.21
sys/arch/cesfic/cesfic/autoconf.c: revision 1.26
sys/arch/cats/cats/autoconf.c: revision 1.17
sys/arch/x68k/x68k/autoconf.c: revision 1.67
sys/arch/news68k/news68k/autoconf.c: revision 1.21
sys/arch/arc/arc/autoconf.c: revision 1.34
sys/arch/evbsh3/evbsh3/autoconf.c: revision 1.11
sys/sys/conf.h: revision 1.143
sys/arch/evbmips/rasoc/autoconf.c: revision 1.3
sys/arch/hpcsh/hpcsh/autoconf.c: revision 1.26
sys/arch/sun68k/sun68k/autoconf.c: revision 1.29
sys/arch/evbmips/rmixl/autoconf.c: revision 1.6
sys/arch/zaurus/zaurus/autoconf.c: revision 1.12
sys/arch/xen/x86/autoconf.c: revision 1.15
sys/arch/evbppc/mpc85xx/autoconf.c: revision 1.6
sys/arch/shark/shark/autoconf.c: revision 1.18
sys/arch/prep/prep/autoconf.c: revision 1.25
sys/arch/newsmips/newsmips/autoconf.c: revision 1.36
sys/arch/sbmips/sbmips/autoconf.c: revision 1.8
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.
No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().
Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().
Make cpu_rootconf(9) describe the calling order.
add rootconf(9) as a link to cpu_rootconf(9)
make this compile again
 1.15.6.1 02-Jun-2012  mrg sync to latest -current.
 1.15.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.15.2.1 30-Oct-2012  yamt sync with head
 1.17.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.2.1 23-Jun-2013  tls resync from head
 1.19.2.1 18-May-2014  rmind sync with head
 1.20.22.2 07-Dec-2019  martin Build fix for ticket #1465
 1.20.22.1 05-Dec-2019  bouyer Pull up following revision(s) (requested by joerg in ticket #1465):
sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.24
Add a hack for qemu/macppc. OF_finddevice calls will crash depending on
the boot loader and kernel being used. This patch allows using
-prom-env qemu_boot_hack=y to disable the lookup.
 1.21.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.21.4.1 10-Jun-2019  christos Sync with HEAD
 1.21.2.2 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.21.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.23.4.1 08-Dec-2019  martin Pull up following revision(s) (requested by joerg in ticket #494):

sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.24

Add a hack for qemu/macppc. OF_finddevice calls will crash depending on
the boot loader and kernel being used. This patch allows using
-prom-env qemu_boot_hack=y to disable the lookup.
 1.27 06-Dec-2022  macallan convert more seriously early output to ofprint
regular console output needs more of the kernel in working order now, and this
stuff happ0ens long before the banner
 1.26 24-Nov-2022  macallan move ofprint() to powerpc/ofw_machdep.c and make it official
now that console output uses locks it needs more of the kernel to function, so
for now use direct OF calls for earliest debug output
 1.25 13-Feb-2022  martin PR port-macppc/56091: on G5 macs we currently can not easily make
early serial console work, so keep the OF based "failsafe" console
but note that we would like to switch over.
Once zs attaches, use the new device mapping and do a belated init
of the zs console globals, and then switch over to real zs based
serial console.
 1.24 05-Mar-2021  thorpej Separate probing for the console device and initializing it, so that
ofwoea_initppc() can have more control over which of those steps are
performed during initialization. Probing happens before setting up
the exception vectors, initializing happens after.
 1.23 19-Feb-2021  thorpej Fix the previously differently.
 1.22 19-Feb-2021  thorpej Avoid an unused variable warning for the not-building-macppc case.
 1.21 19-Feb-2021  thorpej Revert unintended change.
 1.20 19-Feb-2021  thorpej Shuffle around a couple of things that aren't particularly OEA-specific:

- Early bootstrap console initialization moves to ofw_machdep.c, and
is called a bit earlier, from ofw_bootstrap().

- Decoding the "translations" property from /chosen/mmu is specified
in the general OpenFirmware PowerPC bindings, and is not specific to
any particular PowerPC flavor. It's now decoded a bit earlier in
ofw_bootstrap().

The *interpretation* of the mode field of a translation is, however,
implementation-specific, so that remains in ofwoea_machdep.c.
 1.19 06-Jul-2020  rin branches: 1.19.2;
Style and cosmetic changes. No binary changes intended.
 1.18 15-Apr-2020  rin When boot up with auto-boot? == true, some systems do not provide stdout
if the normal output is screen.

Open screen explicitly as stdout in this case, both for ofwboot and kernel,
which fixes problems with auto-boot? == true for Mac mini G4:

- messages from ofwboot do not appear
- kernel freeze during early boot stage

Taken from OpenBSD:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/macppc/ofw_machdep.c#rev1.3
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/stand/Locore.c#rev1.3

XXX
pullup to netbsd-9 and -8
 1.17 14-Feb-2016  dholland branches: 1.17.10; 1.17.18; 1.17.22; 1.17.28;
Add missing va_end, from David Binderman in PR 50798.
 1.16 12-May-2013  macallan branches: 1.16.10;
move console_node and console_instance to ofw_consinit.c where they're
actually used
 1.15 29-Oct-2012  chs fix compile problems (for POWERMAC_G5).
 1.14 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.13 17-Jul-2011  joerg branches: 1.13.2; 1.13.12;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.12 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.11 14-Nov-2010  uebayasi prop/proplib.h is indirectly used here, include it.

XXX What is the conclusion about direct vs. indirect #include from headers?
 1.10 14-Mar-2010  kiyohara branches: 1.10.2;
Fix isa(4) support for ofw.
ofw not initialized bus_space for isa(4).
It tested on ofppc(PegasosII).
 1.9 10-Mar-2010  kiyohara Remove white-spaces.
 1.8 25-Sep-2008  macallan branches: 1.8.14;
If we have to guess wether the console keyboard is USB or ADB check if the
PMU actually has ADB support.
 1.7 28-Apr-2008  martin branches: 1.7.2; 1.7.6;
Remove clause 3 and 4 from TNF licenses
 1.6 26-Nov-2007  garbled branches: 1.6.14; 1.6.16; 1.6.18;
Apply a set of patches from Frank Wille to make the genfb attachment work
better on ofppc. In doing so, we also move a few functions around in
macppc and the generic ofw powerpc stuff to allow better sharing of code.
Also, introduce a model_init function.

move ofb_cons.c from macppc/dev to powerpc/oea and rename it to rascons.
This gets rid of some naming confusion, and makes it OFW-MI rather than
macppc specific.
 1.5 10-Nov-2007  macallan unbork the initial console for macppc
ofb_cnattach() has nothing to do with ofb (anymore) - it's simply a dumb
rasops console we use until a real wsdisplay driver attaches, therefore
it needs to be #if NWSDISPLAY > 0, not NOFB > 0
Should probably be renamed to avoid future confusion.
 1.4 05-Nov-2007  garbled branches: 1.4.2; 1.4.4;
Lots of small changes for ofppc:

Remove the ofb driver. I'm not interested in trying to make this work.
It should be replaced with the genfb driver, which I have added,
commented out because that driver needs work before it will function on
ofppc. (it's too panic-happy, and ofppc needs a working autoconf.c)

Change the way we do isa_inb/outb. The new way is a slightly nastier
hack, but won't run afoul of the other isa drivers as much.

Fix ofw_consinit.c to remove the dependency on ofb.
 1.3 04-Nov-2007  garbled Get rid of the ofppc use of the ofbus completely, for the last time.

Write a complete OF boot console into ofw_consinit.c and rewire a bunch
of the ifdef logic in that file to use it when appropriate on both macppc
and ofppc. Get rid of the attempt to wire up the serial console early,
as that is extremely difficult on ofppc. Yank all the console code out
of ofppc/machdep.c. (This is a boot console only, not a full blown
console like ofcons.c)

Delete all the ofbus references out of the config files, and pull in
dev/ofw/openfirmio.c and dev/ofw/ofw_subr.c directly rather than pulling
in files.ofw. It might be worth going back and adding a files.ofw-nobus
to that directory to allow pulling in the openfirmware driver without
pulling in the whole ofbus mess.

Change rtas driver to connect directly to mainbus, like the PCI bus nodes do.
 1.2 17-Oct-2007  garbled branches: 1.2.2; 1.2.4;
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.1 06-Jun-2007  garbled branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10;
file ofw_consinit.c was initially added on branch ppcoea-renovation.
 1.1.10.2 13-Nov-2007  bouyer Sync with HEAD
 1.1.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.1.8.1 18-Oct-2007  yamt sync with head.
 1.1.6.5 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.1.6.4 11-Nov-2007  joerg Sync with HEAD.
 1.1.6.3 06-Nov-2007  joerg Sync with HEAD.
 1.1.6.2 04-Nov-2007  jmcneill Sync with HEAD.
 1.1.6.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.1.2.3 21-Jun-2007  garbled Protect the 16550 serial console code with a NISA > 0.
 1.1.2.2 14-Jun-2007  macallan add a missing return in ofwoea_bootstrap_console() - now we get past ofb
initialization and hang a little later
 1.1.2.1 06-Jun-2007  garbled Add new routines which should be common between macppc and ofppc. Not
used by either port yet.
 1.2.4.4 07-Dec-2007  yamt sync with head
 1.2.4.3 15-Nov-2007  yamt sync with head.
 1.2.4.2 27-Oct-2007  yamt sync with head.
 1.2.4.1 17-Oct-2007  yamt file ofw_consinit.c was added on branch yamt-lazymbuf on 2007-10-27 11:27:54 +0000
 1.2.2.4 03-Dec-2007  ad Sync with HEAD.
 1.2.2.3 03-Dec-2007  ad Sync with HEAD.
 1.2.2.2 23-Oct-2007  ad Sync with head.
 1.2.2.1 17-Oct-2007  ad file ofw_consinit.c was added on branch vmlocking on 2007-10-23 20:36:09 +0000
 1.4.4.3 09-Jan-2008  matt sync with HEAD
 1.4.4.2 06-Nov-2007  matt sync with HEAD
 1.4.4.1 05-Nov-2007  matt file ofw_consinit.c was added on branch matt-armv6 on 2007-11-06 23:20:45 +0000
 1.4.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.4.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.6.18.3 11-Aug-2010  yamt sync with head.
 1.6.18.2 04-May-2009  yamt sync with head.
 1.6.18.1 16-May-2008  yamt sync with head.
 1.6.16.1 18-May-2008  yamt sync with head.
 1.6.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.6.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.6.1 19-Oct-2008  haad Sync with HEAD.
 1.7.2.1 10-Oct-2008  skrll Sync with HEAD.
 1.8.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.10.2.1 05-Mar-2011  rmind sync with head
 1.13.12.3 03-Dec-2017  jdolecek update from HEAD
 1.13.12.2 23-Jun-2013  tls resync from head
 1.13.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.13.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.2.1 30-Oct-2012  yamt sync with head
 1.16.10.1 19-Mar-2016  skrll Sync with HEAD
 1.17.28.1 20-Apr-2020  bouyer Sync with HEAD
 1.17.22.1 21-Apr-2020  martin Pull up following revision(s) (requested by rin in ticket #837):

sys/arch/macppc/stand/ofwboot/Locore.c: revision 1.34
sys/arch/powerpc/oea/ofw_consinit.c: revision 1.18

When boot up with auto-boot? == true, some systems do not provide stdout
if the normal output is screen.

Open screen explicitly as stdout in this case, both for ofwboot and kernel,
which fixes problems with auto-boot? == true for Mac mini G4:
- messages from ofwboot do not appear
- kernel freeze during early boot stage

Taken from OpenBSD:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/macppc/ofw_machdep.c#rev1.3
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/stand/Locore.c#rev1.3

XXX
pullup to netbsd-9 and -8
 1.17.18.1 21-Apr-2020  martin Sync with HEAD
 1.17.10.1 21-Apr-2020  martin Pull up following revision(s) (requested by rin in ticket #1533):

sys/arch/macppc/stand/ofwboot/Locore.c: revision 1.34 (via patch)
sys/arch/powerpc/oea/ofw_consinit.c: revision 1.18

When boot up with auto-boot? == true, some systems do not provide stdout
if the normal output is screen.

Open screen explicitly as stdout in this case, both for ofwboot and kernel,
which fixes problems with auto-boot? == true for Mac mini G4:
- messages from ofwboot do not appear
- kernel freeze during early boot stage

Taken from OpenBSD:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/macppc/ofw_machdep.c#rev1.3
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/stand/Locore.c#rev1.3

XXX
pullup to netbsd-9 and -8
 1.19.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.18 17-Aug-2021  andvar fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected.
 1.17 07-Jul-2020  rin rascons_init_rasops(): Initialize color palette only for macppc.
Fix build failure for ofppc.
 1.16 07-Jul-2020  rin It turned out that using some Open Firmware routines causes the system
freeze after calling OF_quiesce().

This is why setting color palette crash the system for some Power Mac G5
models, like PowerMac11,2.

Therefore, stop using color-palette and backlight callbacks for genfb(4)
in this case.

Also, postpone OF_quiesce() after rascons_init_rasops(), and initialize
color palette there if OF is going to be quiesced and color depth is 8.

Now, color palette for wscons is initialized correctly for PowerMac11,2.
 1.15 07-Jul-2020  rin Fix boot failure for PowerMac11,2 when ``auto-boot?'' is true.

For some machines like PowerMac11,2, Open Firmware does not correctly
initialize console-related variables, like font-adr and line#, when
``auto-boot?'' is true; -1 is returned instead of correct values.

Fall back to wsfont embedded in kernel in this case. Also, do not use
line# if it is negative.
 1.14 16-Mar-2020  macallan make the ROM font usable on G5s:
- copy the font data into a buffer instead of just pointing at the ROM
- don't blindly assume the font's width
- don't try to center output ourselves - rasops_init() will do it for us
- provide a hook to add the ROM font to wsfont when we're ready
 1.13 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.12 02-Mar-2018  macallan branches: 1.12.2; 1.12.4;
add a comment to explain why we defer wsdisplay_preattach() in bridge mode
 1.11 02-Mar-2018  macallan defer scribbling into video memory until after re-enabling the MMU if
we're in bridge mode.
With this NetBSD boots on PCI-X G5s
 1.10 23-Feb-2018  sevan Remove OFB_ENABLE_CACHE
from <macallan>
"it is outdated, genfb and friends don't need or use it, and it makes no sense
on accelerated drivers either. It tries to BAT-map the framebuffer cacheable,
which works on most macs but makes a few models lock up. Genfb doesn't have that
problem and is faster too."
 1.9 11-Apr-2013  macallan branches: 1.9.28;
for some reason we can't use the ROM font on G5, so disable it with
options OFWOEA_WSCONS_NO_ROM_FONT
from Phileas Fogg
 1.8 01-Feb-2012  matt branches: 1.8.6;
Use kmem instead of malloc. Remove unneeded <sys/malloc.h> includes.
 1.7 01-Feb-2012  matt Enable XBSEN and HIGHBAT for OEA 7455 and related CPUs.
The BAT entries now have a resolution of 8MB. (Adjacent entries are merged
up to a total of 2GB per entry).
 1.6 01-Jul-2011  dyoung branches: 1.6.2; 1.6.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.5 06-May-2010  macallan set RI_NO_AUTO when initializing the early console - we're so early that
kmem_alloc() can't be used and we don't really need box drawing characters
for the OF font anyway
 1.4 10-Mar-2010  kiyohara branches: 1.4.2;
Remove white-spaces.
 1.3 18-Mar-2009  cegger branches: 1.3.2;
Ansify function definitions w/o arguments. Generated with sed.
 1.2 03-Mar-2008  phx branches: 1.2.4; 1.2.12; 1.2.18; 1.2.26;
Removed the check for device_type==display in rascons_cnattach(). It is not
required, because this function will be called for display-consoles only,
and it allows SmartFirmware to attach a rascons console.
Approved by garbled.
 1.1 26-Nov-2007  garbled branches: 1.1.2; 1.1.4; 1.1.8; 1.1.10; 1.1.18; 1.1.20; 1.1.24;
Apply a set of patches from Frank Wille to make the genfb attachment work
better on ofppc. In doing so, we also move a few functions around in
macppc and the generic ofw powerpc stuff to allow better sharing of code.
Also, introduce a model_init function.

move ofb_cons.c from macppc/dev to powerpc/oea and rename it to rascons.
This gets rid of some naming confusion, and makes it OFW-MI rather than
macppc specific.
 1.1.24.1 03-Apr-2008  mjf Sync with HEAD.
 1.1.20.1 24-Mar-2008  keiichi sync with head.
 1.1.18.3 23-Mar-2008  matt sync with HEAD
 1.1.18.2 09-Jan-2008  matt sync with HEAD
 1.1.18.1 26-Nov-2007  matt file ofw_rascons.c was added on branch matt-armv6 on 2008-01-09 01:47:52 +0000
 1.1.10.2 08-Dec-2007  mjf Sync with HEAD.
 1.1.10.1 26-Nov-2007  mjf file ofw_rascons.c was added on branch mjf-devfs on 2007-12-08 18:17:40 +0000
 1.1.8.3 17-Mar-2008  yamt sync with head.
 1.1.8.2 07-Dec-2007  yamt sync with head
 1.1.8.1 26-Nov-2007  yamt file ofw_rascons.c was added on branch yamt-lazymbuf on 2007-12-07 17:25:56 +0000
 1.1.4.2 03-Dec-2007  ad Sync with HEAD.
 1.1.4.1 26-Nov-2007  ad file ofw_rascons.c was added on branch vmlocking on 2007-12-03 19:04:01 +0000
 1.1.2.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.1.2.1 26-Nov-2007  joerg file ofw_rascons.c was added on branch jmcneill-pm on 2007-11-27 19:35:51 +0000
 1.2.26.1 26-Jan-2011  matt Change battable to have a granularity of 8MB.
 1.2.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.2.4.2 11-Aug-2010  yamt sync with head.
 1.2.4.1 04-May-2009  yamt sync with head.
 1.3.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.4.2.1 30-May-2010  rmind sync with head
 1.6.6.1 18-Feb-2012  mrg merge to -current.
 1.6.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.6.2.1 17-Apr-2012  yamt sync with head
 1.8.6.1 23-Jun-2013  tls resync from head
 1.9.28.1 26-Feb-2018  snj Pull up following revision(s) (requested by sevan in ticket #578):
sys/arch/macppc/conf/GENERIC: 1.341
sys/arch/macppc/conf/MAMBO: 1.28
sys/arch/macppc/conf/POWERMAC: 1.69
sys/arch/macppc/conf/POWERMAC_G5: 1.30
sys/arch/powerpc/oea/ofw_rascons.c: 1.10
Remove OFB_ENABLE_CACHE
from <macallan>
"it is outdated, genfb and friends don't need or use it, and it makes no
sense on accelerated drivers either. It tries to BAT-map the framebuffer
cacheable, which works on most macs but makes a few models lock up.
Genfb doesn't have that problem and is faster too."
 1.12.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.12.4.1 10-Jun-2019  christos Sync with HEAD
 1.12.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3 16-Mar-2020  macallan make the ROM font usable on G5s:
- copy the font data into a buffer instead of just pointing at the ROM
- don't blindly assume the font's width
- don't try to center output ourselves - rasops_init() will do it for us
- provide a hook to add the ROM font to wsfont when we're ready
 1.2 02-Mar-2018  macallan branches: 1.2.4;
defer scribbling into video memory until after re-enabling the MMU if
we're in bridge mode.
With this NetBSD boots on PCI-X G5s
 1.1 26-Nov-2007  garbled branches: 1.1.2; 1.1.4; 1.1.8; 1.1.10; 1.1.18;
Apply a set of patches from Frank Wille to make the genfb attachment work
better on ofppc. In doing so, we also move a few functions around in
macppc and the generic ofw powerpc stuff to allow better sharing of code.
Also, introduce a model_init function.

move ofb_cons.c from macppc/dev to powerpc/oea and rename it to rascons.
This gets rid of some naming confusion, and makes it OFW-MI rather than
macppc specific.
 1.1.18.2 09-Jan-2008  matt sync with HEAD
 1.1.18.1 26-Nov-2007  matt file ofw_rasconsvar.h was added on branch matt-armv6 on 2008-01-09 01:47:52 +0000
 1.1.10.2 08-Dec-2007  mjf Sync with HEAD.
 1.1.10.1 26-Nov-2007  mjf file ofw_rasconsvar.h was added on branch mjf-devfs on 2007-12-08 18:17:40 +0000
 1.1.8.2 07-Dec-2007  yamt sync with head
 1.1.8.1 26-Nov-2007  yamt file ofw_rasconsvar.h was added on branch yamt-lazymbuf on 2007-12-07 17:25:57 +0000
 1.1.4.2 03-Dec-2007  ad Sync with HEAD.
 1.1.4.1 26-Nov-2007  ad file ofw_rasconsvar.h was added on branch vmlocking on 2007-12-03 19:04:03 +0000
 1.1.2.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.1.2.1 26-Nov-2007  joerg file ofw_rasconsvar.h was added on branch jmcneill-pm on 2007-11-27 19:35:51 +0000
 1.2.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.20 28-Feb-2021  thorpej Minor re-ordering of a few things, and issue an isync barrier at all
critical MMU on/off transitions.
 1.19 24-Feb-2021  thorpej - Fix a comment.
- rename ofwsrsave to clsrsave; we're saving / restoring the client's
(i.e. kernel's) SRs there, not the firmware's.
 1.18 24-Feb-2021  thorpej Don't save the firmware's copy of SPRG[0-3], and don't fiddle with
SPRG[0-3] in the firmware trampoline. Section 7.1 of the OpenFirmware
PowerPC CPU bindings says that firmware "client interface shall not modify"
when in virtual-mode, and "client interface shall preserve" in real-mode.

This is important because in vritual-mode, DSI exceptions will land in
the kernel's DSI exception handler, and that handler depends on the
kernel's SPRG0 value (it contains the pointer to the cpu_info for that
CPU).

Additionally, in the firmware trampoline, point curcpu at an empty
ofw_battable. This ensures that the DSI exception handler won't
load a BAT register with a kernel block translation that clobbers
a segment translation owned by the firmware. Eventually, this ofw_battable
might contain some of the larger translations owned by the firmware.
 1.17 19-Feb-2021  thorpej ofwreal_incharge does not need to be global.
 1.16 19-Feb-2021  thorpej Put back accidental removal of "ofwreal_incharge".
 1.15 18-Feb-2021  thorpej Add an ofw_bootstrap() function, called during early bootstrap from
ofwinit() to perform additional early initialization in C code. Use
this to get the memory config while we're still running in the OpenFirmware
client environment, rather than waiting until we've started fiddling with
the system state.
 1.14 18-Feb-2021  thorpej - Tidy up some comments.
- Use correct stack frame linkage everywhere so that if something goes
wrong, we can get a meaningful back trace.
- Use an additional layer of indirection so that, when we're very
early in bootstrap, we can just call OpenFirmware directly, rather
than using our trampoline that saves/restores kernel state.
- Carve out a space for ofwinit() to call into C code to do additional
initialization. (This is not done yet.)
 1.13 13-Feb-2021  thorpej - Don't change to the OFW stack in C code; instead, switch to the OFW
stack in the openfirmware() wrapper itself. Inspired by a similar
change in OpenBSD designed to appease clang.
- The OF_*() entry firmware interfaces use several global resources;
protect those global resources with a __cpu_simple_lock_t.
- Make ofbcopy() static -- it's no longer referenced outside openfirm.c
 1.12 06-Jul-2020  rin branches: 1.12.2;
Include missing opt_ppcarch.h.
 1.11 15-Nov-2019  macallan bump OF_buf(fer) since we may put extra parameters in there
 1.10 27-Jul-2011  macallan branches: 1.10.54;
move clearing PSL_IP in ofwmsr back where it was - if we do it too early my
PowerBook 3400c hangs on startup.
 1.9 12-Jun-2011  matt Save/restore all sprgs when calling OFW.
Move all-zero variables from .data to .bss
Use .lcomm for local variables.
Cleanup a bit of assembly.
Clear PSL_IP in the saved ofmsr (was previously done in ofwoea_machdep.c)
 1.8 08-Apr-2008  garbled branches: 1.8.36;
SMP support for ofppc. (finally) Much thanks to Matt Thomas for help in
figuring out all the crazy nuances of getting this working, and to
Michael Lorenz for testing/fixing my changes on macppc. Tested with a
quad-proc 7044-270.
Summary of changes:

Bumped CPU_MAXNUM to 16 on ofppc.
Added md_* routines to ofppc/cpu.c, to sync the timebase, and awaken the CPUs.
Fixed a bug in the test for a 64bit bridge cpu early in locore.S
Added code to set the interrupt priority for all CPUs with an openpic.
Change rtas to probe before cpus, to allow use of the rtas freeze/thaw
timebase code routines.
Fix CPU_INFO_FOREACH macro to iterate through detected cpus, not CPU_MAXNUM.
Change most uses of ci_cpuid to ci_index, to deal with CPUs that do not allow
writing to SPR_PIR. Don't write SPR_PIR unless the secondary cpu identifies
itself as 0.
Change the hatchstack/interrupt stack allocations to allocate a 8192byte
interrupt stack, and a 4096 byte hatch stack, align them to 16 bytes, and
allocate them no lower than 0x10000. Allocate them separately to prevent the
hatch stack corrupting the interrupt stack later on.
If the CPU is a 64bit cpu, copy SPR_ASR in cpu_hatch()
Set the idle stack to ci->ci_data.cpu_idlelwp->l_addr->u_pcb.pcb_sp.
Add OF_start_cpu(). Add a routine to ofwoea_initppc to spin up secondary
procs early, and place them into a spinloop waiting for the hatch routines
to be ready.
Modify the ipi routines to deal with openpics that reverse byte order on read
from an ipi register. (such as on the 7044)
Change the rtas setup to allocate the rtas physical base address above
the kernel, to avoid mucking up the hatch/interrupt stacks.
 1.7 14-Feb-2008  garbled branches: 1.7.6;
Some powerpc cleanup. Remove unneeded/bad usage of extern oeacpufeat.
Convert asm code to use %r register format. Done by comparison to
disassembled output, double checked with diff of dissasembled output
before and after, and test booted on my 7044.
 1.6 28-Jan-2008  garbled Pull another instance of bridge mode avoiding the BATs.
Fix FIRMWORKSBUGS. The #else on one of the ifdefs for it made it so that
it would never work on a machine that didn't need it. This caused IBM
machines to be unable to talk to OFW if the option was enabled. Replace
the #else with a branch and call it good.
 1.5 17-Oct-2007  garbled branches: 1.5.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.4 25-Jun-2007  aymeric branches: 1.4.10;
in the FIRMWORKSBUGS case, and if PSL_DR/PSL_IR are set, don't do the
job of saving and restoring registers twice: let ofwreal cope with everything.

This was the last bit needed to get a stock NetBSD/ofppc kernel booting
on the Efika. This will have to be adapted to the ppcoea-renovation branch.
 1.3 05-Aug-2006  sanjayl branches: 1.3.14; 1.3.16; 1.3.22;
1st cut of Powermac G5 support (uses bridge mode).
 1.2 13-Feb-2003  matt branches: 1.2.18; 1.2.32; 1.2.36;
Use register 8, not 0, when construct OF_buffer address.
 1.1 03-Feb-2003  matt Rename PPC_MPC6XX to PPC_OEA (and any mpc6xx reference to oea).
 1.2.36.1 11-Aug-2006  yamt sync with head
 1.2.32.1 09-Sep-2006  rpaulo sync with head
 1.2.18.4 27-Feb-2008  yamt sync with head.
 1.2.18.3 04-Feb-2008  yamt sync with head.
 1.2.18.2 03-Sep-2007  yamt sync with head.
 1.2.18.1 30-Dec-2006  yamt sync with head.
 1.3.22.2 02-Aug-2007  macallan sync with HEAD
 1.3.22.1 26-Jun-2007  garbled Sync with HEAD.
 1.3.16.1 11-Jul-2007  mjf Sync with head.
 1.3.14.1 15-Jul-2007  ad Sync with head.
 1.4.10.2 23-Mar-2008  matt sync with HEAD
 1.4.10.1 06-Nov-2007  matt sync with HEAD
 1.5.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.7.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.36.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.12.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.64 28-May-2024  macallan - initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly
 1.63 23-Sep-2023  andvar add ifdef NWSDISPLAY > 0 around rascons_* functions usage,
otherwise implementation is not available, which breaks macppc MAMBO config.

potentially better solution to provide empty implementation, comments welcome.
 1.62 05-Dec-2021  msaitoh s/preceed/preced/ in comment.
 1.61 02-Apr-2021  macallan clarify comment in previous
( this is a hack, should go away when the root cause is fixed etc. )
no functional change
 1.60 01-Apr-2021  macallan avoid mapping 0xfffff000 - my beige G3 DSIs on it
with this my the machine boots again
tested on a variety of G4 and G5 models with no problems
 1.59 05-Mar-2021  thorpej branches: 1.59.2;
Separate probing for the console device and initializing it, so that
ofwoea_initppc() can have more control over which of those steps are
performed during initialization. Probing happens before setting up
the exception vectors, initializing happens after.
 1.58 05-Mar-2021  thorpej Split set_timebase() into get_timebase_frequency() and init_decrementer().
Call get_timebase_frequency() much earlier.
 1.57 05-Mar-2021  thorpej Move ofppc-specific CPU spinup code to ofppc/machdep.c
 1.56 27-Feb-2021  thorpej Un-do a bunch of misguided code sharing. It's not really shared if it's
full of platform-specific #ifdefs:
- ofwoea_batinit() is gone; just do what's needed early in macppc / ofppc
initppc() functions.
- Get a bunch of Mac-specific stuff out of ofwoea_initppc().
 1.55 27-Feb-2021  thorpej In ofwoea_initppc(), call oea_init() after getting the bootpath, etc.
Also, add a comment explaining why it's actually necessary to clear
PSL_IP after installing the kernel's exception vectors.
 1.54 24-Feb-2021  thorpej Don't save the firmware's copy of SPRG[0-3], and don't fiddle with
SPRG[0-3] in the firmware trampoline. Section 7.1 of the OpenFirmware
PowerPC CPU bindings says that firmware "client interface shall not modify"
when in virtual-mode, and "client interface shall preserve" in real-mode.

This is important because in vritual-mode, DSI exceptions will land in
the kernel's DSI exception handler, and that handler depends on the
kernel's SPRG0 value (it contains the pointer to the cpu_info for that
CPU).

Additionally, in the firmware trampoline, point curcpu at an empty
ofw_battable. This ensures that the DSI exception handler won't
load a BAT register with a kernel block translation that clobbers
a segment translation owned by the firmware. Eventually, this ofw_battable
might contain some of the larger translations owned by the firmware.
 1.53 19-Feb-2021  thorpej Update some #ifdef PMAC_G5 for previous change that I missed before.
 1.52 19-Feb-2021  thorpej Shuffle around a couple of things that aren't particularly OEA-specific:

- Early bootstrap console initialization moves to ofw_machdep.c, and
is called a bit earlier, from ofw_bootstrap().

- Decoding the "translations" property from /chosen/mmu is specified
in the general OpenFirmware PowerPC bindings, and is not specific to
any particular PowerPC flavor. It's now decoded a bit earlier in
ofw_bootstrap().

The *interpretation* of the mode field of a translation is, however,
implementation-specific, so that remains in ofwoea_machdep.c.
 1.51 12-Feb-2021  thorpej Add some comments to help visually track the nested #ifdef blocks in
ofwoea_batinit().
 1.50 07-Jul-2020  rin branches: 1.50.2;
It turned out that using some Open Firmware routines causes the system
freeze after calling OF_quiesce().

This is why setting color palette crash the system for some Power Mac G5
models, like PowerMac11,2.

Therefore, stop using color-palette and backlight callbacks for genfb(4)
in this case.

Also, postpone OF_quiesce() after rascons_init_rasops(), and initialize
color palette there if OF is going to be quiesced and color depth is 8.

Now, color palette for wscons is initialized correctly for PowerMac11,2.
 1.49 06-Jul-2020  rin - Drop unused opt_compat_netbsd.h.
- Include missing opt_multiprocessor.h.
 1.48 06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.47 28-Feb-2020  macallan do what FreeBSD does and OF_quiesce() only on PowerMac11,2 and 12,1
 1.46 28-Feb-2020  macallan switch PowerMac7,* CPUs to full speed via OF
if we do this later we hang
 1.45 15-Jul-2018  maxv branches: 1.45.6;
Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
 1.44 03-Mar-2018  macallan branches: 1.44.2; 1.44.4;
get bootpath from OF if we don't get it as an argument
 1.43 02-Mar-2018  macallan defer scribbling into video memory until after re-enabling the MMU if
we're in bridge mode.
With this NetBSD boots on PCI-X G5s
 1.42 21-Jan-2018  mrg fix ofppc/pegasosII (and maybe others).

don't assume PPC_OEA64_BRIDGE means we have a 64 bit cpu (code
for 64 bit in bridge and normal 32 bit can co-exist due to
fixups the early boot code does has, and ofppc builds GENERIC
this way):
- fix mtmsr()/mfmsr() to use the right method based upon the
actually cpu booted on.
- fix cpu_setup() to have 32 bit and 64 bit hid0 variables
and operate on the right one based upon the current cpu.
restore a minor optimisation of not writing hid0 if it
didn't change.

in set_timebase() check if OF_finddevice("/cpus/@0") failed
and returned -1 before using it for OF_getprop().
 1.41 22-Sep-2017  macallan add quick path for timebase-frequency detection
deal with differences in /u4 reg property encoding vs. /uni-n, so this works
on my G5 now
 1.40 15-Sep-2017  macallan flesh out RANGE_TYPE_MACIO
 1.39 22-Dec-2016  cherry switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.
 1.38 25-Mar-2014  matt branches: 1.38.6; 1.38.10;
sprintf -> snprintf
 1.37 03-Mar-2014  macallan support ppc601
from scole_mail, ok matt@
 1.36 28-Feb-2014  matt Use uintptr_t instead of int.
 1.35 03-Nov-2013  mrg - remove set but unused variables
- move some variables inside their relevant use #ifdef
 1.34 31-Aug-2013  matt Move the pmap_setup to the start oea_init (no non-OFW ports can use it).
If PPC_OEA64_BRIDGE is defined, add code so that when OEACPU_64_BRIDGE is not
present, it replaces the rfid with rfi and mfmsr/rldicl/mtmsrd sequence
with NOPs. This allows plain OEA kernels to work. (tested on PMPPC with
PPC_OEA64_BRIDGE option added).
 1.33 13-May-2013  macallan branches: 1.33.2;
more G5 stuff:
- call OF_quiesce()
- properly map the message buffer
 1.32 11-Apr-2013  macallan make PPC_OEA64_BRIDGE mode work
from Phileas Fogg
 1.31 20-Oct-2012  kiyohara Support Cache Protocol 'MEI' with MULTIPROCESSOR.
 1.30 17-Jul-2012  jmmv branches: 1.30.2;
OF_finddevice returns -1 on error, not an arbitrary negative number. Make
conditional explicit so that model_name gets a chance to be initialized when
the handle for the device is actually negative (which appears to be the case
in my Mac Mini G4).
 1.29 08-May-2012  macallan provide a BAT mapping for the PCI IO range on Grackle/Heathrow based macs
now drivers that need PCI IO access work again
 1.28 16-Feb-2012  matt Allow use of large (>256MB) bats for iobats. If XBSEN isn't present, they
will be "downsized" into multiple 256MB bats. Tested by riz.
 1.27 15-Feb-2012  macallan branches: 1.27.2;
fix crash during early startup - we can't call OpenFirmware between zapping
the BATs and complete setting them up again
ok releng
 1.26 04-Aug-2011  phx branches: 1.26.2; 1.26.6;
Drop into ddb, when requested by ofwboot (-d option).
 1.25 27-Jul-2011  macallan move clearing PSL_IP in ofwmsr back where it was - if we do it too early my
PowerBook 3400c hangs on startup.
 1.24 17-Jul-2011  dyoung Enable new-style <sys/bus.h> on several PowerPC ports supporting PCI
buses. Make non-inline implementations of bus_space(9) and bus_dma(9)
routines and move them to appropriate .c files.

This may leave amigappc in a bad state, sorry. Fortunately, it will be
easy to repair by imitating the bus.h -> bus_{defs,funcs}.h split in
some other PowerPC port.
 1.23 02-Jul-2011  matt Select pmap style before calling oea_init.
 1.22 20-Jun-2011  matt <arch/powerpc/... -> <powerpc/...
 1.21 12-Jun-2011  matt Save/restore all sprgs when calling OFW.
Move all-zero variables from .data to .bss
Use .lcomm for local variables.
Cleanup a bit of assembly.
Clear PSL_IP in the saved ofmsr (was previously done in ofwoea_machdep.c)
 1.20 14-Mar-2010  kiyohara branches: 1.20.8;
Fix isa(4) support for ofw.
ofw not initialized bus_space for isa(4).
It tested on ofppc(PegasosII).
 1.19 10-Mar-2010  kiyohara Remove white-spaces.
 1.18 17-Jan-2010  phx branches: 1.18.2;
Heed modeldata.ranges_offset while constructing the ranges bitmap.
 1.17 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.16 30-Nov-2008  martin branches: 1.16.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.
 1.15 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.14 28-Apr-2008  martin branches: 1.14.6; 1.14.8;
Remove clause 3 and 4 from TNF licenses
 1.13 08-Apr-2008  garbled branches: 1.13.2; 1.13.4;
SMP support for ofppc. (finally) Much thanks to Matt Thomas for help in
figuring out all the crazy nuances of getting this working, and to
Michael Lorenz for testing/fixing my changes on macppc. Tested with a
quad-proc 7044-270.
Summary of changes:

Bumped CPU_MAXNUM to 16 on ofppc.
Added md_* routines to ofppc/cpu.c, to sync the timebase, and awaken the CPUs.
Fixed a bug in the test for a 64bit bridge cpu early in locore.S
Added code to set the interrupt priority for all CPUs with an openpic.
Change rtas to probe before cpus, to allow use of the rtas freeze/thaw
timebase code routines.
Fix CPU_INFO_FOREACH macro to iterate through detected cpus, not CPU_MAXNUM.
Change most uses of ci_cpuid to ci_index, to deal with CPUs that do not allow
writing to SPR_PIR. Don't write SPR_PIR unless the secondary cpu identifies
itself as 0.
Change the hatchstack/interrupt stack allocations to allocate a 8192byte
interrupt stack, and a 4096 byte hatch stack, align them to 16 bytes, and
allocate them no lower than 0x10000. Allocate them separately to prevent the
hatch stack corrupting the interrupt stack later on.
If the CPU is a 64bit cpu, copy SPR_ASR in cpu_hatch()
Set the idle stack to ci->ci_data.cpu_idlelwp->l_addr->u_pcb.pcb_sp.
Add OF_start_cpu(). Add a routine to ofwoea_initppc to spin up secondary
procs early, and place them into a spinloop waiting for the hatch routines
to be ready.
Modify the ipi routines to deal with openpics that reverse byte order on read
from an ipi register. (such as on the 7044)
Change the rtas setup to allocate the rtas physical base address above
the kernel, to avoid mucking up the hatch/interrupt stacks.
 1.12 14-Feb-2008  garbled branches: 1.12.6;
Some powerpc cleanup. Remove unneeded/bad usage of extern oeacpufeat.
Convert asm code to use %r register format. Done by comparison to
disassembled output, double checked with diff of dissasembled output
before and after, and test booted on my 7044.
 1.11 11-Feb-2008  garbled Use model_init to clean up how we decide the ranges for
PCI_NETBSD_CONFIGURE. Add some code to hopefully better handle the
firepower and powerstackII, based on the OFW dumps from those machines.
Untested on those machines, but doesn't break anything on pegasos/7044.
 1.10 05-Feb-2008  garbled Rewrite a big chunk of the pmap and locore code for powerpc to better
deal with the 64bit bridge mode. pmap changes by Matt Thomas, rest by myself.

Change pmap.c to work similar to exec_elf.c to allow us to compile in
multiple pmaps to a single kernel. This allows the pmap for bridge64 to
co-exist with the 32bit pmap.

Yank __HAVE_PMAP_PHYSSEG from all the oea code.

Add a new global, "oeacpufeat", which is used early in locore to determine
certain cpu features. This allows us to conditionalize code early in the boot
for certain CPUs that have special needs.

Yank most of the ifdef PPC_OEA_BRIDGE64 code from almost every file it was
found in. Some of it seemed incorrect, and my 7044 booted just fine
without it. It would appear that the bridge cpus treat BAT instructions
as nops, so they seem to be safe.

In ofppc, check the oeacpufeat, and if we are on a 64bit proc, clear
MSR[SF], and ASR[V].

With all of these changes, a kernel with both PPC_OEA and PPC_OEA_BRIDGE64
will boot on the POWERIII-2 cpu. However, it will not yet boot on a 32bit
cpu, because of CACHELINESIZE. Work remains to be done there to fix that.
 1.9 28-Jan-2008  garbled Apparently BRIDGE mode allows BAT registers, so re-enable that code.
Change the pegasos PCI_NETBSD_CONFIGURE arguments around to wire up mem
space into the correct area, and move the io regs a little to make it
work properly. Just avoid the secondary PCI entirely.
Change the list of things that we fiddle with in pci_conf_hook. Map mem
on the fwohci, avoid display cards, avoid IO on the auvia.
Change some printf's to aprint_*
Yank a call to genppc_pci_indirect_make_tag and change it to the
bus-independant pci call instead. (in pci_conf_hook)
 1.8 17-Jan-2008  garbled Add support to ofppc for the IBM 7044-270 machine. This is a POWER3-II
based machine. Currently the kernel to run on this machine is
incompatible with the standard GENERIC kernel, so for now, we have a
separate GENERIC_B64. Eventually, I hope to combine the two.

Please note, this is a port of 32bit ofppc, not a powerpc64 port.

Thanks to Matt Thomas and Kevin Bowling for helping to make this port
possible.

Summary of changes:

Change ofwpci to use the ofmethod config for configuring the PCI bus,
rather than indirect configuration.
Move the wiring of the interrupt controllers from at the start of the
boot, into the configuration of the first PCI bus.
Rewrite the map_isa_ioregs() hack to work on a machine without BATs
Fix a ton of bugs in the genofw_find_pics routine, and in the map_space code.
Split the pic_openpic into openpic_common and pic_openpic.
Create a new pic_distopenpic driver, for the distributed openpic found on
some newer IBM machines.
Fix a bad panic in pmap_extract on 64bit bridge mode
 1.7 09-Jan-2008  garbled ofwoea_batinit should be a nop when PPC_OEA is not defined
 1.6 26-Nov-2007  garbled branches: 1.6.6;
Apply a set of patches from Frank Wille to make the genfb attachment work
better on ofppc. In doing so, we also move a few functions around in
macppc and the generic ofw powerpc stuff to allow better sharing of code.
Also, introduce a model_init function.

move ofb_cons.c from macppc/dev to powerpc/oea and rename it to rascons.
This gets rid of some naming confusion, and makes it OFW-MI rather than
macppc specific.
 1.5 14-Nov-2007  garbled Commit a fix for the _SR regions that are needed by ofppc. Because this
platform tends to just declare anything from 0x8 to 0xf as mem or io
regions willy-nilly, we need to avoid batmapping a few of those in order
to save space for USER_SR, KERNEL_SR and KERNEL2_SR. I picked values for
these three that are least-commonly used or used for non-vital things.
 1.4 26-Oct-2007  garbled branches: 1.4.2; 1.4.4; 1.4.6;
Fix the ranges_bitmap function so it correctly finds the various ranges
on OFW, and passes them on to ofwoea_batmap correctly. With this fix,
ofppc now properly initializes all of it's batmappings.

Kept the macppc specific override of the bitmap, but surrounded it with
an #ifdef macppc. It would probably be worth testing macppc without this
ifdef to see if it works there as well.
 1.3 25-Oct-2007  garbled Add a bunch of fixes and minor rewrites to ofppc to bring it closer to
working properly. This is still a work in progress, and all work so far
has been based on the PegasosII machne.

1) Rewrite how the ISA memory and IO space maps are found. More work
will still need to be done in this area.
2) Add a new OFW method of pci configuration. So far I can only get this
to work on the primary PCI bus on the Pegasos. Unsure if this is a
pegasos bug or a code bug.
3) Add the rtas device to ofppc, and add an "rtas_reboot" function to
rtas to allow me to reboot the PegasosII. The rtas driver works, and is
a great start but needs to be changed slightly to allow easier access to
the functions from outside the driver.
4) Fix a number of bugs that existed in the shared PCI code for ofw that
probably weren't tickled by macppc.

There is much much more left to do here, this is all still a work in
progress, but this commit will allow other people to play around with the
code if they want to.
 1.2 17-Oct-2007  garbled branches: 1.2.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.1 06-Jun-2007  garbled branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10;
file ofwoea_machdep.c was initially added on branch ppcoea-renovation.
 1.1.10.3 18-Nov-2007  bouyer Sync with HEAD
 1.1.10.2 13-Nov-2007  bouyer Sync with HEAD
 1.1.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.1.8.1 18-Oct-2007  yamt sync with head.
 1.1.6.4 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.1.6.3 21-Nov-2007  joerg Sync with HEAD.
 1.1.6.2 28-Oct-2007  joerg Sync with HEAD.
 1.1.6.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.1.2.7 24-Sep-2007  macallan shutup debug output if options OFWOEA_DEBUG isn't given
 1.1.2.6 15-Aug-2007  macallan add a config option to control the number of ranges we can bus_space_map()
per bus, also bump it from 8 to 20 so all PCI devices in my iBook work
again.
 1.1.2.5 18-Jun-2007  macallan call ksyms_init()
 1.1.2.4 18-Jun-2007  macallan forgot to XXX an evil hack
 1.1.2.3 18-Jun-2007  macallan make this work on macppc
caveats:
- ISA is likely borked
- the way we set PCI memory and IO ranges might be macppc-specific and
should probably go into the host bridge drivers
 1.1.2.2 07-Jun-2007  garbled Convert macppc to powerpc bus_space. Lots of work here from Matt Thomas,
as well as the common ofwoea code from myself. Compile tested only,
still probably needs some fine tuning.

Also in this commit:
Convert macppc to new shared ofwoea routines.
Lots of KNF.
 1.1.2.1 06-Jun-2007  garbled Add new routines which should be common between macppc and ofppc. Not
used by either port yet.
 1.2.2.3 03-Dec-2007  ad Sync with HEAD.
 1.2.2.2 23-Oct-2007  ad Sync with head.
 1.2.2.1 17-Oct-2007  ad file ofwoea_machdep.c was added on branch vmlocking on 2007-10-23 20:36:10 +0000
 1.4.6.4 23-Mar-2008  matt sync with HEAD
 1.4.6.3 09-Jan-2008  matt sync with HEAD
 1.4.6.2 06-Nov-2007  matt sync with HEAD
 1.4.6.1 26-Oct-2007  matt file ofwoea_machdep.c was added on branch matt-armv6 on 2007-11-06 23:20:46 +0000
 1.4.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.4.4.2 08-Dec-2007  mjf Sync with HEAD.
 1.4.4.1 19-Nov-2007  mjf Sync with HEAD.
 1.4.2.8 27-Feb-2008  yamt sync with head.
 1.4.2.7 11-Feb-2008  yamt sync with head.
 1.4.2.6 04-Feb-2008  yamt sync with head.
 1.4.2.5 21-Jan-2008  yamt sync with head
 1.4.2.4 07-Dec-2007  yamt sync with head
 1.4.2.3 15-Nov-2007  yamt sync with head.
 1.4.2.2 27-Oct-2007  yamt sync with head.
 1.4.2.1 26-Oct-2007  yamt file ofwoea_machdep.c was added on branch yamt-lazymbuf on 2007-10-27 11:27:54 +0000
 1.6.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.6.6.1 10-Jan-2008  bouyer Sync with HEAD
 1.12.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.12.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.4.4 11-Aug-2010  yamt sync with head.
 1.13.4.3 11-Mar-2010  yamt sync with head
 1.13.4.2 04-May-2009  yamt sync with head.
 1.13.4.1 16-May-2008  yamt sync with head.
 1.13.2.1 18-May-2008  yamt sync with head.
 1.14.8.2 03-Mar-2009  skrll Sync with HEAD.
 1.14.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.20.8.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.26.6.2 02-Jun-2012  mrg sync to latest -current.
 1.26.6.1 18-Feb-2012  mrg merge to -current.
 1.26.2.4 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.26.2.3 30-Oct-2012  yamt sync with head
 1.26.2.2 23-May-2012  yamt sync with head.
 1.26.2.1 17-Apr-2012  yamt sync with head
 1.27.2.1 12-Jun-2012  riz Pull up following revision(s) (requested by macallan in ticket #321):
sys/arch/powerpc/oea/ofwoea_machdep.c: revision 1.29
provide a BAT mapping for the PCI IO range on Grackle/Heathrow based macs
now drivers that need PCI IO access work again
 1.30.2.4 03-Dec-2017  jdolecek update from HEAD
 1.30.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.2.2 23-Jun-2013  tls resync from head
 1.30.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.33.2.1 18-May-2014  rmind sync with head
 1.38.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.38.6.1 05-Feb-2017  skrll Sync with HEAD
 1.44.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.44.4.1 10-Jun-2019  christos Sync with HEAD
 1.44.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.45.6.1 29-Feb-2020  ad Sync with head.
 1.50.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.59.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.122 28-Feb-2025  andvar Fix various typos in comments.
 1.121 15-Dec-2023  rin branches: 1.121.2;
powerpc: oea: For OEA64_BRIDGE, 1:1 map up to 3GiB memory

As done for OEA. Note that kva over 3GiB is reserved.

Provide PMAP_MAP_POOLPAGE for OEA64_BRIDGE at the same time, by
which direct-mapped memory is utilized in order to work around
starvation of 512MiB kernel virtual space.

PR kern/57621
 1.120 15-Dec-2023  rin powerpc/oea: pmap_create: Use PR_ZERO and drop memset(9), NFC

Part of PR kern/57621
 1.119 15-Dec-2023  rin powerpc/oea: pmap: Fix mostly-pointless overhead of pmap_pvo_pool

(1) Drop __aligned(32) from struct pvo_entry; otherwise,
sizeof(struct pvo_entry) is round-up'ed to a multiple of 32.

(2) Do not set sizeof(struct pvo_entry) to `align` argument for
pool_init(9); it must be power of 2.

(3) Align pvo_entry to 32-byte boundary only if reasonably possible,
i.e., OEA without DIAGNOSTIC (--> POOL_REDZONE) for now.

Part of PR kern/57621
 1.118 15-Dec-2023  rin powerpc/oea: pmap: Rework pmap_pte_spill()

It was broken in many ways... Now, it gets working stable both for
OEA and OEA64_BRIDGE, as far as I can see.

Part of PR kern/57621
 1.117 15-Dec-2023  rin powerpc/oea: pmap: Drop unused argument for pmap_pvo_reclaim(), NFC

Part of PR kern/57621
 1.116 08-Dec-2023  andvar fix triple s typos in comments.
 1.115 09-Oct-2023  rin powerpc/oea: pmap: Use pool_allocator_nointr() for pmap_pool

As done for (majority of) other pmap implementations.

pmap_pool_allocator() allocates memory below 256MB, but it is not
necessary for struct pmap.

Fix part of PR kern/57621, i.e., stall in pmap_create(9).

There should be another bugs that cause (MP?) kernel hangs
reported in the PR, in pmap or other MD components for powerpc
(PR port-powerpc/56922 should be one of the candidates).

XXX
pmap for powerpc/oea apparently needs some clean ups. But leave it
as is, and pull up this minimum fix to netbsd-10 at the moment.
 1.114 09-May-2022  rin branches: 1.114.4;
PR port-powerpc/56818

Fix inverted logic introduced in rev. 1.108, by which modified/referenced
bits of pages were never cleared appropriately.

Now, full ATF runs on macppc and sandpoint, with no regression observed.
 1.113 09-Apr-2022  riastradh sys: Use membar_release/acquire around reference drop.

This just goes through my recent reference count membar audit and
changes membar_exit to membar_release and membar_enter to
membar_acquire -- this should make everything cheaper on most CPUs
without hurting correctness, because membar_acquire is generally
cheaper than membar_enter.
 1.112 12-Mar-2022  riastradh sys: Membar audit around reference count releases.

If two threads are using an object that is freed when the reference
count goes to zero, we need to ensure that all memory operations
related to the object happen before freeing the object.

Using an atomic_dec_uint_nv(&refcnt) == 0 ensures that only one
thread takes responsibility for freeing, but it's not enough to
ensure that the other thread's memory operations happen before the
freeing.

Consider:

Thread A Thread B
obj->foo = 42; obj->baz = 73;
mumble(&obj->bar); grumble(&obj->quux);
/* membar_exit(); */ /* membar_exit(); */
atomic_dec -- not last atomic_dec -- last
/* membar_enter(); */
KASSERT(invariant(obj->foo,
obj->bar));
free_stuff(obj);

The memory barriers ensure that

obj->foo = 42;
mumble(&obj->bar);

in thread A happens before

KASSERT(invariant(obj->foo, obj->bar));
free_stuff(obj);

in thread B. Without them, this ordering is not guaranteed.

So in general it is necessary to do

membar_exit();
if (atomic_dec_uint_nv(&obj->refcnt) != 0)
return;
membar_enter();

to release a reference, for the `last one out hit the lights' style
of reference counting. (This is in contrast to the style where one
thread blocks new references and then waits under a lock for existing
ones to drain with a condvar -- no membar needed thanks to mutex(9).)

I searched for atomic_dec to find all these. Obviously we ought to
have a better abstraction for this because there's so much copypasta.
This is a stop-gap measure to fix actual bugs until we have that. It
would be nice if an abstraction could gracefully handle the different
styles of reference counting in use -- some years ago I drafted an
API for this, but making it cover everything got a little out of hand
(particularly with struct vnode::v_usecount) and I ended up setting
it aside to work on psref/localcount instead for better scalability.

I got bored of adding #ifdef __HAVE_ATOMIC_AS_MEMBAR everywhere, so I
only put it on things that look performance-critical on 5sec review.
We should really adopt membar_enter_preatomic/membar_exit_postatomic
or something (except they are applicable only to atomic r/m/w, not to
atomic_load/store_*, making the naming annoying) and get rid of all
the ifdefs.
 1.111 18-Feb-2022  martin Backout previous and fix the correct macro magic
 1.110 18-Feb-2022  martin pmap_pv_protect is not STATIC
 1.109 16-Feb-2022  riastradh powerpc: Sprinkle "memory" clobbers on eieio and nearby asm blocks.

Otherwise the compiler may reorder these around loads and stores,
which mostly defeats the purpose. `asm volatile' just ensures the
instruction isn't _deleted_; it may still move around.
 1.108 16-Feb-2022  riastradh powerpc: Implement pv-tracking for unmanaged pages.

Needed for drm.
 1.107 19-Jul-2021  chs there is no need to keep pvos for unmanaged mappings on a hidden p/v list,
since "unmanaged" means that we don't want to find such pvos on any p/v list.
instead, just don't put such pvos on any p/v list at all and remove
the two hidden p/v lists for unmanaged mappings. code mostly from martin,
to implement rin's suggestion of unifying the two hidden lists.
 1.106 27-Jun-2021  martin PR 55325: unify both pvo pools (for managed and unmanaged pages).
Analyzis by rin, fix suggested by chs.
 1.105 12-Mar-2021  thorpej branches: 1.105.4;
Fix paste-o in last.
 1.104 12-Mar-2021  thorpej Re-factor the code in pmap_extract() that checks the 601 I/O segment
table and the BAT tables into separate functions that can be called
from outside of the pmap module.
 1.103 11-Mar-2021  thorpej Tidy up initialization of the kernel SRs just a bit.
 1.102 10-Mar-2021  thorpej - In pmap_bootstrap1(), make sure to initialize pmap_kernel()->pm_vsid
with the kernel's base VSID.
- In va_to_vsid(), always compute the VSID from the base VSID in the
pmap and the effective segment ID (ESID), rather than extracting it
from the pmap's segment register value for that ESID. Not only does
this make the code the same between OEA and OEA64, but is also lets
us compute the correct VSID for that pmap/ESID even if the cached SR
for that ESID currently contains something else, such as an I/O segment
mapping (as might be the case on a 601).

With this change, we can temporarily toggle between an I/O segment and
and HTAB-mapped segment if needed (e.g. when calling OpenFirmware on
a 601-based system).
 1.101 02-Mar-2021  thorpej Complete the pmap symbol renaming shenanigans for pmap_bootstrap[12]().
 1.100 02-Mar-2021  rin Apply PMAPNAME() to pmap_bootstrap[12](); fix build for ofppc, which has
both pmap32 and pmap64bridge in a single kernel.
 1.99 01-Mar-2021  thorpej Split pmap_bootstrap() into 2 functions:
- pmap_bootstrap1(), which sets up the low-level pmap data structures.
- pmap_bootstrap2(), which actually programs the MMU hardware based on
pmap_bootstrap1()'s work.

pmap_bootstrap() is still provided as a wrapper around the two, but this
provides flexibility to platforms that might need to do additional work
between these two phases.
 1.98 06-Jul-2020  rin branches: 1.98.2;
Style and cosmetic changes. No binary changes intended.
 1.97 02-Jul-2020  rin Fix typo; PMAP_OEA64_BRIDGE not PMAP_OEA_BRIDGE.
Tested on Power Mac G5.
 1.96 31-May-2020  rin Stop returning while PMAP_LOCK() (= KERNEL_LOCK(1, NULL)) is held.

Kernel freeze with heavy load is significantly mitigated (fixed?),
in which I could not even enter DDB from console.

XXX
There is still inconsistency in usage of two PVO pools.
I will send-pr later.

XXX
pullup to netbsd-[987]
 1.95 27-Jan-2018  chs branches: 1.95.8;
apply the change from arch/x86/x86/pmap.c rev. 1.266 commitid vZRjvmxG7YTHLOfA:

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them. If we are replacing an existing mapping,
reuse the pv structure where possible.

This implements the requirement that pmap_enter(PMAP_CANFAIL) must not fail
when replacing an existing mapping with the first mapping of a new page,
which is an unintended consequence of the changes from the rmind-uvmplock
branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries. This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before. It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706 on the remaining platforms where
this problem existed.
 1.94 23-Dec-2016  cherry branches: 1.94.8;
"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.93 14-Feb-2016  dholland branches: 1.93.2;
Add missing va_end; PR 50795 from David Binderman.
 1.92 10-Aug-2014  joerg branches: 1.92.2; 1.92.4;
Update conditions on mfsrin definition to match use.
 1.91 03-Mar-2014  macallan support ppc601
from scole_mail, ok matt@
 1.90 03-Nov-2013  mrg gcc 4.8.1 wants:
- remove some set but unused variables
- move some variables inside their usage #ifdef's
- cast to (void) instead of using a dummy return variable

(there are more to come, but this one is now tested with gcc 4.5)
 1.89 11-Apr-2013  macallan branches: 1.89.4;
make PPC_OEA64_BRIDGE mode work
from Phileas Fogg
 1.88 28-Mar-2013  christos Fix loop bug (Phileas Fogg)
 1.87 20-Oct-2012  kiyohara Support Cache Protocol 'MEI' with MULTIPROCESSOR.
 1.86 28-Jul-2012  matt branches: 1.86.2;
Fix -fno-common fallout.
 1.85 03-Feb-2012  matt Use CPP __VA_ARGS__ for DPRINTF*
 1.84 01-Feb-2012  matt Use kmem instead of malloc. Remove unneeded <sys/malloc.h> includes.
 1.83 01-Feb-2012  matt Enable XBSEN and HIGHBAT for OEA 7455 and related CPUs.
The BAT entries now have a resolution of 8MB. (Adjacent entries are merged
up to a total of 2GB per entry).
 1.82 17-Jul-2011  joerg branches: 1.82.2; 1.82.6;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.81 30-Jun-2011  matt Modify mapiodev to take a third argument indicating whether the space
should be prefetchable (true) or not (false).
 1.80 19-Jun-2011  matt Use __builtin_clz instead of cntlzw
 1.79 02-May-2011  matt branches: 1.79.2;
A little PMAP_OEA64 pmap support.
 1.78 18-Feb-2011  matt Move powerpc_mmap_flags since pmap.c can get compiled multiple time resulting
in multiple defintions of powerpc_mmap_flags.
 1.77 15-Feb-2011  macallan implement pmap_mmap_flags() and teach PowerPC's bus_space_mmap() to actually
use BUS_SPACE_MAP_PREFETCHABLE which, now that /dev/pci* knows how to use it,
helps improve X performance
 1.76 12-Feb-2011  matt When an OEA kernel is configured for multiple MMU types, use the new
powerpc fixup mechanism to bind the kernel to a particular MMU. This
avoids an indirect call for every pmap call.
 1.75 18-Jan-2011  matt branches: 1.75.2;
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.74 12-Nov-2010  uebayasi branches: 1.74.2;
Put VM_PAGE_TO_MD() definition in one place. No functional changes.
 1.73 10-Nov-2010  uebayasi Use more VM_PHYSMEM_*() accessors. No functional changes.
 1.72 30-Oct-2010  uebayasi Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional
changes.
 1.71 25-Feb-2010  matt branches: 1.71.2;
Adapt to spr.h breakup.
 1.70 25-Feb-2010  skrll s/cpu_fork/cpu_lwp_fork/ in comment
 1.69 21-Nov-2009  rmind branches: 1.69.2;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.68 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.67 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.66 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.65 21-Apr-2009  cegger change pmap flags argument from int to u_int.
discussed with christos@ on source-changes-d@
 1.64 11-Dec-2008  pooka branches: 1.64.2;
Since oea pmap.c is #included many times, put kernel_pmap_ptr into
its own source module to avoid multiple initialized data definitions.
 1.63 10-Dec-2008  pooka Make kernel_pmap_ptr a const. Requested by steve_martin.
 1.62 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.61 29-Oct-2008  skrll branches: 1.61.12;
Typo in comment.
 1.60 05-May-2008  chs branches: 1.60.6; 1.60.8;
pmap_upvo_pool needs to use IPL_VM since it is used from
pmap_kenter_pa(), which can be called from interrupt context.
 1.59 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.58 08-Apr-2008  garbled branches: 1.58.2; 1.58.4;
SMP support for ofppc. (finally) Much thanks to Matt Thomas for help in
figuring out all the crazy nuances of getting this working, and to
Michael Lorenz for testing/fixing my changes on macppc. Tested with a
quad-proc 7044-270.
Summary of changes:

Bumped CPU_MAXNUM to 16 on ofppc.
Added md_* routines to ofppc/cpu.c, to sync the timebase, and awaken the CPUs.
Fixed a bug in the test for a 64bit bridge cpu early in locore.S
Added code to set the interrupt priority for all CPUs with an openpic.
Change rtas to probe before cpus, to allow use of the rtas freeze/thaw
timebase code routines.
Fix CPU_INFO_FOREACH macro to iterate through detected cpus, not CPU_MAXNUM.
Change most uses of ci_cpuid to ci_index, to deal with CPUs that do not allow
writing to SPR_PIR. Don't write SPR_PIR unless the secondary cpu identifies
itself as 0.
Change the hatchstack/interrupt stack allocations to allocate a 8192byte
interrupt stack, and a 4096 byte hatch stack, align them to 16 bytes, and
allocate them no lower than 0x10000. Allocate them separately to prevent the
hatch stack corrupting the interrupt stack later on.
If the CPU is a 64bit cpu, copy SPR_ASR in cpu_hatch()
Set the idle stack to ci->ci_data.cpu_idlelwp->l_addr->u_pcb.pcb_sp.
Add OF_start_cpu(). Add a routine to ofwoea_initppc to spin up secondary
procs early, and place them into a spinloop waiting for the hatch routines
to be ready.
Modify the ipi routines to deal with openpics that reverse byte order on read
from an ipi register. (such as on the 7044)
Change the rtas setup to allocate the rtas physical base address above
the kernel, to avoid mucking up the hatch/interrupt stacks.
 1.57 11-Mar-2008  matt on MP systems, whenever we change a PTE, make to sync the data cache so that
other processors can see the change.
 1.56 17-Feb-2008  phx branches: 1.56.2; 1.56.6;
Fixed compilation with DEBUG option for PMAP_OEA64_BRIDGE.
Approved by garbled.
 1.55 05-Feb-2008  garbled Ifdef out all the MPC601 code with PPC_OEA601. Now only arches that have the
possibility of running on an MPC601, are infected with all the extra code
and nops that it added.

Also, fix compilation that I broke with the pmap code, by adding
oeacpufeat to the locores of various ppc arches. Noted by mlelstv.
 1.54 05-Feb-2008  mlelstv fix and cleanup debug printf formats
 1.53 05-Feb-2008  garbled Rewrite a big chunk of the pmap and locore code for powerpc to better
deal with the 64bit bridge mode. pmap changes by Matt Thomas, rest by myself.

Change pmap.c to work similar to exec_elf.c to allow us to compile in
multiple pmaps to a single kernel. This allows the pmap for bridge64 to
co-exist with the 32bit pmap.

Yank __HAVE_PMAP_PHYSSEG from all the oea code.

Add a new global, "oeacpufeat", which is used early in locore to determine
certain cpu features. This allows us to conditionalize code early in the boot
for certain CPUs that have special needs.

Yank most of the ifdef PPC_OEA_BRIDGE64 code from almost every file it was
found in. Some of it seemed incorrect, and my 7044 booted just fine
without it. It would appear that the bridge cpus treat BAT instructions
as nops, so they seem to be safe.

In ofppc, check the oeacpufeat, and if we are on a 64bit proc, clear
MSR[SF], and ASR[V].

With all of these changes, a kernel with both PPC_OEA and PPC_OEA_BRIDGE64
will boot on the POWERIII-2 cpu. However, it will not yet boot on a 32bit
cpu, because of CACHELINESIZE. Work remains to be done there to fix that.
 1.52 17-Jan-2008  garbled Add support to ofppc for the IBM 7044-270 machine. This is a POWER3-II
based machine. Currently the kernel to run on this machine is
incompatible with the standard GENERIC kernel, so for now, we have a
separate GENERIC_B64. Eventually, I hope to combine the two.

Please note, this is a port of 32bit ofppc, not a powerpc64 port.

Thanks to Matt Thomas and Kevin Bowling for helping to make this port
possible.

Summary of changes:

Change ofwpci to use the ofmethod config for configuring the PCI bus,
rather than indirect configuration.
Move the wiring of the interrupt controllers from at the start of the
boot, into the configuration of the first PCI bus.
Rewrite the map_isa_ioregs() hack to work on a machine without BATs
Fix a ton of bugs in the genofw_find_pics routine, and in the map_space code.
Split the pic_openpic into openpic_common and pic_openpic.
Create a new pic_distopenpic driver, for the distributed openpic found on
some newer IBM machines.
Fix a bad panic in pmap_extract on 64bit bridge mode
 1.51 09-Jan-2008  garbled fix a bad cast when compiling in bridge mode
 1.50 02-Jan-2008  ad Merge vmlocking2 to head.
 1.49 15-Dec-2007  perry __FUNCTION__ -> __func__
 1.48 12-Mar-2007  ad branches: 1.48.18; 1.48.24; 1.48.26; 1.48.30;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.47 04-Mar-2007  macallan branches: 1.47.2;
make this compile again
 1.46 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.45 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.44 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.43 30-Oct-2006  garbled branches: 1.43.4;
Make these files compile with -Wextra -Wno-unused.
 1.42 19-Sep-2006  matt When mapping the kernel, make to update its segment register to be valid.
 1.41 19-Sep-2006  matt At the end of pmap_bootstrap, if PMAP_NEED_MAPKERNEL, map the kernel into
the kernel's pmap (text will be rx, data will be rw).
 1.40 07-Sep-2006  sanjayl branches: 1.40.2; 1.40.4;
Remove debug printf that got left in accidentally
 1.39 02-Sep-2006  matt Add/rename macros (PVO_xxx_P) for testing WIRED, MANAGED, EXECUTABLE ness
of a PVO entry. (Fixes where PVO_WIRED was tested against pvo_pt.pte_lo
instead of pvo_vaddr)
 1.38 05-Aug-2006  sanjayl branches: 1.38.2;
1st cut of Powermac G5 support (uses bridge mode).
 1.37 13-May-2006  matt Fix a problem when an exec page is mapped, modified, and then unmapped.
Make sure to either clear the execness or sync the page to the icache.

This fixes gdb testsuite failures. Thanks for nathanw for testing.
 1.36 12-May-2006  nathanw Fix a typo in a comment.
 1.35 24-Dec-2005  perry branches: 1.35.4; 1.35.6; 1.35.8; 1.35.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.34 08-Dec-2005  yamt use VM_PAGE_TO_PHYS macro.
 1.33 27-Sep-2005  chs avoid calling into the pool code while PSL_EE is off.
the pool code can do spl*()/splx(), and splx() requires PSL_EE to be on.
 1.32 02-Jun-2005  he branches: 1.32.2;
Remove the hack to compile oea/pmap.c with -Wno-cast-qual, and instead
make use of the new __UNVOLATILE() macro in memset() usage.
 1.31 02-Jun-2005  he Fix variable shadowing warning.
 1.30 29-May-2005  chs in pmap_enter(), preset the ref bit for execute-only mappings too.
 1.29 22-Feb-2005  briggs branches: 1.29.2;
pmap_extract(): Only attempt to set '*pap' if pap is non-NULL.
PR port-powerpc/29507 from Neil Ludban.
 1.28 13-Feb-2005  chs move recursion-detection code inside interrupt-protected region. PR 24254.
 1.27 16-Jan-2005  chs branches: 1.27.2;
add some whitespace.
 1.26 24-Aug-2004  matt branches: 1.26.4;
Add pmap counters for reclaimed pvos and for the times a pvo could not be
obtained.
Switch to EVCNT_ATTACH_STATIC*
In DEBUG/DIAGNOSTIC, decrement/increment pmap_pvo_enter_depth around pool
calls since they could possibly cause a recursion back into pmap_pvo_enter.
 1.25 19-Aug-2004  chs implement pmap_pvo_reclaim(), which steals an existing non-wired pvo entry
for reuse, and use this in pmap_pvo_enter() when we can't allocate a new one.
 1.24 09-Jun-2004  kleink pmap_extract(): consider the MPC601's different battable layout, and its
use of I/O segments.
 1.23 21-Mar-2004  aymeric branches: 1.23.2;
pmap_pinit(): improve the hash function in the case of collisions, the
previous version would easily make the low order bits oscillate between 0
and some other value.

Together with the previous change, this should make those
pmap_pinit: out of segments
panics even less likely.

We should really attempt a systematic search before panic()ing at the end.
 1.22 21-Mar-2004  aymeric . don't call VSID_TO_HASH() on a pmap.pm_vsid. It already holds the hash value.
This should fix PR #24754, as well as many of the hangs and process
aborts reported on port-macppc@ in the last weeks.
This error would cause the pmap's vsid never to be freed, and would
occasionnally free a valid vsid used by another pmap, sometimes the kernel's.
. add a related KASSERT() to avoid regression
 1.21 17-Mar-2004  aymeric defparam PMAP_MEMLIMIT
 1.20 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.19 27-Dec-2003  mjl Add some casts to printf() args to make it compile w/ DEBUG set.
 1.18 21-Nov-2003  matt More PPC64 changes. (latent for now).
 1.17 21-Nov-2003  matt Restore ci_curpm since it re-enables 603 to working state.
 1.16 27-Oct-2003  kleink pmap_print_mmuregs(): move initialization of addr before its first use;
reported by David Young.
 1.15 27-Oct-2003  dyoung Stop false uninitialized variable warning.
 1.14 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.13 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.12 08-Aug-2003  matt Allow only user-mappings to be evicted (spillage). This prevents the
dreaded eviction of a kernel stack page.
 1.11 15-Jul-2003  lukem __KERNEL_RCSID()
 1.10 10-May-2003  thorpej branches: 1.10.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.9 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.8 07-Apr-2003  matt Add a KASSERT to pmap_extract so that vtophys is never attempted on a
mapped user address.
 1.7 04-Apr-2003  matt If extracting an address from the kernel pmap, see if the address is outside
the mapped address range. If so, try to look it up via the BAT table. If
successful, translate and return the BAT'ed pa.
 1.6 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.5 17-Mar-2003  matt fix typo in comment.
 1.4 16-Mar-2003  matt Honor PMAP_NC for pmap_kenter_pa. Fix goof in pmap_pte_to_va.
 1.3 14-Mar-2003  matt Remove Debugger call.
 1.2 05-Feb-2003  matt Make things a bit more LP64 friendly.
 1.1 03-Feb-2003  matt Rename PPC_MPC6XX to PPC_OEA (and any mpc6xx reference to oea).
 1.10.2.10 11-Dec-2005  christos Sync with head.
 1.10.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.10.2.6 17-Jan-2005  skrll Sync with HEAD.
 1.10.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.3 03-Sep-2004  skrll Sync with HEAD
 1.10.2.2 25-Aug-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.2.1 22-Aug-2004  tron branches: 1.23.2.1.2;
Pull up revision 1.25 (requested by chs in ticket #780):
implement pmap_pvo_reclaim(), which steals an existing non-wired pvo entry
for reuse, and use this in pmap_pvo_enter() when we can't allocate a new one.
 1.23.2.1.2.1 07-Aug-2005  riz Pull up revisions 1.23 and 1.29 (requested by briggs in ticket #1238):
Consider the MPC601's different battable layout and its use of
I/O segments.
Ensure that pap is non-NULL before use in pmap_extract(). Fixes PR#29507.
 1.26.4.1 29-Apr-2005  kent sync with -current
 1.27.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.29.2.1 21-Oct-2005  tron Pull up following revision(s) (requested by chs in ticket #897):
sys/arch/powerpc/oea/pmap.c: revision 1.33 via patch
avoid calling into the pool code while PSL_EE is off.
the pool code can do spl*()/splx(), and splx() requires PSL_EE to be on.
 1.32.2.8 17-Mar-2008  yamt sync with head.
 1.32.2.7 27-Feb-2008  yamt sync with head.
 1.32.2.6 11-Feb-2008  yamt sync with head.
 1.32.2.5 21-Jan-2008  yamt sync with head
 1.32.2.4 03-Sep-2007  yamt sync with head.
 1.32.2.3 26-Feb-2007  yamt sync with head.
 1.32.2.2 30-Dec-2006  yamt sync with head.
 1.32.2.1 21-Jun-2006  yamt sync with head.
 1.35.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.35.8.4 14-Sep-2006  yamt sync with head.
 1.35.8.3 03-Sep-2006  yamt sync with head.
 1.35.8.2 11-Aug-2006  yamt sync with head
 1.35.8.1 24-May-2006  yamt sync with head.
 1.35.6.1 01-Jun-2006  kardel Sync with head.
 1.35.4.1 09-Sep-2006  rpaulo sync with head
 1.38.2.1 08-Sep-2006  rpaulo Pull up following revision(s) (requested by garbled in ticket #134):
sys/arch/powerpc/oea/pmap.c: revision 1.40
Remove debug printf that got left in accidentally
 1.40.4.2 10-Dec-2006  yamt sync with head.
 1.40.4.1 22-Oct-2006  yamt sync with head
 1.40.2.1 18-Nov-2006  ad Sync with head.
 1.43.4.3 24-Mar-2007  yamt sync with head.
 1.43.4.2 12-Mar-2007  rmind Sync with HEAD.
 1.43.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.1 13-Mar-2007  ad Sync with head.
 1.48.30.3 19-Jan-2008  bouyer Sync with HEAD
 1.48.30.2 10-Jan-2008  bouyer Sync with HEAD
 1.48.30.1 02-Jan-2008  bouyer Sync with HEAD
 1.48.26.2 27-Dec-2007  ad locking changes for macppc. Please test.
 1.48.26.1 26-Dec-2007  ad Sync with head.
 1.48.24.1 18-Feb-2008  mjf Sync with HEAD.
 1.48.18.2 23-Mar-2008  matt sync with HEAD
 1.48.18.1 09-Jan-2008  matt sync with HEAD
 1.56.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.56.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.56.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.56.2.1 24-Mar-2008  keiichi sync with head.
 1.58.4.4 11-Mar-2010  yamt sync with head
 1.58.4.3 19-Aug-2009  yamt sync with head.
 1.58.4.2 04-May-2009  yamt sync with head.
 1.58.4.1 16-May-2008  yamt sync with head.
 1.58.2.1 18-May-2008  yamt sync with head.
 1.60.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.60.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.60.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.61.12.3 26-Jan-2011  matt Change battable to have a granularity of 8MB.
 1.61.12.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.61.12.1 07-Jan-2011  matt Deal with new powerpc world.
 1.64.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.69.2.5 06-Nov-2010  uebayasi Sync with HEAD.
 1.69.2.4 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.69.2.3 30-Apr-2010  uebayasi Sync with HEAD.
 1.69.2.2 28-Apr-2010  uebayasi Always use struct vm_physseg *vm_physmem_ptrs[] in MD code.
 1.69.2.1 26-Feb-2010  uebayasi Use VM_PAGE_TO_MD(). Only compile tested.
 1.71.2.2 31-May-2011  rmind sync with head
 1.71.2.1 05-Mar-2011  rmind sync with head
 1.74.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.75.2.2 05-Mar-2011  bouyer Sync with HEAD
 1.75.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.79.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.82.6.1 18-Feb-2012  mrg merge to -current.
 1.82.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.82.2.2 30-Oct-2012  yamt sync with head
 1.82.2.1 17-Apr-2012  yamt sync with head
 1.86.2.4 03-Dec-2017  jdolecek update from HEAD
 1.86.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.86.2.2 23-Jun-2013  tls resync from head
 1.86.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.89.4.1 18-May-2014  rmind sync with head
 1.92.4.2 05-Feb-2017  skrll Sync with HEAD
 1.92.4.1 19-Mar-2016  skrll Sync with HEAD
 1.92.2.1 07-Jun-2020  martin Pull up following revision(s) (requested by rin in ticket #1732):

sys/arch/powerpc/oea/pmap.c: revision 1.96

Stop returning while PMAP_LOCK() (= KERNEL_LOCK(1, NULL)) is held.
Kernel freeze with heavy load is significantly mitigated (fixed?),
in which I could not even enter DDB from console.

XXX
There is still inconsistency in usage of two PVO pools.
I will send-pr later.

XXX
pullup to netbsd-[987]
 1.93.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.94.8.2 07-Jun-2020  martin Pull up following revision(s) (requested by rin in ticket #1554):

sys/arch/powerpc/oea/pmap.c: revision 1.96

Stop returning while PMAP_LOCK() (= KERNEL_LOCK(1, NULL)) is held.
Kernel freeze with heavy load is significantly mitigated (fixed?),
in which I could not even enter DDB from console.

XXX
There is still inconsistency in usage of two PVO pools.
I will send-pr later.

XXX
pullup to netbsd-[987]
 1.94.8.1 27-Feb-2018  martin Pull up following revision(s) (requested by mrg in ticket #593):
sys/dev/marvell/mvxpsec.c: revision 1.2
sys/arch/m68k/m68k/pmap_motorola.c: revision 1.70
sys/opencrypto/crypto.c: revision 1.102
sys/arch/sparc64/sparc64/pmap.c: revision 1.308
sys/ufs/chfs/chfs_malloc.c: revision 1.5
sys/arch/powerpc/oea/pmap.c: revision 1.95
sys/sys/pool.h: revision 1.80,1.82
sys/kern/subr_pool.c: revision 1.209-1.216,1.219-1.220
sys/arch/alpha/alpha/pmap.c: revision 1.262
sys/kern/uipc_mbuf.c: revision 1.173
sys/uvm/uvm_fault.c: revision 1.202
sys/sys/mbuf.h: revision 1.172
sys/kern/subr_extent.c: revision 1.86
sys/arch/x86/x86/pmap.c: revision 1.266 (via patch)
sys/dev/dtv/dtv_scatter.c: revision 1.4

Allow only one pending call to a pool's backing allocator at a time.
Candidate fix for problems with hanging after kva fragmentation related
to PR kern/45718.

Proposed on tech-kern:
https://mail-index.NetBSD.org/tech-kern/2017/10/23/msg022472.html
Tested by bouyer@ on i386.

This makes one small change to the semantics of pool_prime and
pool_setlowat: they may fail with EWOULDBLOCK instead of ENOMEM, if
there is a pending call to the backing allocator in another thread but
we are not actually out of memory. That is unlikely because nearly
always these are used during initialization, when the pool is not in
use.

Define the new flag too for previous commit.

pool_grow can now fail even when sleeping is ok. Catch this case in pool_get
and retry.

Assert that pool_get failure happens only with PR_NOWAIT.
This would have caught the mistake I made last week leading to null
pointer dereferences all over the place, a mistake which I evidently
poorly scheduled alongside maxv's change to the panic message on x86
for null pointer dereferences.

Since pr_lock is now used to wait for two things now (PR_GROWING and
PR_WANTED) we need to loop for the condition we wanted.
make the KASSERTMSG/panic strings consistent as '%s: [%s], __func__, wchan'
Handle the ERESTART case from pool_grow()

don't pass 0 to the pool flags
Guess pool_cache_get(pc, 0) means PR_WAITOK here.
Earlier on in the same context we use kmem_alloc(sz, KM_SLEEP).

use PR_WAITOK everywhere.
use PR_NOWAIT.

Don't use 0 for PR_NOWAIT

use PR_NOWAIT instead of 0

panic ex nihilo -- PR_NOWAITing for zerot

Add assertions that either PR_WAITOK or PR_NOWAIT are set.
- fix an assert; we can reach there if we are nowait or limitfail.
- when priming the pool and failing with ERESTART, don't decrement the number
of pages; this avoids the issue of returning an ERESTART when we get to 0,
and is more correct.
- simplify the pool_grow code, and don't wakeup things if we ENOMEM.

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them. This implements the requirement that
pmap_enter(PMAP_CANFAIL) must not fail when replacing an existing
mapping with the first mapping of a new page, which is an unintended
consequence of the changes from the rmind-uvmplock branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries. This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before. It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706, as well as the failing assertion
about "uvm_page_locked_p(old_pg)". (but only on x86, various other platforms
will need their own changes to handle this issue.)
In uvm_fault_upper_enter(), if pmap_enter(PMAP_CANFAIL) fails, assert that
the pmap did not leave around a now-stale pmap mapping for an old page.
If such a pmap mapping still existed after we unlocked the vm_map,
the UVM code would not know later that it would need to lock the
lower layer object while calling the pmap to remove or replace that
stale pmap mapping. See PR 52706 for further details.
hopefully workaround the irregularly "fork fails in init" problem.
if a pool is growing, and the grower is PR_NOWAIT, mark this.
if another caller wants to grow the pool and is also PR_NOWAIT,
busy-wait for the original caller, which should either succeed
or hard-fail fairly quickly.

implement the busy-wait by unlocking and relocking this pools
mutex and returning ERESTART. other methods (such as having
the caller do this) were significantly more code and this hack
is fairly localised.
ok chs@ riastradh@

Don't release the lock in the PR_NOWAIT allocation. Move flags setting
after the acquiring the mutex. (from Tobias Nygren)
apply the change from arch/x86/x86/pmap.c rev. 1.266 commitid vZRjvmxG7YTHLOfA:

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them. If we are replacing an existing mapping,
reuse the pv structure where possible.

This implements the requirement that pmap_enter(PMAP_CANFAIL) must not fail
when replacing an existing mapping with the first mapping of a new page,
which is an unintended consequence of the changes from the rmind-uvmplock
branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries. This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before. It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706 on the remaining platforms where
this problem existed.
 1.95.8.1 07-Jun-2020  martin Pull up following revision(s) (requested by rin in ticket #938):

sys/arch/powerpc/oea/pmap.c: revision 1.96

Stop returning while PMAP_LOCK() (= KERNEL_LOCK(1, NULL)) is held.
Kernel freeze with heavy load is significantly mitigated (fixed?),
in which I could not even enter DDB from console.

XXX
There is still inconsistency in usage of two PVO pools.
I will send-pr later.

XXX
pullup to netbsd-[987]
 1.98.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.105.4.1 01-Aug-2021  thorpej Sync with HEAD.
 1.114.4.2 29-Dec-2023  martin Additionally pull up following revision(s) (requested by rin in ticket #400):

sys/arch/powerpc/include/oea/pmap.h: revision 1.39
sys/arch/powerpc/include/pmap.h: revision 1.43
sys/arch/powerpc/oea/pmap_kernel.c: revision 1.14
sys/arch/powerpc/oea/pmap.c: revision 1.117
sys/arch/powerpc/oea/pmap.c: revision 1.118
sys/arch/powerpc/oea/pmap.c: revision 1.119
sys/arch/powerpc/include/vmparam.h: revision 1.27
sys/arch/powerpc/powerpc/trap.c: revision 1.165
sys/arch/powerpc/oea/pmap.c: revision 1.120
sys/arch/powerpc/oea/pmap.c: revision 1.121
sys/arch/powerpc/powerpc/vm_machdep.c: revision 1.106
sys/arch/powerpc/powerpc/bus_dma.c: revision 1.56

powerpc/oea: trap: pmap_{pte,ste}_spill() even in the interrupt context

Page table for oea is something like L2 TLB on memory; kernel and
processes share its entries, and process entries can be spilled out.

As done for MMU based on software-managed TLB, we need to restore
such entries even in the interrupt context.

Note that pmap_pte_spill() require no resouce to restore entries.
Still-not-implemented pmap_ste_spill() for OEA64 should also.
Part of PR kern/57621

powerpc/oea: pmap: Drop unused argument for pmap_pvo_reclaim(), NFC
Part of PR kern/57621

powerpc/oea: pmap: Rework pmap_pte_spill()

It was broken in many ways... Now, it gets working stable both for
OEA and OEA64_BRIDGE, as far as I can see.
Part of PR kern/57621

powerpc/oea: pmap: Fix mostly-pointless overhead of pmap_pvo_pool
(1) Drop __aligned(32) from struct pvo_entry; otherwise,
sizeof(struct pvo_entry) is round-up'ed to a multiple of 32.
(2) Do not set sizeof(struct pvo_entry) to `align` argument for
pool_init(9); it must be power of 2.
(3) Align pvo_entry to 32-byte boundary only if reasonably possible,
i.e., OEA without DIAGNOSTIC (--> POOL_REDZONE) for now.
Part of PR kern/57621

powerpc/oea: pmap_create: Use PR_ZERO and drop memset(9), NFC
Part of PR kern/57621

powerpc: oea: For OEA64_BRIDGE, 1:1 map up to 3GiB memory
As done for OEA. Note that kva over 3GiB is reserved.

Provide PMAP_MAP_POOLPAGE for OEA64_BRIDGE at the same time, by
which direct-mapped memory is utilized in order to work around
starvation of 512MiB kernel virtual space.
PR kern/57621

powerpc: Make sure direct-mapped buffer fits within correct range

For OEA and OEA64_BRIDGE, only first 3GiB memory is direct-mapped.
Part of PR kern/57621
 1.114.4.1 09-Oct-2023  martin Pull up following revision(s) (requested by rin in ticket #400):

sys/arch/powerpc/oea/pmap.c: revision 1.115

powerpc/oea: pmap: Use pool_allocator_nointr() for pmap_pool

As done for (majority of) other pmap implementations.
pmap_pool_allocator() allocates memory below 256MB, but it is not
necessary for struct pmap.

Fix part of PR kern/57621, i.e., stall in pmap_create(9).

There should be another bugs that cause (MP?) kernel hangs
reported in the PR, in pmap or other MD components for powerpc
(PR port-powerpc/56922 should be one of the candidates).
XXX

pmap for powerpc/oea apparently needs some clean ups. But leave it
as is, and pull up this minimum fix to netbsd-10 at the moment.
 1.121.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 05-Feb-2008  garbled branches: 1.1.2; 1.1.4; 1.1.12;
Rewrite a big chunk of the pmap and locore code for powerpc to better
deal with the 64bit bridge mode. pmap changes by Matt Thomas, rest by myself.

Change pmap.c to work similar to exec_elf.c to allow us to compile in
multiple pmaps to a single kernel. This allows the pmap for bridge64 to
co-exist with the 32bit pmap.

Yank __HAVE_PMAP_PHYSSEG from all the oea code.

Add a new global, "oeacpufeat", which is used early in locore to determine
certain cpu features. This allows us to conditionalize code early in the boot
for certain CPUs that have special needs.

Yank most of the ifdef PPC_OEA_BRIDGE64 code from almost every file it was
found in. Some of it seemed incorrect, and my 7044 booted just fine
without it. It would appear that the bridge cpus treat BAT instructions
as nops, so they seem to be safe.

In ofppc, check the oeacpufeat, and if we are on a 64bit proc, clear
MSR[SF], and ASR[V].

With all of these changes, a kernel with both PPC_OEA and PPC_OEA_BRIDGE64
will boot on the POWERIII-2 cpu. However, it will not yet boot on a 32bit
cpu, because of CACHELINESIZE. Work remains to be done there to fix that.
 1.1.12.2 23-Mar-2008  matt sync with HEAD
 1.1.12.1 05-Feb-2008  matt file pmap64.c was added on branch matt-armv6 on 2008-03-23 02:04:18 +0000
 1.1.4.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.4.1 05-Feb-2008  mjf file pmap64.c was added on branch mjf-devfs on 2008-02-18 21:04:58 +0000
 1.1.2.2 11-Feb-2008  yamt sync with head.
 1.1.2.1 05-Feb-2008  yamt file pmap64.c was added on branch yamt-lazymbuf on 2008-02-11 14:59:29 +0000
 1.1 05-Feb-2008  garbled branches: 1.1.2; 1.1.4; 1.1.12;
Rewrite a big chunk of the pmap and locore code for powerpc to better
deal with the 64bit bridge mode. pmap changes by Matt Thomas, rest by myself.

Change pmap.c to work similar to exec_elf.c to allow us to compile in
multiple pmaps to a single kernel. This allows the pmap for bridge64 to
co-exist with the 32bit pmap.

Yank __HAVE_PMAP_PHYSSEG from all the oea code.

Add a new global, "oeacpufeat", which is used early in locore to determine
certain cpu features. This allows us to conditionalize code early in the boot
for certain CPUs that have special needs.

Yank most of the ifdef PPC_OEA_BRIDGE64 code from almost every file it was
found in. Some of it seemed incorrect, and my 7044 booted just fine
without it. It would appear that the bridge cpus treat BAT instructions
as nops, so they seem to be safe.

In ofppc, check the oeacpufeat, and if we are on a 64bit proc, clear
MSR[SF], and ASR[V].

With all of these changes, a kernel with both PPC_OEA and PPC_OEA_BRIDGE64
will boot on the POWERIII-2 cpu. However, it will not yet boot on a 32bit
cpu, because of CACHELINESIZE. Work remains to be done there to fix that.
 1.1.12.2 23-Mar-2008  matt sync with HEAD
 1.1.12.1 05-Feb-2008  matt file pmap64_bridge.c was added on branch matt-armv6 on 2008-03-23 02:04:18 +0000
 1.1.4.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.4.1 05-Feb-2008  mjf file pmap64_bridge.c was added on branch mjf-devfs on 2008-02-18 21:04:58 +0000
 1.1.2.2 11-Feb-2008  yamt sync with head.
 1.1.2.1 05-Feb-2008  yamt file pmap64_bridge.c was added on branch yamt-lazymbuf on 2008-02-11 14:59:29 +0000
 1.14 15-Dec-2023  rin powerpc: oea: For OEA64_BRIDGE, 1:1 map up to 3GiB memory

As done for OEA. Note that kva over 3GiB is reserved.

Provide PMAP_MAP_POOLPAGE for OEA64_BRIDGE at the same time, by
which direct-mapped memory is utilized in order to work around
starvation of 512MiB kernel virtual space.

PR kern/57621
 1.13 16-Feb-2022  riastradh branches: 1.13.4;
powerpc: Implement pv-tracking for unmanaged pages.

Needed for drm.
 1.12 02-Mar-2021  thorpej Complete the pmap symbol renaming shenanigans for pmap_bootstrap[12]().
 1.11 06-Jul-2020  rin branches: 1.11.2;
Style and cosmetic changes. No binary changes intended.
 1.10 28-Jul-2012  matt Fix -fno-common fallout.
 1.9 30-Jun-2011  matt branches: 1.9.2;
Modify mapiodev to take a third argument indicating whether the space
should be prefetchable (true) or not (false).
 1.8 20-Jun-2011  matt Add #error for unknown PPC variant
Now that oea calls cpu_fixup_stubs, we don't need pmap_fixup_stubs.
 1.7 27-Feb-2011  rjs branches: 1.7.2;
Missing semicolon.
 1.6 26-Feb-2011  matt Can't pass a void.
 1.5 18-Feb-2011  matt Make sure stub routines are not profiled.
 1.4 18-Feb-2011  matt Move powerpc_mmap_flags since pmap.c can get compiled multiple time resulting
in multiple defintions of powerpc_mmap_flags.
 1.3 12-Feb-2011  matt When an OEA kernel is configured for multiple MMU types, use the new
powerpc fixup mechanism to bind the kernel to a particular MMU. This
avoids an indirect call for every pmap call.
 1.2 11-Dec-2008  pooka branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.16; 1.2.18;
rcs id police
 1.1 11-Dec-2008  pooka Since oea pmap.c is #included many times, put kernel_pmap_ptr into
its own source module to avoid multiple initialized data definitions.
 1.2.18.2 05-Mar-2011  bouyer Sync with HEAD
 1.2.18.1 17-Feb-2011  bouyer Sync with HEAD
 1.2.16.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.14.1 05-Mar-2011  rmind sync with head
 1.2.10.2 04-May-2009  yamt sync with head.
 1.2.10.1 11-Dec-2008  yamt file pmap_kernel.c was added on branch yamt-nfs-mp on 2009-05-04 08:11:44 +0000
 1.2.6.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.6.1 11-Dec-2008  skrll file pmap_kernel.c was added on branch nick-hppapmap on 2009-01-19 13:16:37 +0000
 1.2.4.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.4.1 11-Dec-2008  mjf file pmap_kernel.c was added on branch mjf-devfs2 on 2009-01-17 13:28:26 +0000
 1.2.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.2.1 11-Dec-2008  haad file pmap_kernel.c was added on branch haad-dm on 2008-12-13 01:13:24 +0000
 1.7.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.9.2.1 30-Oct-2012  yamt sync with head
 1.11.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.13.4.1 29-Dec-2023  martin Additionally pull up following revision(s) (requested by rin in ticket #400):

sys/arch/powerpc/include/oea/pmap.h: revision 1.39
sys/arch/powerpc/include/pmap.h: revision 1.43
sys/arch/powerpc/oea/pmap_kernel.c: revision 1.14
sys/arch/powerpc/oea/pmap.c: revision 1.117
sys/arch/powerpc/oea/pmap.c: revision 1.118
sys/arch/powerpc/oea/pmap.c: revision 1.119
sys/arch/powerpc/include/vmparam.h: revision 1.27
sys/arch/powerpc/powerpc/trap.c: revision 1.165
sys/arch/powerpc/oea/pmap.c: revision 1.120
sys/arch/powerpc/oea/pmap.c: revision 1.121
sys/arch/powerpc/powerpc/vm_machdep.c: revision 1.106
sys/arch/powerpc/powerpc/bus_dma.c: revision 1.56

powerpc/oea: trap: pmap_{pte,ste}_spill() even in the interrupt context

Page table for oea is something like L2 TLB on memory; kernel and
processes share its entries, and process entries can be spilled out.

As done for MMU based on software-managed TLB, we need to restore
such entries even in the interrupt context.

Note that pmap_pte_spill() require no resouce to restore entries.
Still-not-implemented pmap_ste_spill() for OEA64 should also.
Part of PR kern/57621

powerpc/oea: pmap: Drop unused argument for pmap_pvo_reclaim(), NFC
Part of PR kern/57621

powerpc/oea: pmap: Rework pmap_pte_spill()

It was broken in many ways... Now, it gets working stable both for
OEA and OEA64_BRIDGE, as far as I can see.
Part of PR kern/57621

powerpc/oea: pmap: Fix mostly-pointless overhead of pmap_pvo_pool
(1) Drop __aligned(32) from struct pvo_entry; otherwise,
sizeof(struct pvo_entry) is round-up'ed to a multiple of 32.
(2) Do not set sizeof(struct pvo_entry) to `align` argument for
pool_init(9); it must be power of 2.
(3) Align pvo_entry to 32-byte boundary only if reasonably possible,
i.e., OEA without DIAGNOSTIC (--> POOL_REDZONE) for now.
Part of PR kern/57621

powerpc/oea: pmap_create: Use PR_ZERO and drop memset(9), NFC
Part of PR kern/57621

powerpc: oea: For OEA64_BRIDGE, 1:1 map up to 3GiB memory
As done for OEA. Note that kva over 3GiB is reserved.

Provide PMAP_MAP_POOLPAGE for OEA64_BRIDGE at the same time, by
which direct-mapped memory is utilized in order to work around
starvation of 512MiB kernel virtual space.
PR kern/57621

powerpc: Make sure direct-mapped buffer fits within correct range

For OEA and OEA64_BRIDGE, only first 3GiB memory is direct-mapped.
Part of PR kern/57621
 1.13 27-Feb-2021  thorpej Don't put #ifdefs in prep_initppc(). Instead, let callers specify the
additional BAT-mapped regions they care about.
 1.12 06-Jul-2020  rin branches: 1.12.2;
Style and cosmetic changes. No binary changes intended.
 1.11 22-Dec-2016  cherry switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.
 1.10 11-Feb-2012  kiyohara branches: 1.10.6; 1.10.24; 1.10.28;
Fix panic() on KASSERT(len >= BAT_BL_8M) in oea_iobat_add(). Thanks phx@.
 1.9 01-Feb-2012  matt Use kmem instead of malloc. Remove unneeded <sys/malloc.h> includes.
 1.8 07-Aug-2011  kiyohara branches: 1.8.2; 1.8.6;
Set BeBox Mainboard Registers space to BAT register.
 1.7 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.6 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.5 30-Nov-2008  martin branches: 1.5.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.
 1.4 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.3 28-Apr-2008  martin branches: 1.3.6; 1.3.8;
Remove clause 3 and 4 from TNF licenses
 1.2 17-Oct-2007  garbled branches: 1.2.2; 1.2.4; 1.2.8; 1.2.22; 1.2.24; 1.2.26;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.1 09-May-2007  garbled branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10;
file prep_machdep.c was initially added on branch ppcoea-renovation.
 1.1.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.1.8.1 18-Oct-2007  yamt sync with head.
 1.1.6.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.1.2.2 10-May-2007  garbled More cleanup. mvmeppc and ibmnws are machines that have a PReP memory
map. Rather than have each port roll it's own code, use
oea/prep_machdep.c instead.
 1.1.2.1 09-May-2007  garbled Add a prep_bus.h and prep_machdep.c. These files contain a number of
common routines that all machines with a PReP memory map should have in
common. Note that the machine does not need to be a fully PReP compliant
machine to use these functions, just use the memory map.
 1.2.26.2 04-May-2009  yamt sync with head.
 1.2.26.1 16-May-2008  yamt sync with head.
 1.2.24.1 18-May-2008  yamt sync with head.
 1.2.22.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.22.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.8.2 06-Nov-2007  matt sync with HEAD
 1.2.8.1 17-Oct-2007  matt file prep_machdep.c was added on branch matt-armv6 on 2007-11-06 23:20:47 +0000
 1.2.4.2 27-Oct-2007  yamt sync with head.
 1.2.4.1 17-Oct-2007  yamt file prep_machdep.c was added on branch yamt-lazymbuf on 2007-10-27 11:27:55 +0000
 1.2.2.2 23-Oct-2007  ad Sync with head.
 1.2.2.1 17-Oct-2007  ad file prep_machdep.c was added on branch vmlocking on 2007-10-23 20:36:11 +0000
 1.3.8.2 03-Mar-2009  skrll Sync with HEAD.
 1.3.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.3.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.6.1 18-Feb-2012  mrg merge to -current.
 1.8.2.1 17-Apr-2012  yamt sync with head
 1.10.28.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.10.24.1 05-Feb-2017  skrll Sync with HEAD
 1.10.6.1 03-Dec-2017  jdolecek update from HEAD
 1.12.2.1 03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed