The PrepareMemoryForIO function has a single parameter, a pointer to an IOPreparationTable structure.
Some fields of the IOPreparationTable structure contain pointers to subsidiary structures. There are three types of subsidiary structures:
typedef LogicalAddress *LogicalMappingTablePtr;
typedef PhysicalAddress *PhysicalMappingTablePtr;
typedef struct AddressRange *AddressRangeTablePtr;
The IOPreparationTable structure and its subsidiary structures are diagrammed in Figure 11-1.
Note
In Figure 11-1, gray areas are filled in by the PrepareMemoryForIO function and white areas are filled in by the calling software. The preparationID field is used both ways.
The IOPreparationTable structure is defined as follows:
struct IOPreparationTable
{
IOPreparationOptions options;
IOPreparationState state;
IOPreparationID preparationID;
AddressSpaceID addressSpace;
ByteCount granularity;
ByteCount firstPrepared;
ByteCount lengthPrepared;
ItemCount mappingEntryCount;
LogicalMappingTablePtr logicalMapping;
PhysicalMappingTablePtr physicalMapping;
union
{
AddressRange range;
MultipleAddressRange multipleRanges;
} rangeInfo;
};
typedef struct IOPreparationTable IOPreparationTable;
typedef OptionBits IOPreparationOptions;
enum {
kIOMultipleRanges = 0x00000001,
kIOLogicalRanges = 0x00000002,
kIOMinimalLogicalMapping = 0x00000004,
kIOShareMappingTables = 0x00000008,
kIOIsInput = 0x00000010,
kIOIsOutput = 0x00000020,
kIOCoherentDataPath = 0x00000040,
kIOClientIsUserMode = 0x00000080
};
Figure 11-1 IOPreparationTable structure
typedef OptionBits IOPreparationState;
enum {
kIOStateDone = 0x00000001
};
typedef struct MultipleAddressRange MultipleAddressRange;
struct MultipleAddressRange
{
ItemCount entryCount;
AddressRangeTablePtr rangeTable;
};
The IOPreparationTable structure specifies the buffer to be prepared and provides storage for the mapping and other information that are returned. Its fields contain the following information: