PCI_MAPREG_MAP(9)

πŸ“¦ in nixpkgs unstable

πŸ’… PCI_MAPREG_MAP(9) β€” bestie edition πŸ’…

okay so this is the section 9 page from the Kernel Developer's Manual, and it's literally all about PCI register mappings. no cap, it's giving very "small helpers, big kernel energy." 🫢


🌸 NAME 🌸

pci_mapreg_map, pci_mapreg_info, pci_mapreg_probe, pci_mapreg_type β€” PCI register mappings ✨


πŸŽ€ SYNOPSIS πŸŽ€

bestie, here's the exact include and signatures β€” copy them character-for-character, iykyk:

#include <dev/pci/pcivar.h>

int
pci_mapreg_map(struct pci_attach_args *paa, int reg, pcireg_t type,
    int flags, bus_space_tag_t *tagp, bus_space_handle_t *handlep,
    bus_addr_t *basep, bus_size_t *sizep, bus_size_t maxsize);

int
pci_mapreg_info(pci_chipset_tag_t pc, pcitag_t tag, int reg,
    pcireg_t type, bus_addr_t *basep, bus_size_t *sizep, int *flagsp);

int
pci_mapreg_probe(pci_chipset_tag_t pc, pcitag_t tag, int reg,
    pcireg_t *typep);

pcireg_t
pci_mapreg_type(pci_chipset_tag_t pc, pcitag_t tag, int reg);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so these functions are wrappers and helpers around bus_space(9) mappings for device registers described by the Base Address Registers (BARs) in a PCI device's configuration space. iconic behavior, honestly πŸ‘‘

🌟 pci_mapreg_map 🌟

pci_mapreg_map wraps a call to bus_space_map(9) using information from the BAR referenced by reg for the device being attached with paa.

Memory or I/O mappings are derived from the type argument. the size of the register mapping can be restricted by specifying a non-zero value in maxsize β€” so if maxsize is zero, no restriction via that arg, periodt.

The bus space tag and handle used for the mapping, as well as the base address and size of the mapping, will be provided to the caller via the optional tagp, handlep, basep, and sizep pointers. optional besties, so don't stress if you don't need every single one πŸ’…

🌈 pci_mapreg_info 🌈

pci_mapreg_info provides bus space mapping information from the BAR referenced by reg.

The type argument specifies whether the mapping provides Memory or I/O access. the base address, size, and bus space flags are optionally provided to the caller via the basep, sizep, and flagsp pointers. very "here's the info, no strings attached" energy πŸŽ€

🧚 pci_mapreg_probe 🧚

pci_mapreg_probe attempts to determine if the BAR referenced by reg describes a valid register mapping. it's literally doing a vibe check on that BAR πŸ”₯

πŸ“ pci_mapreg_type πŸ“

pci_mapreg_type returns the type of register access for the registers at the BAR referenced by reg.


⭐ RETURN VALUES ⭐

pci_mapreg_map, pci_mapreg_info, and pci_mapreg_probe return 0 on success, or an errno(2) style value on failure. so yeah β€” zero means slay, nonzero means something went off 😭

pci_mapreg_type returns either PCI_MAPREG_TYPE_IO or PCI_MAPREG_TYPE_MEM.


πŸ”₯ SEE ALSO πŸ”₯

go read those too, bestie β€” the lore is real πŸ“šβœ¨


mwah πŸ’‹ this edition is the Debian one, dated April 13, 2023, and the page is PCI_MAPREG_MAP(9). bye bestie 🫢

πŸ“¦ where this page comes from
  • nixpkgs unstable: cvs-export
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms