Note
Power Macintosh computers that implement the NewWorld architecture (iMac and later) have the startup code in a small
bootROM. The remainder of what has been traditionally referred to as the Macintosh Toolbox is loaded from a file, called Mac OS ROM, located on disk, and then stitched into RAM to appear as one contiguous read-only ROM. Power Macintosh computers built before the NewWorld implementation have the startup code and the Macintosh Toolbox code in a larger ROM, usually on the order of 4 MB in size.
While the Open Firmware startup code is running, the Power Macintosh computer starts up and configures its on-board hardware, including all peripheral devices the startup code knows about or has config variables for, independently of any operating system. The computer then finds an operating system in ROM or on a mass storage device, loads it into RAM, and terminates the Open Firmware startup process by giving the operating system control of the PowerPC processor. The operating system may be Mac OS or a different system, provided it uses the PowerPC instruction set.
The Open Firmware startup process includes these specific features:
-
Startup firmware, as defined by IEEE Standard 1275, is written in the
Forth language. Firmware code is stored in an abbreviated representation called
FCode,
a version of Forth in which most Forth words are replaced by single bytes or 2-byte groups. The startup firmware in the Power Macintosh ROM provides an
FCode loader that installs FCode in system RAM that the Open Firmware Forth interpreter executes. Expansion card firmware can modify the Open Firmware startup process by supplying a FCode boot driver that the computer's startup firmware loads and runs before launching an operating system. The expansion card startup firmware can also include a minimal run-time driver that works in the Open Firmware environment and is replaced by a comprehensive driver later in the boot process.
-
The Macintosh startup firmware creates a hierarchical data structure of nodes called a
device tree,
in which each device is described by a
property list
, and optional properties and methods. The device tree is stored in system RAM. The nodes, which are also called packages, contain properties and methods. Properties are attributes that describe the hardware and driver. Methods do work much like subroutines or procedures. The operating system that is ultimately installed and launched can search the device tree to determine what hardware is available. For example, Mac OS extracts information from the device tree to create the device portion of the Macintosh Name Registry, described in Chapter
10. The full list of standard device tree properties is given in IEEE Standard 1275; the properties that Mac OS uses are listed in
Table 10-1. An example of a device node in a device tree is given in
Listing 10-1.
-
Device drivers that are required during system startup are also written in FCode. Plug-in expansion cards for startup devices must contain all the driver code required during startup in the expansion ROM on the card and may also need to provide other driver support resources such as fonts. The startup firmware in the Power Macintosh ROM installs Open Firmware boot drivers in system RAM and the Open Firmware Forth interpreter executes the driver FCode. Examples of devices needed during system startup include display, keyboard, and mouse devices; storage devices such as SCSI, IDE, floppy disk, and magneto-optical drives; and network interfaces if the target OS supports network booting.
You can write PCI expansion ROM code in standard Forth words and then reduce the result to FCode by using an
FCode tokenizer,
a program that translates Forth words into FCodes. The
Forth vocabulary that you can use is presented in IEEE Standard 1275. For a description of the Open Firmware user interface, see
Open Firmware User Interface.