man-pages/man8/setpci.8.html
2021-03-31 01:06:50 +01:00

288 lines
8.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of setpci</TITLE>
</HEAD><BODY>
<H1>setpci</H1>
Section: The PCI Utilities (8)<BR>Updated: 25 January 2020<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
setpci - configure PCI devices
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>setpci</B>
[<B>options</B>]
<B>devices</B>
<B>operations</B>...
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<B>setpci</B>
is a utility for querying and configuring PCI devices.
<P>
All numbers are entered in hexadecimal notation.
<P>
Root privileges are necessary for almost all operations, excluding reads
of the standard header of the configuration space on some operating systems.
Please see
<B><A HREF="/cgi-bin/man/man2html?8+lspci">lspci</A>(8)</B>
for details on access rights.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
<A NAME="lbAF">&nbsp;</A>
<H3>General options</H3>
<DL COMPACT>
<DT id="1"><B>-v</B>
<DD>
Tells
<I>setpci</I>
to be verbose and display detailed information about configuration space accesses.
<DT id="2"><B>-f</B>
<DD>
Tells
<I>setpci</I>
not to complain when there's nothing to do (when no devices are selected).
This option is intended for use in widely-distributed configuration scripts
where it's uncertain whether the device in question is present in the machine
or not.
<DT id="3"><B>-D</B>
<DD>
`Demo mode' -- don't write anything to the configuration registers.
It's useful to try
<B>setpci -vD</B>
to verify that your complex sequence of
<B>setpci</B>
operations does what you think it should do.
<DT id="4"><B>--version</B>
<DD>
Show
<I>setpci</I>
version. This option should be used stand-alone.
<DT id="5"><B>--help</B>
<DD>
Show detailed help on available options. This option should be used stand-alone.
<DT id="6"><B>--dumpregs</B>
<DD>
Show a list of all known PCI registers and capabilities. This option should be
used stand-alone.
<P>
</DL>
<A NAME="lbAG">&nbsp;</A>
<H3>PCI access options</H3>
<P>
The PCI utilities use the PCI library to talk to PCI devices (see
<B><A HREF="/cgi-bin/man/man2html?7+pcilib">pcilib</A></B>(7) for details). You can use the following options to
influence its behavior:
<DL COMPACT>
<DT id="7"><B>-A &lt;method&gt;</B>
<DD>
The library supports a variety of methods to access the PCI hardware.
By default, it uses the first access method available, but you can use
this option to override this decision. See <B>-A help</B> for a list of
available methods and their descriptions.
<DT id="8"><B>-O &lt;param&gt;=&lt;value&gt;</B>
<DD>
The behavior of the library is controlled by several named parameters.
This option allows one to set the value of any of the parameters. Use <B>-O help</B>
for a list of known parameters and their default values.
<DT id="9"><B>-H1</B>
<DD>
Use direct hardware access via Intel configuration mechanism 1.
(This is a shorthand for <B>-A intel-conf1</B>.)
<DT id="10"><B>-H2</B>
<DD>
Use direct hardware access via Intel configuration mechanism 2.
(This is a shorthand for <B>-A intel-conf2</B>.)
<DT id="11"><B>-G</B>
<DD>
Increase debug level of the library.
<P>
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>DEVICE SELECTION</H2>
<P>
Before each sequence of operations you need to select which devices you wish that
operation to affect.
<DL COMPACT>
<DT id="12"><B>-s [[[[&lt;domain&gt;]:]&lt;bus&gt;]:][&lt;slot&gt;][.[&lt;func&gt;]]</B>
<DD>
Consider only devices in the specified domain (in case your machine has several host bridges,
they can either share a common bus number space or each of them can address a PCI domain
of its own; domains are numbered from 0 to ffff), bus (0 to ff), slot (0 to 1f) and function (0 to 7).
Each component of the device address can be omitted or set to &quot;*&quot;, both meaning &quot;any value&quot;. All numbers are
hexadecimal. E.g., &quot;0:&quot; means all devices on bus 0, &quot;0&quot; means all functions of device 0
on any bus, &quot;0.3&quot; selects third function of device 0 on all buses and &quot;.4&quot; matches only
the fourth function of each device.
<DT id="13"><B>-d [&lt;vendor&gt;]:[&lt;device&gt;]</B>
<DD>
Select devices with specified vendor and device ID. Both ID's are given in
hexadecimal and may be omitted or given as &quot;*&quot;, both meaning &quot;any value&quot;.
</DL>
<P>
When
<B>-s</B>
and
<B>-d</B>
are combined, only devices that match both criteria are selected. When multiple
options of the same kind are specified, the rightmost one overrides the others.
<P>
<A NAME="lbAI">&nbsp;</A>
<H2>OPERATIONS</H2>
<P>
There are two kinds of operations: reads and writes. To read a register, just specify
its name. Writes have the form
<I>name</I>=<I>value</I>,<I>value</I>...
where each
<I>value</I>
is either a hexadecimal number or an expression of type
<I>data</I>:<I>mask</I>
where both
<I>data</I>
and
<I>mask</I>
are hexadecimal numbers. In the latter case, only the bits corresponding to binary
ones in the <I>mask</I> are changed (technically, this is a read-modify-write operation).
<P>
<P>
There are several ways how to identity a register:
<DL COMPACT>
<DT id="14">&bull;<DD>
Tell its address in hexadecimal.
<DT id="15">&bull;<DD>
Spell its name. Setpci knows the names of all registers in the standard configuration
headers. Use `<B>setpci --dumpregs</B>' to get the complete list.
See PCI bus specifications for the precise meaning of these registers or consult
<B>header.h</B> or <B>/usr/include/pci/pci.h</B> for a brief sketch.
<DT id="16">&bull;<DD>
If the register is a part of a PCI capability, you can specify the name of the
capability to get the address of its first register. See the names starting with
`CAP_' or `ECAP_' in the <B>--dumpregs</B> output.
<DT id="17">&bull;<DD>
If the name of the capability is not known to <B>setpci</B>, you can refer to it
by its number in the form CAP<B>id</B> or ECAP<B>id</B>, where <B>id</B> is the numeric
identifier of the capability in hexadecimal.
<DT id="18">&bull;<DD>
Each of the previous formats can be followed by <B>+offset</B> to add an offset
(a hex number) to the address. This feature can be useful for addressing of registers
living within a capability, or to modify parts of standard registers.
<DT id="19">&bull;<DD>
To choose how many bytes (1, 2, or 4) should be transferred, you should append a width
specifier <B>.B</B>, <B>.W</B>, or <B>.L</B>. The width can be omitted if you are
referring to a register by its name and the width of the register is well known.
<DT id="20">&bull;<DD>
Finally, if a capability exists multiple times you can choose which one to target using
<B>@number</B>. Indexing starts at 0.
<P>
</DL>
<P>
All names of registers and width specifiers are case-insensitive.
<P>
<A NAME="lbAJ">&nbsp;</A>
<H2>EXAMPLES</H2>
<P>
<DL COMPACT>
<DT id="21">COMMAND<DD>
asks for the word-sized command register.
<DT id="22">4.w<DD>
is a numeric address of the same register.
<DT id="23">COMMAND.l<DD>
asks for a 32-bit word starting at the location of the command register,
i.e., the command and status registers together.
<DT id="24">VENDOR_ID+1.b<DD>
specifies the upper byte of the vendor ID register (remember, PCI is little-endian).
<DT id="25">CAP_PM+2.w<DD>
corresponds to the second word of the power management capability.
<DT id="26">ECAP108.l<DD>
asks for the first 32-bit word of the extended capability with ID 0x108.
<P>
</DL>
<A NAME="lbAK">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?8+lspci">lspci</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?7+pcilib">pcilib</A></B>(7)
<P>
<A NAME="lbAL">&nbsp;</A>
<H2>AUTHOR</H2>
The PCI Utilities are maintained by Martin Mares &lt;<A HREF="mailto:mj@ucw.cz">mj@ucw.cz</A>&gt;.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="27"><A HREF="#lbAB">NAME</A><DD>
<DT id="28"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="29"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="30"><A HREF="#lbAE">OPTIONS</A><DD>
<DL>
<DT id="31"><A HREF="#lbAF">General options</A><DD>
<DT id="32"><A HREF="#lbAG">PCI access options</A><DD>
</DL>
<DT id="33"><A HREF="#lbAH">DEVICE SELECTION</A><DD>
<DT id="34"><A HREF="#lbAI">OPERATIONS</A><DD>
<DT id="35"><A HREF="#lbAJ">EXAMPLES</A><DD>
<DT id="36"><A HREF="#lbAK">SEE ALSO</A><DD>
<DT id="37"><A HREF="#lbAL">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:16 GMT, March 31, 2021
</BODY>
</HTML>