Developer Documentation
PATHHardware Documentation > iMac Developer Note


What Is Different

Even though ROM-in-RAM involves a fundamental change to the construction of the product-specific part of the Mac OS, the changes in the code and its execution are not that large. Many components are in changed locations, but their functions with respect to boot time and run time have not greatly changed. Many Mac OS components remain untouched.

Interrupt Handling

Interrupt handling is very different with the NewWorld approach. The interrupt code has been rewritten to allow for dynamic creation of the interrupt layout. The new code has two features that did not exist in the old code. One is that interrupt latency has been reduced to such an extent as to make it negligible. The other is that the interrupt handling code no longer requires changes to support a new machine, unless it has new interrupt controller hardware. The description of the interrupt layout is now part of an Open Firmware interrupt tree that is interlaced within the Open Firmware device tree. The Trampoline code uses this interrupt tree to build the Mac OS native interrupt tree.

Outmoded Resources

Prior to NewWorld, many resources in the ROM exist in the System Folder as well, often as replacements that fix or enhance those in the ROM, but sometimes because the ROM resources have not yet been removed from the ROM. With the NewWorld approach, any resources that are not needed early in the boot sequence are no longer in the ToolBox ROM Image, and only the resources from the System Folder are in use.

RAM Footprint

NewWorld puts the ToolBox ROM Image in RAM, and marks it read-only. Although the image is 4 megabytes in size, not all of it is in use. The portion that is not used is returned to Mac OS for use as part of system RAM. At the time this document was written, less than 3 megabytes of the 4 megabyte ToolBox ROM Image are in use, allowing more than 1 megabyte to be returned to Mac OS.

RTAS

Certain hardware devices differ from machine to machine, but provide similar functions. RTAS ( Run-time Abstraction Services) provides such hardware-specific functions, including functions for accessing the real-time clock, non-volatile RAM (NV-RAM), restart, shutdown, and PCI configuration cycles. The I/O primitives for these functions in the ToolBox ROM Image for NewWorld use RTAS.

NV-RAM

Instead of using hard-coded offsets to locations in NV-RAM for Mac OS NV-RAM and other information, the Trampoline code breaks NV-RAM into variable-sized partitions that are used by Mac OS, Open Firmware, and any other client. PRAM resides in the Mac OS partition. The partitioning scheme is part of the CHRP specification.

NanoKernel

The previous version of the NanoKernel has code that is processor-specific to create data structures. Under NewWorld, the Trampoline code creates these data structures from information in the Open Firmware Device Tree.

NanoKernel is typically no longer changed to support a new CPU. Support for new processors has moved to POST, which is responsible for configuring all processor-specific registers. Run-time cache control is part of RTAS.

Startup Disk Control Panel

Open Firmware now bears responsibility for locating a startup device. This is very different from previous Mac OS systems where the Mac OS ROM had responsibility for locating the startup device. On the iMac computer, the Mac OS ROM image itself comes from the startup disk, so decisions regarding startup device must be made earlier in the startup process. Open Firmware recreates as much as possible the user experience of earlier systems but the implemention is very different.

Previous systems stored the user's selected startup device in PRAM. The startup device was set in PRAM when the user selected a device in the Startup Disk control panel. This device was honored by the Mac OS ROM unless the selected device was unavailable or was overridden by the user.

The startup disk routine for the iMac, rather than setting Mac OS PRAM, sets an Open Firmware config variable called boot-device . This setting is honored by Open Firmware unless the selected device was unavailable or was overridden by the user.

The following keys can be used to override the selected startup device.

Once Open Firmware locates a startup device and successfully loads a Mac OS ROM, image it passes information about the chosen device in the bootpath variable. This information, rather than that previously set in PRAM, is subsequently used by the Mac OS ROM to locate the device containing the startup System Folder.

The previous API for controlling the startup device selection, using _GetDefaultStartup and _SetDefaultStartup , is not effective on the iMac.

Open Firmware and the Device Tree

NewWorld relies heavily on a functioning Open Firmware with a complete device tree.

Interrupt Layout

The interrupt layout is determined by information in the device tree. An interrupt tree overlays the other information in the device tree to describe how the interrupts are configured. The Trampoline code traverses this device tree interrupt tree and builds data structures that are used to dispatch interrupts. The device tree interrupt tree is defined in the Open Firmware Recommended Practice: Interrupt Mapping . It is not necessary to change any of the interrupt dispatching code, either 68K or native. All the necessary information is retrieved from the device tree.

This interrupt dispatch code has drastically reduced latency times as compared to all previous PCI Macintosh computers.

Machine Identification

Applications can find out which machine they are running on by calling the Gestalt Manager. The gestaltMachineType value returned for the iMac is 406 (196 hexadecimal).

Because NewWorld uses the same Universal and ProductInfo tables for all computer models that it runs on, those computers all have the same Box Flag. All those computers use the same enablers, and no patches are made to the ToolBox ROM Image, so sharing the same Box Flag is not an issue for those areas.

Programs such as control panels and installers that use Box Flag to verify that this is a valid CPU on which to execute need to be changed to verify the existence of the hardware they require. Developers should look for the features they need, rather than reading the Box Flag and then making assumptions about the computer's features.

Asset management software that reports the kind of machine it is run on should check the name registry for the value of the property at Devices:device-tree:model . For the current iMac, the property value is iMac,1 .


© 1998 Apple Computer, Inc.