PATH 
ADC Home > Documentation > Hardware > Device Managers and Drivers > PCI Card Services > Designing PCI Cards and Drivers for Power Macintosh Computers


  

Fast I/O Space Cycle Generation

The PCI property assigned-addresses provides vector entries that represent the physical addresses of devices on expansion cards. Apple has added another property-- AAPL,address --that provides a vector of 32-bit logical address values, where the n th value corresponds to the n th assigned-addresses vector entry. When accessing device functions located in memory space, you should use the corresponding AAPL,address property as the device's base. The same technique is recommended when you are accessing high-performance device functions in I/O space.

Using the AAPL,address property, a driver can find the logical address of an I/O resource. Accessing the logical address generates an I/O cycle on the PCI bus. Using the logical base address, a driver can generate a PCI I/O cycle in the same way it accesses a PCI device in memory space. This provides the fastest possible interface to I/O space. For sample code that illustrates this technique, see Listing 9-3.

To access a register in memory or I/O space using an AAPL,address property, do the following:

  1. At initialization, resolve the assigned-addresses and AAPL,address properties.


  2. Search the assigned-addresses vector for an address range in I/O space.


  3. Store the corresponding AAPL,address vector entry in a variable such as


  4.     volatile UInt16 *gIORegisterBase;

  5. To read the (16-bit) register at offset 0x04, you can then do


  6.     value = gIORegisterBase[0x04 / sizeof (UInt16)];

As with memory accesses, you will need to byte swap the returned value to obtain a Macintosh big-endian result. Byte swapping routines are described in Byte Swapping Routines.

IMPORTANT

Between PCI I/O accesses, software must call the SynchronizeIO function to ensure that the accesses affect the PCI device in the correct order.


© 1999 Apple Computer, Inc. – (Last Updated 26 March 99)