aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:02:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:02:07 -0500
commit40d7ee5d162203b40b5f4fbb312ab016edddb97f (patch)
tree432db33df85f7f244676127a189a828dfbf2877b /Documentation
parent5fec8bdbf9a1c4df4ad3f20e52aa2d8caed490c8 (diff)
parentb8ac9fc0e8cda9f9776019c5b0464b0c6d2d4c90 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (60 commits) uio: make uio_info's name and version const UIO: Documentation for UIO ioport info handling UIO: Pass information about ioports to userspace (V2) UIO: uio_pdrv_genirq: allow custom irq_flags UIO: use pci_ioremap_bar() in drivers/uio arm: struct device - replace bus_id with dev_name(), dev_set_name() libata: struct device - replace bus_id with dev_name(), dev_set_name() avr: struct device - replace bus_id with dev_name(), dev_set_name() block: struct device - replace bus_id with dev_name(), dev_set_name() chris: struct device - replace bus_id with dev_name(), dev_set_name() dmi: struct device - replace bus_id with dev_name(), dev_set_name() gadget: struct device - replace bus_id with dev_name(), dev_set_name() gpio: struct device - replace bus_id with dev_name(), dev_set_name() gpu: struct device - replace bus_id with dev_name(), dev_set_name() hwmon: struct device - replace bus_id with dev_name(), dev_set_name() i2o: struct device - replace bus_id with dev_name(), dev_set_name() IA64: struct device - replace bus_id with dev_name(), dev_set_name() i7300_idle: struct device - replace bus_id with dev_name(), dev_set_name() infiniband: struct device - replace bus_id with dev_name(), dev_set_name() ISDN: struct device - replace bus_id with dev_name(), dev_set_name() ...
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/DocBook/uio-howto.tmpl101
-rw-r--r--Documentation/kobject.txt4
2 files changed, 101 insertions, 4 deletions
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index df87d1b93605..b787e4721c90 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -42,6 +42,12 @@ GPL version 2.
42 42
43<revhistory> 43<revhistory>
44 <revision> 44 <revision>
45 <revnumber>0.6</revnumber>
46 <date>2008-12-05</date>
47 <authorinitials>hjk</authorinitials>
48 <revremark>Added description of portio sysfs attributes.</revremark>
49 </revision>
50 <revision>
45 <revnumber>0.5</revnumber> 51 <revnumber>0.5</revnumber>
46 <date>2008-05-22</date> 52 <date>2008-05-22</date>
47 <authorinitials>hjk</authorinitials> 53 <authorinitials>hjk</authorinitials>
@@ -318,6 +324,54 @@ interested in translating it, please email me
318offset = N * getpagesize(); 324offset = N * getpagesize();
319</programlisting> 325</programlisting>
320 326
327<para>
328 Sometimes there is hardware with memory-like regions that can not be
329 mapped with the technique described here, but there are still ways to
330 access them from userspace. The most common example are x86 ioports.
331 On x86 systems, userspace can access these ioports using
332 <function>ioperm()</function>, <function>iopl()</function>,
333 <function>inb()</function>, <function>outb()</function>, and similar
334 functions.
335</para>
336<para>
337 Since these ioport regions can not be mapped, they will not appear under
338 <filename>/sys/class/uio/uioX/maps/</filename> like the normal memory
339 described above. Without information about the port regions a hardware
340 has to offer, it becomes difficult for the userspace part of the
341 driver to find out which ports belong to which UIO device.
342</para>
343<para>
344 To address this situation, the new directory
345 <filename>/sys/class/uio/uioX/portio/</filename> was added. It only
346 exists if the driver wants to pass information about one or more port
347 regions to userspace. If that is the case, subdirectories named
348 <filename>port0</filename>, <filename>port1</filename>, and so on,
349 will appear underneath
350 <filename>/sys/class/uio/uioX/portio/</filename>.
351</para>
352<para>
353 Each <filename>portX/</filename> directory contains three read-only
354 files that show start, size, and type of the port region:
355</para>
356<itemizedlist>
357<listitem>
358 <para>
359 <filename>start</filename>: The first port of this region.
360 </para>
361</listitem>
362<listitem>
363 <para>
364 <filename>size</filename>: The number of ports in this region.
365 </para>
366</listitem>
367<listitem>
368 <para>
369 <filename>porttype</filename>: A string describing the type of port.
370 </para>
371</listitem>
372</itemizedlist>
373
374
321</sect1> 375</sect1>
322</chapter> 376</chapter>
323 377
@@ -339,12 +393,12 @@ offset = N * getpagesize();
339 393
340<itemizedlist> 394<itemizedlist>
341<listitem><para> 395<listitem><para>
342<varname>char *name</varname>: Required. The name of your driver as 396<varname>const char *name</varname>: Required. The name of your driver as
343it will appear in sysfs. I recommend using the name of your module for this. 397it will appear in sysfs. I recommend using the name of your module for this.
344</para></listitem> 398</para></listitem>
345 399
346<listitem><para> 400<listitem><para>
347<varname>char *version</varname>: Required. This string appears in 401<varname>const char *version</varname>: Required. This string appears in
348<filename>/sys/class/uio/uioX/version</filename>. 402<filename>/sys/class/uio/uioX/version</filename>.
349</para></listitem> 403</para></listitem>
350 404
@@ -356,6 +410,13 @@ See the description below for details.
356</para></listitem> 410</para></listitem>
357 411
358<listitem><para> 412<listitem><para>
413<varname>struct uio_port port[ MAX_UIO_PORTS_REGIONS ]</varname>: Required
414if you want to pass information about ioports to userspace. For each port
415region you need to fill one of the <varname>uio_port</varname> structures.
416See the description below for details.
417</para></listitem>
418
419<listitem><para>
359<varname>long irq</varname>: Required. If your hardware generates an 420<varname>long irq</varname>: Required. If your hardware generates an
360interrupt, it's your modules task to determine the irq number during 421interrupt, it's your modules task to determine the irq number during
361initialization. If you don't have a hardware generated interrupt but 422initialization. If you don't have a hardware generated interrupt but
@@ -448,6 +509,42 @@ Please do not touch the <varname>kobj</varname> element of
448<varname>struct uio_mem</varname>! It is used by the UIO framework 509<varname>struct uio_mem</varname>! It is used by the UIO framework
449to set up sysfs files for this mapping. Simply leave it alone. 510to set up sysfs files for this mapping. Simply leave it alone.
450</para> 511</para>
512
513<para>
514Sometimes, your device can have one or more port regions which can not be
515mapped to userspace. But if there are other possibilities for userspace to
516access these ports, it makes sense to make information about the ports
517available in sysfs. For each region, you have to set up a
518<varname>struct uio_port</varname> in the <varname>port[]</varname> array.
519Here's a description of the fields of <varname>struct uio_port</varname>:
520</para>
521
522<itemizedlist>
523<listitem><para>
524<varname>char *porttype</varname>: Required. Set this to one of the predefined
525constants. Use <varname>UIO_PORT_X86</varname> for the ioports found in x86
526architectures.
527</para></listitem>
528
529<listitem><para>
530<varname>unsigned long start</varname>: Required if the port region is used.
531Fill in the number of the first port of this region.
532</para></listitem>
533
534<listitem><para>
535<varname>unsigned long size</varname>: Fill in the number of ports in this
536region. If <varname>size</varname> is zero, the region is considered unused.
537Note that you <emphasis>must</emphasis> initialize <varname>size</varname>
538with zero for all unused regions.
539</para></listitem>
540</itemizedlist>
541
542<para>
543Please do not touch the <varname>portio</varname> element of
544<varname>struct uio_port</varname>! It is used internally by the UIO
545framework to set up sysfs files for this region. Simply leave it alone.
546</para>
547
451</sect1> 548</sect1>
452 549
453<sect1 id="adding_irq_handler"> 550<sect1 id="adding_irq_handler">
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt
index f5d2aad65a67..b2e374586bd8 100644
--- a/Documentation/kobject.txt
+++ b/Documentation/kobject.txt
@@ -118,8 +118,8 @@ the name of the kobject, call kobject_rename():
118 118
119 int kobject_rename(struct kobject *kobj, const char *new_name); 119 int kobject_rename(struct kobject *kobj, const char *new_name);
120 120
121Note kobject_rename does perform any locking or have a solid notion of 121kobject_rename does not perform any locking or have a solid notion of
122what names are valid so the provide must provide their own sanity checking 122what names are valid so the caller must provide their own sanity checking
123and serialization. 123and serialization.
124 124
125There is a function called kobject_set_name() but that is legacy cruft and 125There is a function called kobject_set_name() but that is legacy cruft and