Reads and writes PCI bus slot configuration registers.
#include <sys/mdio.h>
int pci_cfgrw(bid, md, write_flag)
int bid;
struct mdio *md;
int write_flag;
The pci_cfgrw kernel service provides serialized access to the configuration registers for a PCI bus. To ensure data integrity in a multi-processor environment, a lock is required before accessing the configuration registers. Depending on the value of the write_flag parameter, a read or write to the configuration register is performed at offset md_addr for the device identified by md_sla.
The pci_cfgrw kernel service provides for kernel extensions the same services as the MIOPCFGET and MIOPCFPUT ioctls provides for applications. The pci_cfgrw kernel service can be called from either the process or the interrupt environment.
Item | Description |
---|---|
bid | Specifies the bus identifier. |
md | Specifies the address of the mdio structure. The mdio structure
contains the following fields:
|
write_flag | Set to 1 for write and 0 for read. |
Returns 0 for successful completion.
Item | Description |
---|---|
ENOMEM | Indicates no memory could be allocated. |
EINVAL | Indicated that the bus, device/function, or size is not valid. |
EPERM | Indicates that the platform does not allow the requested operation |