|Please consider a donation to the Higher Intellect project. See https://preterhuman.net/donate.php or the Donate to Higher Intellect page for more info.|
A set of Macintosh II ROM routines that let applications access declaration ROMs on slot cards.
The Slot Manager provides functions to help you search through the data structures that expansion cards use to organize the information in their firmware. The meaning of the information in the data structures varies from card to card; you need to know the specifics of a card in order to interpret its data structures. To interpret these data structures, you need to know the information in Designing Cards and Drivers for the Macintosh Family, third edition, as well as information specific to the expansion card you’re using.
Introduction to Slots and Cards
The Macintosh Operating System provides a standardized interface to expansion cards through the Slot Manager. The Slot Manager supports two types of expansion cards: NuBus and processor-direct slot (PDS). Most Macintosh computers include one or both of these expansion systems. Although the discussion and examples in this chapter use NuBus, the information also applies to PDS expansion cards.
Processor-direct slot expansion cards connect directly to the processor bus, giving them direct access to the microprocessor and therefore a speed advantage over NuBus cards. However, because the PDS expansion interface is an extension of the processor bus, the configuration of the slot depends on which microprocessor is used by the computer. Refer to Designing Cards and Drivers for the Macintosh Family, third edition, for information specific to PDS expansion cards.
Macintosh computers that include the NuBus expansion interface contain one or more identical NuBus slots. Each slot is identified by slot a number in the range $1 through $E. (Slot $0 corresponds to the main logic board, and slot $F is reserved for NuBus address translation.)
Both the processor bus and the NuBus are 4 bytes (32 bits) wide. The bus interface transfers data between the buses in byte lanes. A byte lane is any of the 4 bytes that make up the 32-bit bus. Because the processor bus and the NuBus interpret the significance of bytes within words differently, the bus interface must perform byte-lane swapping between the two buses.
The bus interface also performs some address translation between the two buses. It maps certain address ranges on each bus to different address ranges on the other bus. Designing Cards and Drivers for the Macintosh Family, third edition, discusses byte lanes and address translation in more detail.
Slot Address Allocations
The Macintosh architecture assigns certain address ranges to each slot. The microprocessor communicates with an expansion card in a particular slot by reading or writing to memory in the slot’s address range. Expansion cards can also communicate with each other in this manner.
The NuBus architecture supports 32-bit addressing, providing 4 gigabytes of address space. All Macintosh computers that use Motorola 68030, 68040, or PowerPC processors support 32-bit addressing under System 7. Macintosh computers that use Motorola 68000 or 68020 processors, and those running System 6, use 24-bit addressing. This section describes address space allocation in both the 32-bit and 24-bit modes.
In 32-bit mode, the Macintosh architecture assigns two address ranges to each NuBus slot: a 256-megabyte super slot space and a 16-megabyte standard slot space.
The 4 gigabytes of 32-bit address space contain 16 regions of 256 megabytes apiece. Each region constitutes the super slot space for one possible slot ID. Each super slot space spans an address range of $s000 0000 through $sFFF FFFF, where s is a hexadecimal digit $1 through $E, corresponding to the slot ID. For example, the address range $9000 0000 through $9FFF FFFF constitutes the super slot space for slot $9.
The standard slot spaces are 16 megabytes apiece and have address ranges of the form $Fs00 0000 through $FsFF FFFF, where s is the slot ID. The standard slot space for slot $9, for example, is $F900 0000 through $F9FF FFFF.
In 24-bit mode, software can address only a fraction of each card’s allocated address range. In this mode, the Operating System assigns each slot a 1-megabyte minor slot space. The bus interface translates 24-bit addresses on the processor bus with the form $sx xxxx (where s is a slot ID and x is any hexadecimal digit) into 32-bit NuBus addresses of the form $Fs0x xxxx, which is the first megabyte of the slot’s standard slot space.
For example, 24-bit addresses in the range $90 0000 through $9F FFFF constitute the minor slot space corresponding to slot $9. The hardware translates these addresses into the NuBus address range $F900 0000 through $F90F FFFF.
The firmware of a NuBus expansion card contains information that identifies the card and its functions. Your application uses the Slot Manager to communicate with this firmware. This firmware, called the declaration ROM, may also include other information, such as initialization code or code for drivers that communicate with devices on the card. The sole purpose of many Slot Manager routines is to provide access to the information in the declaration ROM.
This section discusses the data structures used to store information in the declaration ROM. You’ll need to understand these structures in order to use the Slot Manager routines. To create firmware for an expansion card, you’ll need to read Designing Cards and Drivers for the Macintosh Family, third edition.
The declaration ROM includes these elements:
- The sResources . An sResource is a data structure in the firmware of an expansion card’s declaration ROM that defines a function or capability of the card. An sResource typically contains information about a single function or capability, although some sResources may contain other data—for example, device drivers, icons, fonts, code, or vendor-specific information.
- The sResource directory . The sResource directory is a special sResource that contains offsets to all of the other sResources in the declaration ROM.
- The format block . The format block is a data structure that allows the Slot Manager to find the declaration ROM and to validate it. It contains some identification information and an offset to the sResource directory.
About the Slot Manager
The Slot Manager provides three basic services:
- On startup, it examines each slot and initializes any expansion cards it finds.
- It maintains data structures that contain information about each slot and every available sResource.
- It provides functions that allow you to get information about expansion cards and their sResources.
There are two variations of the System 7 Slot Manager: version 1 and version 2. Version 1 of the Slot Manager is RAM based and is installed by the user with the System 7 upgrade kit. Version 2 is included in the ROM of newer Macintosh computers.
At startup, the version of the Slot Manager in ROM searches each slot for a declaration ROM and creates a slot information record for each slot.
As the Slot Manager searches the slots, it identifies all of the sResources in each declaration ROM and creates a table—the slot resource table (SRT)—that lists all of the sResources currently available to the system. The slot resource table is a private data structure maintained by the Slot Manager. Applications and device drivers use Slot Manager routines to get information from the slot resource table.
After building the slot resource table, the Slot Manager initializes the 6 bytes reserved for each slot in parameter RAM. If the slot has an expansion card with a PRAMInitData entry in its board sResource, the Slot Manager uses the values in that entry to initialize the parameter RAM; otherwise, it clears those bytes in parameter RAM.
Next, the Slot Manager disables interrupts and executes the code in the PrimaryInit entry of the board sResource for each card. Note that at this point in the startup, the keyboard and the mouse are not initialized and that a card’s PrimaryInit code has only limited control over the functionality of the card itself.
If certain values (defined by the Start Manager) are set in a card’s parameter RAM, a card with an sRsrcBootRec entry may take over the system startup process. The Start Manager passes control to the code in the sRsrcBootRec early in the startup sequence, before system patches are installed. Refer to the chapter “Start Manager” in Inside Macintosh: Operating System Utilities for more information about the startup process.
Designing Cards and Drivers for the Macintosh Family, third edition, describes the PRAMInitData, PrimaryInit, and sRsrcBootRec entry types.
If no card takes over, the normal system startup continues. After version 1 of the Slot Manager is loaded, it conducts a second search for declaration ROMs, this time in 32-bit mode. If the Slot Manager finds any additional NuBus cards, it adds their sResources to the slot resource table and executes the code in their PrimaryInit entries. (Version 2 of the Slot Manager, which resides in ROM, does not need to conduct a second search.)
After all system patches have been installed, version 1 or later of the Slot Manager executes the code in any SecondaryInit entries it finds in the declaration ROMs. It does not reexecute the code from PrimaryInit entries, reinitialize parameter RAM, or restore any sResources deleted by the PrimaryInit code.
After the Slot Manager executes SecondaryInit code, it searches for sResources that have an sRsrcFlags entry with the fOpenAtStart flag set. When the Slot Manager finds an sResource with this flag set, it loads the device driver from the sRsrcDrvrDir entry of the sResource, or calls the code in the sResource’s sRsrcLoadRec entry, which loads the sResource’s device driver.
Finally, the system executes initialization resources of type 'INIT'.