---
name: "pciconfig_write"
section: "2"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/pciconfig_read"
---

# pciconfig\_write(2)

pci device information handling

Part of [pciconfig\_read(2)](/pciconfig_read/2.md).

## NAME

pciconfig\_read, pciconfig\_write, pciconfig\_iobase - pci device information handling

## LIBRARY

Standard C library (*libc*, *-lc*)

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

## DESCRIPTION

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**().

## STANDARDS

Linux.

## HISTORY

Linux 2.0.26/2.1.11.

## SEE ALSO

[**capabilities**(7)](/capabilities/7.md)
