pciconfig_read(2)
๐ pciconfig_read(2) โ the manual, but make it slay ๐
okay bestie, gather round, because today we're talking about three syscalls from the System Calls Manual: pciconfig_read, pciconfig_write, and pciconfig_iobase ๐ซถ They're all about pci device information handling, and ngl, most of you will never need them. But knowledge is free, so let's go ๐
๐ธ LIBRARY ๐ธ
Standard C library (libc, -lc) โ yes queen, it's just libc, we love a basic-in-a-good-way moment โจ
๐ SYNOPSIS ๐
#include <pci.h>
int pciconfig_read(unsigned long bus, unsigned long dfn,
unsigned long off, unsigned long size,
unsigned char *buf);
int pciconfig_write(unsigned long bus, unsigned long dfn,
unsigned long off, unsigned long size,
unsigned char *buf);
int pciconfig_iobase(int which, unsigned long bus,
unsigned long devfn);
look at those signatures, they're giving very โจ low-level โจ energy, and honestly? iconic ๐
๐ฆ DESCRIPTION ๐ฆ
So here's the tea ๐: most of the talking-to-PCI-devices business is already handled by the kernel PCI layer. Which means these calls should not normally need to be accessed from user space. Like, they exist, but they're not the main characters โ they're the background extras, iykyk.
pciconfig_read()
Reads to buf from device dev at offset off value. That's the whole vibe: you point at a device, an offset, and a buffer, and the info flows into your buf ๐ง
pciconfig_write()
Writes from buf to device dev at offset off value. Same energy, opposite direction ๐ซ
pciconfig_iobase()
You hand it a bus/devfn pair and you get back a physical address for whichever of these you asked about:
- the memory offset (for things like prep, this is
0xc0000000๐) - the IO base for PIO cycles
- or the ISA holes, if any
๐ RETURN VALUE ๐
pciconfig_read()
On success, zero is returned. On error, -1 is returned and errno is set to indicate the error.
pciconfig_write()
On success, zero is returned. On error, -1 is returned and errno is set to indicate the error.
pciconfig_iobase()
Returns information on locations of various I/O regions in physical memory according to the which value. The values for which are: IOBASE_BRIDGE_NUMBER, IOBASE_MEMORY, IOBASE_IO, IOBASE_ISA_IO, IOBASE_ISA_MEM. Pick your fighter, bestie ๐
๐ญ ERRORS ๐ญ
EINVALโ thesizevalue is invalid. This does not apply topciconfig_iobase().EIOโ I/O error. classic.ENODEVโ forpciconfig_iobase(), the"hose"value isNULL. For the other calls, it means the slot could not be found ๐ENOSYSโ the system has not implemented these calls (CONFIG_PCInot defined). the kernel said "not today" ๐EOPNOTSUPPโ this return value is valid only forpciconfig_iobase(). It's returned if the value forwhichis invalid.EPERMโ the user does not have theCAP_SYS_ADMINcapability. This does not apply topciconfig_iobase().
fr fr kings and queens, CAP_SYS_ADMIN is not a vibe you can just manifest. either you have it or you don't ๐
๐ STANDARDS ๐
Linux. that's it, that's the standard ๐ซ๐ฎโจ
๐ HISTORY ๐
Linux 2.0.26 / 2.1.11. ancient. vintage. lowkey a museum piece ๐๏ธ
๐ SEE ALSO ๐
and that's the whole page, bestie โ go forth and don't casually poke at PCI devices from user space, the kernel's got it ๐ซถ
mwah ๐ stay slay, stay on the physical memory,
โจ Linux man-pages 6.20 โ 2026-02-08 โจ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms