[OpenBIOS] How to pass CIF chain arguments on SPARC64?

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Tue Apr 8 10:25:45 CEST 2014

On 04/04/14 19:15, Tarl Neustaedter wrote:

>> I'm working on implementing a version of the CIF chain service for
>> SPARC64
> Hmm. I note that in current Openboot, there is no CIF for "chain". It's
> commented out.

Yeah, that's what I saw :(

>> How are the arguments passed to the next client program? A quick peek
>> at the OpenBOOT source shows that (init-program) only sets up %o4
>> (CIF) and %o6 (stack) registers. Does that mean that the arguments
>> should be copied onto the stack or somehow via the registers?
>> Unfortunately I can't seem to find a suitable 64-bit SPARC IEEE1275
>> ISA document anywhere :(
> Where does your client program expect the arguments?
> The client programs I'm familiar with all fetch their arguments from
> properties in /chosen, don't expect things on the stack.

The code comes from an older version of NetBSD. Browsing through the 
source, it appears that the kernel entry point as pointed to by "chain" 
expects the following register layout:

  * Kernel entry point.
  * The contract between bootloader and kernel is:
  * %o0          OpenFirmware entry point, to keep Sun's updaters happy
  * %o1          Address of boot information vector (see bootinfo.h)
  * %o2          Length of the vector, in bytes
  * %o3          OpenFirmware entry point, to mimic Sun bootloader behavior
  * %o4          OpenFirmware, to meet earlier NetBSD kernels expectations

Interestingly enough, my copy of 12751d1a.pdf contains the following 
section which (minus the OBP pointers) seems to agree with this:

5.2.3. Client program arguments

Registers %o1 and %o2 may be used to pass to the client program an array 
of bytes of arbitrary content, with %o1
containing the base address of the array and %o2 the length. If no such 
array is passed, %o1 and %o2 shall contain

NOTE—The Open Firmware standard makes no provision for specifying such 
an array or its contents. Therefore, in the
absence of implementation-dependent extensions, a client program 
executed directly from an Open Firmware implementation
will not be passed such an array. However, intermediate boot programs 
that simulate or propagate the Open Firmware client
interface to the programs that they load can provide such an array for 
their clients.

NOTE—Boot command line arguments, typically consisting of the name of a 
file to be loaded by a secondary boot program
followed by flags selecting various secondary boot and operating system 
options, are provided to client programs via the
“bootargs” and “bootpath” properties of the “/chosen” node.

I appreciate that the document referenced above is actually for a 32-bit 
SPARC ISA, however the indication is that something similar was in place 
for 64-bit SPARC. More amusingly is that the last few NetBSD releases 
simply call the kernel entry point directly rather than bothering to 
invoke "chain" via the CIF at all.



More information about the OpenBIOS mailing list