PCI_CONF_READ(9) | Kernel Developer's Manual | PCI_CONF_READ(9) |
pci_make_tag
,
pci_decompose_tag
,
pci_conf_read
,
pci_conf_write
— PCI config
space manipulation functions
#include
<alpha/pci/pci_machdep.h>
#include
<i386/pci/pci_machdep.h>
#include
<powerpc/pci/pci_machdep.h>
#include
<sgi/pci/pci_machdep.h>
#include
<machine/pci_machdep.h>
pcitag_t
pci_make_tag
(pci_chipset_tag_t
pc, int bus,
int dev,
int func);
void
pci_decompose_tag
(pci_chipset_tag_t
pc, pcitag_t tag,
int *busp,
int *devp,
int *funcp);
pcireg_t
pci_conf_read
(pci_chipset_tag_t
pc, pcitag_t tag,
int reg);
void
pci_conf_write
(pci_chipset_tag_t
pc, pcitag_t tag,
int reg,
pcireg_t val);
These functions provide a way to access PCI configuration space.
The following types are defined in the machine dependent include
file <pci_machdep.h>
.
In order to access PCI configuration space, a device tag shall be
made using pci_make_tag
given the PCI chipset tag
pc and the device specification in a tuple of
bus, device,
function. The PCI tag composition is a PCI chipset
dependent operation although often as simple as a shift and logical OR
combination.
The pci_decompose_tag
provides a reverse
operation. Once a tag is composed, it is possible to perform configuration
space read and write with pci_conf_read
and
pci_conf_write
, respectively. Access to PCI
configuration space is only provided for whole
pcireg_t
items, which is usually a 32-bit integer.
Access to non-existent PCI devices do not (or should not) generate any kinds
of faults or interruptions and thus allow for an easy device scanning by
cycling through all possible device and function numbers for a given
bus.
Below is an overview of defined PCI configuration space registers for devices:
These functions first appeared in OpenBSD 1.2.
February 15, 2015 | OpenBSD-6.0 |