When it builds the device tree, the Macintosh ROM installs a node at its root, called the gestalt node, that contains information about the Macintosh system on which it is running. The names of the properties of this node are the standard Macintosh gestalt selectors, as described in Inside Macintosh: Operating System Utilities. This book is described in Supplementary Documents. Some of the available Gestalt properties of interest to PCI drivers are shown in Table 10-2.
Specific Macintosh computer models may lack some of the gestalt values listed in Table 10-2, so the corresponding properties will not appear in the gestalt node. Macintosh computers introduced after the iMac do not include the gestalt node.
PCI expansion card firmware and driver code can explore the gestalt name entry in the Name Registry to determine the hardware and firmware environment available to it. For example, Listing 10-11 shows typical code to extract the 32-bit value of the Macintosh virtual memory attributes from the "vm " property of the gestalt name entry.
Listing 10-11 Sample code to fetch virtual memory gestalt
RegEntryIter cookie;
RegEntryID gestaltEntry;
RegPropertyValueSize gestaltEntrySize = sizeof(UInt32);
Boolean done;
OSErr err;
err = RegistryEntryIterateCreate(&cookie);
if ( err != noErr )
return err;
err = RegistryEntrySearch ( &cookie,
kRegIterRoot,
&gestaltEntry,
&done,
"vm ",
nil,
0 );
if ( err != noErr )
return err;
err = RegistryPropertyGet ( &gestaltEntry,
"vm ",
&vmIsOn,
&gestaltEntrySize );
if ( err != noErr )
return err;
RegistryEntryIterateDispose (&cookie);