pci_read_legacy_io(9)
π pci_read_legacy_io β like, the Kernel API Manual page for it β¨
okay bestie, so this is <pink>pci_read_legacy_io</pink> from the Kernel API Manual, and it's literally the function that reads byte(s) from legacy I/O port space. yes, that legacy I/O port space. we're going old school and it's kind of iconic π
β¨ NAME β¨
pci_read_legacy_io β read byte(s) from legacy I/O port space π«Ά
πΈ SYNOPSIS πΈ
ssize_t pci_read_legacy_io (struct file *filp , struct kobject *kobj ,
const struct bin_attribute *bin_attr , char *buf , loff_t off , size_t
count );
like, that's the whole signature, no cap. six args, one return value of type ssize_t. slay π
π¦ ARGUMENTS π¦
one bullet per parameter because we respect ourselves:
filpβ the open sysfs file, fr fr. it's astruct file *and it's literally just sitting there being the file you opened πkobjβ thekobjectthat corresponds to the file you're reading from. it's giving "who am I actually talking to" energy β¨bin_attrβ thestruct bin_attributefor this file. yes, that's the binary attribute struct, and yes, it'sconstπbufβ the buffer where the results go. this is the destination, the main character, the place your bytes end up πoffβ the offset into legacy I/O port space. like, where in the port space you're starting from πcountβ the number of bytes to read. the vibe check on how much you want π
π DESCRIPTION π
okay so here's the tea: pci_read_legacy_io reads 1, 2, or 4 bytes from legacy I/O port space.
that's it. that's the whole thing. but β and this is the fun part β it does it using an arch specific callback routine, specifically pci_legacy_read. so it's not out here raw-dogging the port space itself, it's delegating to the architecture's own little helper. teamwork, honestly π«Ά
literally only 1, 2, or 4 bytes. not 3. not 8. bestie, don't come at it with a weird size, that's not the move π
π SEE ALSO π
the whole friend group, plus the kernel file they all live in:
- Kernel file
./drivers/pci/pci-sysfs.cβ that's the source file, go read it, iykyk π pci_write_legacy_io(9)β the writing counterpart, the other half of the ship πpci_mmap_legacy_mem(9)β legacy memory, but mmap'd π§pci_mmap_legacy_io(9)β legacy I/O, but mmap'd πΈpci_mmap_resource(9)β mmap a resource, iconic behaviour π₯pci_write_rom(9)β write to ROM, careful with that one π«Άpci_read_rom(9)β read from ROM, the safer sibling β¨
π the cute sign-off π
so this little beauty lives over in ./drivers/pci, and the docs are stamped October 2026 β like, future date, main character energy, we love to see it. and obviously it's all about pci_read_legacy_io(9), which is the page you just read. periodt π
π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms