pci(3) - NetBSD Manual Pages

PCI(3)                  NetBSD Library Functions Manual                 PCI(3)


NAME
pci -- library interface for PCI bus access
LIBRARY
PCI Bus Access Library (libpci, -lpci)
SYNOPSIS
#include <pci.h> int pcibus_conf_read(int pcifd, unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg, pcireg_t *valp); int pcibus_conf_write(int pcifd, unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg, pcireg_t val); int pcidev_conf_read(int devfd, unsigned int reg, pcireg_t *valp); int pcidev_conf_write(int devfd, unsigned int reg, pcireg_t val); char * pci_findvendor(pcireg_t id_reg); void pci_devinfo(pcireg_t id_reg, pcireg_t class_reg, int showclass, char *devinfo, size_t len); void pci_conf_print(int pcifd, unsigned int bus, unsigned int dev, unsigned int func); int pci_drvname(int pcifd, unsigned int dev, unsigned int func, char *drvname, size_t len); int pci_drvnameonbus(int pcifd, u_int bus, u_int dev, u_int func, char *drvname, size_t len);
DESCRIPTION
The pci library provides support for accessing the PCI bus by user pro- grams. These functions are available in the libpci library. Programs should be linked with -lpci.
CONFIGURATION SPACE FUNCTIONS
The following functions are used to access PCI configuration space: pcibus_conf_read() Access the PCI configuration register reg on the device located at bus, dev, func, and place the result in *valp. pcifd must be an open file descriptor to a PCI bus within the target PCI domain. pcibus_conf_write() Write the value specified by val into the PCI configuration regis- ter reg on the device located at bus, dev, func. pcifd must be an open file descriptor to a PCI bus within the target PCI domain. pcidev_conf_read() Access the PCI configuration register reg on the device associated with the open file descriptor devfd and place the result in *valp. pcidev_conf_write() Write the value specified by val into the PCI configuration regis- ter reg on the device associated with the open file descriptor devfd.
MISCELLANEOUS FUNCTIONS
The following miscellaneous functions are available: pci_findvendor() Return an ASCII description of the PCI vendor in the PCI ID regis- ter id_reg. pci_devinfo() Return an ASCII description of the PCI vendor, PCI product, and PCI class specified by the PCI ID register id_reg and PCI class ID reg- ister class_reg. The description is placed into the buffer pointed to by devinfo; the size of that buffer is specified in len. If showclass is not 0, the class, subclass and interface are added into the buffer. pci_conf_print() Print the PCI configuration information for the device located at bus, dev, func. pcifd must be an open file descriptor to a PCI bus within the target PCI domain. pci_drvname() For the PCI bus opened on pcifd, return the driver name for dev and func into drvname using len as the buffer length. pci_drvnameonbus() Just like pci_drvname() but also allows looking up via PCI bus num- ber.
RETURN VALUES
The pcibus_conf_read(), pcibus_conf_write(), pcidev_conf_read(), pcidev_conf_write(), pci_devinfo(), and pci_drvname() functions return 0 on success and -1 on failure. The pci_findvendor() function returns NULL if the PCI vendor description cannot be found.
SEE ALSO
pci(4)
HISTORY
The pcibus_conf_read(), pcibus_conf_write(), pcidev_conf_read(), pcidev_conf_write(), pci_findvendor(), pci_devinfo(), and pci_conf_print() functions first appeared in NetBSD 1.6. The pci_drvname() function first appeared in NetBSD 7.0. NetBSD 8.3 September 23, 2016 NetBSD 8.3

Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.