IOPCIDevice



Member Functions

configRead32

Abstract: Reads a 32-bit value from the PCI device's configuration space.
public:

virtual UInt32 configRead32( UInt8 offset );

This method reads a 32-bit configuration space register on the device and returns its value.

Parameters

NameDescription
offsetAn 8-bit offset into configuration space, of which bits 0-1 are ignored.
Result: An 32-bit value in host byte order (big endian on PPC).

configWrite32

Abstract: Writes a 32-bit value to the PCI device's configuration space.
public:

virtual void configWrite32( UInt8 offset, UInt32 data );

This method write a 32-bit value to a configuration space register on the device.

Parameters

NameDescription
offsetAn 8-bit offset into configuration space, of which bits 0-1 are ignored.
dataAn 32-bit value to be written in host byte order (big endian on PPC).

findPCICapability

Abstract: Search configuration space for a PCI capability register.
public:

virtual UInt32 findPCICapability( UInt8 capabilityID );

This method searchs the device's config space for a PCI capability register matching the passed capability ID, if the device supports PCI capabilities.

Parameters

NameDescription
capabilityIDAn 8-bit PCI capability ID.
Result: The 32-bit value of the capability register if one was found, zero otherwise.

getBusNumber

Abstract: Accessor to return the PCI device's assigned bus number.
public:

virtual UInt8 getBusNumber( void );

This method is an accessor to return the PCI device's assigned bus number.

Result: The 8-bit value of device's PCI bus number.

getDeviceMemoryWithRegister

Abstract: Returns an instance of IODeviceMemory representing one of the device's memory mapped ranges.
public:

virtual IODeviceMemory * getDeviceMemoryWithRegister( UInt8 reg );

This method will return a pointer to an instance of IODeviceMemory for the physical memory range that was assigned to the configuration space base address register passed in. It is analogous to IOService::getDeviceMemoryWithIndex.

Parameters

NameDescription
regThe 8-bit configuration space register that is the base address register for the desired range.
Result: A pointer to an instance of IODeviceMemory, or zero no such range was found. The IODeviceMemory is retained by the provider, so is valid while attached, or while any mappings to it exist. It should not be released by the caller.

getDeviceNumber

Abstract: Accessor to return the PCI device's device number.
public:

virtual UInt8 getDeviceNumber( void );

This method is an accessor to return the PCI device's device number.

Result: The 5-bit value of device's device number.

getFunctionNumber

Abstract: Accessor to return the PCI device's function number.
public:

virtual UInt8 getFunctionNumber( void );

This method is an accessor to return the PCI device's function number.

Result: The 3-bit value of device's function number.

ioDeviceMemory

Abstract: Accessor to the I/O space aperture for the bus.
public:

virtual IODeviceMemory * ioDeviceMemory( void );

This method will return a reference to the IODeviceMemory for the I/O aperture of the bus the device is on.

Result: A pointer to an IODeviceMemory object for the I/O aperture. The IODeviceMemory is retained by the provider, so is valid while attached, or while any mappings to it exist. It should not be released by the caller.

ioRead16

Abstract: Reads a 16-bit value from an I/O space aperture.
public:

virtual UInt16 ioRead16( UInt16 offset, IOMemoryMap * map = 0 );

This method will read a 16-bit value from a 2 byte aligned offset in an I/O space aperture. If a map object is passed in, the value is read relative to it, otherwise to the value is read relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC.

Parameters

NameDescription
offsetAn offset into a bus or device's I/O space aperture.
mapIf the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space.
Result: The value read in host byte order (big endian on PPC).

ioRead32

Abstract: Reads a 32-bit value from an I/O space aperture.
public:

virtual UInt32 ioRead32( UInt16 offset, IOMemoryMap * map = 0 );

This method will read a 32-bit value from a 4 byte aligned offset in an I/O space aperture. If a map object is passed in, the value is read relative to it, otherwise to the value is read relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC.

Parameters

NameDescription
offsetAn offset into a bus or device's I/O space aperture.
mapIf the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space.
Result: The value read in host byte order (big endian on PPC).

ioRead8

Abstract: Reads a 8-bit value from an I/O space aperture.
public:

virtual UInt8 ioRead8( UInt16 offset, IOMemoryMap * map = 0 );

This method will read a 8-bit value from an offset in an I/O space aperture. If a map object is passed in, the value is read relative to it, otherwise to the value is read relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC.

Parameters

