PCI_CONF_READ(9)
okay so bestie, welcome to PCI_CONF_READ(9) from the Kernel Developerβs Manual β weβre talking PCI config space manipulation, and itβs giving βtiny functions, big kernel energyβ β¨π
π NAME π
pci_make_tag, pci_decompose_tag, pci_conf_read, pci_conf_write β PCI config space manipulation functions π
β¨ SYNOPSIS β¨
#include <alpha/pci/pci_machdep.h>
#include <i386/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);
π¦ DESCRIPTION π¦
These functions are your little backstage pass to PCI configuration space π₯ They let you make tags, take tags apart, and read or write config space registers. iconic behavior, honestly.
π the types, bestie π
The following types are defined in the machine dependent include file <pci_machdep.h>:
pci_chipset_tag_tβ a PCI chipset descriptorpcitag_tβ a PCI device tagpcireg_tβ a PCI register datum
πΈ how the tag situation works πΈ
So to access PCI configuration space, you first make a device tag with pci_make_tag, giving it the PCI chipset tag pc and the device spec as a tuple of bus, dev, func. The PCI tag composition is a PCI chipset dependent operation, although itβs often as simple as a shift and logical OR combination. slay for simple bit math π
pci_decompose_tag does the reverse operation. Once a tag is composed, you can do config space reads and writes 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. no sneaky partial reads, bestie π
Access to non-existent PCI devices do not (or should not) generate any kinds of faults or interruptions, and thus allow for easy device scanning by cycling through all possible device and function numbers for a given bus. thatβs the vibe check that makes scanning work π¦
π₯ config space registers, for the girlies who like offsets π₯
Below is an overview of defined PCI configuration space registers for devices:
0x00β Vendor (lower word) and Product (higher word) identification (see/sys/dev/pci/pcidevsfor a comprehensive list).0x04β Commands and Status register.0x08β PCI deviceβs class and subclass IDs. See/sys/dev/pci/pcireg.hforPCI_CLASS_*andPCI_SUBCLASS_*definitions.0x0cβ Specify (low byte to high): cache line size, PCI latency timer, header type, and BIST.0x10 - 0x28β Base address registers for I/O and memory space mapped registers.0x28β CardBus CIS register.0x2cβ Similar to0x00registerβs definitions for a subsystem identification.0x34β A pointer to the capabilities list. Each item is an offset in the configuration space itself.0x3cβ Interrupt line and pin numbers.
π SEE ALSO π
cardbus(4), pci(4), pci_intr_map(9) π
π HISTORY π
These functions first appeared in OpenBSD 1.2. vintage but still main character energy π
π and thatβs the whole page, bestie β brought to you by Debian, dated November 13, 2024, under the manual name PCI_CONF_READ(9). byeee π«Άπ
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2005 Michael Shalayeff
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms