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