NameDescription
offsetAn offset into a bus or device's I/O space aperture.
mapIf the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space.
Result: The value read.

ioWrite16

Abstract: Writes a 16-bit value to an I/O space aperture.
public:

virtual void ioWrite16( UInt16 offset, UInt16 value, IOMemoryMap * map = 0 );

This method will write a 16-bit value to a 2 byte aligned offset in an I/O space aperture. If a map object is passed in, the value is written relative to it, otherwise to the value is written relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC.

Parameters

NameDescription
offsetAn offset into a bus or device's I/O space aperture.
valueThe value to be written in host byte order (big endian on PPC).
mapIf the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space.

ioWrite32

Abstract: Writes a 32-bit value to an I/O space aperture.
public:

virtual void ioWrite32( UInt16 offset, UInt32 value, IOMemoryMap * map = 0 );

This method will write a 32-bit value to a 4 byte aligned offset in an I/O space aperture. If a map object is passed in, the value is written relative to it, otherwise to the value is written relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC.

Parameters

NameDescription
offsetAn offset into a bus or device's I/O space aperture.
valueThe value to be written in host byte order (big endian on PPC).
mapIf the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space.

ioWrite8

Abstract: Writes a 8-bit value to an I/O space aperture.
public:

virtual void ioWrite8( UInt16 offset, UInt8 value, IOMemoryMap * map = 0 );

This method will write a 8-bit value to an offset in an I/O space aperture. If a map object is passed in, the value is written relative to it, otherwise to the value is written relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC.

Parameters

NameDescription
offsetAn offset into a bus or device's I/O space aperture.
valueThe value to be written in host byte order (big endian on PPC).
mapIf the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space.

mapDeviceMemoryWithRegister

Abstract: Maps a physical range of the device.
public:

virtual IOMemoryMap * mapDeviceMemoryWithRegister( UInt8 reg, IOOptionBits options = 0 );

This method will create a mapping for the IODeviceMemory for the physical memory range that was assigned to the configuration space base address register passed in, with IODeviceMemory::map(options). The mapping is represented by the returned instance of IOMemoryMap, which should not be released until the mapping is no longer required. This method is analogous to IOService::mapDeviceMemoryWithIndex.

Parameters

NameDescription
indexAn index into the array of ranges assigned to the device.
Result: An instance of IOMemoryMap, or zero if the index is beyond the count available. The mapping should be released only when access to it is no longer required.

setBusMasterEnable

Abstract: Sets the device's bus master enable.
public:

virtual bool setBusMasterEnable( bool enable );

This method sets the bus master enable bit in the device's command config space register to the passed value, and returns the previous state of the enable.

Parameters

NameDescription
enableTrue or false to enable or disable bus mastering.
Result: True if bus mastering was previously enabled, false otherwise.

setConfigBits

Abstract: Sets masked bits in a configuration space register.
public:

virtual UInt32 setConfigBits( UInt8 offset, UInt32 mask, UInt32 value );

This method sets masked bits in a configuration space register on the device by reading and writing the register. The value of the masked bits before the write is returned.

Parameters

NameDescription
offsetAn 8-bit offset into configuration space, of which bits 0-1 are ignored.
maskAn 32-bit mask indicating which bits in the value parameter are valid.
dataAn 32-bit value to be written in host byte order (big endian on PPC).
Result: The value of the register masked with the mask before the write.

setIOEnable

Abstract: Sets the device's I/O space response.
public:

virtual bool setIOEnable( bool enable, bool exclusive = false );

This method sets the I/O space response bit in the device's command config space register to the passed value, and returns the previous state of the enable. The exclusive option allows only one exclusive device on the bus to be enabled concurrently, this should be only for temporary access.

Parameters

NameDescription
enableTrue or false to enable or disable the I/O space response.
exclusiveIf true, only one setIOEnable with the exclusive flag set will be allowed at a time on the bus, this should be only for temporary access.
Result: True if the I/O space response was previously enabled, false otherwise.

setMemoryEnable

Abstract: Sets the device's memory space response.
public:

virtual bool setMemoryEnable( bool enable );

This method sets the memory space response bit in the device's command config space register to the passed value, and returns the previous state of the enable.

Parameters

NameDescription
enableTrue or false to enable or disable the memory space response.
Result: True if the memory space response was previously enabled, false otherwise.

© 2000 Apple Computer, Inc. — (Last Updated 2/23/2000)