Subject: Re: feasible to return from the kernel to OpenFirmware?
To: None <tech-kern@netbsd.org>
From: Derek Peschel <dpeschel@eskimo.com>
List: tech-kern
Date: 01/09/2002 18:15:24
On Wed, Jan 09, 2002 at 10:20:05PM -0000, eeh@netbsd.org wrote:
> | I have OpenFirmware on my machine (PowerMacintosh G4).  As I see it,
> | the bootloader (and the kernel, which it chains to) are just gigantic
> | subroutines called by OF.  Therefore, the kernel ought to be able to
> | return to OF as the result of some flavor of cpu_reboot, with things
> | set up so that I could continue using OF (all CLAIMed memory freed,
> | etc.)
> 
> Sure.  When you halt a SPARC it returns to the firmware.  However,
> if you try to boot some other kernel, the firmware is intelligent and
> resets itself.  So in theory there's no reason you couldn't at least
> return to the `ok' prompt.
> 
> In practice, the kernel has probably changed the configuration of
> important devices, so the firmware may not be able to deal with that.

The Sparc code contains various functions (I forget the order in which
they call each other; I'm still using MacOS for networking):

	prom_halt
	_prom_halt
	po_halt

and on OpenFirmware machines, one of them eventually calls OF_exit
and assumes it won't return.  The MacOS code also has OF_exit but
assumes it might return (thus the endless loop I mentioned).  So
I think the Mac implementation of OF is conspiring against me.

Do you know how the firmware knows to reset itself?

-- Derek