Sophie

Sophie

distrib > CentOS > 6 > i386 > by-pkgid > cf93d8a8acdcc6fe2225039da0502495 > files > 3771

kernel-doc-2.6.32-131.17.1.el6.centos.plus.noarch.rpm

<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Chapter&#160;5.&#160;Generic PCI UIO driver</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="The Userspace I/O HOWTO" /><link rel="up" href="index.html" title="The Userspace I/O HOWTO" /><link rel="prev" href="ch04s03.html" title="Waiting for interrupts" /><link rel="next" href="ch05s02.html" title="Things to know about uio_pci_generic" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&#160;5.&#160;Generic PCI UIO driver</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a>&#160;</td><th width="60%" align="center">&#160;</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch05s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter&#160;5.&#160;Generic PCI UIO driver"><div class="titlepage"><div><div><h2 class="title"><a id="uio_pci_generic"></a>Chapter&#160;5.&#160;Generic PCI UIO driver</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="uio_pci_generic.html#uio_pci_generic_binding">Making the driver recognize the device</a></span></dt><dt><span class="sect1"><a href="ch05s02.html">Things to know about uio_pci_generic</a></span></dt><dt><span class="sect1"><a href="ch05s03.html">Writing userspace driver using uio_pci_generic</a></span></dt><dt><span class="sect1"><a href="ch05s04.html">Example code using uio_pci_generic</a></span></dt></dl></div><p>
	The generic driver is a kernel module named uio_pci_generic.
	It can work with any device compliant to PCI 2.3 (circa 2002) and
	any compliant PCI Express device. Using this, you only need to
        write the userspace driver, removing the need to write
        a hardware-specific kernel module.
	</p><div class="sect1" title="Making the driver recognize the device"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="uio_pci_generic_binding"></a>Making the driver recognize the device</h2></div></div></div><p>
Since the driver does not declare any device ids, it will not get loaded
automatically and will not automatically bind to any devices, you must load it
and allocate id to the driver yourself. For example:
	</p><pre class="programlisting">
 modprobe uio_pci_generic
 echo "8086 10f5" &gt; /sys/bus/pci/drivers/uio_pci_generic/new_id
	</pre><p>
	</p><p>
If there already is a hardware specific kernel driver for your device, the
generic driver still won't bind to it, in this case if you want to use the
generic driver (why would you?) you'll have to manually unbind the hardware
specific driver and bind the generic driver, like this:
	</p><pre class="programlisting">
    echo -n 0000:00:19.0 &gt; /sys/bus/pci/drivers/e1000e/unbind
    echo -n 0000:00:19.0 &gt; /sys/bus/pci/drivers/uio_pci_generic/bind
	</pre><p>
	</p><p>
You can verify that the device has been bound to the driver
by looking for it in sysfs, for example like the following:
	</p><pre class="programlisting">
    ls -l /sys/bus/pci/devices/0000:00:19.0/driver
	</pre><p>
Which if successful should print
	</p><pre class="programlisting">
  .../0000:00:19.0/driver -&gt; ../../../bus/pci/drivers/uio_pci_generic
	</pre><p>
Note that the generic driver will not bind to old PCI 2.2 devices.
If binding the device failed, run the following command:
	</p><pre class="programlisting">
  dmesg
	</pre><p>
and look in the output for failure reasons
	</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a>&#160;</td><td width="20%" align="center">&#160;</td><td width="40%" align="right">&#160;<a accesskey="n" href="ch05s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Waiting for interrupts&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Things to know about uio_pci_generic</td></tr></table></div></body></html>