Blame man2/pciconfig_read.2

Packit 7cfc04
.\" Contributed by Niki A. Rahimi, LTC Security Development
Packit 7cfc04
.\" narahimi@us.ibm.com
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE)
Packit 7cfc04
.\" May be freely distributed and modified.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.TH PCICONFIG_READ 2 2016-07-17 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
pciconfig_read, pciconfig_write, pciconfig_iobase \- pci device information handling
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <pci.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int pciconfig_read(unsigned long " bus ", unsigned long " dfn ,
Packit 7cfc04
.BI "          unsigned long " off ", unsigned long " len ", void *" buf );
Packit 7cfc04
.BI "int pciconfig_write(unsigned long " bus ", unsigned long " dfn ,
Packit 7cfc04
.BI "          unsigned long " off ", unsigned long " len ", void *" buf );
Packit 7cfc04
.BI "int pciconfig_iobase(long " which ", unsigned long " bus ,
Packit 7cfc04
.BI "          unsigned long " devfn );
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
.PP
Packit 7cfc04
Most of the interaction with PCI devices is already handled by the
Packit 7cfc04
kernel PCI layer,
Packit 7cfc04
and thus these calls should not normally need to be accessed from user space.
Packit 7cfc04
.TP
Packit 7cfc04
.BR pciconfig_read ()
Packit 7cfc04
Reads to
Packit 7cfc04
.I buf
Packit 7cfc04
from device
Packit 7cfc04
.I dev
Packit 7cfc04
at offset
Packit 7cfc04
.I off
Packit 7cfc04
value.
Packit 7cfc04
.TP
Packit 7cfc04
.BR pciconfig_write ()
Packit 7cfc04
Writes from
Packit 7cfc04
.I buf
Packit 7cfc04
to device
Packit 7cfc04
.I dev
Packit 7cfc04
at offset
Packit 7cfc04
.I off
Packit 7cfc04
value.
Packit 7cfc04
.TP
Packit 7cfc04
.BR pciconfig_iobase ()
Packit 7cfc04
You pass it a bus/devfn pair and get a physical address for either the
Packit 7cfc04
memory offset (for things like prep, this is 0xc0000000),
Packit 7cfc04
the IO base for PIO cycles, or the ISA holes if any.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
.TP
Packit 7cfc04
.BR pciconfig_read ()
Packit 7cfc04
On success, zero is returned.
Packit 7cfc04
On error, \-1 is returned and
Packit 7cfc04
.I errno
Packit 7cfc04
is set appropriately.
Packit 7cfc04
.TP
Packit 7cfc04
.BR pciconfig_write ()
Packit 7cfc04
On success, zero is returned.
Packit 7cfc04
On error, \-1 is returned and
Packit 7cfc04
.I errno
Packit 7cfc04
is set appropriately.
Packit 7cfc04
.TP
Packit 7cfc04
.BR pciconfig_iobase ()
Packit 7cfc04
Returns information on locations of various I/O
Packit 7cfc04
regions in physical memory according to the
Packit 7cfc04
.I which
Packit 7cfc04
value.
Packit 7cfc04
Values for
Packit 7cfc04
.I which
Packit 7cfc04
are:
Packit 7cfc04
.BR IOBASE_BRIDGE_NUMBER ,
Packit 7cfc04
.BR IOBASE_MEMORY ,
Packit 7cfc04
.BR IOBASE_IO ,
Packit 7cfc04
.BR IOBASE_ISA_IO ,
Packit 7cfc04
.BR IOBASE_ISA_MEM .
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
.I len
Packit 7cfc04
value is invalid.
Packit 7cfc04
This does not apply to
Packit 7cfc04
.BR pciconfig_iobase ().
Packit 7cfc04
.TP
Packit 7cfc04
.B EIO
Packit 7cfc04
I/O error.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENODEV
Packit 7cfc04
For
Packit 7cfc04
.BR pciconfig_iobase (),
Packit 7cfc04
"hose" value is NULL.
Packit 7cfc04
For the other calls, could not find a slot.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOSYS
Packit 7cfc04
The system has not implemented these calls
Packit 7cfc04
.RB ( CONFIG_PCI
Packit 7cfc04
not defined).
Packit 7cfc04
.TP
Packit 7cfc04
.B EOPNOTSUPP
Packit 7cfc04
This return value is valid only for
Packit 7cfc04
.BR pciconfig_iobase ().
Packit 7cfc04
It is returned if the value for
Packit 7cfc04
.I which
Packit 7cfc04
is invalid.
Packit 7cfc04
.TP
Packit 7cfc04
.B EPERM
Packit 7cfc04
User does not have the
Packit 7cfc04
.B CAP_SYS_ADMIN
Packit 7cfc04
capability.
Packit 7cfc04
This does not apply to
Packit 7cfc04
.BR pciconfig_iobase ().
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
These calls are Linux-specific, available since Linux 2.0.26/2.1.11.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR capabilities (7)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.