PCI_MAPREG_MAP(9)

NAME
pci_mapreg_map, pci_mapreg_info, pci_mapreg_probe, pci_mapreg_type - PCI register mappings

SYNOPSIS
#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
These functions provide wrappers and helpers around bus_space(9) mappings for device registers described by the Base Address Registers (BARs) in a PCI devices configuration space.

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. 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.

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.

pci_mapreg_probe attempts to determine if the BAR referenced by reg describes a valid register mapping.

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.

pci_mapreg_type returns either PCI_MAPREG_TYPE_IO or PCI_MAPREG_TYPE_MEM.

SEE ALSO
pci(4), bus_space(9), pci_conf_read(9)