Home | History | Annotate | Download | only in oea
History log of /src/sys/arch/powerpc/oea/ofw_subr.S
RevisionDateAuthorComments
 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.

RSS XML Feed