man-pages/man2/pciconfig_read.2

100 lines
2.4 KiB
Groff
Raw Normal View History

2004-11-03 13:51:07 +00:00
.\" Contributed by Niki A. Rahimi, LTC Security Development
.\" narahimi@us.ibm.com
.\" May be freely distributed.
.\"
.TH PCICONFIG_READ 2 2003-07-14 "Linux 2.4.19" "Linux Programmer's Manual"
.SH NAME
pciconfig_read, pciconfig_write, pciconfig_iobase \- pci device information handling
.SH SYNOPSIS
.nf
.B #include <pci.h>
.sp
.BI "int pciconfig_read(unsigned long " bus ", unsigned long " dfn ,
.BI " unsigned long " off ", unsigned long " len ", void *" buf );
.BI "int pciconfig_write(unsigned long " bus ", unsigned long " dfn ,
.BI " unsigned long " off ", unsigned long " len ", void *" buf );
.BI "int pciconfig_iobase(long " which ", unsigned long " bus ,
.BI " unsigned long " devfn );
.fi
.SH DESCRIPTION
.TP
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 userspace.
.TP
.BR pciconfig_read ()
2004-11-03 13:51:07 +00:00
Reads to
.I
buf
from device
.I
dev
at offset
.I
off
value.
.TP
.BR pciconfig_write ()
2004-11-03 13:51:07 +00:00
Writes from
.I
buf
to device
.I
dev
at offset
.I
off
value.
.TP
.BR pciconfig_iobase ()
2004-11-03 13:51:07 +00:00
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.
.SH "RETURN VALUE"
.TP
.BR pciconfig_read ()
2005-06-15 14:10:23 +00:00
On success zero is returned. On error, \-1 is returned and errno is set appropriately.
2004-11-03 13:51:07 +00:00
.TP
.BR pciconfig_write ()
2005-06-15 14:10:23 +00:00
On success zero is returned. On error, \-1 is returned and errno is set appropriately.
2004-11-03 13:51:07 +00:00
.TP
.BR pciconfig_iobase ()
2004-11-03 13:51:07 +00:00
Returns information on locations of various I/O regions in physical memory according to the
.I which
value. Values for
.I which
are: IOBASE_BRIDGE_NUMBER, IOBASE_MEMORY, IOBASE_IO, IOBASE_ISA_IO, IOBASE_ISA_MEM.
.SH ERRORS
.TP
.B EINVAL
.I len
2006-12-27 03:44:22 +00:00
value is invalid.
This does not apply to
.BR pciconfig_iobase ().
2004-11-03 13:51:07 +00:00
.TP
.B EIO
I/O error.
.TP
.B ENODEV
2006-12-27 03:44:22 +00:00
For
.BR pciconfig_iobase (),
"hose" value is NULL?
For the other calls, could not find a slot.
2004-11-03 13:51:07 +00:00
.TP
.B ENOSYS
The system has not implemented these calls (CONFIG_PCI not defined).
.TP
.B EOPNOTSUPP
2006-12-27 03:44:22 +00:00
This return value is only valid for
.BR pciconfig_iobase ().
.TP
It is returned if the value for
2004-11-03 13:51:07 +00:00
.I
which
is invalid.
.TP
.B EPERM
2006-12-27 03:44:22 +00:00
User does not have the CAP_SYS_ADMIN capability.
This does not apply to
.BR pciconfig_iobase ().
2004-11-03 13:51:07 +00:00
.SH "CONFORMING TO"
These calls are Linux specific, available since Linux 2.0.26/2.1.11.
.SH "SEE ALSO"
.BR capabilities (7)