[OpenBIOS] Apple's Open Firmware.

Joe van Tunen joevt at shaw.ca
Mon Apr 2 20:28:43 CEST 2018


On 4/2/18, 5:51 AM, "Mark Cave-Ayland" <mark.cave-ayland at ilande.co.uk> wrote:

    On 31/03/18 02:37, Joe van Tunen wrote:
    
    > On 3/30/18, 4:02 PM, "OpenBIOS on behalf of Segher Boessenkool" <openbios-bounces at openbios.org on behalf of segher at kernel.crashing.org> wrote:
    > 
    >      And Apple uses some non-standard FCodes, too
    >      (for local variables, most prominently).  And their drivers can use
    >      anything defined in the "main" OF (so you cannot transplant them to
    >      a different machine or a different FW version even).
    > 
    > 
    > Right. Local variables are used by Apple's device drivers (for example, "mesh" (SATA) and "control" (PowerMac 8600 graphics) devices). Different PowerMacs use different tokens for defining and using local variables. Apple used
    > different tokenizers for the different PowerMacs so the local variables in the tokenized output will work only for PowerMacs using the same Open Firmware.
    > 
    > Local variables are not used by third party drivers (ATI/AMD, Nvidia) so third party drivers should work in different Open Firmware implementations, as long as the driver doesn't depend on other non-standard stuff.
    > 
    > OpenBIOS does have support for local variables:
    > 
    > : hello { a b ; c } a b + -> c c ;
    > 3 4 hello .
    > 7
    > 
    > The runtime support functions for local variables have names on the PowerMac G5 that are different than what OpenBIOS uses. The functions on Old World Macs are unnamed.
    
    Right. As the author of the OpenBIOS local variable support, I can 
    confirm that it's limited to Forth without any associated FCode support. 
    It was added simply to be able to run the Apple bootloaders.
    
    
    ATB,
    
    Mark.

Fcode support for OpenBIOS is not necessary because the Apple bootloader is in forth, and any standard driver would not use local variable support, or the driver could be included as forth instead of fcode.

You couldn't add Apple fcode support because the Apple fcode drivers use different tokens in different firmwares. Below is the results from the firmwares I've checked. In any case, Apple's fcode drivers can be converted from fcode to forth, which your local variable support could then probably handle. But Apple's fcode drivers are for Apple hardware, so there's little reason to do that unless you want to replace Apple's Open Firwmare on Apple hardware.


/* fcodes from New World Macs are not included since I only have compiled fcode from them to look at as I have not made an effort to search for actual fcode which is probably compressed in the rom. */
/* The PowerMac G5 info is not included because it keeps all the names even when fcode-debug? is false. The names below of the compiled fcode tokens are the names from the corresponding G5 version of the compiled fcode token. */
/* The B&W G3 has names for the compiled fcodes also, so I don't remember why I included them here. */
/* Only the compiled fcode tokens that are included in Apple fcode drivers are included here. */

	if (mac_rom & 1)
	{
/* PowerMac 8600 ROM tokens */
		add_token( 0x401, "{ ... ; .... }" ); /* local variables { local_0 ... local_n-1 ; ... }; n is stored in the next byte */
	/* compiled fcode tokens */
		add_token( 0x432, "(val)" );
		add_token( 0x433, "(i-val)" );
		add_token( 0x434, "b<to>" );
		add_token( 0x435, "b<to>1" );
		add_token( 0x436, "(i-to)" );
		add_token( 0x437, "(var)" );
		add_token( 0x438, "(i-var)" );
		add_token( 0x43C, "(defer)" );
		add_token( 0x43D, "(i-defer)" );
		add_token( 0x43E, "(field)" );
		add_token( 0x43F, "b<lit>" );
		add_token( 0x440, "b<'>" );
		add_token( 0x441, "{'}" );
		add_token( 0x454, "b<\">" );
	}
	
	if (mac_rom & 2)
	{
/* PowerMac G3 ROM tokens */
		add_token( 0x407, "{ ; ... }" );
		add_token( 0x408, "{ local_0 ; ... }" );
		add_token( 0x409, "{ local_0 local_1 ; ... }" );
		add_token( 0x40A, "{ local_0 local_1 local_2 ; ... }" );
		add_token( 0x40B, "{ local_0 local_1 local_2 local_3 ; ... }" );
		add_token( 0x40C, "{ local_0 local_1 local_2 local_3 local_4 ; ... }" );
		add_token( 0x40D, "{ local_0 local_1 local_2 local_3 local_4 local_5 ; ... }" );
		add_token( 0x40E, "{ local_0 local_1 local_2 local_3 local_4 local_5 local_6 ; ... }" );
		add_token( 0x40F, "{ local_0 local_1 local_2 local_3 local_4 local_5 local_6 local_7 ; ... }" );
	/* compiled fcode tokens */
		add_token( 0x43F, "(val)" );
		add_token( 0x440, "(i-val)" );
		add_token( 0x441, "b<to>" );
		add_token( 0x442, "b<to>1" );
		add_token( 0x443, "(i-to)" );
		add_token( 0x444, "(var)" );
		add_token( 0x445, "(i-var)" );
		add_token( 0x449, "(defer)" );
		add_token( 0x44A, "(i-defer)" );
		add_token( 0x44B, "(field)" );
		add_token( 0x44C, "b<lit>" );
		add_token( 0x44D, "b<'>" );
		add_token( 0x44E, "{'}" );
		add_token( 0x462, "b<\">" );
	}

	if (mac_rom & 3)
	{
/* PowerMac 8600 and G3 ROM tokens */
		add_token( 0x410, "local_0" );
		add_token( 0x411, "local_1" );
		add_token( 0x412, "local_2" );
		add_token( 0x413, "local_3" );
		add_token( 0x414, "local_4" );
		add_token( 0x415, "local_5" );
		add_token( 0x416, "local_6" );
		add_token( 0x417, "local_7" );

		add_token( 0x418, "-> local_0" );
		add_token( 0x419, "-> local_1" );
		add_token( 0x41A, "-> local_2" );
		add_token( 0x41B, "-> local_3" );
		add_token( 0x41C, "-> local_4" );
		add_token( 0x41D, "-> local_5" );
		add_token( 0x41E, "-> local_6" );
		add_token( 0x41F, "-> local_7" );
	}
	
	if (mac_rom & 8)
	{
/* B&W G3 ROM tokens */

	/* compiled fcode tokens */
		add_token( 0x439, "(val)" );
		add_token( 0x43A, "(i-val)" );
		add_token( 0x43B, "b<to>" );  /* B&W stores at +8 like G5 does */
		add_token( 0x43C, "b<to>1" );
		add_token( 0x43D, "(i-to)" );
		add_token( 0x43E, "(var)" );
		add_token( 0x43F, "(i-var)" );

		add_token( 0x443, "(defer)" );
		add_token( 0x444, "(i-defer)" );
		add_token( 0x445, "(field)" );
		add_token( 0x446, "b<lit>" );
		add_token( 0x447, "b<'>" );
		add_token( 0x448, "{'}" );

		add_token( 0x458, "b<\">" );
	}






More information about the OpenBIOS mailing list