pciconfig_write(2)

pciconfig_write2

Pci device information handling

Part of pciconfig_read(2).

Usage

#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);

Library

Standard C library (libc, -lc)

Overview

Most of the interaction with PCI devices is already handled by the kernel PCI layer, and thus these calls should not normally need to be accessed from user space.

pciconfig_read()

Reads to buf from device dev at offset off value.

pciconfig_write()

Writes from buf to device dev at offset off value.

pciconfig_iobase()

You pass it a bus/devfn pair and get a physical address for either 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. Values for which are: IOBASE_BRIDGE_NUMBER, IOBASE_MEMORY, IOBASE_IO, IOBASE_ISA_IO, IOBASE_ISA_MEM.

Errors

EINVAL

size value is invalid. This does not apply to pciconfig_iobase().

EIO

I/O error.

ENODEV

For pciconfig_iobase(), "hose" value is NULL. For the other calls, could not find a slot.

ENOSYS

The system has not implemented these calls (CONFIG_PCI not defined).

EOPNOTSUPP

This return value is valid only for pciconfig_iobase(). It is returned if the value for which is invalid.

EPERM

User does not have the CAP_SYS_ADMIN capability. This does not apply to pciconfig_iobase().

Releases

12 releases since Debian 3.1 (Sarge); the text changed 11 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 6.0
  5. 7
  6. 8
  7. 9
  8. 10
  9. 11
  10. 12
  11. 13
  12. Arch

Standards

Linux.

History

Linux 2.0.26/2.1.11.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.