diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 13:21:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 13:21:17 -0400 |
commit | c58d4055c054fc6dc72f1be8bc71bd6fff209e48 (patch) | |
tree | 56527e28fc65d74d6d5e8397c502ccc87a9ec99b | |
parent | ceb198bb007b84ead867e87a71ffe715c4412b15 (diff) | |
parent | 9bb0e9cb04c82d6bf0e72f3207307d621083b801 (diff) |
Merge tag 'docs-4.12' of git://git.lwn.net/linux
Pull documentation update from Jonathan Corbet:
"A reasonably busy cycle for documentation this time around. There is a
new guide for user-space API documents, rather sparsely populated at
the moment, but it's a start. Markus improved the infrastructure for
converting diagrams. Mauro has converted much of the USB documentation
over to RST. Plus the usual set of fixes, improvements, and tweaks.
There's a bit more than the usual amount of reaching out of
Documentation/ to fix comments elsewhere in the tree; I have acks for
those where I could get them"
* tag 'docs-4.12' of git://git.lwn.net/linux: (74 commits)
docs: Fix a couple typos
docs: Fix a spelling error in vfio-mediated-device.txt
docs: Fix a spelling error in ioctl-number.txt
MAINTAINERS: update file entry for HSI subsystem
Documentation: allow installing man pages to a user defined directory
Doc/PM: Sync with intel_powerclamp code behavior
zr364xx.rst: usb/devices is now at /sys/kernel/debug/
usb.rst: move documentation from proc_usb_info.txt to USB ReST book
convert philips.txt to ReST and add to media docs
docs-rst: usb: update old usbfs-related documentation
arm: Documentation: update a path name
docs: process/4.Coding.rst: Fix a couple of document refs
docs-rst: fix usb cross-references
usb: gadget.h: be consistent at kernel doc macros
usb: composite.h: fix two warnings when building docs
usb: get rid of some ReST doc build errors
usb.rst: get rid of some Sphinx errors
usb/URB.txt: convert to ReST and update it
usb/persist.txt: convert to ReST and add to driver-api book
usb/hotplug.txt: convert to ReST and add to driver-api book
...
132 files changed, 6111 insertions, 5417 deletions
diff --git a/Documentation/ABI/stable/sysfs-bus-usb b/Documentation/ABI/stable/sysfs-bus-usb index 831f15d9672f..b832eeff9999 100644 --- a/Documentation/ABI/stable/sysfs-bus-usb +++ b/Documentation/ABI/stable/sysfs-bus-usb | |||
@@ -9,7 +9,7 @@ Description: | |||
9 | hubs this facility is always enabled and their device | 9 | hubs this facility is always enabled and their device |
10 | directories will not contain this file. | 10 | directories will not contain this file. |
11 | 11 | ||
12 | For more information, see Documentation/usb/persist.txt. | 12 | For more information, see Documentation/driver-api/usb/persist.rst. |
13 | 13 | ||
14 | What: /sys/bus/usb/devices/.../power/autosuspend | 14 | What: /sys/bus/usb/devices/.../power/autosuspend |
15 | Date: March 2007 | 15 | Date: March 2007 |
diff --git a/Documentation/ABI/stable/vdso b/Documentation/ABI/stable/vdso index 7cdfc28cc2c6..55406ec8a35a 100644 --- a/Documentation/ABI/stable/vdso +++ b/Documentation/ABI/stable/vdso | |||
@@ -16,7 +16,8 @@ The vDSO uses symbol versioning; whenever you request a symbol from the | |||
16 | vDSO, specify the version you are expecting. | 16 | vDSO, specify the version you are expecting. |
17 | 17 | ||
18 | Programs that dynamically link to glibc will use the vDSO automatically. | 18 | Programs that dynamically link to glibc will use the vDSO automatically. |
19 | Otherwise, you can use the reference parser in Documentation/vDSO/parse_vdso.c. | 19 | Otherwise, you can use the reference parser in |
20 | tools/testing/selftests/vDSO/parse_vdso.c. | ||
20 | 21 | ||
21 | Unless otherwise noted, the set of symbols with any given version and the | 22 | Unless otherwise noted, the set of symbols with any given version and the |
22 | ABI of those symbols is considered stable. It may vary across architectures, | 23 | ABI of those symbols is considered stable. It may vary across architectures, |
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci index 5a1732b78707..e4e90104d7c3 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci +++ b/Documentation/ABI/testing/sysfs-bus-pci | |||
@@ -299,5 +299,5 @@ What: /sys/bus/pci/devices/.../revision | |||
299 | Date: November 2016 | 299 | Date: November 2016 |
300 | Contact: Emil Velikov <emil.l.velikov@gmail.com> | 300 | Contact: Emil Velikov <emil.l.velikov@gmail.com> |
301 | Description: | 301 | Description: |
302 | This file contains the revision field of the the PCI device. | 302 | This file contains the revision field of the PCI device. |
303 | The value comes from device config space. The file is read only. | 303 | The value comes from device config space. The file is read only. |
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 164c1c76971f..85916f13d330 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -8,12 +8,11 @@ | |||
8 | 8 | ||
9 | DOCBOOKS := z8530book.xml \ | 9 | DOCBOOKS := z8530book.xml \ |
10 | kernel-hacking.xml kernel-locking.xml \ | 10 | kernel-hacking.xml kernel-locking.xml \ |
11 | writing_usb_driver.xml networking.xml \ | 11 | networking.xml \ |
12 | kernel-api.xml filesystems.xml lsm.xml kgdb.xml \ | 12 | filesystems.xml lsm.xml kgdb.xml \ |
13 | gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ | 13 | libata.xml mtdnand.xml librs.xml rapidio.xml \ |
14 | genericirq.xml s390-drivers.xml scsi.xml \ | 14 | s390-drivers.xml scsi.xml \ |
15 | sh.xml w1.xml \ | 15 | sh.xml w1.xml |
16 | writing_musb_glue_layer.xml | ||
17 | 16 | ||
18 | ifeq ($(DOCBOOKS),) | 17 | ifeq ($(DOCBOOKS),) |
19 | 18 | ||
@@ -62,11 +61,14 @@ MAN := $(patsubst %.xml, %.9, $(BOOKS)) | |||
62 | mandocs: $(MAN) | 61 | mandocs: $(MAN) |
63 | find $(obj)/man -name '*.9' | xargs gzip -nf | 62 | find $(obj)/man -name '*.9' | xargs gzip -nf |
64 | 63 | ||
64 | # Default location for installed man pages | ||
65 | export INSTALL_MAN_PATH = $(objtree)/usr | ||
66 | |||
65 | installmandocs: mandocs | 67 | installmandocs: mandocs |
66 | mkdir -p /usr/local/man/man9/ | 68 | mkdir -p $(INSTALL_MAN_PATH)/man/man9/ |
67 | find $(obj)/man -name '*.9.gz' -printf '%h %f\n' | \ | 69 | find $(obj)/man -name '*.9.gz' -printf '%h %f\n' | \ |
68 | sort -k 2 -k 1 | uniq -f 1 | sed -e 's: :/:' | \ | 70 | sort -k 2 -k 1 | uniq -f 1 | sed -e 's: :/:' | \ |
69 | xargs install -m 644 -t /usr/local/man/man9/ | 71 | xargs install -m 644 -t $(INSTALL_MAN_PATH)/man/man9/ |
70 | 72 | ||
71 | # no-op for the DocBook toolchain | 73 | # no-op for the DocBook toolchain |
72 | epubdocs: | 74 | epubdocs: |
@@ -238,7 +240,9 @@ dochelp: | |||
238 | @echo ' psdocs - Postscript' | 240 | @echo ' psdocs - Postscript' |
239 | @echo ' xmldocs - XML DocBook' | 241 | @echo ' xmldocs - XML DocBook' |
240 | @echo ' mandocs - man pages' | 242 | @echo ' mandocs - man pages' |
241 | @echo ' installmandocs - install man pages generated by mandocs' | 243 | @echo ' installmandocs - install man pages generated by mandocs to INSTALL_MAN_PATH'; \ |
244 | echo ' (default: $(INSTALL_MAN_PATH))'; \ | ||
245 | echo '' | ||
242 | @echo ' cleandocs - clean all generated DocBook files' | 246 | @echo ' cleandocs - clean all generated DocBook files' |
243 | @echo | 247 | @echo |
244 | @echo ' make DOCBOOKS="s1.xml s2.xml" [target] Generate only docs s1.xml s2.xml' | 248 | @echo ' make DOCBOOKS="s1.xml s2.xml" [target] Generate only docs s1.xml s2.xml' |
diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl deleted file mode 100644 index 641629221176..000000000000 --- a/Documentation/DocBook/gadget.tmpl +++ /dev/null | |||
@@ -1,793 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | ||
4 | |||
5 | <book id="USB-Gadget-API"> | ||
6 | <bookinfo> | ||
7 | <title>USB Gadget API for Linux</title> | ||
8 | <date>20 August 2004</date> | ||
9 | <edition>20 August 2004</edition> | ||
10 | |||
11 | <legalnotice> | ||
12 | <para> | ||
13 | This documentation is free software; you can redistribute | ||
14 | it and/or modify it under the terms of the GNU General Public | ||
15 | License as published by the Free Software Foundation; either | ||
16 | version 2 of the License, or (at your option) any later | ||
17 | version. | ||
18 | </para> | ||
19 | |||
20 | <para> | ||
21 | This program is distributed in the hope that it will be | ||
22 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
23 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
24 | See the GNU General Public License for more details. | ||
25 | </para> | ||
26 | |||
27 | <para> | ||
28 | You should have received a copy of the GNU General Public | ||
29 | License along with this program; if not, write to the Free | ||
30 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
31 | MA 02111-1307 USA | ||
32 | </para> | ||
33 | |||
34 | <para> | ||
35 | For more details see the file COPYING in the source | ||
36 | distribution of Linux. | ||
37 | </para> | ||
38 | </legalnotice> | ||
39 | <copyright> | ||
40 | <year>2003-2004</year> | ||
41 | <holder>David Brownell</holder> | ||
42 | </copyright> | ||
43 | |||
44 | <author> | ||
45 | <firstname>David</firstname> | ||
46 | <surname>Brownell</surname> | ||
47 | <affiliation> | ||
48 | <address><email>dbrownell@users.sourceforge.net</email></address> | ||
49 | </affiliation> | ||
50 | </author> | ||
51 | </bookinfo> | ||
52 | |||
53 | <toc></toc> | ||
54 | |||
55 | <chapter id="intro"><title>Introduction</title> | ||
56 | |||
57 | <para>This document presents a Linux-USB "Gadget" | ||
58 | kernel mode | ||
59 | API, for use within peripherals and other USB devices | ||
60 | that embed Linux. | ||
61 | It provides an overview of the API structure, | ||
62 | and shows how that fits into a system development project. | ||
63 | This is the first such API released on Linux to address | ||
64 | a number of important problems, including: </para> | ||
65 | |||
66 | <itemizedlist> | ||
67 | <listitem><para>Supports USB 2.0, for high speed devices which | ||
68 | can stream data at several dozen megabytes per second. | ||
69 | </para></listitem> | ||
70 | <listitem><para>Handles devices with dozens of endpoints just as | ||
71 | well as ones with just two fixed-function ones. Gadget drivers | ||
72 | can be written so they're easy to port to new hardware. | ||
73 | </para></listitem> | ||
74 | <listitem><para>Flexible enough to expose more complex USB device | ||
75 | capabilities such as multiple configurations, multiple interfaces, | ||
76 | composite devices, | ||
77 | and alternate interface settings. | ||
78 | </para></listitem> | ||
79 | <listitem><para>USB "On-The-Go" (OTG) support, in conjunction | ||
80 | with updates to the Linux-USB host side. | ||
81 | </para></listitem> | ||
82 | <listitem><para>Sharing data structures and API models with the | ||
83 | Linux-USB host side API. This helps the OTG support, and | ||
84 | looks forward to more-symmetric frameworks (where the same | ||
85 | I/O model is used by both host and device side drivers). | ||
86 | </para></listitem> | ||
87 | <listitem><para>Minimalist, so it's easier to support new device | ||
88 | controller hardware. I/O processing doesn't imply large | ||
89 | demands for memory or CPU resources. | ||
90 | </para></listitem> | ||
91 | </itemizedlist> | ||
92 | |||
93 | |||
94 | <para>Most Linux developers will not be able to use this API, since they | ||
95 | have USB "host" hardware in a PC, workstation, or server. | ||
96 | Linux users with embedded systems are more likely to | ||
97 | have USB peripheral hardware. | ||
98 | To distinguish drivers running inside such hardware from the | ||
99 | more familiar Linux "USB device drivers", | ||
100 | which are host side proxies for the real USB devices, | ||
101 | a different term is used: | ||
102 | the drivers inside the peripherals are "USB gadget drivers". | ||
103 | In USB protocol interactions, the device driver is the master | ||
104 | (or "client driver") | ||
105 | and the gadget driver is the slave (or "function driver"). | ||
106 | </para> | ||
107 | |||
108 | <para>The gadget API resembles the host side Linux-USB API in that both | ||
109 | use queues of request objects to package I/O buffers, and those requests | ||
110 | may be submitted or canceled. | ||
111 | They share common definitions for the standard USB | ||
112 | <emphasis>Chapter 9</emphasis> messages, structures, and constants. | ||
113 | Also, both APIs bind and unbind drivers to devices. | ||
114 | The APIs differ in detail, since the host side's current | ||
115 | URB framework exposes a number of implementation details | ||
116 | and assumptions that are inappropriate for a gadget API. | ||
117 | While the model for control transfers and configuration | ||
118 | management is necessarily different (one side is a hardware-neutral master, | ||
119 | the other is a hardware-aware slave), the endpoint I/0 API used here | ||
120 | should also be usable for an overhead-reduced host side API. | ||
121 | </para> | ||
122 | |||
123 | </chapter> | ||
124 | |||
125 | <chapter id="structure"><title>Structure of Gadget Drivers</title> | ||
126 | |||
127 | <para>A system running inside a USB peripheral | ||
128 | normally has at least three layers inside the kernel to handle | ||
129 | USB protocol processing, and may have additional layers in | ||
130 | user space code. | ||
131 | The "gadget" API is used by the middle layer to interact | ||
132 | with the lowest level (which directly handles hardware). | ||
133 | </para> | ||
134 | |||
135 | <para>In Linux, from the bottom up, these layers are: | ||
136 | </para> | ||
137 | |||
138 | <variablelist> | ||
139 | |||
140 | <varlistentry> | ||
141 | <term><emphasis>USB Controller Driver</emphasis></term> | ||
142 | |||
143 | <listitem> | ||
144 | <para>This is the lowest software level. | ||
145 | It is the only layer that talks to hardware, | ||
146 | through registers, fifos, dma, irqs, and the like. | ||
147 | The <filename><linux/usb/gadget.h></filename> API abstracts | ||
148 | the peripheral controller endpoint hardware. | ||
149 | That hardware is exposed through endpoint objects, which accept | ||
150 | streams of IN/OUT buffers, and through callbacks that interact | ||
151 | with gadget drivers. | ||
152 | Since normal USB devices only have one upstream | ||
153 | port, they only have one of these drivers. | ||
154 | The controller driver can support any number of different | ||
155 | gadget drivers, but only one of them can be used at a time. | ||
156 | </para> | ||
157 | |||
158 | <para>Examples of such controller hardware include | ||
159 | the PCI-based NetChip 2280 USB 2.0 high speed controller, | ||
160 | the SA-11x0 or PXA-25x UDC (found within many PDAs), | ||
161 | and a variety of other products. | ||
162 | </para> | ||
163 | |||
164 | </listitem></varlistentry> | ||
165 | |||
166 | <varlistentry> | ||
167 | <term><emphasis>Gadget Driver</emphasis></term> | ||
168 | |||
169 | <listitem> | ||
170 | <para>The lower boundary of this driver implements hardware-neutral | ||
171 | USB functions, using calls to the controller driver. | ||
172 | Because such hardware varies widely in capabilities and restrictions, | ||
173 | and is used in embedded environments where space is at a premium, | ||
174 | the gadget driver is often configured at compile time | ||
175 | to work with endpoints supported by one particular controller. | ||
176 | Gadget drivers may be portable to several different controllers, | ||
177 | using conditional compilation. | ||
178 | (Recent kernels substantially simplify the work involved in | ||
179 | supporting new hardware, by <emphasis>autoconfiguring</emphasis> | ||
180 | endpoints automatically for many bulk-oriented drivers.) | ||
181 | Gadget driver responsibilities include: | ||
182 | </para> | ||
183 | <itemizedlist> | ||
184 | <listitem><para>handling setup requests (ep0 protocol responses) | ||
185 | possibly including class-specific functionality | ||
186 | </para></listitem> | ||
187 | <listitem><para>returning configuration and string descriptors | ||
188 | </para></listitem> | ||
189 | <listitem><para>(re)setting configurations and interface | ||
190 | altsettings, including enabling and configuring endpoints | ||
191 | </para></listitem> | ||
192 | <listitem><para>handling life cycle events, such as managing | ||
193 | bindings to hardware, | ||
194 | USB suspend/resume, remote wakeup, | ||
195 | and disconnection from the USB host. | ||
196 | </para></listitem> | ||
197 | <listitem><para>managing IN and OUT transfers on all currently | ||
198 | enabled endpoints | ||
199 | </para></listitem> | ||
200 | </itemizedlist> | ||
201 | |||
202 | <para> | ||
203 | Such drivers may be modules of proprietary code, although | ||
204 | that approach is discouraged in the Linux community. | ||
205 | </para> | ||
206 | </listitem></varlistentry> | ||
207 | |||
208 | <varlistentry> | ||
209 | <term><emphasis>Upper Level</emphasis></term> | ||
210 | |||
211 | <listitem> | ||
212 | <para>Most gadget drivers have an upper boundary that connects | ||
213 | to some Linux driver or framework in Linux. | ||
214 | Through that boundary flows the data which the gadget driver | ||
215 | produces and/or consumes through protocol transfers over USB. | ||
216 | Examples include: | ||
217 | </para> | ||
218 | <itemizedlist> | ||
219 | <listitem><para>user mode code, using generic (gadgetfs) | ||
220 | or application specific files in | ||
221 | <filename>/dev</filename> | ||
222 | </para></listitem> | ||
223 | <listitem><para>networking subsystem (for network gadgets, | ||
224 | like the CDC Ethernet Model gadget driver) | ||
225 | </para></listitem> | ||
226 | <listitem><para>data capture drivers, perhaps video4Linux or | ||
227 | a scanner driver; or test and measurement hardware. | ||
228 | </para></listitem> | ||
229 | <listitem><para>input subsystem (for HID gadgets) | ||
230 | </para></listitem> | ||
231 | <listitem><para>sound subsystem (for audio gadgets) | ||
232 | </para></listitem> | ||
233 | <listitem><para>file system (for PTP gadgets) | ||
234 | </para></listitem> | ||
235 | <listitem><para>block i/o subsystem (for usb-storage gadgets) | ||
236 | </para></listitem> | ||
237 | <listitem><para>... and more </para></listitem> | ||
238 | </itemizedlist> | ||
239 | </listitem></varlistentry> | ||
240 | |||
241 | <varlistentry> | ||
242 | <term><emphasis>Additional Layers</emphasis></term> | ||
243 | |||
244 | <listitem> | ||
245 | <para>Other layers may exist. | ||
246 | These could include kernel layers, such as network protocol stacks, | ||
247 | as well as user mode applications building on standard POSIX | ||
248 | system call APIs such as | ||
249 | <emphasis>open()</emphasis>, <emphasis>close()</emphasis>, | ||
250 | <emphasis>read()</emphasis> and <emphasis>write()</emphasis>. | ||
251 | On newer systems, POSIX Async I/O calls may be an option. | ||
252 | Such user mode code will not necessarily be subject to | ||
253 | the GNU General Public License (GPL). | ||
254 | </para> | ||
255 | </listitem></varlistentry> | ||
256 | |||
257 | |||
258 | </variablelist> | ||
259 | |||
260 | <para>OTG-capable systems will also need to include a standard Linux-USB | ||
261 | host side stack, | ||
262 | with <emphasis>usbcore</emphasis>, | ||
263 | one or more <emphasis>Host Controller Drivers</emphasis> (HCDs), | ||
264 | <emphasis>USB Device Drivers</emphasis> to support | ||
265 | the OTG "Targeted Peripheral List", | ||
266 | and so forth. | ||
267 | There will also be an <emphasis>OTG Controller Driver</emphasis>, | ||
268 | which is visible to gadget and device driver developers only indirectly. | ||
269 | That helps the host and device side USB controllers implement the | ||
270 | two new OTG protocols (HNP and SRP). | ||
271 | Roles switch (host to peripheral, or vice versa) using HNP | ||
272 | during USB suspend processing, and SRP can be viewed as a | ||
273 | more battery-friendly kind of device wakeup protocol. | ||
274 | </para> | ||
275 | |||
276 | <para>Over time, reusable utilities are evolving to help make some | ||
277 | gadget driver tasks simpler. | ||
278 | For example, building configuration descriptors from vectors of | ||
279 | descriptors for the configurations interfaces and endpoints is | ||
280 | now automated, and many drivers now use autoconfiguration to | ||
281 | choose hardware endpoints and initialize their descriptors. | ||
282 | |||
283 | A potential example of particular interest | ||
284 | is code implementing standard USB-IF protocols for | ||
285 | HID, networking, storage, or audio classes. | ||
286 | Some developers are interested in KDB or KGDB hooks, to let | ||
287 | target hardware be remotely debugged. | ||
288 | Most such USB protocol code doesn't need to be hardware-specific, | ||
289 | any more than network protocols like X11, HTTP, or NFS are. | ||
290 | Such gadget-side interface drivers should eventually be combined, | ||
291 | to implement composite devices. | ||
292 | </para> | ||
293 | |||
294 | </chapter> | ||
295 | |||
296 | |||
297 | <chapter id="api"><title>Kernel Mode Gadget API</title> | ||
298 | |||
299 | <para>Gadget drivers declare themselves through a | ||
300 | <emphasis>struct usb_gadget_driver</emphasis>, which is responsible for | ||
301 | most parts of enumeration for a <emphasis>struct usb_gadget</emphasis>. | ||
302 | The response to a set_configuration usually involves | ||
303 | enabling one or more of the <emphasis>struct usb_ep</emphasis> objects | ||
304 | exposed by the gadget, and submitting one or more | ||
305 | <emphasis>struct usb_request</emphasis> buffers to transfer data. | ||
306 | Understand those four data types, and their operations, and | ||
307 | you will understand how this API works. | ||
308 | </para> | ||
309 | |||
310 | <note><title>Incomplete Data Type Descriptions</title> | ||
311 | |||
312 | <para>This documentation was prepared using the standard Linux | ||
313 | kernel <filename>docproc</filename> tool, which turns text | ||
314 | and in-code comments into SGML DocBook and then into usable | ||
315 | formats such as HTML or PDF. | ||
316 | Other than the "Chapter 9" data types, most of the significant | ||
317 | data types and functions are described here. | ||
318 | </para> | ||
319 | |||
320 | <para>However, docproc does not understand all the C constructs | ||
321 | that are used, so some relevant information is likely omitted from | ||
322 | what you are reading. | ||
323 | One example of such information is endpoint autoconfiguration. | ||
324 | You'll have to read the header file, and use example source | ||
325 | code (such as that for "Gadget Zero"), to fully understand the API. | ||
326 | </para> | ||
327 | |||
328 | <para>The part of the API implementing some basic | ||
329 | driver capabilities is specific to the version of the | ||
330 | Linux kernel that's in use. | ||
331 | The 2.6 kernel includes a <emphasis>driver model</emphasis> | ||
332 | framework that has no analogue on earlier kernels; | ||
333 | so those parts of the gadget API are not fully portable. | ||
334 | (They are implemented on 2.4 kernels, but in a different way.) | ||
335 | The driver model state is another part of this API that is | ||
336 | ignored by the kerneldoc tools. | ||
337 | </para> | ||
338 | </note> | ||
339 | |||
340 | <para>The core API does not expose | ||
341 | every possible hardware feature, only the most widely available ones. | ||
342 | There are significant hardware features, such as device-to-device DMA | ||
343 | (without temporary storage in a memory buffer) | ||
344 | that would be added using hardware-specific APIs. | ||
345 | </para> | ||
346 | |||
347 | <para>This API allows drivers to use conditional compilation to handle | ||
348 | endpoint capabilities of different hardware, but doesn't require that. | ||
349 | Hardware tends to have arbitrary restrictions, relating to | ||
350 | transfer types, addressing, packet sizes, buffering, and availability. | ||
351 | As a rule, such differences only matter for "endpoint zero" logic | ||
352 | that handles device configuration and management. | ||
353 | The API supports limited run-time | ||
354 | detection of capabilities, through naming conventions for endpoints. | ||
355 | Many drivers will be able to at least partially autoconfigure | ||
356 | themselves. | ||
357 | In particular, driver init sections will often have endpoint | ||
358 | autoconfiguration logic that scans the hardware's list of endpoints | ||
359 | to find ones matching the driver requirements | ||
360 | (relying on those conventions), to eliminate some of the most | ||
361 | common reasons for conditional compilation. | ||
362 | </para> | ||
363 | |||
364 | <para>Like the Linux-USB host side API, this API exposes | ||
365 | the "chunky" nature of USB messages: I/O requests are in terms | ||
366 | of one or more "packets", and packet boundaries are visible to drivers. | ||
367 | Compared to RS-232 serial protocols, USB resembles | ||
368 | synchronous protocols like HDLC | ||
369 | (N bytes per frame, multipoint addressing, host as the primary | ||
370 | station and devices as secondary stations) | ||
371 | more than asynchronous ones | ||
372 | (tty style: 8 data bits per frame, no parity, one stop bit). | ||
373 | So for example the controller drivers won't buffer | ||
374 | two single byte writes into a single two-byte USB IN packet, | ||
375 | although gadget drivers may do so when they implement | ||
376 | protocols where packet boundaries (and "short packets") | ||
377 | are not significant. | ||
378 | </para> | ||
379 | |||
380 | <sect1 id="lifecycle"><title>Driver Life Cycle</title> | ||
381 | |||
382 | <para>Gadget drivers make endpoint I/O requests to hardware without | ||
383 | needing to know many details of the hardware, but driver | ||
384 | setup/configuration code needs to handle some differences. | ||
385 | Use the API like this: | ||
386 | </para> | ||
387 | |||
388 | <orderedlist numeration='arabic'> | ||
389 | |||
390 | <listitem><para>Register a driver for the particular device side | ||
391 | usb controller hardware, | ||
392 | such as the net2280 on PCI (USB 2.0), | ||
393 | sa11x0 or pxa25x as found in Linux PDAs, | ||
394 | and so on. | ||
395 | At this point the device is logically in the USB ch9 initial state | ||
396 | ("attached"), drawing no power and not usable | ||
397 | (since it does not yet support enumeration). | ||
398 | Any host should not see the device, since it's not | ||
399 | activated the data line pullup used by the host to | ||
400 | detect a device, even if VBUS power is available. | ||
401 | </para></listitem> | ||
402 | |||
403 | <listitem><para>Register a gadget driver that implements some higher level | ||
404 | device function. That will then bind() to a usb_gadget, which | ||
405 | activates the data line pullup sometime after detecting VBUS. | ||
406 | </para></listitem> | ||
407 | |||
408 | <listitem><para>The hardware driver can now start enumerating. | ||
409 | The steps it handles are to accept USB power and set_address requests. | ||
410 | Other steps are handled by the gadget driver. | ||
411 | If the gadget driver module is unloaded before the host starts to | ||
412 | enumerate, steps before step 7 are skipped. | ||
413 | </para></listitem> | ||
414 | |||
415 | <listitem><para>The gadget driver's setup() call returns usb descriptors, | ||
416 | based both on what the bus interface hardware provides and on the | ||
417 | functionality being implemented. | ||
418 | That can involve alternate settings or configurations, | ||
419 | unless the hardware prevents such operation. | ||
420 | For OTG devices, each configuration descriptor includes | ||
421 | an OTG descriptor. | ||
422 | </para></listitem> | ||
423 | |||
424 | <listitem><para>The gadget driver handles the last step of enumeration, | ||
425 | when the USB host issues a set_configuration call. | ||
426 | It enables all endpoints used in that configuration, | ||
427 | with all interfaces in their default settings. | ||
428 | That involves using a list of the hardware's endpoints, enabling each | ||
429 | endpoint according to its descriptor. | ||
430 | It may also involve using <function>usb_gadget_vbus_draw</function> | ||
431 | to let more power be drawn from VBUS, as allowed by that configuration. | ||
432 | For OTG devices, setting a configuration may also involve reporting | ||
433 | HNP capabilities through a user interface. | ||
434 | </para></listitem> | ||
435 | |||
436 | <listitem><para>Do real work and perform data transfers, possibly involving | ||
437 | changes to interface settings or switching to new configurations, until the | ||
438 | device is disconnect()ed from the host. | ||
439 | Queue any number of transfer requests to each endpoint. | ||
440 | It may be suspended and resumed several times before being disconnected. | ||
441 | On disconnect, the drivers go back to step 3 (above). | ||
442 | </para></listitem> | ||
443 | |||
444 | <listitem><para>When the gadget driver module is being unloaded, | ||
445 | the driver unbind() callback is issued. That lets the controller | ||
446 | driver be unloaded. | ||
447 | </para></listitem> | ||
448 | |||
449 | </orderedlist> | ||
450 | |||
451 | <para>Drivers will normally be arranged so that just loading the | ||
452 | gadget driver module (or statically linking it into a Linux kernel) | ||
453 | allows the peripheral device to be enumerated, but some drivers | ||
454 | will defer enumeration until some higher level component (like | ||
455 | a user mode daemon) enables it. | ||
456 | Note that at this lowest level there are no policies about how | ||
457 | ep0 configuration logic is implemented, | ||
458 | except that it should obey USB specifications. | ||
459 | Such issues are in the domain of gadget drivers, | ||
460 | including knowing about implementation constraints | ||
461 | imposed by some USB controllers | ||
462 | or understanding that composite devices might happen to | ||
463 | be built by integrating reusable components. | ||
464 | </para> | ||
465 | |||
466 | <para>Note that the lifecycle above can be slightly different | ||
467 | for OTG devices. | ||
468 | Other than providing an additional OTG descriptor in each | ||
469 | configuration, only the HNP-related differences are particularly | ||
470 | visible to driver code. | ||
471 | They involve reporting requirements during the SET_CONFIGURATION | ||
472 | request, and the option to invoke HNP during some suspend callbacks. | ||
473 | Also, SRP changes the semantics of | ||
474 | <function>usb_gadget_wakeup</function> | ||
475 | slightly. | ||
476 | </para> | ||
477 | |||
478 | </sect1> | ||
479 | |||
480 | <sect1 id="ch9"><title>USB 2.0 Chapter 9 Types and Constants</title> | ||
481 | |||
482 | <para>Gadget drivers | ||
483 | rely on common USB structures and constants | ||
484 | defined in the | ||
485 | <filename><linux/usb/ch9.h></filename> | ||
486 | header file, which is standard in Linux 2.6 kernels. | ||
487 | These are the same types and constants used by host | ||
488 | side drivers (and usbcore). | ||
489 | </para> | ||
490 | |||
491 | !Iinclude/linux/usb/ch9.h | ||
492 | </sect1> | ||
493 | |||
494 | <sect1 id="core"><title>Core Objects and Methods</title> | ||
495 | |||
496 | <para>These are declared in | ||
497 | <filename><linux/usb/gadget.h></filename>, | ||
498 | and are used by gadget drivers to interact with | ||
499 | USB peripheral controller drivers. | ||
500 | </para> | ||
501 | |||
502 | <!-- yeech, this is ugly in nsgmls PDF output. | ||
503 | |||
504 | the PDF bookmark and refentry output nesting is wrong, | ||
505 | and the member/argument documentation indents ugly. | ||
506 | |||
507 | plus something (docproc?) adds whitespace before the | ||
508 | descriptive paragraph text, so it can't line up right | ||
509 | unless the explanations are trivial. | ||
510 | --> | ||
511 | |||
512 | !Iinclude/linux/usb/gadget.h | ||
513 | </sect1> | ||
514 | |||
515 | <sect1 id="utils"><title>Optional Utilities</title> | ||
516 | |||
517 | <para>The core API is sufficient for writing a USB Gadget Driver, | ||
518 | but some optional utilities are provided to simplify common tasks. | ||
519 | These utilities include endpoint autoconfiguration. | ||
520 | </para> | ||
521 | |||
522 | !Edrivers/usb/gadget/usbstring.c | ||
523 | !Edrivers/usb/gadget/config.c | ||
524 | <!-- !Edrivers/usb/gadget/epautoconf.c --> | ||
525 | </sect1> | ||
526 | |||
527 | <sect1 id="composite"><title>Composite Device Framework</title> | ||
528 | |||
529 | <para>The core API is sufficient for writing drivers for composite | ||
530 | USB devices (with more than one function in a given configuration), | ||
531 | and also multi-configuration devices (also more than one function, | ||
532 | but not necessarily sharing a given configuration). | ||
533 | There is however an optional framework which makes it easier to | ||
534 | reuse and combine functions. | ||
535 | </para> | ||
536 | |||
537 | <para>Devices using this framework provide a <emphasis>struct | ||
538 | usb_composite_driver</emphasis>, which in turn provides one or | ||
539 | more <emphasis>struct usb_configuration</emphasis> instances. | ||
540 | Each such configuration includes at least one | ||
541 | <emphasis>struct usb_function</emphasis>, which packages a user | ||
542 | visible role such as "network link" or "mass storage device". | ||
543 | Management functions may also exist, such as "Device Firmware | ||
544 | Upgrade". | ||
545 | </para> | ||
546 | |||
547 | !Iinclude/linux/usb/composite.h | ||
548 | !Edrivers/usb/gadget/composite.c | ||
549 | |||
550 | </sect1> | ||
551 | |||
552 | <sect1 id="functions"><title>Composite Device Functions</title> | ||
553 | |||
554 | <para>At this writing, a few of the current gadget drivers have | ||
555 | been converted to this framework. | ||
556 | Near-term plans include converting all of them, except for "gadgetfs". | ||
557 | </para> | ||
558 | |||
559 | !Edrivers/usb/gadget/function/f_acm.c | ||
560 | !Edrivers/usb/gadget/function/f_ecm.c | ||
561 | !Edrivers/usb/gadget/function/f_subset.c | ||
562 | !Edrivers/usb/gadget/function/f_obex.c | ||
563 | !Edrivers/usb/gadget/function/f_serial.c | ||
564 | |||
565 | </sect1> | ||
566 | |||
567 | |||
568 | </chapter> | ||
569 | |||
570 | <chapter id="controllers"><title>Peripheral Controller Drivers</title> | ||
571 | |||
572 | <para>The first hardware supporting this API was the NetChip 2280 | ||
573 | controller, which supports USB 2.0 high speed and is based on PCI. | ||
574 | This is the <filename>net2280</filename> driver module. | ||
575 | The driver supports Linux kernel versions 2.4 and 2.6; | ||
576 | contact NetChip Technologies for development boards and product | ||
577 | information. | ||
578 | </para> | ||
579 | |||
580 | <para>Other hardware working in the "gadget" framework includes: | ||
581 | Intel's PXA 25x and IXP42x series processors | ||
582 | (<filename>pxa2xx_udc</filename>), | ||
583 | Toshiba TC86c001 "Goku-S" (<filename>goku_udc</filename>), | ||
584 | Renesas SH7705/7727 (<filename>sh_udc</filename>), | ||
585 | MediaQ 11xx (<filename>mq11xx_udc</filename>), | ||
586 | Hynix HMS30C7202 (<filename>h7202_udc</filename>), | ||
587 | National 9303/4 (<filename>n9604_udc</filename>), | ||
588 | Texas Instruments OMAP (<filename>omap_udc</filename>), | ||
589 | Sharp LH7A40x (<filename>lh7a40x_udc</filename>), | ||
590 | and more. | ||
591 | Most of those are full speed controllers. | ||
592 | </para> | ||
593 | |||
594 | <para>At this writing, there are people at work on drivers in | ||
595 | this framework for several other USB device controllers, | ||
596 | with plans to make many of them be widely available. | ||
597 | </para> | ||
598 | |||
599 | <!-- !Edrivers/usb/gadget/net2280.c --> | ||
600 | |||
601 | <para>A partial USB simulator, | ||
602 | the <filename>dummy_hcd</filename> driver, is available. | ||
603 | It can act like a net2280, a pxa25x, or an sa11x0 in terms | ||
604 | of available endpoints and device speeds; and it simulates | ||
605 | control, bulk, and to some extent interrupt transfers. | ||
606 | That lets you develop some parts of a gadget driver on a normal PC, | ||
607 | without any special hardware, and perhaps with the assistance | ||
608 | of tools such as GDB running with User Mode Linux. | ||
609 | At least one person has expressed interest in adapting that | ||
610 | approach, hooking it up to a simulator for a microcontroller. | ||
611 | Such simulators can help debug subsystems where the runtime hardware | ||
612 | is unfriendly to software development, or is not yet available. | ||
613 | </para> | ||
614 | |||
615 | <para>Support for other controllers is expected to be developed | ||
616 | and contributed | ||
617 | over time, as this driver framework evolves. | ||
618 | </para> | ||
619 | |||
620 | </chapter> | ||
621 | |||
622 | <chapter id="gadget"><title>Gadget Drivers</title> | ||
623 | |||
624 | <para>In addition to <emphasis>Gadget Zero</emphasis> | ||
625 | (used primarily for testing and development with drivers | ||
626 | for usb controller hardware), other gadget drivers exist. | ||
627 | </para> | ||
628 | |||
629 | <para>There's an <emphasis>ethernet</emphasis> gadget | ||
630 | driver, which implements one of the most useful | ||
631 | <emphasis>Communications Device Class</emphasis> (CDC) models. | ||
632 | One of the standards for cable modem interoperability even | ||
633 | specifies the use of this ethernet model as one of two | ||
634 | mandatory options. | ||
635 | Gadgets using this code look to a USB host as if they're | ||
636 | an Ethernet adapter. | ||
637 | It provides access to a network where the gadget's CPU is one host, | ||
638 | which could easily be bridging, routing, or firewalling | ||
639 | access to other networks. | ||
640 | Since some hardware can't fully implement the CDC Ethernet | ||
641 | requirements, this driver also implements a "good parts only" | ||
642 | subset of CDC Ethernet. | ||
643 | (That subset doesn't advertise itself as CDC Ethernet, | ||
644 | to avoid creating problems.) | ||
645 | </para> | ||
646 | |||
647 | <para>Support for Microsoft's <emphasis>RNDIS</emphasis> | ||
648 | protocol has been contributed by Pengutronix and Auerswald GmbH. | ||
649 | This is like CDC Ethernet, but it runs on more slightly USB hardware | ||
650 | (but less than the CDC subset). | ||
651 | However, its main claim to fame is being able to connect directly to | ||
652 | recent versions of Windows, using drivers that Microsoft bundles | ||
653 | and supports, making it much simpler to network with Windows. | ||
654 | </para> | ||
655 | |||
656 | <para>There is also support for user mode gadget drivers, | ||
657 | using <emphasis>gadgetfs</emphasis>. | ||
658 | This provides a <emphasis>User Mode API</emphasis> that presents | ||
659 | each endpoint as a single file descriptor. I/O is done using | ||
660 | normal <emphasis>read()</emphasis> and <emphasis>read()</emphasis> calls. | ||
661 | Familiar tools like GDB and pthreads can be used to | ||
662 | develop and debug user mode drivers, so that once a robust | ||
663 | controller driver is available many applications for it | ||
664 | won't require new kernel mode software. | ||
665 | Linux 2.6 <emphasis>Async I/O (AIO)</emphasis> | ||
666 | support is available, so that user mode software | ||
667 | can stream data with only slightly more overhead | ||
668 | than a kernel driver. | ||
669 | </para> | ||
670 | |||
671 | <para>There's a USB Mass Storage class driver, which provides | ||
672 | a different solution for interoperability with systems such | ||
673 | as MS-Windows and MacOS. | ||
674 | That <emphasis>Mass Storage</emphasis> driver uses a | ||
675 | file or block device as backing store for a drive, | ||
676 | like the <filename>loop</filename> driver. | ||
677 | The USB host uses the BBB, CB, or CBI versions of the mass | ||
678 | storage class specification, using transparent SCSI commands | ||
679 | to access the data from the backing store. | ||
680 | </para> | ||
681 | |||
682 | <para>There's a "serial line" driver, useful for TTY style | ||
683 | operation over USB. | ||
684 | The latest version of that driver supports CDC ACM style | ||
685 | operation, like a USB modem, and so on most hardware it can | ||
686 | interoperate easily with MS-Windows. | ||
687 | One interesting use of that driver is in boot firmware (like a BIOS), | ||
688 | which can sometimes use that model with very small systems without | ||
689 | real serial lines. | ||
690 | </para> | ||
691 | |||
692 | <para>Support for other kinds of gadget is expected to | ||
693 | be developed and contributed | ||
694 | over time, as this driver framework evolves. | ||
695 | </para> | ||
696 | |||
697 | </chapter> | ||
698 | |||
699 | <chapter id="otg"><title>USB On-The-GO (OTG)</title> | ||
700 | |||
701 | <para>USB OTG support on Linux 2.6 was initially developed | ||
702 | by Texas Instruments for | ||
703 | <ulink url="http://www.omap.com">OMAP</ulink> 16xx and 17xx | ||
704 | series processors. | ||
705 | Other OTG systems should work in similar ways, but the | ||
706 | hardware level details could be very different. | ||
707 | </para> | ||
708 | |||
709 | <para>Systems need specialized hardware support to implement OTG, | ||
710 | notably including a special <emphasis>Mini-AB</emphasis> jack | ||
711 | and associated transceiver to support <emphasis>Dual-Role</emphasis> | ||
712 | operation: | ||
713 | they can act either as a host, using the standard | ||
714 | Linux-USB host side driver stack, | ||
715 | or as a peripheral, using this "gadget" framework. | ||
716 | To do that, the system software relies on small additions | ||
717 | to those programming interfaces, | ||
718 | and on a new internal component (here called an "OTG Controller") | ||
719 | affecting which driver stack connects to the OTG port. | ||
720 | In each role, the system can re-use the existing pool of | ||
721 | hardware-neutral drivers, layered on top of the controller | ||
722 | driver interfaces (<emphasis>usb_bus</emphasis> or | ||
723 | <emphasis>usb_gadget</emphasis>). | ||
724 | Such drivers need at most minor changes, and most of the calls | ||
725 | added to support OTG can also benefit non-OTG products. | ||
726 | </para> | ||
727 | |||
728 | <itemizedlist> | ||
729 | <listitem><para>Gadget drivers test the <emphasis>is_otg</emphasis> | ||
730 | flag, and use it to determine whether or not to include | ||
731 | an OTG descriptor in each of their configurations. | ||
732 | </para></listitem> | ||
733 | <listitem><para>Gadget drivers may need changes to support the | ||
734 | two new OTG protocols, exposed in new gadget attributes | ||
735 | such as <emphasis>b_hnp_enable</emphasis> flag. | ||
736 | HNP support should be reported through a user interface | ||
737 | (two LEDs could suffice), and is triggered in some cases | ||
738 | when the host suspends the peripheral. | ||
739 | SRP support can be user-initiated just like remote wakeup, | ||
740 | probably by pressing the same button. | ||
741 | </para></listitem> | ||
742 | <listitem><para>On the host side, USB device drivers need | ||
743 | to be taught to trigger HNP at appropriate moments, using | ||
744 | <function>usb_suspend_device()</function>. | ||
745 | That also conserves battery power, which is useful even | ||
746 | for non-OTG configurations. | ||
747 | </para></listitem> | ||
748 | <listitem><para>Also on the host side, a driver must support the | ||
749 | OTG "Targeted Peripheral List". That's just a whitelist, | ||
750 | used to reject peripherals not supported with a given | ||
751 | Linux OTG host. | ||
752 | <emphasis>This whitelist is product-specific; | ||
753 | each product must modify <filename>otg_whitelist.h</filename> | ||
754 | to match its interoperability specification. | ||
755 | </emphasis> | ||
756 | </para> | ||
757 | <para>Non-OTG Linux hosts, like PCs and workstations, | ||
758 | normally have some solution for adding drivers, so that | ||
759 | peripherals that aren't recognized can eventually be supported. | ||
760 | That approach is unreasonable for consumer products that may | ||
761 | never have their firmware upgraded, and where it's usually | ||
762 | unrealistic to expect traditional PC/workstation/server kinds | ||
763 | of support model to work. | ||
764 | For example, it's often impractical to change device firmware | ||
765 | once the product has been distributed, so driver bugs can't | ||
766 | normally be fixed if they're found after shipment. | ||
767 | </para></listitem> | ||
768 | </itemizedlist> | ||
769 | |||
770 | <para> | ||
771 | Additional changes are needed below those hardware-neutral | ||
772 | <emphasis>usb_bus</emphasis> and <emphasis>usb_gadget</emphasis> | ||
773 | driver interfaces; those aren't discussed here in any detail. | ||
774 | Those affect the hardware-specific code for each USB Host or Peripheral | ||
775 | controller, and how the HCD initializes (since OTG can be active only | ||
776 | on a single port). | ||
777 | They also involve what may be called an <emphasis>OTG Controller | ||
778 | Driver</emphasis>, managing the OTG transceiver and the OTG state | ||
779 | machine logic as well as much of the root hub behavior for the | ||
780 | OTG port. | ||
781 | The OTG controller driver needs to activate and deactivate USB | ||
782 | controllers depending on the relevant device role. | ||
783 | Some related changes were needed inside usbcore, so that it | ||
784 | can identify OTG-capable devices and respond appropriately | ||
785 | to HNP or SRP protocols. | ||
786 | </para> | ||
787 | |||
788 | </chapter> | ||
789 | |||
790 | </book> | ||
791 | <!-- | ||
792 | vim:syntax=sgml:sw=4 | ||
793 | --> | ||
diff --git a/Documentation/DocBook/genericirq.tmpl b/Documentation/DocBook/genericirq.tmpl deleted file mode 100644 index 59fb5c077541..000000000000 --- a/Documentation/DocBook/genericirq.tmpl +++ /dev/null | |||
@@ -1,520 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | ||
4 | |||
5 | <book id="Generic-IRQ-Guide"> | ||
6 | <bookinfo> | ||
7 | <title>Linux generic IRQ handling</title> | ||
8 | |||
9 | <authorgroup> | ||
10 | <author> | ||
11 | <firstname>Thomas</firstname> | ||
12 | <surname>Gleixner</surname> | ||
13 | <affiliation> | ||
14 | <address> | ||
15 | <email>tglx@linutronix.de</email> | ||
16 | </address> | ||
17 | </affiliation> | ||
18 | </author> | ||
19 | <author> | ||
20 | <firstname>Ingo</firstname> | ||
21 | <surname>Molnar</surname> | ||
22 | <affiliation> | ||
23 | <address> | ||
24 | <email>mingo@elte.hu</email> | ||
25 | </address> | ||
26 | </affiliation> | ||
27 | </author> | ||
28 | </authorgroup> | ||
29 | |||
30 | <copyright> | ||
31 | <year>2005-2010</year> | ||
32 | <holder>Thomas Gleixner</holder> | ||
33 | </copyright> | ||
34 | <copyright> | ||
35 | <year>2005-2006</year> | ||
36 | <holder>Ingo Molnar</holder> | ||
37 | </copyright> | ||
38 | |||
39 | <legalnotice> | ||
40 | <para> | ||
41 | This documentation is free software; you can redistribute | ||
42 | it and/or modify it under the terms of the GNU General Public | ||
43 | License version 2 as published by the Free Software Foundation. | ||
44 | </para> | ||
45 | |||
46 | <para> | ||
47 | This program is distributed in the hope that it will be | ||
48 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
49 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
50 | See the GNU General Public License for more details. | ||
51 | </para> | ||
52 | |||
53 | <para> | ||
54 | You should have received a copy of the GNU General Public | ||
55 | License along with this program; if not, write to the Free | ||
56 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
57 | MA 02111-1307 USA | ||
58 | </para> | ||
59 | |||
60 | <para> | ||
61 | For more details see the file COPYING in the source | ||
62 | distribution of Linux. | ||
63 | </para> | ||
64 | </legalnotice> | ||
65 | </bookinfo> | ||
66 | |||
67 | <toc></toc> | ||
68 | |||
69 | <chapter id="intro"> | ||
70 | <title>Introduction</title> | ||
71 | <para> | ||
72 | The generic interrupt handling layer is designed to provide a | ||
73 | complete abstraction of interrupt handling for device drivers. | ||
74 | It is able to handle all the different types of interrupt controller | ||
75 | hardware. Device drivers use generic API functions to request, enable, | ||
76 | disable and free interrupts. The drivers do not have to know anything | ||
77 | about interrupt hardware details, so they can be used on different | ||
78 | platforms without code changes. | ||
79 | </para> | ||
80 | <para> | ||
81 | This documentation is provided to developers who want to implement | ||
82 | an interrupt subsystem based for their architecture, with the help | ||
83 | of the generic IRQ handling layer. | ||
84 | </para> | ||
85 | </chapter> | ||
86 | |||
87 | <chapter id="rationale"> | ||
88 | <title>Rationale</title> | ||
89 | <para> | ||
90 | The original implementation of interrupt handling in Linux uses | ||
91 | the __do_IRQ() super-handler, which is able to deal with every | ||
92 | type of interrupt logic. | ||
93 | </para> | ||
94 | <para> | ||
95 | Originally, Russell King identified different types of handlers to | ||
96 | build a quite universal set for the ARM interrupt handler | ||
97 | implementation in Linux 2.5/2.6. He distinguished between: | ||
98 | <itemizedlist> | ||
99 | <listitem><para>Level type</para></listitem> | ||
100 | <listitem><para>Edge type</para></listitem> | ||
101 | <listitem><para>Simple type</para></listitem> | ||
102 | </itemizedlist> | ||
103 | During the implementation we identified another type: | ||
104 | <itemizedlist> | ||
105 | <listitem><para>Fast EOI type</para></listitem> | ||
106 | </itemizedlist> | ||
107 | In the SMP world of the __do_IRQ() super-handler another type | ||
108 | was identified: | ||
109 | <itemizedlist> | ||
110 | <listitem><para>Per CPU type</para></listitem> | ||
111 | </itemizedlist> | ||
112 | </para> | ||
113 | <para> | ||
114 | This split implementation of high-level IRQ handlers allows us to | ||
115 | optimize the flow of the interrupt handling for each specific | ||
116 | interrupt type. This reduces complexity in that particular code path | ||
117 | and allows the optimized handling of a given type. | ||
118 | </para> | ||
119 | <para> | ||
120 | The original general IRQ implementation used hw_interrupt_type | ||
121 | structures and their ->ack(), ->end() [etc.] callbacks to | ||
122 | differentiate the flow control in the super-handler. This leads to | ||
123 | a mix of flow logic and low-level hardware logic, and it also leads | ||
124 | to unnecessary code duplication: for example in i386, there is an | ||
125 | ioapic_level_irq and an ioapic_edge_irq IRQ-type which share many | ||
126 | of the low-level details but have different flow handling. | ||
127 | </para> | ||
128 | <para> | ||
129 | A more natural abstraction is the clean separation of the | ||
130 | 'irq flow' and the 'chip details'. | ||
131 | </para> | ||
132 | <para> | ||
133 | Analysing a couple of architecture's IRQ subsystem implementations | ||
134 | reveals that most of them can use a generic set of 'irq flow' | ||
135 | methods and only need to add the chip-level specific code. | ||
136 | The separation is also valuable for (sub)architectures | ||
137 | which need specific quirks in the IRQ flow itself but not in the | ||
138 | chip details - and thus provides a more transparent IRQ subsystem | ||
139 | design. | ||
140 | </para> | ||
141 | <para> | ||
142 | Each interrupt descriptor is assigned its own high-level flow | ||
143 | handler, which is normally one of the generic | ||
144 | implementations. (This high-level flow handler implementation also | ||
145 | makes it simple to provide demultiplexing handlers which can be | ||
146 | found in embedded platforms on various architectures.) | ||
147 | </para> | ||
148 | <para> | ||
149 | The separation makes the generic interrupt handling layer more | ||
150 | flexible and extensible. For example, an (sub)architecture can | ||
151 | use a generic IRQ-flow implementation for 'level type' interrupts | ||
152 | and add a (sub)architecture specific 'edge type' implementation. | ||
153 | </para> | ||
154 | <para> | ||
155 | To make the transition to the new model easier and prevent the | ||
156 | breakage of existing implementations, the __do_IRQ() super-handler | ||
157 | is still available. This leads to a kind of duality for the time | ||
158 | being. Over time the new model should be used in more and more | ||
159 | architectures, as it enables smaller and cleaner IRQ subsystems. | ||
160 | It's deprecated for three years now and about to be removed. | ||
161 | </para> | ||
162 | </chapter> | ||
163 | <chapter id="bugs"> | ||
164 | <title>Known Bugs And Assumptions</title> | ||
165 | <para> | ||
166 | None (knock on wood). | ||
167 | </para> | ||
168 | </chapter> | ||
169 | |||
170 | <chapter id="Abstraction"> | ||
171 | <title>Abstraction layers</title> | ||
172 | <para> | ||
173 | There are three main levels of abstraction in the interrupt code: | ||
174 | <orderedlist> | ||
175 | <listitem><para>High-level driver API</para></listitem> | ||
176 | <listitem><para>High-level IRQ flow handlers</para></listitem> | ||
177 | <listitem><para>Chip-level hardware encapsulation</para></listitem> | ||
178 | </orderedlist> | ||
179 | </para> | ||
180 | <sect1 id="Interrupt_control_flow"> | ||
181 | <title>Interrupt control flow</title> | ||
182 | <para> | ||
183 | Each interrupt is described by an interrupt descriptor structure | ||
184 | irq_desc. The interrupt is referenced by an 'unsigned int' numeric | ||
185 | value which selects the corresponding interrupt description structure | ||
186 | in the descriptor structures array. | ||
187 | The descriptor structure contains status information and pointers | ||
188 | to the interrupt flow method and the interrupt chip structure | ||
189 | which are assigned to this interrupt. | ||
190 | </para> | ||
191 | <para> | ||
192 | Whenever an interrupt triggers, the low-level architecture code calls | ||
193 | into the generic interrupt code by calling desc->handle_irq(). | ||
194 | This high-level IRQ handling function only uses desc->irq_data.chip | ||
195 | primitives referenced by the assigned chip descriptor structure. | ||
196 | </para> | ||
197 | </sect1> | ||
198 | <sect1 id="Highlevel_Driver_API"> | ||
199 | <title>High-level Driver API</title> | ||
200 | <para> | ||
201 | The high-level Driver API consists of following functions: | ||
202 | <itemizedlist> | ||
203 | <listitem><para>request_irq()</para></listitem> | ||
204 | <listitem><para>free_irq()</para></listitem> | ||
205 | <listitem><para>disable_irq()</para></listitem> | ||
206 | <listitem><para>enable_irq()</para></listitem> | ||
207 | <listitem><para>disable_irq_nosync() (SMP only)</para></listitem> | ||
208 | <listitem><para>synchronize_irq() (SMP only)</para></listitem> | ||
209 | <listitem><para>irq_set_irq_type()</para></listitem> | ||
210 | <listitem><para>irq_set_irq_wake()</para></listitem> | ||
211 | <listitem><para>irq_set_handler_data()</para></listitem> | ||
212 | <listitem><para>irq_set_chip()</para></listitem> | ||
213 | <listitem><para>irq_set_chip_data()</para></listitem> | ||
214 | </itemizedlist> | ||
215 | See the autogenerated function documentation for details. | ||
216 | </para> | ||
217 | </sect1> | ||
218 | <sect1 id="Highlevel_IRQ_flow_handlers"> | ||
219 | <title>High-level IRQ flow handlers</title> | ||
220 | <para> | ||
221 | The generic layer provides a set of pre-defined irq-flow methods: | ||
222 | <itemizedlist> | ||
223 | <listitem><para>handle_level_irq</para></listitem> | ||
224 | <listitem><para>handle_edge_irq</para></listitem> | ||
225 | <listitem><para>handle_fasteoi_irq</para></listitem> | ||
226 | <listitem><para>handle_simple_irq</para></listitem> | ||
227 | <listitem><para>handle_percpu_irq</para></listitem> | ||
228 | <listitem><para>handle_edge_eoi_irq</para></listitem> | ||
229 | <listitem><para>handle_bad_irq</para></listitem> | ||
230 | </itemizedlist> | ||
231 | The interrupt flow handlers (either pre-defined or architecture | ||
232 | specific) are assigned to specific interrupts by the architecture | ||
233 | either during bootup or during device initialization. | ||
234 | </para> | ||
235 | <sect2 id="Default_flow_implementations"> | ||
236 | <title>Default flow implementations</title> | ||
237 | <sect3 id="Helper_functions"> | ||
238 | <title>Helper functions</title> | ||
239 | <para> | ||
240 | The helper functions call the chip primitives and | ||
241 | are used by the default flow implementations. | ||
242 | The following helper functions are implemented (simplified excerpt): | ||
243 | <programlisting> | ||
244 | default_enable(struct irq_data *data) | ||
245 | { | ||
246 | desc->irq_data.chip->irq_unmask(data); | ||
247 | } | ||
248 | |||
249 | default_disable(struct irq_data *data) | ||
250 | { | ||
251 | if (!delay_disable(data)) | ||
252 | desc->irq_data.chip->irq_mask(data); | ||
253 | } | ||
254 | |||
255 | default_ack(struct irq_data *data) | ||
256 | { | ||
257 | chip->irq_ack(data); | ||
258 | } | ||
259 | |||
260 | default_mask_ack(struct irq_data *data) | ||
261 | { | ||
262 | if (chip->irq_mask_ack) { | ||
263 | chip->irq_mask_ack(data); | ||
264 | } else { | ||
265 | chip->irq_mask(data); | ||
266 | chip->irq_ack(data); | ||
267 | } | ||
268 | } | ||
269 | |||
270 | noop(struct irq_data *data)) | ||
271 | { | ||
272 | } | ||
273 | |||
274 | </programlisting> | ||
275 | </para> | ||
276 | </sect3> | ||
277 | </sect2> | ||
278 | <sect2 id="Default_flow_handler_implementations"> | ||
279 | <title>Default flow handler implementations</title> | ||
280 | <sect3 id="Default_Level_IRQ_flow_handler"> | ||
281 | <title>Default Level IRQ flow handler</title> | ||
282 | <para> | ||
283 | handle_level_irq provides a generic implementation | ||
284 | for level-triggered interrupts. | ||
285 | </para> | ||
286 | <para> | ||
287 | The following control flow is implemented (simplified excerpt): | ||
288 | <programlisting> | ||
289 | desc->irq_data.chip->irq_mask_ack(); | ||
290 | handle_irq_event(desc->action); | ||
291 | desc->irq_data.chip->irq_unmask(); | ||
292 | </programlisting> | ||
293 | </para> | ||
294 | </sect3> | ||
295 | <sect3 id="Default_FASTEOI_IRQ_flow_handler"> | ||
296 | <title>Default Fast EOI IRQ flow handler</title> | ||
297 | <para> | ||
298 | handle_fasteoi_irq provides a generic implementation | ||
299 | for interrupts, which only need an EOI at the end of | ||
300 | the handler. | ||
301 | </para> | ||
302 | <para> | ||
303 | The following control flow is implemented (simplified excerpt): | ||
304 | <programlisting> | ||
305 | handle_irq_event(desc->action); | ||
306 | desc->irq_data.chip->irq_eoi(); | ||
307 | </programlisting> | ||
308 | </para> | ||
309 | </sect3> | ||
310 | <sect3 id="Default_Edge_IRQ_flow_handler"> | ||
311 | <title>Default Edge IRQ flow handler</title> | ||
312 | <para> | ||
313 | handle_edge_irq provides a generic implementation | ||
314 | for edge-triggered interrupts. | ||
315 | </para> | ||
316 | <para> | ||
317 | The following control flow is implemented (simplified excerpt): | ||
318 | <programlisting> | ||
319 | if (desc->status & running) { | ||
320 | desc->irq_data.chip->irq_mask_ack(); | ||
321 | desc->status |= pending | masked; | ||
322 | return; | ||
323 | } | ||
324 | desc->irq_data.chip->irq_ack(); | ||
325 | desc->status |= running; | ||
326 | do { | ||
327 | if (desc->status & masked) | ||
328 | desc->irq_data.chip->irq_unmask(); | ||
329 | desc->status &= ~pending; | ||
330 | handle_irq_event(desc->action); | ||
331 | } while (status & pending); | ||
332 | desc->status &= ~running; | ||
333 | </programlisting> | ||
334 | </para> | ||
335 | </sect3> | ||
336 | <sect3 id="Default_simple_IRQ_flow_handler"> | ||
337 | <title>Default simple IRQ flow handler</title> | ||
338 | <para> | ||
339 | handle_simple_irq provides a generic implementation | ||
340 | for simple interrupts. | ||
341 | </para> | ||
342 | <para> | ||
343 | Note: The simple flow handler does not call any | ||
344 | handler/chip primitives. | ||
345 | </para> | ||
346 | <para> | ||
347 | The following control flow is implemented (simplified excerpt): | ||
348 | <programlisting> | ||
349 | handle_irq_event(desc->action); | ||
350 | </programlisting> | ||
351 | </para> | ||
352 | </sect3> | ||
353 | <sect3 id="Default_per_CPU_flow_handler"> | ||
354 | <title>Default per CPU flow handler</title> | ||
355 | <para> | ||
356 | handle_percpu_irq provides a generic implementation | ||
357 | for per CPU interrupts. | ||
358 | </para> | ||
359 | <para> | ||
360 | Per CPU interrupts are only available on SMP and | ||
361 | the handler provides a simplified version without | ||
362 | locking. | ||
363 | </para> | ||
364 | <para> | ||
365 | The following control flow is implemented (simplified excerpt): | ||
366 | <programlisting> | ||
367 | if (desc->irq_data.chip->irq_ack) | ||
368 | desc->irq_data.chip->irq_ack(); | ||
369 | handle_irq_event(desc->action); | ||
370 | if (desc->irq_data.chip->irq_eoi) | ||
371 | desc->irq_data.chip->irq_eoi(); | ||
372 | </programlisting> | ||
373 | </para> | ||
374 | </sect3> | ||
375 | <sect3 id="EOI_Edge_IRQ_flow_handler"> | ||
376 | <title>EOI Edge IRQ flow handler</title> | ||
377 | <para> | ||
378 | handle_edge_eoi_irq provides an abnomination of the edge | ||
379 | handler which is solely used to tame a badly wreckaged | ||
380 | irq controller on powerpc/cell. | ||
381 | </para> | ||
382 | </sect3> | ||
383 | <sect3 id="BAD_IRQ_flow_handler"> | ||
384 | <title>Bad IRQ flow handler</title> | ||
385 | <para> | ||
386 | handle_bad_irq is used for spurious interrupts which | ||
387 | have no real handler assigned.. | ||
388 | </para> | ||
389 | </sect3> | ||
390 | </sect2> | ||
391 | <sect2 id="Quirks_and_optimizations"> | ||
392 | <title>Quirks and optimizations</title> | ||
393 | <para> | ||
394 | The generic functions are intended for 'clean' architectures and chips, | ||
395 | which have no platform-specific IRQ handling quirks. If an architecture | ||
396 | needs to implement quirks on the 'flow' level then it can do so by | ||
397 | overriding the high-level irq-flow handler. | ||
398 | </para> | ||
399 | </sect2> | ||
400 | <sect2 id="Delayed_interrupt_disable"> | ||
401 | <title>Delayed interrupt disable</title> | ||
402 | <para> | ||
403 | This per interrupt selectable feature, which was introduced by Russell | ||
404 | King in the ARM interrupt implementation, does not mask an interrupt | ||
405 | at the hardware level when disable_irq() is called. The interrupt is | ||
406 | kept enabled and is masked in the flow handler when an interrupt event | ||
407 | happens. This prevents losing edge interrupts on hardware which does | ||
408 | not store an edge interrupt event while the interrupt is disabled at | ||
409 | the hardware level. When an interrupt arrives while the IRQ_DISABLED | ||
410 | flag is set, then the interrupt is masked at the hardware level and | ||
411 | the IRQ_PENDING bit is set. When the interrupt is re-enabled by | ||
412 | enable_irq() the pending bit is checked and if it is set, the | ||
413 | interrupt is resent either via hardware or by a software resend | ||
414 | mechanism. (It's necessary to enable CONFIG_HARDIRQS_SW_RESEND when | ||
415 | you want to use the delayed interrupt disable feature and your | ||
416 | hardware is not capable of retriggering an interrupt.) | ||
417 | The delayed interrupt disable is not configurable. | ||
418 | </para> | ||
419 | </sect2> | ||
420 | </sect1> | ||
421 | <sect1 id="Chiplevel_hardware_encapsulation"> | ||
422 | <title>Chip-level hardware encapsulation</title> | ||
423 | <para> | ||
424 | The chip-level hardware descriptor structure irq_chip | ||
425 | contains all the direct chip relevant functions, which | ||
426 | can be utilized by the irq flow implementations. | ||
427 | <itemizedlist> | ||
428 | <listitem><para>irq_ack()</para></listitem> | ||
429 | <listitem><para>irq_mask_ack() - Optional, recommended for performance</para></listitem> | ||
430 | <listitem><para>irq_mask()</para></listitem> | ||
431 | <listitem><para>irq_unmask()</para></listitem> | ||
432 | <listitem><para>irq_eoi() - Optional, required for EOI flow handlers</para></listitem> | ||
433 | <listitem><para>irq_retrigger() - Optional</para></listitem> | ||
434 | <listitem><para>irq_set_type() - Optional</para></listitem> | ||
435 | <listitem><para>irq_set_wake() - Optional</para></listitem> | ||
436 | </itemizedlist> | ||
437 | These primitives are strictly intended to mean what they say: ack means | ||
438 | ACK, masking means masking of an IRQ line, etc. It is up to the flow | ||
439 | handler(s) to use these basic units of low-level functionality. | ||
440 | </para> | ||
441 | </sect1> | ||
442 | </chapter> | ||
443 | |||
444 | <chapter id="doirq"> | ||
445 | <title>__do_IRQ entry point</title> | ||
446 | <para> | ||
447 | The original implementation __do_IRQ() was an alternative entry | ||
448 | point for all types of interrupts. It no longer exists. | ||
449 | </para> | ||
450 | <para> | ||
451 | This handler turned out to be not suitable for all | ||
452 | interrupt hardware and was therefore reimplemented with split | ||
453 | functionality for edge/level/simple/percpu interrupts. This is not | ||
454 | only a functional optimization. It also shortens code paths for | ||
455 | interrupts. | ||
456 | </para> | ||
457 | </chapter> | ||
458 | |||
459 | <chapter id="locking"> | ||
460 | <title>Locking on SMP</title> | ||
461 | <para> | ||
462 | The locking of chip registers is up to the architecture that | ||
463 | defines the chip primitives. The per-irq structure is | ||
464 | protected via desc->lock, by the generic layer. | ||
465 | </para> | ||
466 | </chapter> | ||
467 | |||
468 | <chapter id="genericchip"> | ||
469 | <title>Generic interrupt chip</title> | ||
470 | <para> | ||
471 | To avoid copies of identical implementations of IRQ chips the | ||
472 | core provides a configurable generic interrupt chip | ||
473 | implementation. Developers should check carefully whether the | ||
474 | generic chip fits their needs before implementing the same | ||
475 | functionality slightly differently themselves. | ||
476 | </para> | ||
477 | !Ekernel/irq/generic-chip.c | ||
478 | </chapter> | ||
479 | |||
480 | <chapter id="structs"> | ||
481 | <title>Structures</title> | ||
482 | <para> | ||
483 | This chapter contains the autogenerated documentation of the structures which are | ||
484 | used in the generic IRQ layer. | ||
485 | </para> | ||
486 | !Iinclude/linux/irq.h | ||
487 | !Iinclude/linux/interrupt.h | ||
488 | </chapter> | ||
489 | |||
490 | <chapter id="pubfunctions"> | ||
491 | <title>Public Functions Provided</title> | ||
492 | <para> | ||
493 | This chapter contains the autogenerated documentation of the kernel API functions | ||
494 | which are exported. | ||
495 | </para> | ||
496 | !Ekernel/irq/manage.c | ||
497 | !Ekernel/irq/chip.c | ||
498 | </chapter> | ||
499 | |||
500 | <chapter id="intfunctions"> | ||
501 | <title>Internal Functions Provided</title> | ||
502 | <para> | ||
503 | This chapter contains the autogenerated documentation of the internal functions. | ||
504 | </para> | ||
505 | !Ikernel/irq/irqdesc.c | ||
506 | !Ikernel/irq/handle.c | ||
507 | !Ikernel/irq/chip.c | ||
508 | </chapter> | ||
509 | |||
510 | <chapter id="credits"> | ||
511 | <title>Credits</title> | ||
512 | <para> | ||
513 | The following people have contributed to this document: | ||
514 | <orderedlist> | ||
515 | <listitem><para>Thomas Gleixner<email>tglx@linutronix.de</email></para></listitem> | ||
516 | <listitem><para>Ingo Molnar<email>mingo@elte.hu</email></para></listitem> | ||
517 | </orderedlist> | ||
518 | </para> | ||
519 | </chapter> | ||
520 | </book> | ||
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl deleted file mode 100644 index ecfd0ea40661..000000000000 --- a/Documentation/DocBook/kernel-api.tmpl +++ /dev/null | |||
@@ -1,331 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | ||
4 | |||
5 | <book id="LinuxKernelAPI"> | ||
6 | <bookinfo> | ||
7 | <title>The Linux Kernel API</title> | ||
8 | |||
9 | <legalnotice> | ||
10 | <para> | ||
11 | This documentation is free software; you can redistribute | ||
12 | it and/or modify it under the terms of the GNU General Public | ||
13 | License as published by the Free Software Foundation; either | ||
14 | version 2 of the License, or (at your option) any later | ||
15 | version. | ||
16 | </para> | ||
17 | |||
18 | <para> | ||
19 | This program is distributed in the hope that it will be | ||
20 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
21 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
22 | See the GNU General Public License for more details. | ||
23 | </para> | ||
24 | |||
25 | <para> | ||
26 | You should have received a copy of the GNU General Public | ||
27 | License along with this program; if not, write to the Free | ||
28 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
29 | MA 02111-1307 USA | ||
30 | </para> | ||
31 | |||
32 | <para> | ||
33 | For more details see the file COPYING in the source | ||
34 | distribution of Linux. | ||
35 | </para> | ||
36 | </legalnotice> | ||
37 | </bookinfo> | ||
38 | |||
39 | <toc></toc> | ||
40 | |||
41 | <chapter id="adt"> | ||
42 | <title>Data Types</title> | ||
43 | <sect1><title>Doubly Linked Lists</title> | ||
44 | !Iinclude/linux/list.h | ||
45 | </sect1> | ||
46 | </chapter> | ||
47 | |||
48 | <chapter id="libc"> | ||
49 | <title>Basic C Library Functions</title> | ||
50 | |||
51 | <para> | ||
52 | When writing drivers, you cannot in general use routines which are | ||
53 | from the C Library. Some of the functions have been found generally | ||
54 | useful and they are listed below. The behaviour of these functions | ||
55 | may vary slightly from those defined by ANSI, and these deviations | ||
56 | are noted in the text. | ||
57 | </para> | ||
58 | |||
59 | <sect1><title>String Conversions</title> | ||
60 | !Elib/vsprintf.c | ||
61 | !Finclude/linux/kernel.h kstrtol | ||
62 | !Finclude/linux/kernel.h kstrtoul | ||
63 | !Elib/kstrtox.c | ||
64 | </sect1> | ||
65 | <sect1><title>String Manipulation</title> | ||
66 | <!-- All functions are exported at now | ||
67 | X!Ilib/string.c | ||
68 | --> | ||
69 | !Elib/string.c | ||
70 | </sect1> | ||
71 | <sect1><title>Bit Operations</title> | ||
72 | !Iarch/x86/include/asm/bitops.h | ||
73 | </sect1> | ||
74 | </chapter> | ||
75 | |||
76 | <chapter id="kernel-lib"> | ||
77 | <title>Basic Kernel Library Functions</title> | ||
78 | |||
79 | <para> | ||
80 | The Linux kernel provides more basic utility functions. | ||
81 | </para> | ||
82 | |||
83 | <sect1><title>Bitmap Operations</title> | ||
84 | !Elib/bitmap.c | ||
85 | !Ilib/bitmap.c | ||
86 | </sect1> | ||
87 | |||
88 | <sect1><title>Command-line Parsing</title> | ||
89 | !Elib/cmdline.c | ||
90 | </sect1> | ||
91 | |||
92 | <sect1 id="crc"><title>CRC Functions</title> | ||
93 | !Elib/crc7.c | ||
94 | !Elib/crc16.c | ||
95 | !Elib/crc-itu-t.c | ||
96 | !Elib/crc32.c | ||
97 | !Elib/crc-ccitt.c | ||
98 | </sect1> | ||
99 | |||
100 | <sect1 id="idr"><title>idr/ida Functions</title> | ||
101 | !Pinclude/linux/idr.h idr sync | ||
102 | !Plib/idr.c IDA description | ||
103 | !Elib/idr.c | ||
104 | </sect1> | ||
105 | </chapter> | ||
106 | |||
107 | <chapter id="mm"> | ||
108 | <title>Memory Management in Linux</title> | ||
109 | <sect1><title>The Slab Cache</title> | ||
110 | !Iinclude/linux/slab.h | ||
111 | !Emm/slab.c | ||
112 | !Emm/util.c | ||
113 | </sect1> | ||
114 | <sect1><title>User Space Memory Access</title> | ||
115 | !Iarch/x86/include/asm/uaccess_32.h | ||
116 | !Earch/x86/lib/usercopy_32.c | ||
117 | </sect1> | ||
118 | <sect1><title>More Memory Management Functions</title> | ||
119 | !Emm/readahead.c | ||
120 | !Emm/filemap.c | ||
121 | !Emm/memory.c | ||
122 | !Emm/vmalloc.c | ||
123 | !Imm/page_alloc.c | ||
124 | !Emm/mempool.c | ||
125 | !Emm/dmapool.c | ||
126 | !Emm/page-writeback.c | ||
127 | !Emm/truncate.c | ||
128 | </sect1> | ||
129 | </chapter> | ||
130 | |||
131 | |||
132 | <chapter id="ipc"> | ||
133 | <title>Kernel IPC facilities</title> | ||
134 | |||
135 | <sect1><title>IPC utilities</title> | ||
136 | !Iipc/util.c | ||
137 | </sect1> | ||
138 | </chapter> | ||
139 | |||
140 | <chapter id="kfifo"> | ||
141 | <title>FIFO Buffer</title> | ||
142 | <sect1><title>kfifo interface</title> | ||
143 | !Iinclude/linux/kfifo.h | ||
144 | </sect1> | ||
145 | </chapter> | ||
146 | |||
147 | <chapter id="relayfs"> | ||
148 | <title>relay interface support</title> | ||
149 | |||
150 | <para> | ||
151 | Relay interface support | ||
152 | is designed to provide an efficient mechanism for tools and | ||
153 | facilities to relay large amounts of data from kernel space to | ||
154 | user space. | ||
155 | </para> | ||
156 | |||
157 | <sect1><title>relay interface</title> | ||
158 | !Ekernel/relay.c | ||
159 | !Ikernel/relay.c | ||
160 | </sect1> | ||
161 | </chapter> | ||
162 | |||
163 | <chapter id="modload"> | ||
164 | <title>Module Support</title> | ||
165 | <sect1><title>Module Loading</title> | ||
166 | !Ekernel/kmod.c | ||
167 | </sect1> | ||
168 | <sect1><title>Inter Module support</title> | ||
169 | <para> | ||
170 | Refer to the file kernel/module.c for more information. | ||
171 | </para> | ||
172 | <!-- FIXME: Removed for now since no structured comments in source | ||
173 | X!Ekernel/module.c | ||
174 | --> | ||
175 | </sect1> | ||
176 | </chapter> | ||
177 | |||
178 | <chapter id="hardware"> | ||
179 | <title>Hardware Interfaces</title> | ||
180 | <sect1><title>Interrupt Handling</title> | ||
181 | !Ekernel/irq/manage.c | ||
182 | </sect1> | ||
183 | |||
184 | <sect1><title>DMA Channels</title> | ||
185 | !Ekernel/dma.c | ||
186 | </sect1> | ||
187 | |||
188 | <sect1><title>Resources Management</title> | ||
189 | !Ikernel/resource.c | ||
190 | !Ekernel/resource.c | ||
191 | </sect1> | ||
192 | |||
193 | <sect1><title>MTRR Handling</title> | ||
194 | !Earch/x86/kernel/cpu/mtrr/main.c | ||
195 | </sect1> | ||
196 | |||
197 | <sect1><title>PCI Support Library</title> | ||
198 | !Edrivers/pci/pci.c | ||
199 | !Edrivers/pci/pci-driver.c | ||
200 | !Edrivers/pci/remove.c | ||
201 | !Edrivers/pci/search.c | ||
202 | !Edrivers/pci/msi.c | ||
203 | !Edrivers/pci/bus.c | ||
204 | !Edrivers/pci/access.c | ||
205 | !Edrivers/pci/irq.c | ||
206 | !Edrivers/pci/htirq.c | ||
207 | <!-- FIXME: Removed for now since no structured comments in source | ||
208 | X!Edrivers/pci/hotplug.c | ||
209 | --> | ||
210 | !Edrivers/pci/probe.c | ||
211 | !Edrivers/pci/slot.c | ||
212 | !Edrivers/pci/rom.c | ||
213 | !Edrivers/pci/iov.c | ||
214 | !Idrivers/pci/pci-sysfs.c | ||
215 | </sect1> | ||
216 | <sect1><title>PCI Hotplug Support Library</title> | ||
217 | !Edrivers/pci/hotplug/pci_hotplug_core.c | ||
218 | </sect1> | ||
219 | </chapter> | ||
220 | |||
221 | <chapter id="firmware"> | ||
222 | <title>Firmware Interfaces</title> | ||
223 | <sect1><title>DMI Interfaces</title> | ||
224 | !Edrivers/firmware/dmi_scan.c | ||
225 | </sect1> | ||
226 | <sect1><title>EDD Interfaces</title> | ||
227 | !Idrivers/firmware/edd.c | ||
228 | </sect1> | ||
229 | </chapter> | ||
230 | |||
231 | <chapter id="security"> | ||
232 | <title>Security Framework</title> | ||
233 | !Isecurity/security.c | ||
234 | !Esecurity/inode.c | ||
235 | </chapter> | ||
236 | |||
237 | <chapter id="audit"> | ||
238 | <title>Audit Interfaces</title> | ||
239 | !Ekernel/audit.c | ||
240 | !Ikernel/auditsc.c | ||
241 | !Ikernel/auditfilter.c | ||
242 | </chapter> | ||
243 | |||
244 | <chapter id="accounting"> | ||
245 | <title>Accounting Framework</title> | ||
246 | !Ikernel/acct.c | ||
247 | </chapter> | ||
248 | |||
249 | <chapter id="blkdev"> | ||
250 | <title>Block Devices</title> | ||
251 | !Eblock/blk-core.c | ||
252 | !Iblock/blk-core.c | ||
253 | !Eblock/blk-map.c | ||
254 | !Iblock/blk-sysfs.c | ||
255 | !Eblock/blk-settings.c | ||
256 | !Eblock/blk-exec.c | ||
257 | !Eblock/blk-flush.c | ||
258 | !Eblock/blk-lib.c | ||
259 | !Eblock/blk-tag.c | ||
260 | !Iblock/blk-tag.c | ||
261 | !Eblock/blk-integrity.c | ||
262 | !Ikernel/trace/blktrace.c | ||
263 | !Iblock/genhd.c | ||
264 | !Eblock/genhd.c | ||
265 | </chapter> | ||
266 | |||
267 | <chapter id="chrdev"> | ||
268 | <title>Char devices</title> | ||
269 | !Efs/char_dev.c | ||
270 | </chapter> | ||
271 | |||
272 | <chapter id="miscdev"> | ||
273 | <title>Miscellaneous Devices</title> | ||
274 | !Edrivers/char/misc.c | ||
275 | </chapter> | ||
276 | |||
277 | <chapter id="clk"> | ||
278 | <title>Clock Framework</title> | ||
279 | |||
280 | <para> | ||
281 | The clock framework defines programming interfaces to support | ||
282 | software management of the system clock tree. | ||
283 | This framework is widely used with System-On-Chip (SOC) platforms | ||
284 | to support power management and various devices which may need | ||
285 | custom clock rates. | ||
286 | Note that these "clocks" don't relate to timekeeping or real | ||
287 | time clocks (RTCs), each of which have separate frameworks. | ||
288 | These <structname>struct clk</structname> instances may be used | ||
289 | to manage for example a 96 MHz signal that is used to shift bits | ||
290 | into and out of peripherals or busses, or otherwise trigger | ||
291 | synchronous state machine transitions in system hardware. | ||
292 | </para> | ||
293 | |||
294 | <para> | ||
295 | Power management is supported by explicit software clock gating: | ||
296 | unused clocks are disabled, so the system doesn't waste power | ||
297 | changing the state of transistors that aren't in active use. | ||
298 | On some systems this may be backed by hardware clock gating, | ||
299 | where clocks are gated without being disabled in software. | ||
300 | Sections of chips that are powered but not clocked may be able | ||
301 | to retain their last state. | ||
302 | This low power state is often called a <emphasis>retention | ||
303 | mode</emphasis>. | ||
304 | This mode still incurs leakage currents, especially with finer | ||
305 | circuit geometries, but for CMOS circuits power is mostly used | ||
306 | by clocked state changes. | ||
307 | </para> | ||
308 | |||
309 | <para> | ||
310 | Power-aware drivers only enable their clocks when the device | ||
311 | they manage is in active use. Also, system sleep states often | ||
312 | differ according to which clock domains are active: while a | ||
313 | "standby" state may allow wakeup from several active domains, a | ||
314 | "mem" (suspend-to-RAM) state may require a more wholesale shutdown | ||
315 | of clocks derived from higher speed PLLs and oscillators, limiting | ||
316 | the number of possible wakeup event sources. A driver's suspend | ||
317 | method may need to be aware of system-specific clock constraints | ||
318 | on the target sleep state. | ||
319 | </para> | ||
320 | |||
321 | <para> | ||
322 | Some platforms support programmable clock generators. These | ||
323 | can be used by external chips of various kinds, such as other | ||
324 | CPUs, multimedia codecs, and devices with strict requirements | ||
325 | for interface clocking. | ||
326 | </para> | ||
327 | |||
328 | !Iinclude/linux/clk.h | ||
329 | </chapter> | ||
330 | |||
331 | </book> | ||
diff --git a/Documentation/DocBook/writing_musb_glue_layer.tmpl b/Documentation/DocBook/writing_musb_glue_layer.tmpl deleted file mode 100644 index 837eca77f274..000000000000 --- a/Documentation/DocBook/writing_musb_glue_layer.tmpl +++ /dev/null | |||
@@ -1,873 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | ||
4 | |||
5 | <book id="Writing-MUSB-Glue-Layer"> | ||
6 | <bookinfo> | ||
7 | <title>Writing an MUSB Glue Layer</title> | ||
8 | |||
9 | <authorgroup> | ||
10 | <author> | ||
11 | <firstname>Apelete</firstname> | ||
12 | <surname>Seketeli</surname> | ||
13 | <affiliation> | ||
14 | <address> | ||
15 | <email>apelete at seketeli.net</email> | ||
16 | </address> | ||
17 | </affiliation> | ||
18 | </author> | ||
19 | </authorgroup> | ||
20 | |||
21 | <copyright> | ||
22 | <year>2014</year> | ||
23 | <holder>Apelete Seketeli</holder> | ||
24 | </copyright> | ||
25 | |||
26 | <legalnotice> | ||
27 | <para> | ||
28 | This documentation is free software; you can redistribute it | ||
29 | and/or modify it under the terms of the GNU General Public | ||
30 | License as published by the Free Software Foundation; either | ||
31 | version 2 of the License, or (at your option) any later version. | ||
32 | </para> | ||
33 | |||
34 | <para> | ||
35 | This documentation is distributed in the hope that it will be | ||
36 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
37 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
38 | See the GNU General Public License for more details. | ||
39 | </para> | ||
40 | |||
41 | <para> | ||
42 | You should have received a copy of the GNU General Public License | ||
43 | along with this documentation; if not, write to the Free Software | ||
44 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
45 | 02111-1307 USA | ||
46 | </para> | ||
47 | |||
48 | <para> | ||
49 | For more details see the file COPYING in the Linux kernel source | ||
50 | tree. | ||
51 | </para> | ||
52 | </legalnotice> | ||
53 | </bookinfo> | ||
54 | |||
55 | <toc></toc> | ||
56 | |||
57 | <chapter id="introduction"> | ||
58 | <title>Introduction</title> | ||
59 | <para> | ||
60 | The Linux MUSB subsystem is part of the larger Linux USB | ||
61 | subsystem. It provides support for embedded USB Device Controllers | ||
62 | (UDC) that do not use Universal Host Controller Interface (UHCI) | ||
63 | or Open Host Controller Interface (OHCI). | ||
64 | </para> | ||
65 | <para> | ||
66 | Instead, these embedded UDC rely on the USB On-the-Go (OTG) | ||
67 | specification which they implement at least partially. The silicon | ||
68 | reference design used in most cases is the Multipoint USB | ||
69 | Highspeed Dual-Role Controller (MUSB HDRC) found in the Mentor | ||
70 | Graphics Inventraâ„¢ design. | ||
71 | </para> | ||
72 | <para> | ||
73 | As a self-taught exercise I have written an MUSB glue layer for | ||
74 | the Ingenic JZ4740 SoC, modelled after the many MUSB glue layers | ||
75 | in the kernel source tree. This layer can be found at | ||
76 | drivers/usb/musb/jz4740.c. In this documentation I will walk | ||
77 | through the basics of the jz4740.c glue layer, explaining the | ||
78 | different pieces and what needs to be done in order to write your | ||
79 | own device glue layer. | ||
80 | </para> | ||
81 | </chapter> | ||
82 | |||
83 | <chapter id="linux-musb-basics"> | ||
84 | <title>Linux MUSB Basics</title> | ||
85 | <para> | ||
86 | To get started on the topic, please read USB On-the-Go Basics (see | ||
87 | Resources) which provides an introduction of USB OTG operation at | ||
88 | the hardware level. A couple of wiki pages by Texas Instruments | ||
89 | and Analog Devices also provide an overview of the Linux kernel | ||
90 | MUSB configuration, albeit focused on some specific devices | ||
91 | provided by these companies. Finally, getting acquainted with the | ||
92 | USB specification at USB home page may come in handy, with | ||
93 | practical instance provided through the Writing USB Device Drivers | ||
94 | documentation (again, see Resources). | ||
95 | </para> | ||
96 | <para> | ||
97 | Linux USB stack is a layered architecture in which the MUSB | ||
98 | controller hardware sits at the lowest. The MUSB controller driver | ||
99 | abstract the MUSB controller hardware to the Linux USB stack. | ||
100 | </para> | ||
101 | <programlisting> | ||
102 | ------------------------ | ||
103 | | | <------- drivers/usb/gadget | ||
104 | | Linux USB Core Stack | <------- drivers/usb/host | ||
105 | | | <------- drivers/usb/core | ||
106 | ------------------------ | ||
107 | ⬠| ||
108 | -------------------------- | ||
109 | | | <------ drivers/usb/musb/musb_gadget.c | ||
110 | | MUSB Controller driver | <------ drivers/usb/musb/musb_host.c | ||
111 | | | <------ drivers/usb/musb/musb_core.c | ||
112 | -------------------------- | ||
113 | ⬠| ||
114 | --------------------------------- | ||
115 | | MUSB Platform Specific Driver | | ||
116 | | | <-- drivers/usb/musb/jz4740.c | ||
117 | | aka "Glue Layer" | | ||
118 | --------------------------------- | ||
119 | ⬠| ||
120 | --------------------------------- | ||
121 | | MUSB Controller Hardware | | ||
122 | --------------------------------- | ||
123 | </programlisting> | ||
124 | <para> | ||
125 | As outlined above, the glue layer is actually the platform | ||
126 | specific code sitting in between the controller driver and the | ||
127 | controller hardware. | ||
128 | </para> | ||
129 | <para> | ||
130 | Just like a Linux USB driver needs to register itself with the | ||
131 | Linux USB subsystem, the MUSB glue layer needs first to register | ||
132 | itself with the MUSB controller driver. This will allow the | ||
133 | controller driver to know about which device the glue layer | ||
134 | supports and which functions to call when a supported device is | ||
135 | detected or released; remember we are talking about an embedded | ||
136 | controller chip here, so no insertion or removal at run-time. | ||
137 | </para> | ||
138 | <para> | ||
139 | All of this information is passed to the MUSB controller driver | ||
140 | through a platform_driver structure defined in the glue layer as: | ||
141 | </para> | ||
142 | <programlisting linenumbering="numbered"> | ||
143 | static struct platform_driver jz4740_driver = { | ||
144 | .probe = jz4740_probe, | ||
145 | .remove = jz4740_remove, | ||
146 | .driver = { | ||
147 | .name = "musb-jz4740", | ||
148 | }, | ||
149 | }; | ||
150 | </programlisting> | ||
151 | <para> | ||
152 | The probe and remove function pointers are called when a matching | ||
153 | device is detected and, respectively, released. The name string | ||
154 | describes the device supported by this glue layer. In the current | ||
155 | case it matches a platform_device structure declared in | ||
156 | arch/mips/jz4740/platform.c. Note that we are not using device | ||
157 | tree bindings here. | ||
158 | </para> | ||
159 | <para> | ||
160 | In order to register itself to the controller driver, the glue | ||
161 | layer goes through a few steps, basically allocating the | ||
162 | controller hardware resources and initialising a couple of | ||
163 | circuits. To do so, it needs to keep track of the information used | ||
164 | throughout these steps. This is done by defining a private | ||
165 | jz4740_glue structure: | ||
166 | </para> | ||
167 | <programlisting linenumbering="numbered"> | ||
168 | struct jz4740_glue { | ||
169 | struct device *dev; | ||
170 | struct platform_device *musb; | ||
171 | struct clk *clk; | ||
172 | }; | ||
173 | </programlisting> | ||
174 | <para> | ||
175 | The dev and musb members are both device structure variables. The | ||
176 | first one holds generic information about the device, since it's | ||
177 | the basic device structure, and the latter holds information more | ||
178 | closely related to the subsystem the device is registered to. The | ||
179 | clk variable keeps information related to the device clock | ||
180 | operation. | ||
181 | </para> | ||
182 | <para> | ||
183 | Let's go through the steps of the probe function that leads the | ||
184 | glue layer to register itself to the controller driver. | ||
185 | </para> | ||
186 | <para> | ||
187 | N.B.: For the sake of readability each function will be split in | ||
188 | logical parts, each part being shown as if it was independent from | ||
189 | the others. | ||
190 | </para> | ||
191 | <programlisting linenumbering="numbered"> | ||
192 | static int jz4740_probe(struct platform_device *pdev) | ||
193 | { | ||
194 | struct platform_device *musb; | ||
195 | struct jz4740_glue *glue; | ||
196 | struct clk *clk; | ||
197 | int ret; | ||
198 | |||
199 | glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); | ||
200 | if (!glue) | ||
201 | return -ENOMEM; | ||
202 | |||
203 | musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); | ||
204 | if (!musb) { | ||
205 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
206 | return -ENOMEM; | ||
207 | } | ||
208 | |||
209 | clk = devm_clk_get(&pdev->dev, "udc"); | ||
210 | if (IS_ERR(clk)) { | ||
211 | dev_err(&pdev->dev, "failed to get clock\n"); | ||
212 | ret = PTR_ERR(clk); | ||
213 | goto err_platform_device_put; | ||
214 | } | ||
215 | |||
216 | ret = clk_prepare_enable(clk); | ||
217 | if (ret) { | ||
218 | dev_err(&pdev->dev, "failed to enable clock\n"); | ||
219 | goto err_platform_device_put; | ||
220 | } | ||
221 | |||
222 | musb->dev.parent = &pdev->dev; | ||
223 | |||
224 | glue->dev = &pdev->dev; | ||
225 | glue->musb = musb; | ||
226 | glue->clk = clk; | ||
227 | |||
228 | return 0; | ||
229 | |||
230 | err_platform_device_put: | ||
231 | platform_device_put(musb); | ||
232 | return ret; | ||
233 | } | ||
234 | </programlisting> | ||
235 | <para> | ||
236 | The first few lines of the probe function allocate and assign the | ||
237 | glue, musb and clk variables. The GFP_KERNEL flag (line 8) allows | ||
238 | the allocation process to sleep and wait for memory, thus being | ||
239 | usable in a blocking situation. The PLATFORM_DEVID_AUTO flag (line | ||
240 | 12) allows automatic allocation and management of device IDs in | ||
241 | order to avoid device namespace collisions with explicit IDs. With | ||
242 | devm_clk_get() (line 18) the glue layer allocates the clock -- the | ||
243 | <literal>devm_</literal> prefix indicates that clk_get() is | ||
244 | managed: it automatically frees the allocated clock resource data | ||
245 | when the device is released -- and enable it. | ||
246 | </para> | ||
247 | <para> | ||
248 | Then comes the registration steps: | ||
249 | </para> | ||
250 | <programlisting linenumbering="numbered"> | ||
251 | static int jz4740_probe(struct platform_device *pdev) | ||
252 | { | ||
253 | struct musb_hdrc_platform_data *pdata = &jz4740_musb_platform_data; | ||
254 | |||
255 | pdata->platform_ops = &jz4740_musb_ops; | ||
256 | |||
257 | platform_set_drvdata(pdev, glue); | ||
258 | |||
259 | ret = platform_device_add_resources(musb, pdev->resource, | ||
260 | pdev->num_resources); | ||
261 | if (ret) { | ||
262 | dev_err(&pdev->dev, "failed to add resources\n"); | ||
263 | goto err_clk_disable; | ||
264 | } | ||
265 | |||
266 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | ||
267 | if (ret) { | ||
268 | dev_err(&pdev->dev, "failed to add platform_data\n"); | ||
269 | goto err_clk_disable; | ||
270 | } | ||
271 | |||
272 | return 0; | ||
273 | |||
274 | err_clk_disable: | ||
275 | clk_disable_unprepare(clk); | ||
276 | err_platform_device_put: | ||
277 | platform_device_put(musb); | ||
278 | return ret; | ||
279 | } | ||
280 | </programlisting> | ||
281 | <para> | ||
282 | The first step is to pass the device data privately held by the | ||
283 | glue layer on to the controller driver through | ||
284 | platform_set_drvdata() (line 7). Next is passing on the device | ||
285 | resources information, also privately held at that point, through | ||
286 | platform_device_add_resources() (line 9). | ||
287 | </para> | ||
288 | <para> | ||
289 | Finally comes passing on the platform specific data to the | ||
290 | controller driver (line 16). Platform data will be discussed in | ||
291 | <link linkend="device-platform-data">Chapter 4</link>, but here | ||
292 | we are looking at the platform_ops function pointer (line 5) in | ||
293 | musb_hdrc_platform_data structure (line 3). This function | ||
294 | pointer allows the MUSB controller driver to know which function | ||
295 | to call for device operation: | ||
296 | </para> | ||
297 | <programlisting linenumbering="numbered"> | ||
298 | static const struct musb_platform_ops jz4740_musb_ops = { | ||
299 | .init = jz4740_musb_init, | ||
300 | .exit = jz4740_musb_exit, | ||
301 | }; | ||
302 | </programlisting> | ||
303 | <para> | ||
304 | Here we have the minimal case where only init and exit functions | ||
305 | are called by the controller driver when needed. Fact is the | ||
306 | JZ4740 MUSB controller is a basic controller, lacking some | ||
307 | features found in other controllers, otherwise we may also have | ||
308 | pointers to a few other functions like a power management function | ||
309 | or a function to switch between OTG and non-OTG modes, for | ||
310 | instance. | ||
311 | </para> | ||
312 | <para> | ||
313 | At that point of the registration process, the controller driver | ||
314 | actually calls the init function: | ||
315 | </para> | ||
316 | <programlisting linenumbering="numbered"> | ||
317 | static int jz4740_musb_init(struct musb *musb) | ||
318 | { | ||
319 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | ||
320 | if (!musb->xceiv) { | ||
321 | pr_err("HS UDC: no transceiver configured\n"); | ||
322 | return -ENODEV; | ||
323 | } | ||
324 | |||
325 | /* Silicon does not implement ConfigData register. | ||
326 | * Set dyn_fifo to avoid reading EP config from hardware. | ||
327 | */ | ||
328 | musb->dyn_fifo = true; | ||
329 | |||
330 | musb->isr = jz4740_musb_interrupt; | ||
331 | |||
332 | return 0; | ||
333 | } | ||
334 | </programlisting> | ||
335 | <para> | ||
336 | The goal of jz4740_musb_init() is to get hold of the transceiver | ||
337 | driver data of the MUSB controller hardware and pass it on to the | ||
338 | MUSB controller driver, as usual. The transceiver is the circuitry | ||
339 | inside the controller hardware responsible for sending/receiving | ||
340 | the USB data. Since it is an implementation of the physical layer | ||
341 | of the OSI model, the transceiver is also referred to as PHY. | ||
342 | </para> | ||
343 | <para> | ||
344 | Getting hold of the MUSB PHY driver data is done with | ||
345 | usb_get_phy() which returns a pointer to the structure | ||
346 | containing the driver instance data. The next couple of | ||
347 | instructions (line 12 and 14) are used as a quirk and to setup | ||
348 | IRQ handling respectively. Quirks and IRQ handling will be | ||
349 | discussed later in <link linkend="device-quirks">Chapter | ||
350 | 5</link> and <link linkend="handling-irqs">Chapter 3</link>. | ||
351 | </para> | ||
352 | <programlisting linenumbering="numbered"> | ||
353 | static int jz4740_musb_exit(struct musb *musb) | ||
354 | { | ||
355 | usb_put_phy(musb->xceiv); | ||
356 | |||
357 | return 0; | ||
358 | } | ||
359 | </programlisting> | ||
360 | <para> | ||
361 | Acting as the counterpart of init, the exit function releases the | ||
362 | MUSB PHY driver when the controller hardware itself is about to be | ||
363 | released. | ||
364 | </para> | ||
365 | <para> | ||
366 | Again, note that init and exit are fairly simple in this case due | ||
367 | to the basic set of features of the JZ4740 controller hardware. | ||
368 | When writing an musb glue layer for a more complex controller | ||
369 | hardware, you might need to take care of more processing in those | ||
370 | two functions. | ||
371 | </para> | ||
372 | <para> | ||
373 | Returning from the init function, the MUSB controller driver jumps | ||
374 | back into the probe function: | ||
375 | </para> | ||
376 | <programlisting linenumbering="numbered"> | ||
377 | static int jz4740_probe(struct platform_device *pdev) | ||
378 | { | ||
379 | ret = platform_device_add(musb); | ||
380 | if (ret) { | ||
381 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
382 | goto err_clk_disable; | ||
383 | } | ||
384 | |||
385 | return 0; | ||
386 | |||
387 | err_clk_disable: | ||
388 | clk_disable_unprepare(clk); | ||
389 | err_platform_device_put: | ||
390 | platform_device_put(musb); | ||
391 | return ret; | ||
392 | } | ||
393 | </programlisting> | ||
394 | <para> | ||
395 | This is the last part of the device registration process where the | ||
396 | glue layer adds the controller hardware device to Linux kernel | ||
397 | device hierarchy: at this stage, all known information about the | ||
398 | device is passed on to the Linux USB core stack. | ||
399 | </para> | ||
400 | <programlisting linenumbering="numbered"> | ||
401 | static int jz4740_remove(struct platform_device *pdev) | ||
402 | { | ||
403 | struct jz4740_glue *glue = platform_get_drvdata(pdev); | ||
404 | |||
405 | platform_device_unregister(glue->musb); | ||
406 | clk_disable_unprepare(glue->clk); | ||
407 | |||
408 | return 0; | ||
409 | } | ||
410 | </programlisting> | ||
411 | <para> | ||
412 | Acting as the counterpart of probe, the remove function unregister | ||
413 | the MUSB controller hardware (line 5) and disable the clock (line | ||
414 | 6), allowing it to be gated. | ||
415 | </para> | ||
416 | </chapter> | ||
417 | |||
418 | <chapter id="handling-irqs"> | ||
419 | <title>Handling IRQs</title> | ||
420 | <para> | ||
421 | Additionally to the MUSB controller hardware basic setup and | ||
422 | registration, the glue layer is also responsible for handling the | ||
423 | IRQs: | ||
424 | </para> | ||
425 | <programlisting linenumbering="numbered"> | ||
426 | static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) | ||
427 | { | ||
428 | unsigned long flags; | ||
429 | irqreturn_t retval = IRQ_NONE; | ||
430 | struct musb *musb = __hci; | ||
431 | |||
432 | spin_lock_irqsave(&musb->lock, flags); | ||
433 | |||
434 | musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); | ||
435 | musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); | ||
436 | musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); | ||
437 | |||
438 | /* | ||
439 | * The controller is gadget only, the state of the host mode IRQ bits is | ||
440 | * undefined. Mask them to make sure that the musb driver core will | ||
441 | * never see them set | ||
442 | */ | ||
443 | musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME | | ||
444 | MUSB_INTR_RESET | MUSB_INTR_SOF; | ||
445 | |||
446 | if (musb->int_usb || musb->int_tx || musb->int_rx) | ||
447 | retval = musb_interrupt(musb); | ||
448 | |||
449 | spin_unlock_irqrestore(&musb->lock, flags); | ||
450 | |||
451 | return retval; | ||
452 | } | ||
453 | </programlisting> | ||
454 | <para> | ||
455 | Here the glue layer mostly has to read the relevant hardware | ||
456 | registers and pass their values on to the controller driver which | ||
457 | will handle the actual event that triggered the IRQ. | ||
458 | </para> | ||
459 | <para> | ||
460 | The interrupt handler critical section is protected by the | ||
461 | spin_lock_irqsave() and counterpart spin_unlock_irqrestore() | ||
462 | functions (line 7 and 24 respectively), which prevent the | ||
463 | interrupt handler code to be run by two different threads at the | ||
464 | same time. | ||
465 | </para> | ||
466 | <para> | ||
467 | Then the relevant interrupt registers are read (line 9 to 11): | ||
468 | </para> | ||
469 | <itemizedlist> | ||
470 | <listitem> | ||
471 | <para> | ||
472 | MUSB_INTRUSB: indicates which USB interrupts are currently | ||
473 | active, | ||
474 | </para> | ||
475 | </listitem> | ||
476 | <listitem> | ||
477 | <para> | ||
478 | MUSB_INTRTX: indicates which of the interrupts for TX | ||
479 | endpoints are currently active, | ||
480 | </para> | ||
481 | </listitem> | ||
482 | <listitem> | ||
483 | <para> | ||
484 | MUSB_INTRRX: indicates which of the interrupts for TX | ||
485 | endpoints are currently active. | ||
486 | </para> | ||
487 | </listitem> | ||
488 | </itemizedlist> | ||
489 | <para> | ||
490 | Note that musb_readb() is used to read 8-bit registers at most, | ||
491 | while musb_readw() allows us to read at most 16-bit registers. | ||
492 | There are other functions that can be used depending on the size | ||
493 | of your device registers. See musb_io.h for more information. | ||
494 | </para> | ||
495 | <para> | ||
496 | Instruction on line 18 is another quirk specific to the JZ4740 | ||
497 | USB device controller, which will be discussed later in <link | ||
498 | linkend="device-quirks">Chapter 5</link>. | ||
499 | </para> | ||
500 | <para> | ||
501 | The glue layer still needs to register the IRQ handler though. | ||
502 | Remember the instruction on line 14 of the init function: | ||
503 | </para> | ||
504 | <programlisting linenumbering="numbered"> | ||
505 | static int jz4740_musb_init(struct musb *musb) | ||
506 | { | ||
507 | musb->isr = jz4740_musb_interrupt; | ||
508 | |||
509 | return 0; | ||
510 | } | ||
511 | </programlisting> | ||
512 | <para> | ||
513 | This instruction sets a pointer to the glue layer IRQ handler | ||
514 | function, in order for the controller hardware to call the handler | ||
515 | back when an IRQ comes from the controller hardware. The interrupt | ||
516 | handler is now implemented and registered. | ||
517 | </para> | ||
518 | </chapter> | ||
519 | |||
520 | <chapter id="device-platform-data"> | ||
521 | <title>Device Platform Data</title> | ||
522 | <para> | ||
523 | In order to write an MUSB glue layer, you need to have some data | ||
524 | describing the hardware capabilities of your controller hardware, | ||
525 | which is called the platform data. | ||
526 | </para> | ||
527 | <para> | ||
528 | Platform data is specific to your hardware, though it may cover a | ||
529 | broad range of devices, and is generally found somewhere in the | ||
530 | arch/ directory, depending on your device architecture. | ||
531 | </para> | ||
532 | <para> | ||
533 | For instance, platform data for the JZ4740 SoC is found in | ||
534 | arch/mips/jz4740/platform.c. In the platform.c file each device of | ||
535 | the JZ4740 SoC is described through a set of structures. | ||
536 | </para> | ||
537 | <para> | ||
538 | Here is the part of arch/mips/jz4740/platform.c that covers the | ||
539 | USB Device Controller (UDC): | ||
540 | </para> | ||
541 | <programlisting linenumbering="numbered"> | ||
542 | /* USB Device Controller */ | ||
543 | struct platform_device jz4740_udc_xceiv_device = { | ||
544 | .name = "usb_phy_gen_xceiv", | ||
545 | .id = 0, | ||
546 | }; | ||
547 | |||
548 | static struct resource jz4740_udc_resources[] = { | ||
549 | [0] = { | ||
550 | .start = JZ4740_UDC_BASE_ADDR, | ||
551 | .end = JZ4740_UDC_BASE_ADDR + 0x10000 - 1, | ||
552 | .flags = IORESOURCE_MEM, | ||
553 | }, | ||
554 | [1] = { | ||
555 | .start = JZ4740_IRQ_UDC, | ||
556 | .end = JZ4740_IRQ_UDC, | ||
557 | .flags = IORESOURCE_IRQ, | ||
558 | .name = "mc", | ||
559 | }, | ||
560 | }; | ||
561 | |||
562 | struct platform_device jz4740_udc_device = { | ||
563 | .name = "musb-jz4740", | ||
564 | .id = -1, | ||
565 | .dev = { | ||
566 | .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask, | ||
567 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
568 | }, | ||
569 | .num_resources = ARRAY_SIZE(jz4740_udc_resources), | ||
570 | .resource = jz4740_udc_resources, | ||
571 | }; | ||
572 | </programlisting> | ||
573 | <para> | ||
574 | The jz4740_udc_xceiv_device platform device structure (line 2) | ||
575 | describes the UDC transceiver with a name and id number. | ||
576 | </para> | ||
577 | <para> | ||
578 | At the time of this writing, note that | ||
579 | "usb_phy_gen_xceiv" is the specific name to be used for | ||
580 | all transceivers that are either built-in with reference USB IP or | ||
581 | autonomous and doesn't require any PHY programming. You will need | ||
582 | to set CONFIG_NOP_USB_XCEIV=y in the kernel configuration to make | ||
583 | use of the corresponding transceiver driver. The id field could be | ||
584 | set to -1 (equivalent to PLATFORM_DEVID_NONE), -2 (equivalent to | ||
585 | PLATFORM_DEVID_AUTO) or start with 0 for the first device of this | ||
586 | kind if we want a specific id number. | ||
587 | </para> | ||
588 | <para> | ||
589 | The jz4740_udc_resources resource structure (line 7) defines the | ||
590 | UDC registers base addresses. | ||
591 | </para> | ||
592 | <para> | ||
593 | The first array (line 9 to 11) defines the UDC registers base | ||
594 | memory addresses: start points to the first register memory | ||
595 | address, end points to the last register memory address and the | ||
596 | flags member defines the type of resource we are dealing with. So | ||
597 | IORESOURCE_MEM is used to define the registers memory addresses. | ||
598 | The second array (line 14 to 17) defines the UDC IRQ registers | ||
599 | addresses. Since there is only one IRQ register available for the | ||
600 | JZ4740 UDC, start and end point at the same address. The | ||
601 | IORESOURCE_IRQ flag tells that we are dealing with IRQ resources, | ||
602 | and the name "mc" is in fact hard-coded in the MUSB core | ||
603 | in order for the controller driver to retrieve this IRQ resource | ||
604 | by querying it by its name. | ||
605 | </para> | ||
606 | <para> | ||
607 | Finally, the jz4740_udc_device platform device structure (line 21) | ||
608 | describes the UDC itself. | ||
609 | </para> | ||
610 | <para> | ||
611 | The "musb-jz4740" name (line 22) defines the MUSB | ||
612 | driver that is used for this device; remember this is in fact | ||
613 | the name that we used in the jz4740_driver platform driver | ||
614 | structure in <link linkend="linux-musb-basics">Chapter | ||
615 | 2</link>. The id field (line 23) is set to -1 (equivalent to | ||
616 | PLATFORM_DEVID_NONE) since we do not need an id for the device: | ||
617 | the MUSB controller driver was already set to allocate an | ||
618 | automatic id in <link linkend="linux-musb-basics">Chapter | ||
619 | 2</link>. In the dev field we care for DMA related information | ||
620 | here. The dma_mask field (line 25) defines the width of the DMA | ||
621 | mask that is going to be used, and coherent_dma_mask (line 26) | ||
622 | has the same purpose but for the alloc_coherent DMA mappings: in | ||
623 | both cases we are using a 32 bits mask. Then the resource field | ||
624 | (line 29) is simply a pointer to the resource structure defined | ||
625 | before, while the num_resources field (line 28) keeps track of | ||
626 | the number of arrays defined in the resource structure (in this | ||
627 | case there were two resource arrays defined before). | ||
628 | </para> | ||
629 | <para> | ||
630 | With this quick overview of the UDC platform data at the arch/ | ||
631 | level now done, let's get back to the MUSB glue layer specific | ||
632 | platform data in drivers/usb/musb/jz4740.c: | ||
633 | </para> | ||
634 | <programlisting linenumbering="numbered"> | ||
635 | static struct musb_hdrc_config jz4740_musb_config = { | ||
636 | /* Silicon does not implement USB OTG. */ | ||
637 | .multipoint = 0, | ||
638 | /* Max EPs scanned, driver will decide which EP can be used. */ | ||
639 | .num_eps = 4, | ||
640 | /* RAMbits needed to configure EPs from table */ | ||
641 | .ram_bits = 9, | ||
642 | .fifo_cfg = jz4740_musb_fifo_cfg, | ||
643 | .fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg), | ||
644 | }; | ||
645 | |||
646 | static struct musb_hdrc_platform_data jz4740_musb_platform_data = { | ||
647 | .mode = MUSB_PERIPHERAL, | ||
648 | .config = &jz4740_musb_config, | ||
649 | }; | ||
650 | </programlisting> | ||
651 | <para> | ||
652 | First the glue layer configures some aspects of the controller | ||
653 | driver operation related to the controller hardware specifics. | ||
654 | This is done through the jz4740_musb_config musb_hdrc_config | ||
655 | structure. | ||
656 | </para> | ||
657 | <para> | ||
658 | Defining the OTG capability of the controller hardware, the | ||
659 | multipoint member (line 3) is set to 0 (equivalent to false) | ||
660 | since the JZ4740 UDC is not OTG compatible. Then num_eps (line | ||
661 | 5) defines the number of USB endpoints of the controller | ||
662 | hardware, including endpoint 0: here we have 3 endpoints + | ||
663 | endpoint 0. Next is ram_bits (line 7) which is the width of the | ||
664 | RAM address bus for the MUSB controller hardware. This | ||
665 | information is needed when the controller driver cannot | ||
666 | automatically configure endpoints by reading the relevant | ||
667 | controller hardware registers. This issue will be discussed when | ||
668 | we get to device quirks in <link linkend="device-quirks">Chapter | ||
669 | 5</link>. Last two fields (line 8 and 9) are also about device | ||
670 | quirks: fifo_cfg points to the USB endpoints configuration table | ||
671 | and fifo_cfg_size keeps track of the size of the number of | ||
672 | entries in that configuration table. More on that later in <link | ||
673 | linkend="device-quirks">Chapter 5</link>. | ||
674 | </para> | ||
675 | <para> | ||
676 | Then this configuration is embedded inside | ||
677 | jz4740_musb_platform_data musb_hdrc_platform_data structure (line | ||
678 | 11): config is a pointer to the configuration structure itself, | ||
679 | and mode tells the controller driver if the controller hardware | ||
680 | may be used as MUSB_HOST only, MUSB_PERIPHERAL only or MUSB_OTG | ||
681 | which is a dual mode. | ||
682 | </para> | ||
683 | <para> | ||
684 | Remember that jz4740_musb_platform_data is then used to convey | ||
685 | platform data information as we have seen in the probe function | ||
686 | in <link linkend="linux-musb-basics">Chapter 2</link> | ||
687 | </para> | ||
688 | </chapter> | ||
689 | |||
690 | <chapter id="device-quirks"> | ||
691 | <title>Device Quirks</title> | ||
692 | <para> | ||
693 | Completing the platform data specific to your device, you may also | ||
694 | need to write some code in the glue layer to work around some | ||
695 | device specific limitations. These quirks may be due to some | ||
696 | hardware bugs, or simply be the result of an incomplete | ||
697 | implementation of the USB On-the-Go specification. | ||
698 | </para> | ||
699 | <para> | ||
700 | The JZ4740 UDC exhibits such quirks, some of which we will discuss | ||
701 | here for the sake of insight even though these might not be found | ||
702 | in the controller hardware you are working on. | ||
703 | </para> | ||
704 | <para> | ||
705 | Let's get back to the init function first: | ||
706 | </para> | ||
707 | <programlisting linenumbering="numbered"> | ||
708 | static int jz4740_musb_init(struct musb *musb) | ||
709 | { | ||
710 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | ||
711 | if (!musb->xceiv) { | ||
712 | pr_err("HS UDC: no transceiver configured\n"); | ||
713 | return -ENODEV; | ||
714 | } | ||
715 | |||
716 | /* Silicon does not implement ConfigData register. | ||
717 | * Set dyn_fifo to avoid reading EP config from hardware. | ||
718 | */ | ||
719 | musb->dyn_fifo = true; | ||
720 | |||
721 | musb->isr = jz4740_musb_interrupt; | ||
722 | |||
723 | return 0; | ||
724 | } | ||
725 | </programlisting> | ||
726 | <para> | ||
727 | Instruction on line 12 helps the MUSB controller driver to work | ||
728 | around the fact that the controller hardware is missing registers | ||
729 | that are used for USB endpoints configuration. | ||
730 | </para> | ||
731 | <para> | ||
732 | Without these registers, the controller driver is unable to read | ||
733 | the endpoints configuration from the hardware, so we use line 12 | ||
734 | instruction to bypass reading the configuration from silicon, and | ||
735 | rely on a hard-coded table that describes the endpoints | ||
736 | configuration instead: | ||
737 | </para> | ||
738 | <programlisting linenumbering="numbered"> | ||
739 | static struct musb_fifo_cfg jz4740_musb_fifo_cfg[] = { | ||
740 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, | ||
741 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, | ||
742 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, }, | ||
743 | }; | ||
744 | </programlisting> | ||
745 | <para> | ||
746 | Looking at the configuration table above, we see that each | ||
747 | endpoints is described by three fields: hw_ep_num is the endpoint | ||
748 | number, style is its direction (either FIFO_TX for the controller | ||
749 | driver to send packets in the controller hardware, or FIFO_RX to | ||
750 | receive packets from hardware), and maxpacket defines the maximum | ||
751 | size of each data packet that can be transmitted over that | ||
752 | endpoint. Reading from the table, the controller driver knows that | ||
753 | endpoint 1 can be used to send and receive USB data packets of 512 | ||
754 | bytes at once (this is in fact a bulk in/out endpoint), and | ||
755 | endpoint 2 can be used to send data packets of 64 bytes at once | ||
756 | (this is in fact an interrupt endpoint). | ||
757 | </para> | ||
758 | <para> | ||
759 | Note that there is no information about endpoint 0 here: that one | ||
760 | is implemented by default in every silicon design, with a | ||
761 | predefined configuration according to the USB specification. For | ||
762 | more examples of endpoint configuration tables, see musb_core.c. | ||
763 | </para> | ||
764 | <para> | ||
765 | Let's now get back to the interrupt handler function: | ||
766 | </para> | ||
767 | <programlisting linenumbering="numbered"> | ||
768 | static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) | ||
769 | { | ||
770 | unsigned long flags; | ||
771 | irqreturn_t retval = IRQ_NONE; | ||
772 | struct musb *musb = __hci; | ||
773 | |||
774 | spin_lock_irqsave(&musb->lock, flags); | ||
775 | |||
776 | musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); | ||
777 | musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); | ||
778 | musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); | ||
779 | |||
780 | /* | ||
781 | * The controller is gadget only, the state of the host mode IRQ bits is | ||
782 | * undefined. Mask them to make sure that the musb driver core will | ||
783 | * never see them set | ||
784 | */ | ||
785 | musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME | | ||
786 | MUSB_INTR_RESET | MUSB_INTR_SOF; | ||
787 | |||
788 | if (musb->int_usb || musb->int_tx || musb->int_rx) | ||
789 | retval = musb_interrupt(musb); | ||
790 | |||
791 | spin_unlock_irqrestore(&musb->lock, flags); | ||
792 | |||
793 | return retval; | ||
794 | } | ||
795 | </programlisting> | ||
796 | <para> | ||
797 | Instruction on line 18 above is a way for the controller driver to | ||
798 | work around the fact that some interrupt bits used for USB host | ||
799 | mode operation are missing in the MUSB_INTRUSB register, thus left | ||
800 | in an undefined hardware state, since this MUSB controller | ||
801 | hardware is used in peripheral mode only. As a consequence, the | ||
802 | glue layer masks these missing bits out to avoid parasite | ||
803 | interrupts by doing a logical AND operation between the value read | ||
804 | from MUSB_INTRUSB and the bits that are actually implemented in | ||
805 | the register. | ||
806 | </para> | ||
807 | <para> | ||
808 | These are only a couple of the quirks found in the JZ4740 USB | ||
809 | device controller. Some others were directly addressed in the MUSB | ||
810 | core since the fixes were generic enough to provide a better | ||
811 | handling of the issues for others controller hardware eventually. | ||
812 | </para> | ||
813 | </chapter> | ||
814 | |||
815 | <chapter id="conclusion"> | ||
816 | <title>Conclusion</title> | ||
817 | <para> | ||
818 | Writing a Linux MUSB glue layer should be a more accessible task, | ||
819 | as this documentation tries to show the ins and outs of this | ||
820 | exercise. | ||
821 | </para> | ||
822 | <para> | ||
823 | The JZ4740 USB device controller being fairly simple, I hope its | ||
824 | glue layer serves as a good example for the curious mind. Used | ||
825 | with the current MUSB glue layers, this documentation should | ||
826 | provide enough guidance to get started; should anything gets out | ||
827 | of hand, the linux-usb mailing list archive is another helpful | ||
828 | resource to browse through. | ||
829 | </para> | ||
830 | </chapter> | ||
831 | |||
832 | <chapter id="acknowledgements"> | ||
833 | <title>Acknowledgements</title> | ||
834 | <para> | ||
835 | Many thanks to Lars-Peter Clausen and Maarten ter Huurne for | ||
836 | answering my questions while I was writing the JZ4740 glue layer | ||
837 | and for helping me out getting the code in good shape. | ||
838 | </para> | ||
839 | <para> | ||
840 | I would also like to thank the Qi-Hardware community at large for | ||
841 | its cheerful guidance and support. | ||
842 | </para> | ||
843 | </chapter> | ||
844 | |||
845 | <chapter id="resources"> | ||
846 | <title>Resources</title> | ||
847 | <para> | ||
848 | USB Home Page: | ||
849 | <ulink url="http://www.usb.org">http://www.usb.org</ulink> | ||
850 | </para> | ||
851 | <para> | ||
852 | linux-usb Mailing List Archives: | ||
853 | <ulink url="http://marc.info/?l=linux-usb">http://marc.info/?l=linux-usb</ulink> | ||
854 | </para> | ||
855 | <para> | ||
856 | USB On-the-Go Basics: | ||
857 | <ulink url="http://www.maximintegrated.com/app-notes/index.mvp/id/1822">http://www.maximintegrated.com/app-notes/index.mvp/id/1822</ulink> | ||
858 | </para> | ||
859 | <para> | ||
860 | Writing USB Device Drivers: | ||
861 | <ulink url="https://www.kernel.org/doc/htmldocs/writing_usb_driver/index.html">https://www.kernel.org/doc/htmldocs/writing_usb_driver/index.html</ulink> | ||
862 | </para> | ||
863 | <para> | ||
864 | Texas Instruments USB Configuration Wiki Page: | ||
865 | <ulink url="http://processors.wiki.ti.com/index.php/Usbgeneralpage">http://processors.wiki.ti.com/index.php/Usbgeneralpage</ulink> | ||
866 | </para> | ||
867 | <para> | ||
868 | Analog Devices Blackfin MUSB Configuration: | ||
869 | <ulink url="http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:musb">http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:musb</ulink> | ||
870 | </para> | ||
871 | </chapter> | ||
872 | |||
873 | </book> | ||
diff --git a/Documentation/DocBook/writing_usb_driver.tmpl b/Documentation/DocBook/writing_usb_driver.tmpl deleted file mode 100644 index 3210dcf741c9..000000000000 --- a/Documentation/DocBook/writing_usb_driver.tmpl +++ /dev/null | |||
@@ -1,412 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | ||
4 | |||
5 | <book id="USBDeviceDriver"> | ||
6 | <bookinfo> | ||
7 | <title>Writing USB Device Drivers</title> | ||
8 | |||
9 | <authorgroup> | ||
10 | <author> | ||
11 | <firstname>Greg</firstname> | ||
12 | <surname>Kroah-Hartman</surname> | ||
13 | <affiliation> | ||
14 | <address> | ||
15 | <email>greg@kroah.com</email> | ||
16 | </address> | ||
17 | </affiliation> | ||
18 | </author> | ||
19 | </authorgroup> | ||
20 | |||
21 | <copyright> | ||
22 | <year>2001-2002</year> | ||
23 | <holder>Greg Kroah-Hartman</holder> | ||
24 | </copyright> | ||
25 | |||
26 | <legalnotice> | ||
27 | <para> | ||
28 | This documentation is free software; you can redistribute | ||
29 | it and/or modify it under the terms of the GNU General Public | ||
30 | License as published by the Free Software Foundation; either | ||
31 | version 2 of the License, or (at your option) any later | ||
32 | version. | ||
33 | </para> | ||
34 | |||
35 | <para> | ||
36 | This program is distributed in the hope that it will be | ||
37 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
38 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
39 | See the GNU General Public License for more details. | ||
40 | </para> | ||
41 | |||
42 | <para> | ||
43 | You should have received a copy of the GNU General Public | ||
44 | License along with this program; if not, write to the Free | ||
45 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
46 | MA 02111-1307 USA | ||
47 | </para> | ||
48 | |||
49 | <para> | ||
50 | For more details see the file COPYING in the source | ||
51 | distribution of Linux. | ||
52 | </para> | ||
53 | |||
54 | <para> | ||
55 | This documentation is based on an article published in | ||
56 | Linux Journal Magazine, October 2001, Issue 90. | ||
57 | </para> | ||
58 | </legalnotice> | ||
59 | </bookinfo> | ||
60 | |||
61 | <toc></toc> | ||
62 | |||
63 | <chapter id="intro"> | ||
64 | <title>Introduction</title> | ||
65 | <para> | ||
66 | The Linux USB subsystem has grown from supporting only two different | ||
67 | types of devices in the 2.2.7 kernel (mice and keyboards), to over 20 | ||
68 | different types of devices in the 2.4 kernel. Linux currently supports | ||
69 | almost all USB class devices (standard types of devices like keyboards, | ||
70 | mice, modems, printers and speakers) and an ever-growing number of | ||
71 | vendor-specific devices (such as USB to serial converters, digital | ||
72 | cameras, Ethernet devices and MP3 players). For a full list of the | ||
73 | different USB devices currently supported, see Resources. | ||
74 | </para> | ||
75 | <para> | ||
76 | The remaining kinds of USB devices that do not have support on Linux are | ||
77 | almost all vendor-specific devices. Each vendor decides to implement a | ||
78 | custom protocol to talk to their device, so a custom driver usually needs | ||
79 | to be created. Some vendors are open with their USB protocols and help | ||
80 | with the creation of Linux drivers, while others do not publish them, and | ||
81 | developers are forced to reverse-engineer. See Resources for some links | ||
82 | to handy reverse-engineering tools. | ||
83 | </para> | ||
84 | <para> | ||
85 | Because each different protocol causes a new driver to be created, I have | ||
86 | written a generic USB driver skeleton, modelled after the pci-skeleton.c | ||
87 | file in the kernel source tree upon which many PCI network drivers have | ||
88 | been based. This USB skeleton can be found at drivers/usb/usb-skeleton.c | ||
89 | in the kernel source tree. In this article I will walk through the basics | ||
90 | of the skeleton driver, explaining the different pieces and what needs to | ||
91 | be done to customize it to your specific device. | ||
92 | </para> | ||
93 | </chapter> | ||
94 | |||
95 | <chapter id="basics"> | ||
96 | <title>Linux USB Basics</title> | ||
97 | <para> | ||
98 | If you are going to write a Linux USB driver, please become familiar with | ||
99 | the USB protocol specification. It can be found, along with many other | ||
100 | useful documents, at the USB home page (see Resources). An excellent | ||
101 | introduction to the Linux USB subsystem can be found at the USB Working | ||
102 | Devices List (see Resources). It explains how the Linux USB subsystem is | ||
103 | structured and introduces the reader to the concept of USB urbs | ||
104 | (USB Request Blocks), which are essential to USB drivers. | ||
105 | </para> | ||
106 | <para> | ||
107 | The first thing a Linux USB driver needs to do is register itself with | ||
108 | the Linux USB subsystem, giving it some information about which devices | ||
109 | the driver supports and which functions to call when a device supported | ||
110 | by the driver is inserted or removed from the system. All of this | ||
111 | information is passed to the USB subsystem in the usb_driver structure. | ||
112 | The skeleton driver declares a usb_driver as: | ||
113 | </para> | ||
114 | <programlisting> | ||
115 | static struct usb_driver skel_driver = { | ||
116 | .name = "skeleton", | ||
117 | .probe = skel_probe, | ||
118 | .disconnect = skel_disconnect, | ||
119 | .fops = &skel_fops, | ||
120 | .minor = USB_SKEL_MINOR_BASE, | ||
121 | .id_table = skel_table, | ||
122 | }; | ||
123 | </programlisting> | ||
124 | <para> | ||
125 | The variable name is a string that describes the driver. It is used in | ||
126 | informational messages printed to the system log. The probe and | ||
127 | disconnect function pointers are called when a device that matches the | ||
128 | information provided in the id_table variable is either seen or removed. | ||
129 | </para> | ||
130 | <para> | ||
131 | The fops and minor variables are optional. Most USB drivers hook into | ||
132 | another kernel subsystem, such as the SCSI, network or TTY subsystem. | ||
133 | These types of drivers register themselves with the other kernel | ||
134 | subsystem, and any user-space interactions are provided through that | ||
135 | interface. But for drivers that do not have a matching kernel subsystem, | ||
136 | such as MP3 players or scanners, a method of interacting with user space | ||
137 | is needed. The USB subsystem provides a way to register a minor device | ||
138 | number and a set of file_operations function pointers that enable this | ||
139 | user-space interaction. The skeleton driver needs this kind of interface, | ||
140 | so it provides a minor starting number and a pointer to its | ||
141 | file_operations functions. | ||
142 | </para> | ||
143 | <para> | ||
144 | The USB driver is then registered with a call to usb_register, usually in | ||
145 | the driver's init function, as shown here: | ||
146 | </para> | ||
147 | <programlisting> | ||
148 | static int __init usb_skel_init(void) | ||
149 | { | ||
150 | int result; | ||
151 | |||
152 | /* register this driver with the USB subsystem */ | ||
153 | result = usb_register(&skel_driver); | ||
154 | if (result < 0) { | ||
155 | err("usb_register failed for the "__FILE__ "driver." | ||
156 | "Error number %d", result); | ||
157 | return -1; | ||
158 | } | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | module_init(usb_skel_init); | ||
163 | </programlisting> | ||
164 | <para> | ||
165 | When the driver is unloaded from the system, it needs to deregister | ||
166 | itself with the USB subsystem. This is done with the usb_deregister | ||
167 | function: | ||
168 | </para> | ||
169 | <programlisting> | ||
170 | static void __exit usb_skel_exit(void) | ||
171 | { | ||
172 | /* deregister this driver with the USB subsystem */ | ||
173 | usb_deregister(&skel_driver); | ||
174 | } | ||
175 | module_exit(usb_skel_exit); | ||
176 | </programlisting> | ||
177 | <para> | ||
178 | To enable the linux-hotplug system to load the driver automatically when | ||
179 | the device is plugged in, you need to create a MODULE_DEVICE_TABLE. The | ||
180 | following code tells the hotplug scripts that this module supports a | ||
181 | single device with a specific vendor and product ID: | ||
182 | </para> | ||
183 | <programlisting> | ||
184 | /* table of devices that work with this driver */ | ||
185 | static struct usb_device_id skel_table [] = { | ||
186 | { USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) }, | ||
187 | { } /* Terminating entry */ | ||
188 | }; | ||
189 | MODULE_DEVICE_TABLE (usb, skel_table); | ||
190 | </programlisting> | ||
191 | <para> | ||
192 | There are other macros that can be used in describing a usb_device_id for | ||
193 | drivers that support a whole class of USB drivers. See usb.h for more | ||
194 | information on this. | ||
195 | </para> | ||
196 | </chapter> | ||
197 | |||
198 | <chapter id="device"> | ||
199 | <title>Device operation</title> | ||
200 | <para> | ||
201 | When a device is plugged into the USB bus that matches the device ID | ||
202 | pattern that your driver registered with the USB core, the probe function | ||
203 | is called. The usb_device structure, interface number and the interface ID | ||
204 | are passed to the function: | ||
205 | </para> | ||
206 | <programlisting> | ||
207 | static int skel_probe(struct usb_interface *interface, | ||
208 | const struct usb_device_id *id) | ||
209 | </programlisting> | ||
210 | <para> | ||
211 | The driver now needs to verify that this device is actually one that it | ||
212 | can accept. If so, it returns 0. | ||
213 | If not, or if any error occurs during initialization, an errorcode | ||
214 | (such as <literal>-ENOMEM</literal> or <literal>-ENODEV</literal>) | ||
215 | is returned from the probe function. | ||
216 | </para> | ||
217 | <para> | ||
218 | In the skeleton driver, we determine what end points are marked as bulk-in | ||
219 | and bulk-out. We create buffers to hold the data that will be sent and | ||
220 | received from the device, and a USB urb to write data to the device is | ||
221 | initialized. | ||
222 | </para> | ||
223 | <para> | ||
224 | Conversely, when the device is removed from the USB bus, the disconnect | ||
225 | function is called with the device pointer. The driver needs to clean any | ||
226 | private data that has been allocated at this time and to shut down any | ||
227 | pending urbs that are in the USB system. | ||
228 | </para> | ||
229 | <para> | ||
230 | Now that the device is plugged into the system and the driver is bound to | ||
231 | the device, any of the functions in the file_operations structure that | ||
232 | were passed to the USB subsystem will be called from a user program trying | ||
233 | to talk to the device. The first function called will be open, as the | ||
234 | program tries to open the device for I/O. We increment our private usage | ||
235 | count and save a pointer to our internal structure in the file | ||
236 | structure. This is done so that future calls to file operations will | ||
237 | enable the driver to determine which device the user is addressing. All | ||
238 | of this is done with the following code: | ||
239 | </para> | ||
240 | <programlisting> | ||
241 | /* increment our usage count for the module */ | ||
242 | ++skel->open_count; | ||
243 | |||
244 | /* save our object in the file's private structure */ | ||
245 | file->private_data = dev; | ||
246 | </programlisting> | ||
247 | <para> | ||
248 | After the open function is called, the read and write functions are called | ||
249 | to receive and send data to the device. In the skel_write function, we | ||
250 | receive a pointer to some data that the user wants to send to the device | ||
251 | and the size of the data. The function determines how much data it can | ||
252 | send to the device based on the size of the write urb it has created (this | ||
253 | size depends on the size of the bulk out end point that the device has). | ||
254 | Then it copies the data from user space to kernel space, points the urb to | ||
255 | the data and submits the urb to the USB subsystem. This can be seen in | ||
256 | the following code: | ||
257 | </para> | ||
258 | <programlisting> | ||
259 | /* we can only write as much as 1 urb will hold */ | ||
260 | bytes_written = (count > skel->bulk_out_size) ? skel->bulk_out_size : count; | ||
261 | |||
262 | /* copy the data from user space into our urb */ | ||
263 | copy_from_user(skel->write_urb->transfer_buffer, buffer, bytes_written); | ||
264 | |||
265 | /* set up our urb */ | ||
266 | usb_fill_bulk_urb(skel->write_urb, | ||
267 | skel->dev, | ||
268 | usb_sndbulkpipe(skel->dev, skel->bulk_out_endpointAddr), | ||
269 | skel->write_urb->transfer_buffer, | ||
270 | bytes_written, | ||
271 | skel_write_bulk_callback, | ||
272 | skel); | ||
273 | |||
274 | /* send the data out the bulk port */ | ||
275 | result = usb_submit_urb(skel->write_urb); | ||
276 | if (result) { | ||
277 | err("Failed submitting write urb, error %d", result); | ||
278 | } | ||
279 | </programlisting> | ||
280 | <para> | ||
281 | When the write urb is filled up with the proper information using the | ||
282 | usb_fill_bulk_urb function, we point the urb's completion callback to call our | ||
283 | own skel_write_bulk_callback function. This function is called when the | ||
284 | urb is finished by the USB subsystem. The callback function is called in | ||
285 | interrupt context, so caution must be taken not to do very much processing | ||
286 | at that time. Our implementation of skel_write_bulk_callback merely | ||
287 | reports if the urb was completed successfully or not and then returns. | ||
288 | </para> | ||
289 | <para> | ||
290 | The read function works a bit differently from the write function in that | ||
291 | we do not use an urb to transfer data from the device to the driver. | ||
292 | Instead we call the usb_bulk_msg function, which can be used to send or | ||
293 | receive data from a device without having to create urbs and handle | ||
294 | urb completion callback functions. We call the usb_bulk_msg function, | ||
295 | giving it a buffer into which to place any data received from the device | ||
296 | and a timeout value. If the timeout period expires without receiving any | ||
297 | data from the device, the function will fail and return an error message. | ||
298 | This can be shown with the following code: | ||
299 | </para> | ||
300 | <programlisting> | ||
301 | /* do an immediate bulk read to get data from the device */ | ||
302 | retval = usb_bulk_msg (skel->dev, | ||
303 | usb_rcvbulkpipe (skel->dev, | ||
304 | skel->bulk_in_endpointAddr), | ||
305 | skel->bulk_in_buffer, | ||
306 | skel->bulk_in_size, | ||
307 | &count, HZ*10); | ||
308 | /* if the read was successful, copy the data to user space */ | ||
309 | if (!retval) { | ||
310 | if (copy_to_user (buffer, skel->bulk_in_buffer, count)) | ||
311 | retval = -EFAULT; | ||
312 | else | ||
313 | retval = count; | ||
314 | } | ||
315 | </programlisting> | ||
316 | <para> | ||
317 | The usb_bulk_msg function can be very useful for doing single reads or | ||
318 | writes to a device; however, if you need to read or write constantly to a | ||
319 | device, it is recommended to set up your own urbs and submit them to the | ||
320 | USB subsystem. | ||
321 | </para> | ||
322 | <para> | ||
323 | When the user program releases the file handle that it has been using to | ||
324 | talk to the device, the release function in the driver is called. In this | ||
325 | function we decrement our private usage count and wait for possible | ||
326 | pending writes: | ||
327 | </para> | ||
328 | <programlisting> | ||
329 | /* decrement our usage count for the device */ | ||
330 | --skel->open_count; | ||
331 | </programlisting> | ||
332 | <para> | ||
333 | One of the more difficult problems that USB drivers must be able to handle | ||
334 | smoothly is the fact that the USB device may be removed from the system at | ||
335 | any point in time, even if a program is currently talking to it. It needs | ||
336 | to be able to shut down any current reads and writes and notify the | ||
337 | user-space programs that the device is no longer there. The following | ||
338 | code (function <function>skel_delete</function>) | ||
339 | is an example of how to do this: </para> | ||
340 | <programlisting> | ||
341 | static inline void skel_delete (struct usb_skel *dev) | ||
342 | { | ||
343 | kfree (dev->bulk_in_buffer); | ||
344 | if (dev->bulk_out_buffer != NULL) | ||
345 | usb_free_coherent (dev->udev, dev->bulk_out_size, | ||
346 | dev->bulk_out_buffer, | ||
347 | dev->write_urb->transfer_dma); | ||
348 | usb_free_urb (dev->write_urb); | ||
349 | kfree (dev); | ||
350 | } | ||
351 | </programlisting> | ||
352 | <para> | ||
353 | If a program currently has an open handle to the device, we reset the flag | ||
354 | <literal>device_present</literal>. For | ||
355 | every read, write, release and other functions that expect a device to be | ||
356 | present, the driver first checks this flag to see if the device is | ||
357 | still present. If not, it releases that the device has disappeared, and a | ||
358 | -ENODEV error is returned to the user-space program. When the release | ||
359 | function is eventually called, it determines if there is no device | ||
360 | and if not, it does the cleanup that the skel_disconnect | ||
361 | function normally does if there are no open files on the device (see | ||
362 | Listing 5). | ||
363 | </para> | ||
364 | </chapter> | ||
365 | |||
366 | <chapter id="iso"> | ||
367 | <title>Isochronous Data</title> | ||
368 | <para> | ||
369 | This usb-skeleton driver does not have any examples of interrupt or | ||
370 | isochronous data being sent to or from the device. Interrupt data is sent | ||
371 | almost exactly as bulk data is, with a few minor exceptions. Isochronous | ||
372 | data works differently with continuous streams of data being sent to or | ||
373 | from the device. The audio and video camera drivers are very good examples | ||
374 | of drivers that handle isochronous data and will be useful if you also | ||
375 | need to do this. | ||
376 | </para> | ||
377 | </chapter> | ||
378 | |||
379 | <chapter id="Conclusion"> | ||
380 | <title>Conclusion</title> | ||
381 | <para> | ||
382 | Writing Linux USB device drivers is not a difficult task as the | ||
383 | usb-skeleton driver shows. This driver, combined with the other current | ||
384 | USB drivers, should provide enough examples to help a beginning author | ||
385 | create a working driver in a minimal amount of time. The linux-usb-devel | ||
386 | mailing list archives also contain a lot of helpful information. | ||
387 | </para> | ||
388 | </chapter> | ||
389 | |||
390 | <chapter id="resources"> | ||
391 | <title>Resources</title> | ||
392 | <para> | ||
393 | The Linux USB Project: <ulink url="http://www.linux-usb.org">http://www.linux-usb.org/</ulink> | ||
394 | </para> | ||
395 | <para> | ||
396 | Linux Hotplug Project: <ulink url="http://linux-hotplug.sourceforge.net">http://linux-hotplug.sourceforge.net/</ulink> | ||
397 | </para> | ||
398 | <para> | ||
399 | Linux USB Working Devices List: <ulink url="http://www.qbik.ch/usb/devices">http://www.qbik.ch/usb/devices/</ulink> | ||
400 | </para> | ||
401 | <para> | ||
402 | linux-usb-devel Mailing List Archives: <ulink url="http://marc.theaimsgroup.com/?l=linux-usb-devel">http://marc.theaimsgroup.com/?l=linux-usb-devel</ulink> | ||
403 | </para> | ||
404 | <para> | ||
405 | Programming Guide for Linux USB Device Drivers: <ulink url="http://usb.cs.tum.edu/usbdoc">http://usb.cs.tum.edu/usbdoc</ulink> | ||
406 | </para> | ||
407 | <para> | ||
408 | USB Home Page: <ulink url="http://www.usb.org">http://www.usb.org</ulink> | ||
409 | </para> | ||
410 | </chapter> | ||
411 | |||
412 | </book> | ||
diff --git a/Documentation/PCI/pci-error-recovery.txt b/Documentation/PCI/pci-error-recovery.txt index da3b2176d5da..0b6bb3ef449e 100644 --- a/Documentation/PCI/pci-error-recovery.txt +++ b/Documentation/PCI/pci-error-recovery.txt | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | Many PCI bus controllers are able to detect a variety of hardware | 12 | Many PCI bus controllers are able to detect a variety of hardware |
13 | PCI errors on the bus, such as parity errors on the data and address | 13 | PCI errors on the bus, such as parity errors on the data and address |
14 | busses, as well as SERR and PERR errors. Some of the more advanced | 14 | buses, as well as SERR and PERR errors. Some of the more advanced |
15 | chipsets are able to deal with these errors; these include PCI-E chipsets, | 15 | chipsets are able to deal with these errors; these include PCI-E chipsets, |
16 | and the PCI-host bridges found on IBM Power4, Power5 and Power6-based | 16 | and the PCI-host bridges found on IBM Power4, Power5 and Power6-based |
17 | pSeries boxes. A typical action taken is to disconnect the affected device, | 17 | pSeries boxes. A typical action taken is to disconnect the affected device, |
@@ -173,7 +173,7 @@ is STEP 6 (Permanent Failure). | |||
173 | >>> a value of 0xff on read, and writes will be dropped. If more than | 173 | >>> a value of 0xff on read, and writes will be dropped. If more than |
174 | >>> EEH_MAX_FAILS I/O's are attempted to a frozen adapter, EEH | 174 | >>> EEH_MAX_FAILS I/O's are attempted to a frozen adapter, EEH |
175 | >>> assumes that the device driver has gone into an infinite loop | 175 | >>> assumes that the device driver has gone into an infinite loop |
176 | >>> and prints an error to syslog. A reboot is then required to | 176 | >>> and prints an error to syslog. A reboot is then required to |
177 | >>> get the device working again. | 177 | >>> get the device working again. |
178 | 178 | ||
179 | STEP 2: MMIO Enabled | 179 | STEP 2: MMIO Enabled |
@@ -231,14 +231,14 @@ proceeds to STEP 4 (Slot Reset) | |||
231 | STEP 3: Link Reset | 231 | STEP 3: Link Reset |
232 | ------------------ | 232 | ------------------ |
233 | The platform resets the link. This is a PCI-Express specific step | 233 | The platform resets the link. This is a PCI-Express specific step |
234 | and is done whenever a non-fatal error has been detected that can be | 234 | and is done whenever a fatal error has been detected that can be |
235 | "solved" by resetting the link. | 235 | "solved" by resetting the link. |
236 | 236 | ||
237 | STEP 4: Slot Reset | 237 | STEP 4: Slot Reset |
238 | ------------------ | 238 | ------------------ |
239 | 239 | ||
240 | In response to a return value of PCI_ERS_RESULT_NEED_RESET, the | 240 | In response to a return value of PCI_ERS_RESULT_NEED_RESET, the |
241 | the platform will perform a slot reset on the requesting PCI device(s). | 241 | the platform will perform a slot reset on the requesting PCI device(s). |
242 | The actual steps taken by a platform to perform a slot reset | 242 | The actual steps taken by a platform to perform a slot reset |
243 | will be platform-dependent. Upon completion of slot reset, the | 243 | will be platform-dependent. Upon completion of slot reset, the |
244 | platform will call the device slot_reset() callback. | 244 | platform will call the device slot_reset() callback. |
@@ -258,7 +258,7 @@ configuration registers to initialize to their default conditions. | |||
258 | 258 | ||
259 | For most PCI devices, a soft reset will be sufficient for recovery. | 259 | For most PCI devices, a soft reset will be sufficient for recovery. |
260 | Optional fundamental reset is provided to support a limited number | 260 | Optional fundamental reset is provided to support a limited number |
261 | of PCI Express PCI devices for which a soft reset is not sufficient | 261 | of PCI Express devices for which a soft reset is not sufficient |
262 | for recovery. | 262 | for recovery. |
263 | 263 | ||
264 | If the platform supports PCI hotplug, then the reset might be | 264 | If the platform supports PCI hotplug, then the reset might be |
@@ -303,7 +303,7 @@ driver performs device init only from PCI function 0: | |||
303 | Same as above. | 303 | Same as above. |
304 | 304 | ||
305 | Drivers for PCI Express cards that require a fundamental reset must | 305 | Drivers for PCI Express cards that require a fundamental reset must |
306 | set the needs_freset bit in the pci_dev structure in their probe function. | 306 | set the needs_freset bit in the pci_dev structure in their probe function. |
307 | For example, the QLogic qla2xxx driver sets the needs_freset bit for certain | 307 | For example, the QLogic qla2xxx driver sets the needs_freset bit for certain |
308 | PCI card types: | 308 | PCI card types: |
309 | 309 | ||
diff --git a/Documentation/acpi/aml-debugger.txt b/Documentation/acpi/aml-debugger.txt index 5f62aa4a493b..e851cc5de63f 100644 --- a/Documentation/acpi/aml-debugger.txt +++ b/Documentation/acpi/aml-debugger.txt | |||
@@ -15,7 +15,7 @@ kernel. | |||
15 | CONFIG_ACPI_DEBUGGER=y | 15 | CONFIG_ACPI_DEBUGGER=y |
16 | CONFIG_ACPI_DEBUGGER_USER=m | 16 | CONFIG_ACPI_DEBUGGER_USER=m |
17 | 17 | ||
18 | The userspace utlities can be built from the kernel source tree using | 18 | The userspace utilities can be built from the kernel source tree using |
19 | the following commands: | 19 | the following commands: |
20 | 20 | ||
21 | $ cd tools | 21 | $ cd tools |
diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt index 209a5eba6b87..7bcf9c3d9fbe 100644 --- a/Documentation/acpi/enumeration.txt +++ b/Documentation/acpi/enumeration.txt | |||
@@ -367,10 +367,10 @@ resulting child platform device. | |||
367 | 367 | ||
368 | Device Tree namespace link device ID | 368 | Device Tree namespace link device ID |
369 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 369 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
370 | The Device Tree protocol uses device indentification based on the "compatible" | 370 | The Device Tree protocol uses device identification based on the "compatible" |
371 | property whose value is a string or an array of strings recognized as device | 371 | property whose value is a string or an array of strings recognized as device |
372 | identifiers by drivers and the driver core. The set of all those strings may be | 372 | identifiers by drivers and the driver core. The set of all those strings may be |
373 | regarded as a device indentification namespace analogous to the ACPI/PNP device | 373 | regarded as a device identification namespace analogous to the ACPI/PNP device |
374 | ID namespace. Consequently, in principle it should not be necessary to allocate | 374 | ID namespace. Consequently, in principle it should not be necessary to allocate |
375 | a new (and arguably redundant) ACPI/PNP device ID for a devices with an existing | 375 | a new (and arguably redundant) ACPI/PNP device ID for a devices with an existing |
376 | identification string in the Device Tree (DT) namespace, especially if that ID | 376 | identification string in the Device Tree (DT) namespace, especially if that ID |
@@ -381,7 +381,7 @@ In ACPI, the device identification object called _CID (Compatible ID) is used to | |||
381 | list the IDs of devices the given one is compatible with, but those IDs must | 381 | list the IDs of devices the given one is compatible with, but those IDs must |
382 | belong to one of the namespaces prescribed by the ACPI specification (see | 382 | belong to one of the namespaces prescribed by the ACPI specification (see |
383 | Section 6.1.2 of ACPI 6.0 for details) and the DT namespace is not one of them. | 383 | Section 6.1.2 of ACPI 6.0 for details) and the DT namespace is not one of them. |
384 | Moreover, the specification mandates that either a _HID or an _ADR identificaion | 384 | Moreover, the specification mandates that either a _HID or an _ADR identification |
385 | object be present for all ACPI objects representing devices (Section 6.1 of ACPI | 385 | object be present for all ACPI objects representing devices (Section 6.1 of ACPI |
386 | 6.0). For non-enumerable bus types that object must be _HID and its value must | 386 | 6.0). For non-enumerable bus types that object must be _HID and its value must |
387 | be a device ID from one of the namespaces prescribed by the specification too. | 387 | be a device ID from one of the namespaces prescribed by the specification too. |
diff --git a/Documentation/admin-guide/index.rst b/Documentation/admin-guide/index.rst index 8ddae4e4299a..8c60a8a32a1a 100644 --- a/Documentation/admin-guide/index.rst +++ b/Documentation/admin-guide/index.rst | |||
@@ -60,6 +60,7 @@ configure specific aspects of kernel behavior to your liking. | |||
60 | mono | 60 | mono |
61 | java | 61 | java |
62 | ras | 62 | ras |
63 | pm/index | ||
63 | 64 | ||
64 | .. only:: subproject and html | 65 | .. only:: subproject and html |
65 | 66 | ||
diff --git a/Documentation/admin-guide/kernel-parameters.rst b/Documentation/admin-guide/kernel-parameters.rst index c74933ccf7c9..d76ab3907e2b 100644 --- a/Documentation/admin-guide/kernel-parameters.rst +++ b/Documentation/admin-guide/kernel-parameters.rst | |||
@@ -1,3 +1,5 @@ | |||
1 | .. _kernelparameters: | ||
2 | |||
1 | The kernel's command-line parameters | 3 | The kernel's command-line parameters |
2 | ==================================== | 4 | ==================================== |
3 | 5 | ||
@@ -196,7 +198,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
196 | 198 | ||
197 | Finally, the [KMG] suffix is commonly described after a number of kernel | 199 | Finally, the [KMG] suffix is commonly described after a number of kernel |
198 | parameter values. These 'K', 'M', and 'G' letters represent the _binary_ | 200 | parameter values. These 'K', 'M', and 'G' letters represent the _binary_ |
199 | multipliers 'Kilo', 'Mega', and 'Giga', equalling 2^10, 2^20, and 2^30 | 201 | multipliers 'Kilo', 'Mega', and 'Giga', equaling 2^10, 2^20, and 2^30 |
200 | bytes respectively. Such letter suffixes can also be entirely omitted: | 202 | bytes respectively. Such letter suffixes can also be entirely omitted: |
201 | 203 | ||
202 | .. include:: kernel-parameters.txt | 204 | .. include:: kernel-parameters.txt |
diff --git a/Documentation/admin-guide/pm/cpufreq.rst b/Documentation/admin-guide/pm/cpufreq.rst new file mode 100644 index 000000000000..289c80f7760e --- /dev/null +++ b/Documentation/admin-guide/pm/cpufreq.rst | |||
@@ -0,0 +1,700 @@ | |||
1 | .. |struct cpufreq_policy| replace:: :c:type:`struct cpufreq_policy <cpufreq_policy>` | ||
2 | |||
3 | ======================= | ||
4 | CPU Performance Scaling | ||
5 | ======================= | ||
6 | |||
7 | :: | ||
8 | |||
9 | Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
10 | |||
11 | The Concept of CPU Performance Scaling | ||
12 | ====================================== | ||
13 | |||
14 | The majority of modern processors are capable of operating in a number of | ||
15 | different clock frequency and voltage configurations, often referred to as | ||
16 | Operating Performance Points or P-states (in ACPI terminology). As a rule, | ||
17 | the higher the clock frequency and the higher the voltage, the more instructions | ||
18 | can be retired by the CPU over a unit of time, but also the higher the clock | ||
19 | frequency and the higher the voltage, the more energy is consumed over a unit of | ||
20 | time (or the more power is drawn) by the CPU in the given P-state. Therefore | ||
21 | there is a natural tradeoff between the CPU capacity (the number of instructions | ||
22 | that can be executed over a unit of time) and the power drawn by the CPU. | ||
23 | |||
24 | In some situations it is desirable or even necessary to run the program as fast | ||
25 | as possible and then there is no reason to use any P-states different from the | ||
26 | highest one (i.e. the highest-performance frequency/voltage configuration | ||
27 | available). In some other cases, however, it may not be necessary to execute | ||
28 | instructions so quickly and maintaining the highest available CPU capacity for a | ||
29 | relatively long time without utilizing it entirely may be regarded as wasteful. | ||
30 | It also may not be physically possible to maintain maximum CPU capacity for too | ||
31 | long for thermal or power supply capacity reasons or similar. To cover those | ||
32 | cases, there are hardware interfaces allowing CPUs to be switched between | ||
33 | different frequency/voltage configurations or (in the ACPI terminology) to be | ||
34 | put into different P-states. | ||
35 | |||
36 | Typically, they are used along with algorithms to estimate the required CPU | ||
37 | capacity, so as to decide which P-states to put the CPUs into. Of course, since | ||
38 | the utilization of the system generally changes over time, that has to be done | ||
39 | repeatedly on a regular basis. The activity by which this happens is referred | ||
40 | to as CPU performance scaling or CPU frequency scaling (because it involves | ||
41 | adjusting the CPU clock frequency). | ||
42 | |||
43 | |||
44 | CPU Performance Scaling in Linux | ||
45 | ================================ | ||
46 | |||
47 | The Linux kernel supports CPU performance scaling by means of the ``CPUFreq`` | ||
48 | (CPU Frequency scaling) subsystem that consists of three layers of code: the | ||
49 | core, scaling governors and scaling drivers. | ||
50 | |||
51 | The ``CPUFreq`` core provides the common code infrastructure and user space | ||
52 | interfaces for all platforms that support CPU performance scaling. It defines | ||
53 | the basic framework in which the other components operate. | ||
54 | |||
55 | Scaling governors implement algorithms to estimate the required CPU capacity. | ||
56 | As a rule, each governor implements one, possibly parametrized, scaling | ||
57 | algorithm. | ||
58 | |||
59 | Scaling drivers talk to the hardware. They provide scaling governors with | ||
60 | information on the available P-states (or P-state ranges in some cases) and | ||
61 | access platform-specific hardware interfaces to change CPU P-states as requested | ||
62 | by scaling governors. | ||
63 | |||
64 | In principle, all available scaling governors can be used with every scaling | ||
65 | driver. That design is based on the observation that the information used by | ||
66 | performance scaling algorithms for P-state selection can be represented in a | ||
67 | platform-independent form in the majority of cases, so it should be possible | ||
68 | to use the same performance scaling algorithm implemented in exactly the same | ||
69 | way regardless of which scaling driver is used. Consequently, the same set of | ||
70 | scaling governors should be suitable for every supported platform. | ||
71 | |||
72 | However, that observation may not hold for performance scaling algorithms | ||
73 | based on information provided by the hardware itself, for example through | ||
74 | feedback registers, as that information is typically specific to the hardware | ||
75 | interface it comes from and may not be easily represented in an abstract, | ||
76 | platform-independent way. For this reason, ``CPUFreq`` allows scaling drivers | ||
77 | to bypass the governor layer and implement their own performance scaling | ||
78 | algorithms. That is done by the ``intel_pstate`` scaling driver. | ||
79 | |||
80 | |||
81 | ``CPUFreq`` Policy Objects | ||
82 | ========================== | ||
83 | |||
84 | In some cases the hardware interface for P-state control is shared by multiple | ||
85 | CPUs. That is, for example, the same register (or set of registers) is used to | ||
86 | control the P-state of multiple CPUs at the same time and writing to it affects | ||
87 | all of those CPUs simultaneously. | ||
88 | |||
89 | Sets of CPUs sharing hardware P-state control interfaces are represented by | ||
90 | ``CPUFreq`` as |struct cpufreq_policy| objects. For consistency, | ||
91 | |struct cpufreq_policy| is also used when there is only one CPU in the given | ||
92 | set. | ||
93 | |||
94 | The ``CPUFreq`` core maintains a pointer to a |struct cpufreq_policy| object for | ||
95 | every CPU in the system, including CPUs that are currently offline. If multiple | ||
96 | CPUs share the same hardware P-state control interface, all of the pointers | ||
97 | corresponding to them point to the same |struct cpufreq_policy| object. | ||
98 | |||
99 | ``CPUFreq`` uses |struct cpufreq_policy| as its basic data type and the design | ||
100 | of its user space interface is based on the policy concept. | ||
101 | |||
102 | |||
103 | CPU Initialization | ||
104 | ================== | ||
105 | |||
106 | First of all, a scaling driver has to be registered for ``CPUFreq`` to work. | ||
107 | It is only possible to register one scaling driver at a time, so the scaling | ||
108 | driver is expected to be able to handle all CPUs in the system. | ||
109 | |||
110 | The scaling driver may be registered before or after CPU registration. If | ||
111 | CPUs are registered earlier, the driver core invokes the ``CPUFreq`` core to | ||
112 | take a note of all of the already registered CPUs during the registration of the | ||
113 | scaling driver. In turn, if any CPUs are registered after the registration of | ||
114 | the scaling driver, the ``CPUFreq`` core will be invoked to take note of them | ||
115 | at their registration time. | ||
116 | |||
117 | In any case, the ``CPUFreq`` core is invoked to take note of any logical CPU it | ||
118 | has not seen so far as soon as it is ready to handle that CPU. [Note that the | ||
119 | logical CPU may be a physical single-core processor, or a single core in a | ||
120 | multicore processor, or a hardware thread in a physical processor or processor | ||
121 | core. In what follows "CPU" always means "logical CPU" unless explicitly stated | ||
122 | otherwise and the word "processor" is used to refer to the physical part | ||
123 | possibly including multiple logical CPUs.] | ||
124 | |||
125 | Once invoked, the ``CPUFreq`` core checks if the policy pointer is already set | ||
126 | for the given CPU and if so, it skips the policy object creation. Otherwise, | ||
127 | a new policy object is created and initialized, which involves the creation of | ||
128 | a new policy directory in ``sysfs``, and the policy pointer corresponding to | ||
129 | the given CPU is set to the new policy object's address in memory. | ||
130 | |||
131 | Next, the scaling driver's ``->init()`` callback is invoked with the policy | ||
132 | pointer of the new CPU passed to it as the argument. That callback is expected | ||
133 | to initialize the performance scaling hardware interface for the given CPU (or, | ||
134 | more precisely, for the set of CPUs sharing the hardware interface it belongs | ||
135 | to, represented by its policy object) and, if the policy object it has been | ||
136 | called for is new, to set parameters of the policy, like the minimum and maximum | ||
137 | frequencies supported by the hardware, the table of available frequencies (if | ||
138 | the set of supported P-states is not a continuous range), and the mask of CPUs | ||
139 | that belong to the same policy (including both online and offline CPUs). That | ||
140 | mask is then used by the core to populate the policy pointers for all of the | ||
141 | CPUs in it. | ||
142 | |||
143 | The next major initialization step for a new policy object is to attach a | ||
144 | scaling governor to it (to begin with, that is the default scaling governor | ||
145 | determined by the kernel configuration, but it may be changed later | ||
146 | via ``sysfs``). First, a pointer to the new policy object is passed to the | ||
147 | governor's ``->init()`` callback which is expected to initialize all of the | ||
148 | data structures necessary to handle the given policy and, possibly, to add | ||
149 | a governor ``sysfs`` interface to it. Next, the governor is started by | ||
150 | invoking its ``->start()`` callback. | ||
151 | |||
152 | That callback it expected to register per-CPU utilization update callbacks for | ||
153 | all of the online CPUs belonging to the given policy with the CPU scheduler. | ||
154 | The utilization update callbacks will be invoked by the CPU scheduler on | ||
155 | important events, like task enqueue and dequeue, on every iteration of the | ||
156 | scheduler tick or generally whenever the CPU utilization may change (from the | ||
157 | scheduler's perspective). They are expected to carry out computations needed | ||
158 | to determine the P-state to use for the given policy going forward and to | ||
159 | invoke the scaling driver to make changes to the hardware in accordance with | ||
160 | the P-state selection. The scaling driver may be invoked directly from | ||
161 | scheduler context or asynchronously, via a kernel thread or workqueue, depending | ||
162 | on the configuration and capabilities of the scaling driver and the governor. | ||
163 | |||
164 | Similar steps are taken for policy objects that are not new, but were "inactive" | ||
165 | previously, meaning that all of the CPUs belonging to them were offline. The | ||
166 | only practical difference in that case is that the ``CPUFreq`` core will attempt | ||
167 | to use the scaling governor previously used with the policy that became | ||
168 | "inactive" (and is re-initialized now) instead of the default governor. | ||
169 | |||
170 | In turn, if a previously offline CPU is being brought back online, but some | ||
171 | other CPUs sharing the policy object with it are online already, there is no | ||
172 | need to re-initialize the policy object at all. In that case, it only is | ||
173 | necessary to restart the scaling governor so that it can take the new online CPU | ||
174 | into account. That is achieved by invoking the governor's ``->stop`` and | ||
175 | ``->start()`` callbacks, in this order, for the entire policy. | ||
176 | |||
177 | As mentioned before, the ``intel_pstate`` scaling driver bypasses the scaling | ||
178 | governor layer of ``CPUFreq`` and provides its own P-state selection algorithms. | ||
179 | Consequently, if ``intel_pstate`` is used, scaling governors are not attached to | ||
180 | new policy objects. Instead, the driver's ``->setpolicy()`` callback is invoked | ||
181 | to register per-CPU utilization update callbacks for each policy. These | ||
182 | callbacks are invoked by the CPU scheduler in the same way as for scaling | ||
183 | governors, but in the ``intel_pstate`` case they both determine the P-state to | ||
184 | use and change the hardware configuration accordingly in one go from scheduler | ||
185 | context. | ||
186 | |||
187 | The policy objects created during CPU initialization and other data structures | ||
188 | associated with them are torn down when the scaling driver is unregistered | ||
189 | (which happens when the kernel module containing it is unloaded, for example) or | ||
190 | when the last CPU belonging to the given policy in unregistered. | ||
191 | |||
192 | |||
193 | Policy Interface in ``sysfs`` | ||
194 | ============================= | ||
195 | |||
196 | During the initialization of the kernel, the ``CPUFreq`` core creates a | ||
197 | ``sysfs`` directory (kobject) called ``cpufreq`` under | ||
198 | :file:`/sys/devices/system/cpu/`. | ||
199 | |||
200 | That directory contains a ``policyX`` subdirectory (where ``X`` represents an | ||
201 | integer number) for every policy object maintained by the ``CPUFreq`` core. | ||
202 | Each ``policyX`` directory is pointed to by ``cpufreq`` symbolic links | ||
203 | under :file:`/sys/devices/system/cpu/cpuY/` (where ``Y`` represents an integer | ||
204 | that may be different from the one represented by ``X``) for all of the CPUs | ||
205 | associated with (or belonging to) the given policy. The ``policyX`` directories | ||
206 | in :file:`/sys/devices/system/cpu/cpufreq` each contain policy-specific | ||
207 | attributes (files) to control ``CPUFreq`` behavior for the corresponding policy | ||
208 | objects (that is, for all of the CPUs associated with them). | ||
209 | |||
210 | Some of those attributes are generic. They are created by the ``CPUFreq`` core | ||
211 | and their behavior generally does not depend on what scaling driver is in use | ||
212 | and what scaling governor is attached to the given policy. Some scaling drivers | ||
213 | also add driver-specific attributes to the policy directories in ``sysfs`` to | ||
214 | control policy-specific aspects of driver behavior. | ||
215 | |||
216 | The generic attributes under :file:`/sys/devices/system/cpu/cpufreq/policyX/` | ||
217 | are the following: | ||
218 | |||
219 | ``affected_cpus`` | ||
220 | List of online CPUs belonging to this policy (i.e. sharing the hardware | ||
221 | performance scaling interface represented by the ``policyX`` policy | ||
222 | object). | ||
223 | |||
224 | ``bios_limit`` | ||
225 | If the platform firmware (BIOS) tells the OS to apply an upper limit to | ||
226 | CPU frequencies, that limit will be reported through this attribute (if | ||
227 | present). | ||
228 | |||
229 | The existence of the limit may be a result of some (often unintentional) | ||
230 | BIOS settings, restrictions coming from a service processor or another | ||
231 | BIOS/HW-based mechanisms. | ||
232 | |||
233 | This does not cover ACPI thermal limitations which can be discovered | ||
234 | through a generic thermal driver. | ||
235 | |||
236 | This attribute is not present if the scaling driver in use does not | ||
237 | support it. | ||
238 | |||
239 | ``cpuinfo_max_freq`` | ||
240 | Maximum possible operating frequency the CPUs belonging to this policy | ||
241 | can run at (in kHz). | ||
242 | |||
243 | ``cpuinfo_min_freq`` | ||
244 | Minimum possible operating frequency the CPUs belonging to this policy | ||
245 | can run at (in kHz). | ||
246 | |||
247 | ``cpuinfo_transition_latency`` | ||
248 | The time it takes to switch the CPUs belonging to this policy from one | ||
249 | P-state to another, in nanoseconds. | ||
250 | |||
251 | If unknown or if known to be so high that the scaling driver does not | ||
252 | work with the `ondemand`_ governor, -1 (:c:macro:`CPUFREQ_ETERNAL`) | ||
253 | will be returned by reads from this attribute. | ||
254 | |||
255 | ``related_cpus`` | ||
256 | List of all (online and offline) CPUs belonging to this policy. | ||
257 | |||
258 | ``scaling_available_governors`` | ||
259 | List of ``CPUFreq`` scaling governors present in the kernel that can | ||
260 | be attached to this policy or (if the ``intel_pstate`` scaling driver is | ||
261 | in use) list of scaling algorithms provided by the driver that can be | ||
262 | applied to this policy. | ||
263 | |||
264 | [Note that some governors are modular and it may be necessary to load a | ||
265 | kernel module for the governor held by it to become available and be | ||
266 | listed by this attribute.] | ||
267 | |||
268 | ``scaling_cur_freq`` | ||
269 | Current frequency of all of the CPUs belonging to this policy (in kHz). | ||
270 | |||
271 | For the majority of scaling drivers, this is the frequency of the last | ||
272 | P-state requested by the driver from the hardware using the scaling | ||
273 | interface provided by it, which may or may not reflect the frequency | ||
274 | the CPU is actually running at (due to hardware design and other | ||
275 | limitations). | ||
276 | |||
277 | Some scaling drivers (e.g. ``intel_pstate``) attempt to provide | ||
278 | information more precisely reflecting the current CPU frequency through | ||
279 | this attribute, but that still may not be the exact current CPU | ||
280 | frequency as seen by the hardware at the moment. | ||
281 | |||
282 | ``scaling_driver`` | ||
283 | The scaling driver currently in use. | ||
284 | |||
285 | ``scaling_governor`` | ||
286 | The scaling governor currently attached to this policy or (if the | ||
287 | ``intel_pstate`` scaling driver is in use) the scaling algorithm | ||
288 | provided by the driver that is currently applied to this policy. | ||
289 | |||
290 | This attribute is read-write and writing to it will cause a new scaling | ||
291 | governor to be attached to this policy or a new scaling algorithm | ||
292 | provided by the scaling driver to be applied to it (in the | ||
293 | ``intel_pstate`` case), as indicated by the string written to this | ||
294 | attribute (which must be one of the names listed by the | ||
295 | ``scaling_available_governors`` attribute described above). | ||
296 | |||
297 | ``scaling_max_freq`` | ||
298 | Maximum frequency the CPUs belonging to this policy are allowed to be | ||
299 | running at (in kHz). | ||
300 | |||
301 | This attribute is read-write and writing a string representing an | ||
302 | integer to it will cause a new limit to be set (it must not be lower | ||
303 | than the value of the ``scaling_min_freq`` attribute). | ||
304 | |||
305 | ``scaling_min_freq`` | ||
306 | Minimum frequency the CPUs belonging to this policy are allowed to be | ||
307 | running at (in kHz). | ||
308 | |||
309 | This attribute is read-write and writing a string representing a | ||
310 | non-negative integer to it will cause a new limit to be set (it must not | ||
311 | be higher than the value of the ``scaling_max_freq`` attribute). | ||
312 | |||
313 | ``scaling_setspeed`` | ||
314 | This attribute is functional only if the `userspace`_ scaling governor | ||
315 | is attached to the given policy. | ||
316 | |||
317 | It returns the last frequency requested by the governor (in kHz) or can | ||
318 | be written to in order to set a new frequency for the policy. | ||
319 | |||
320 | |||
321 | Generic Scaling Governors | ||
322 | ========================= | ||
323 | |||
324 | ``CPUFreq`` provides generic scaling governors that can be used with all | ||
325 | scaling drivers. As stated before, each of them implements a single, possibly | ||
326 | parametrized, performance scaling algorithm. | ||
327 | |||
328 | Scaling governors are attached to policy objects and different policy objects | ||
329 | can be handled by different scaling governors at the same time (although that | ||
330 | may lead to suboptimal results in some cases). | ||
331 | |||
332 | The scaling governor for a given policy object can be changed at any time with | ||
333 | the help of the ``scaling_governor`` policy attribute in ``sysfs``. | ||
334 | |||
335 | Some governors expose ``sysfs`` attributes to control or fine-tune the scaling | ||
336 | algorithms implemented by them. Those attributes, referred to as governor | ||
337 | tunables, can be either global (system-wide) or per-policy, depending on the | ||
338 | scaling driver in use. If the driver requires governor tunables to be | ||
339 | per-policy, they are located in a subdirectory of each policy directory. | ||
340 | Otherwise, they are located in a subdirectory under | ||
341 | :file:`/sys/devices/system/cpu/cpufreq/`. In either case the name of the | ||
342 | subdirectory containing the governor tunables is the name of the governor | ||
343 | providing them. | ||
344 | |||
345 | ``performance`` | ||
346 | --------------- | ||
347 | |||
348 | When attached to a policy object, this governor causes the highest frequency, | ||
349 | within the ``scaling_max_freq`` policy limit, to be requested for that policy. | ||
350 | |||
351 | The request is made once at that time the governor for the policy is set to | ||
352 | ``performance`` and whenever the ``scaling_max_freq`` or ``scaling_min_freq`` | ||
353 | policy limits change after that. | ||
354 | |||
355 | ``powersave`` | ||
356 | ------------- | ||
357 | |||
358 | When attached to a policy object, this governor causes the lowest frequency, | ||
359 | within the ``scaling_min_freq`` policy limit, to be requested for that policy. | ||
360 | |||
361 | The request is made once at that time the governor for the policy is set to | ||
362 | ``powersave`` and whenever the ``scaling_max_freq`` or ``scaling_min_freq`` | ||
363 | policy limits change after that. | ||
364 | |||
365 | ``userspace`` | ||
366 | ------------- | ||
367 | |||
368 | This governor does not do anything by itself. Instead, it allows user space | ||
369 | to set the CPU frequency for the policy it is attached to by writing to the | ||
370 | ``scaling_setspeed`` attribute of that policy. | ||
371 | |||
372 | ``schedutil`` | ||
373 | ------------- | ||
374 | |||
375 | This governor uses CPU utilization data available from the CPU scheduler. It | ||
376 | generally is regarded as a part of the CPU scheduler, so it can access the | ||
377 | scheduler's internal data structures directly. | ||
378 | |||
379 | It runs entirely in scheduler context, although in some cases it may need to | ||
380 | invoke the scaling driver asynchronously when it decides that the CPU frequency | ||
381 | should be changed for a given policy (that depends on whether or not the driver | ||
382 | is capable of changing the CPU frequency from scheduler context). | ||
383 | |||
384 | The actions of this governor for a particular CPU depend on the scheduling class | ||
385 | invoking its utilization update callback for that CPU. If it is invoked by the | ||
386 | RT or deadline scheduling classes, the governor will increase the frequency to | ||
387 | the allowed maximum (that is, the ``scaling_max_freq`` policy limit). In turn, | ||
388 | if it is invoked by the CFS scheduling class, the governor will use the | ||
389 | Per-Entity Load Tracking (PELT) metric for the root control group of the | ||
390 | given CPU as the CPU utilization estimate (see the `Per-entity load tracking`_ | ||
391 | LWN.net article for a description of the PELT mechanism). Then, the new | ||
392 | CPU frequency to apply is computed in accordance with the formula | ||
393 | |||
394 | f = 1.25 * ``f_0`` * ``util`` / ``max`` | ||
395 | |||
396 | where ``util`` is the PELT number, ``max`` is the theoretical maximum of | ||
397 | ``util``, and ``f_0`` is either the maximum possible CPU frequency for the given | ||
398 | policy (if the PELT number is frequency-invariant), or the current CPU frequency | ||
399 | (otherwise). | ||
400 | |||
401 | This governor also employs a mechanism allowing it to temporarily bump up the | ||
402 | CPU frequency for tasks that have been waiting on I/O most recently, called | ||
403 | "IO-wait boosting". That happens when the :c:macro:`SCHED_CPUFREQ_IOWAIT` flag | ||
404 | is passed by the scheduler to the governor callback which causes the frequency | ||
405 | to go up to the allowed maximum immediately and then draw back to the value | ||
406 | returned by the above formula over time. | ||
407 | |||
408 | This governor exposes only one tunable: | ||
409 | |||
410 | ``rate_limit_us`` | ||
411 | Minimum time (in microseconds) that has to pass between two consecutive | ||
412 | runs of governor computations (default: 1000 times the scaling driver's | ||
413 | transition latency). | ||
414 | |||
415 | The purpose of this tunable is to reduce the scheduler context overhead | ||
416 | of the governor which might be excessive without it. | ||
417 | |||
418 | This governor generally is regarded as a replacement for the older `ondemand`_ | ||
419 | and `conservative`_ governors (described below), as it is simpler and more | ||
420 | tightly integrated with the CPU scheduler, its overhead in terms of CPU context | ||
421 | switches and similar is less significant, and it uses the scheduler's own CPU | ||
422 | utilization metric, so in principle its decisions should not contradict the | ||
423 | decisions made by the other parts of the scheduler. | ||
424 | |||
425 | ``ondemand`` | ||
426 | ------------ | ||
427 | |||
428 | This governor uses CPU load as a CPU frequency selection metric. | ||
429 | |||
430 | In order to estimate the current CPU load, it measures the time elapsed between | ||
431 | consecutive invocations of its worker routine and computes the fraction of that | ||
432 | time in which the given CPU was not idle. The ratio of the non-idle (active) | ||
433 | time to the total CPU time is taken as an estimate of the load. | ||
434 | |||
435 | If this governor is attached to a policy shared by multiple CPUs, the load is | ||
436 | estimated for all of them and the greatest result is taken as the load estimate | ||
437 | for the entire policy. | ||
438 | |||
439 | The worker routine of this governor has to run in process context, so it is | ||
440 | invoked asynchronously (via a workqueue) and CPU P-states are updated from | ||
441 | there if necessary. As a result, the scheduler context overhead from this | ||
442 | governor is minimum, but it causes additional CPU context switches to happen | ||
443 | relatively often and the CPU P-state updates triggered by it can be relatively | ||
444 | irregular. Also, it affects its own CPU load metric by running code that | ||
445 | reduces the CPU idle time (even though the CPU idle time is only reduced very | ||
446 | slightly by it). | ||
447 | |||
448 | It generally selects CPU frequencies proportional to the estimated load, so that | ||
449 | the value of the ``cpuinfo_max_freq`` policy attribute corresponds to the load of | ||
450 | 1 (or 100%), and the value of the ``cpuinfo_min_freq`` policy attribute | ||
451 | corresponds to the load of 0, unless when the load exceeds a (configurable) | ||
452 | speedup threshold, in which case it will go straight for the highest frequency | ||
453 | it is allowed to use (the ``scaling_max_freq`` policy limit). | ||
454 | |||
455 | This governor exposes the following tunables: | ||
456 | |||
457 | ``sampling_rate`` | ||
458 | This is how often the governor's worker routine should run, in | ||
459 | microseconds. | ||
460 | |||
461 | Typically, it is set to values of the order of 10000 (10 ms). Its | ||
462 | default value is equal to the value of ``cpuinfo_transition_latency`` | ||
463 | for each policy this governor is attached to (but since the unit here | ||
464 | is greater by 1000, this means that the time represented by | ||
465 | ``sampling_rate`` is 1000 times greater than the transition latency by | ||
466 | default). | ||
467 | |||
468 | If this tunable is per-policy, the following shell command sets the time | ||
469 | represented by it to be 750 times as high as the transition latency:: | ||
470 | |||
471 | # echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate | ||
472 | |||
473 | |||
474 | ``min_sampling_rate`` | ||
475 | The minimum value of ``sampling_rate``. | ||
476 | |||
477 | Equal to 10000 (10 ms) if :c:macro:`CONFIG_NO_HZ_COMMON` and | ||
478 | :c:data:`tick_nohz_active` are both set or to 20 times the value of | ||
479 | :c:data:`jiffies` in microseconds otherwise. | ||
480 | |||
481 | ``up_threshold`` | ||
482 | If the estimated CPU load is above this value (in percent), the governor | ||
483 | will set the frequency to the maximum value allowed for the policy. | ||
484 | Otherwise, the selected frequency will be proportional to the estimated | ||
485 | CPU load. | ||
486 | |||
487 | ``ignore_nice_load`` | ||
488 | If set to 1 (default 0), it will cause the CPU load estimation code to | ||
489 | treat the CPU time spent on executing tasks with "nice" levels greater | ||
490 | than 0 as CPU idle time. | ||
491 | |||
492 | This may be useful if there are tasks in the system that should not be | ||
493 | taken into account when deciding what frequency to run the CPUs at. | ||
494 | Then, to make that happen it is sufficient to increase the "nice" level | ||
495 | of those tasks above 0 and set this attribute to 1. | ||
496 | |||
497 | ``sampling_down_factor`` | ||
498 | Temporary multiplier, between 1 (default) and 100 inclusive, to apply to | ||
499 | the ``sampling_rate`` value if the CPU load goes above ``up_threshold``. | ||
500 | |||
501 | This causes the next execution of the governor's worker routine (after | ||
502 | setting the frequency to the allowed maximum) to be delayed, so the | ||
503 | frequency stays at the maximum level for a longer time. | ||
504 | |||
505 | Frequency fluctuations in some bursty workloads may be avoided this way | ||
506 | at the cost of additional energy spent on maintaining the maximum CPU | ||
507 | capacity. | ||
508 | |||
509 | ``powersave_bias`` | ||
510 | Reduction factor to apply to the original frequency target of the | ||
511 | governor (including the maximum value used when the ``up_threshold`` | ||
512 | value is exceeded by the estimated CPU load) or sensitivity threshold | ||
513 | for the AMD frequency sensitivity powersave bias driver | ||
514 | (:file:`drivers/cpufreq/amd_freq_sensitivity.c`), between 0 and 1000 | ||
515 | inclusive. | ||
516 | |||
517 | If the AMD frequency sensitivity powersave bias driver is not loaded, | ||
518 | the effective frequency to apply is given by | ||
519 | |||
520 | f * (1 - ``powersave_bias`` / 1000) | ||
521 | |||
522 | where f is the governor's original frequency target. The default value | ||
523 | of this attribute is 0 in that case. | ||
524 | |||
525 | If the AMD frequency sensitivity powersave bias driver is loaded, the | ||
526 | value of this attribute is 400 by default and it is used in a different | ||
527 | way. | ||
528 | |||
529 | On Family 16h (and later) AMD processors there is a mechanism to get a | ||
530 | measured workload sensitivity, between 0 and 100% inclusive, from the | ||
531 | hardware. That value can be used to estimate how the performance of the | ||
532 | workload running on a CPU will change in response to frequency changes. | ||
533 | |||
534 | The performance of a workload with the sensitivity of 0 (memory-bound or | ||
535 | IO-bound) is not expected to increase at all as a result of increasing | ||
536 | the CPU frequency, whereas workloads with the sensitivity of 100% | ||
537 | (CPU-bound) are expected to perform much better if the CPU frequency is | ||
538 | increased. | ||
539 | |||
540 | If the workload sensitivity is less than the threshold represented by | ||
541 | the ``powersave_bias`` value, the sensitivity powersave bias driver | ||
542 | will cause the governor to select a frequency lower than its original | ||
543 | target, so as to avoid over-provisioning workloads that will not benefit | ||
544 | from running at higher CPU frequencies. | ||
545 | |||
546 | ``conservative`` | ||
547 | ---------------- | ||
548 | |||
549 | This governor uses CPU load as a CPU frequency selection metric. | ||
550 | |||
551 | It estimates the CPU load in the same way as the `ondemand`_ governor described | ||
552 | above, but the CPU frequency selection algorithm implemented by it is different. | ||
553 | |||
554 | Namely, it avoids changing the frequency significantly over short time intervals | ||
555 | which may not be suitable for systems with limited power supply capacity (e.g. | ||
556 | battery-powered). To achieve that, it changes the frequency in relatively | ||
557 | small steps, one step at a time, up or down - depending on whether or not a | ||
558 | (configurable) threshold has been exceeded by the estimated CPU load. | ||
559 | |||
560 | This governor exposes the following tunables: | ||
561 | |||
562 | ``freq_step`` | ||
563 | Frequency step in percent of the maximum frequency the governor is | ||
564 | allowed to set (the ``scaling_max_freq`` policy limit), between 0 and | ||
565 | 100 (5 by default). | ||
566 | |||
567 | This is how much the frequency is allowed to change in one go. Setting | ||
568 | it to 0 will cause the default frequency step (5 percent) to be used | ||
569 | and setting it to 100 effectively causes the governor to periodically | ||
570 | switch the frequency between the ``scaling_min_freq`` and | ||
571 | ``scaling_max_freq`` policy limits. | ||
572 | |||
573 | ``down_threshold`` | ||
574 | Threshold value (in percent, 20 by default) used to determine the | ||
575 | frequency change direction. | ||
576 | |||
577 | If the estimated CPU load is greater than this value, the frequency will | ||
578 | go up (by ``freq_step``). If the load is less than this value (and the | ||
579 | ``sampling_down_factor`` mechanism is not in effect), the frequency will | ||
580 | go down. Otherwise, the frequency will not be changed. | ||
581 | |||
582 | ``sampling_down_factor`` | ||
583 | Frequency decrease deferral factor, between 1 (default) and 10 | ||
584 | inclusive. | ||
585 | |||
586 | It effectively causes the frequency to go down ``sampling_down_factor`` | ||
587 | times slower than it ramps up. | ||
588 | |||
589 | |||
590 | Frequency Boost Support | ||
591 | ======================= | ||
592 | |||
593 | Background | ||
594 | ---------- | ||
595 | |||
596 | Some processors support a mechanism to raise the operating frequency of some | ||
597 | cores in a multicore package temporarily (and above the sustainable frequency | ||
598 | threshold for the whole package) under certain conditions, for example if the | ||
599 | whole chip is not fully utilized and below its intended thermal or power budget. | ||
600 | |||
601 | Different names are used by different vendors to refer to this functionality. | ||
602 | For Intel processors it is referred to as "Turbo Boost", AMD calls it | ||
603 | "Turbo-Core" or (in technical documentation) "Core Performance Boost" and so on. | ||
604 | As a rule, it also is implemented differently by different vendors. The simple | ||
605 | term "frequency boost" is used here for brevity to refer to all of those | ||
606 | implementations. | ||
607 | |||
608 | The frequency boost mechanism may be either hardware-based or software-based. | ||
609 | If it is hardware-based (e.g. on x86), the decision to trigger the boosting is | ||
610 | made by the hardware (although in general it requires the hardware to be put | ||
611 | into a special state in which it can control the CPU frequency within certain | ||
612 | limits). If it is software-based (e.g. on ARM), the scaling driver decides | ||
613 | whether or not to trigger boosting and when to do that. | ||
614 | |||
615 | The ``boost`` File in ``sysfs`` | ||
616 | ------------------------------- | ||
617 | |||
618 | This file is located under :file:`/sys/devices/system/cpu/cpufreq/` and controls | ||
619 | the "boost" setting for the whole system. It is not present if the underlying | ||
620 | scaling driver does not support the frequency boost mechanism (or supports it, | ||
621 | but provides a driver-specific interface for controlling it, like | ||
622 | ``intel_pstate``). | ||
623 | |||
624 | If the value in this file is 1, the frequency boost mechanism is enabled. This | ||
625 | means that either the hardware can be put into states in which it is able to | ||
626 | trigger boosting (in the hardware-based case), or the software is allowed to | ||
627 | trigger boosting (in the software-based case). It does not mean that boosting | ||
628 | is actually in use at the moment on any CPUs in the system. It only means a | ||
629 | permission to use the frequency boost mechanism (which still may never be used | ||
630 | for other reasons). | ||
631 | |||
632 | If the value in this file is 0, the frequency boost mechanism is disabled and | ||
633 | cannot be used at all. | ||
634 | |||
635 | The only values that can be written to this file are 0 and 1. | ||
636 | |||
637 | Rationale for Boost Control Knob | ||
638 | -------------------------------- | ||
639 | |||
640 | The frequency boost mechanism is generally intended to help to achieve optimum | ||
641 | CPU performance on time scales below software resolution (e.g. below the | ||
642 | scheduler tick interval) and it is demonstrably suitable for many workloads, but | ||
643 | it may lead to problems in certain situations. | ||
644 | |||
645 | For this reason, many systems make it possible to disable the frequency boost | ||
646 | mechanism in the platform firmware (BIOS) setup, but that requires the system to | ||
647 | be restarted for the setting to be adjusted as desired, which may not be | ||
648 | practical at least in some cases. For example: | ||
649 | |||
650 | 1. Boosting means overclocking the processor, although under controlled | ||
651 | conditions. Generally, the processor's energy consumption increases | ||
652 | as a result of increasing its frequency and voltage, even temporarily. | ||
653 | That may not be desirable on systems that switch to power sources of | ||
654 | limited capacity, such as batteries, so the ability to disable the boost | ||
655 | mechanism while the system is running may help there (but that depends on | ||
656 | the workload too). | ||
657 | |||
658 | 2. In some situations deterministic behavior is more important than | ||
659 | performance or energy consumption (or both) and the ability to disable | ||
660 | boosting while the system is running may be useful then. | ||
661 | |||
662 | 3. To examine the impact of the frequency boost mechanism itself, it is useful | ||
663 | to be able to run tests with and without boosting, preferably without | ||
664 | restarting the system in the meantime. | ||
665 | |||
666 | 4. Reproducible results are important when running benchmarks. Since | ||
667 | the boosting functionality depends on the load of the whole package, | ||
668 | single-thread performance may vary because of it which may lead to | ||
669 | unreproducible results sometimes. That can be avoided by disabling the | ||
670 | frequency boost mechanism before running benchmarks sensitive to that | ||
671 | issue. | ||
672 | |||
673 | Legacy AMD ``cpb`` Knob | ||
674 | ----------------------- | ||
675 | |||
676 | The AMD powernow-k8 scaling driver supports a ``sysfs`` knob very similar to | ||
677 | the global ``boost`` one. It is used for disabling/enabling the "Core | ||
678 | Performance Boost" feature of some AMD processors. | ||
679 | |||
680 | If present, that knob is located in every ``CPUFreq`` policy directory in | ||
681 | ``sysfs`` (:file:`/sys/devices/system/cpu/cpufreq/policyX/`) and is called | ||
682 | ``cpb``, which indicates a more fine grained control interface. The actual | ||
683 | implementation, however, works on the system-wide basis and setting that knob | ||
684 | for one policy causes the same value of it to be set for all of the other | ||
685 | policies at the same time. | ||
686 | |||
687 | That knob is still supported on AMD processors that support its underlying | ||
688 | hardware feature, but it may be configured out of the kernel (via the | ||
689 | :c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configuration option) and the global | ||
690 | ``boost`` knob is present regardless. Thus it is always possible use the | ||
691 | ``boost`` knob instead of the ``cpb`` one which is highly recommended, as that | ||
692 | is more consistent with what all of the other systems do (and the ``cpb`` knob | ||
693 | may not be supported any more in the future). | ||
694 | |||
695 | The ``cpb`` knob is never present for any processors without the underlying | ||
696 | hardware feature (e.g. all Intel ones), even if the | ||
697 | :c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configuration option is set. | ||
698 | |||
699 | |||
700 | .. _Per-entity load tracking: https://lwn.net/Articles/531853/ | ||
diff --git a/Documentation/admin-guide/pm/index.rst b/Documentation/admin-guide/pm/index.rst new file mode 100644 index 000000000000..c80f087321fc --- /dev/null +++ b/Documentation/admin-guide/pm/index.rst | |||
@@ -0,0 +1,15 @@ | |||
1 | ================ | ||
2 | Power Management | ||
3 | ================ | ||
4 | |||
5 | .. toctree:: | ||
6 | :maxdepth: 2 | ||
7 | |||
8 | cpufreq | ||
9 | |||
10 | .. only:: subproject and html | ||
11 | |||
12 | Indices | ||
13 | ======= | ||
14 | |||
15 | * :ref:`genindex` | ||
diff --git a/Documentation/admin-guide/ras.rst b/Documentation/admin-guide/ras.rst index 1b90c6f00a92..8c7bbf2c88d2 100644 --- a/Documentation/admin-guide/ras.rst +++ b/Documentation/admin-guide/ras.rst | |||
@@ -8,7 +8,7 @@ RAS concepts | |||
8 | ************ | 8 | ************ |
9 | 9 | ||
10 | Reliability, Availability and Serviceability (RAS) is a concept used on | 10 | Reliability, Availability and Serviceability (RAS) is a concept used on |
11 | servers meant to measure their robusteness. | 11 | servers meant to measure their robustness. |
12 | 12 | ||
13 | Reliability | 13 | Reliability |
14 | is the probability that a system will produce correct outputs. | 14 | is the probability that a system will produce correct outputs. |
@@ -42,13 +42,13 @@ Among the monitoring measures, the most usual ones include: | |||
42 | 42 | ||
43 | * CPU – detect errors at instruction execution and at L1/L2/L3 caches; | 43 | * CPU – detect errors at instruction execution and at L1/L2/L3 caches; |
44 | * Memory – add error correction logic (ECC) to detect and correct errors; | 44 | * Memory – add error correction logic (ECC) to detect and correct errors; |
45 | * I/O – add CRC checksums for tranfered data; | 45 | * I/O – add CRC checksums for transferred data; |
46 | * Storage – RAID, journal file systems, checksums, | 46 | * Storage – RAID, journal file systems, checksums, |
47 | Self-Monitoring, Analysis and Reporting Technology (SMART). | 47 | Self-Monitoring, Analysis and Reporting Technology (SMART). |
48 | 48 | ||
49 | By monitoring the number of occurrences of error detections, it is possible | 49 | By monitoring the number of occurrences of error detections, it is possible |
50 | to identify if the probability of hardware errors is increasing, and, on such | 50 | to identify if the probability of hardware errors is increasing, and, on such |
51 | case, do a preventive maintainance to replace a degrated component while | 51 | case, do a preventive maintenance to replace a degraded component while |
52 | those errors are correctable. | 52 | those errors are correctable. |
53 | 53 | ||
54 | Types of errors | 54 | Types of errors |
@@ -121,7 +121,7 @@ using the ``dmidecode`` tool. For example, on a desktop machine, it shows:: | |||
121 | On the above example, a DDR4 SO-DIMM memory module is located at the | 121 | On the above example, a DDR4 SO-DIMM memory module is located at the |
122 | system's memory labeled as "BANK 0", as given by the *bank locator* field. | 122 | system's memory labeled as "BANK 0", as given by the *bank locator* field. |
123 | Please notice that, on such system, the *total width* is equal to the | 123 | Please notice that, on such system, the *total width* is equal to the |
124 | *data witdh*. It means that such memory module doesn't have error | 124 | *data width*. It means that such memory module doesn't have error |
125 | detection/correction mechanisms. | 125 | detection/correction mechanisms. |
126 | 126 | ||
127 | Unfortunately, not all systems use the same field to specify the memory | 127 | Unfortunately, not all systems use the same field to specify the memory |
@@ -145,7 +145,7 @@ bank. On this example, from an older server, ``dmidecode`` shows:: | |||
145 | 145 | ||
146 | There, the DDR3 RDIMM memory module is located at the system's memory labeled | 146 | There, the DDR3 RDIMM memory module is located at the system's memory labeled |
147 | as "DIMM_A1", as given by the *locator* field. Please notice that this | 147 | as "DIMM_A1", as given by the *locator* field. Please notice that this |
148 | memory module has 64 bits of *data witdh* and 72 bits of *total width*. So, | 148 | memory module has 64 bits of *data width* and 72 bits of *total width*. So, |
149 | it has 8 extra bits to be used by error detection and correction mechanisms. | 149 | it has 8 extra bits to be used by error detection and correction mechanisms. |
150 | Such kind of memory is called Error-correcting code memory (ECC memory). | 150 | Such kind of memory is called Error-correcting code memory (ECC memory). |
151 | 151 | ||
@@ -186,7 +186,7 @@ Architecture (MCA)\ [#f3]_. | |||
186 | .. [#f1] Please notice that several memory controllers allow operation on a | 186 | .. [#f1] Please notice that several memory controllers allow operation on a |
187 | mode called "Lock-Step", where it groups two memory modules together, | 187 | mode called "Lock-Step", where it groups two memory modules together, |
188 | doing 128-bit reads/writes. That gives 16 bits for error correction, with | 188 | doing 128-bit reads/writes. That gives 16 bits for error correction, with |
189 | significatively improves the error correction mechanism, at the expense | 189 | significantly improves the error correction mechanism, at the expense |
190 | that, when an error happens, there's no way to know what memory module is | 190 | that, when an error happens, there's no way to know what memory module is |
191 | to blame. So, it has to blame both memory modules. | 191 | to blame. So, it has to blame both memory modules. |
192 | 192 | ||
diff --git a/Documentation/admin-guide/security-bugs.rst b/Documentation/admin-guide/security-bugs.rst index 4f7414cad586..47574b382d75 100644 --- a/Documentation/admin-guide/security-bugs.rst +++ b/Documentation/admin-guide/security-bugs.rst | |||
@@ -14,14 +14,17 @@ Contact | |||
14 | The Linux kernel security team can be contacted by email at | 14 | The Linux kernel security team can be contacted by email at |
15 | <security@kernel.org>. This is a private list of security officers | 15 | <security@kernel.org>. This is a private list of security officers |
16 | who will help verify the bug report and develop and release a fix. | 16 | who will help verify the bug report and develop and release a fix. |
17 | It is possible that the security team will bring in extra help from | 17 | If you already have a fix, please include it with your report, as |
18 | area maintainers to understand and fix the security vulnerability. | 18 | that can speed up the process considerably. It is possible that the |
19 | security team will bring in extra help from area maintainers to | ||
20 | understand and fix the security vulnerability. | ||
19 | 21 | ||
20 | As it is with any bug, the more information provided the easier it | 22 | As it is with any bug, the more information provided the easier it |
21 | will be to diagnose and fix. Please review the procedure outlined in | 23 | will be to diagnose and fix. Please review the procedure outlined in |
22 | admin-guide/reporting-bugs.rst if you are unclear about what information is helpful. | 24 | admin-guide/reporting-bugs.rst if you are unclear about what |
23 | Any exploit code is very helpful and will not be released without | 25 | information is helpful. Any exploit code is very helpful and will not |
24 | consent from the reporter unless it has already been made public. | 26 | be released without consent from the reporter unless it has already been |
27 | made public. | ||
25 | 28 | ||
26 | Disclosure | 29 | Disclosure |
27 | ---------- | 30 | ---------- |
@@ -39,6 +42,32 @@ disclosure is from immediate (esp. if it's already publicly known) | |||
39 | to a few weeks. As a basic default policy, we expect report date to | 42 | to a few weeks. As a basic default policy, we expect report date to |
40 | disclosure date to be on the order of 7 days. | 43 | disclosure date to be on the order of 7 days. |
41 | 44 | ||
45 | Coordination | ||
46 | ------------ | ||
47 | |||
48 | Fixes for sensitive bugs, such as those that might lead to privilege | ||
49 | escalations, may need to be coordinated with the private | ||
50 | <linux-distros@vs.openwall.org> mailing list so that distribution vendors | ||
51 | are well prepared to issue a fixed kernel upon public disclosure of the | ||
52 | upstream fix. Distros will need some time to test the proposed patch and | ||
53 | will generally request at least a few days of embargo, and vendor update | ||
54 | publication prefers to happen Tuesday through Thursday. When appropriate, | ||
55 | the security team can assist with this coordination, or the reporter can | ||
56 | include linux-distros from the start. In this case, remember to prefix | ||
57 | the email Subject line with "[vs]" as described in the linux-distros wiki: | ||
58 | <http://oss-security.openwall.org/wiki/mailing-lists/distros#how-to-use-the-lists> | ||
59 | |||
60 | CVE assignment | ||
61 | -------------- | ||
62 | |||
63 | The security team does not normally assign CVEs, nor do we require them | ||
64 | for reports or fixes, as this can needlessly complicate the process and | ||
65 | may delay the bug handling. If a reporter wishes to have a CVE identifier | ||
66 | assigned ahead of public disclosure, they will need to contact the private | ||
67 | linux-distros list, described above. When such a CVE identifier is known | ||
68 | before a patch is provided, it is desirable to mention it in the commit | ||
69 | message, though. | ||
70 | |||
42 | Non-disclosure agreements | 71 | Non-disclosure agreements |
43 | ------------------------- | 72 | ------------------------- |
44 | 73 | ||
diff --git a/Documentation/admin-guide/sysrq.rst b/Documentation/admin-guide/sysrq.rst index d1712ea2d314..7b9035c01a2e 100644 --- a/Documentation/admin-guide/sysrq.rst +++ b/Documentation/admin-guide/sysrq.rst | |||
@@ -212,7 +212,8 @@ I hit SysRq, but nothing seems to happen, what's wrong? | |||
212 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 212 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
213 | 213 | ||
214 | There are some keyboards that produce a different keycode for SysRq than the | 214 | There are some keyboards that produce a different keycode for SysRq than the |
215 | pre-defined value of 99 (see ``KEY_SYSRQ`` in ``include/linux/input.h``), or | 215 | pre-defined value of 99 |
216 | (see ``KEY_SYSRQ`` in ``include/uapi/linux/input-event-codes.h``), or | ||
216 | which don't have a SysRq key at all. In these cases, run ``showkey -s`` to find | 217 | which don't have a SysRq key at all. In these cases, run ``showkey -s`` to find |
217 | an appropriate scancode sequence, and use ``setkeycodes <sequence> 99`` to map | 218 | an appropriate scancode sequence, and use ``setkeycodes <sequence> 99`` to map |
218 | this sequence to the usual SysRq code (e.g., ``setkeycodes e05b 99``). It's | 219 | this sequence to the usual SysRq code (e.g., ``setkeycodes e05b 99``). It's |
diff --git a/Documentation/arm/mem_alignment b/Documentation/arm/mem_alignment index c7c7a114c78c..6335fcacbba9 100644 --- a/Documentation/arm/mem_alignment +++ b/Documentation/arm/mem_alignment | |||
@@ -48,7 +48,7 @@ Note that not all combinations are supported - only values 0 through 5. | |||
48 | For example, the following will turn on the warnings, but without | 48 | For example, the following will turn on the warnings, but without |
49 | fixing up or sending SIGBUS signals: | 49 | fixing up or sending SIGBUS signals: |
50 | 50 | ||
51 | echo 1 > /proc/sys/debug/alignment | 51 | echo 1 > /proc/cpu/alignment |
52 | 52 | ||
53 | You can also read the content of the same file to get statistical | 53 | You can also read the content of the same file to get statistical |
54 | information on unaligned access occurrences plus the current mode of | 54 | information on unaligned access occurrences plus the current mode of |
diff --git a/Documentation/conf.py b/Documentation/conf.py index 7fadb3b83293..08aef4595059 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py | |||
@@ -17,7 +17,7 @@ import os | |||
17 | import sphinx | 17 | import sphinx |
18 | 18 | ||
19 | # Get Sphinx version | 19 | # Get Sphinx version |
20 | major, minor, patch = map(int, sphinx.__version__.split(".")) | 20 | major, minor, patch = sphinx.version_info[:3] |
21 | 21 | ||
22 | 22 | ||
23 | # If extensions (or modules to document with autodoc) are in another directory, | 23 | # If extensions (or modules to document with autodoc) are in another directory, |
@@ -29,12 +29,12 @@ from load_config import loadConfig | |||
29 | # -- General configuration ------------------------------------------------ | 29 | # -- General configuration ------------------------------------------------ |
30 | 30 | ||
31 | # If your documentation needs a minimal Sphinx version, state it here. | 31 | # If your documentation needs a minimal Sphinx version, state it here. |
32 | #needs_sphinx = '1.0' | 32 | needs_sphinx = '1.2' |
33 | 33 | ||
34 | # Add any Sphinx extension module names here, as strings. They can be | 34 | # Add any Sphinx extension module names here, as strings. They can be |
35 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | 35 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
36 | # ones. | 36 | # ones. |
37 | extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain'] | 37 | extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure'] |
38 | 38 | ||
39 | # The name of the math extension changed on Sphinx 1.4 | 39 | # The name of the math extension changed on Sphinx 1.4 |
40 | if major == 1 and minor > 3: | 40 | if major == 1 and minor > 3: |
diff --git a/Documentation/core-api/flexible-arrays.rst b/Documentation/core-api/flexible-arrays.rst new file mode 100644 index 000000000000..b6b85a1b518e --- /dev/null +++ b/Documentation/core-api/flexible-arrays.rst | |||
@@ -0,0 +1,130 @@ | |||
1 | |||
2 | =================================== | ||
3 | Using flexible arrays in the kernel | ||
4 | =================================== | ||
5 | |||
6 | Large contiguous memory allocations can be unreliable in the Linux kernel. | ||
7 | Kernel programmers will sometimes respond to this problem by allocating | ||
8 | pages with :c:func:`vmalloc()`. This solution not ideal, though. On 32-bit | ||
9 | systems, memory from vmalloc() must be mapped into a relatively small address | ||
10 | space; it's easy to run out. On SMP systems, the page table changes required | ||
11 | by vmalloc() allocations can require expensive cross-processor interrupts on | ||
12 | all CPUs. And, on all systems, use of space in the vmalloc() range increases | ||
13 | pressure on the translation lookaside buffer (TLB), reducing the performance | ||
14 | of the system. | ||
15 | |||
16 | In many cases, the need for memory from vmalloc() can be eliminated by piecing | ||
17 | together an array from smaller parts; the flexible array library exists to make | ||
18 | this task easier. | ||
19 | |||
20 | A flexible array holds an arbitrary (within limits) number of fixed-sized | ||
21 | objects, accessed via an integer index. Sparse arrays are handled | ||
22 | reasonably well. Only single-page allocations are made, so memory | ||
23 | allocation failures should be relatively rare. The down sides are that the | ||
24 | arrays cannot be indexed directly, individual object size cannot exceed the | ||
25 | system page size, and putting data into a flexible array requires a copy | ||
26 | operation. It's also worth noting that flexible arrays do no internal | ||
27 | locking at all; if concurrent access to an array is possible, then the | ||
28 | caller must arrange for appropriate mutual exclusion. | ||
29 | |||
30 | The creation of a flexible array is done with :c:func:`flex_array_alloc()`:: | ||
31 | |||
32 | #include <linux/flex_array.h> | ||
33 | |||
34 | struct flex_array *flex_array_alloc(int element_size, | ||
35 | unsigned int total, | ||
36 | gfp_t flags); | ||
37 | |||
38 | The individual object size is provided by ``element_size``, while total is the | ||
39 | maximum number of objects which can be stored in the array. The flags | ||
40 | argument is passed directly to the internal memory allocation calls. With | ||
41 | the current code, using flags to ask for high memory is likely to lead to | ||
42 | notably unpleasant side effects. | ||
43 | |||
44 | It is also possible to define flexible arrays at compile time with:: | ||
45 | |||
46 | DEFINE_FLEX_ARRAY(name, element_size, total); | ||
47 | |||
48 | This macro will result in a definition of an array with the given name; the | ||
49 | element size and total will be checked for validity at compile time. | ||
50 | |||
51 | Storing data into a flexible array is accomplished with a call to | ||
52 | :c:func:`flex_array_put()`:: | ||
53 | |||
54 | int flex_array_put(struct flex_array *array, unsigned int element_nr, | ||
55 | void *src, gfp_t flags); | ||
56 | |||
57 | This call will copy the data from src into the array, in the position | ||
58 | indicated by ``element_nr`` (which must be less than the maximum specified when | ||
59 | the array was created). If any memory allocations must be performed, flags | ||
60 | will be used. The return value is zero on success, a negative error code | ||
61 | otherwise. | ||
62 | |||
63 | There might possibly be a need to store data into a flexible array while | ||
64 | running in some sort of atomic context; in this situation, sleeping in the | ||
65 | memory allocator would be a bad thing. That can be avoided by using | ||
66 | ``GFP_ATOMIC`` for the flags value, but, often, there is a better way. The | ||
67 | trick is to ensure that any needed memory allocations are done before | ||
68 | entering atomic context, using :c:func:`flex_array_prealloc()`:: | ||
69 | |||
70 | int flex_array_prealloc(struct flex_array *array, unsigned int start, | ||
71 | unsigned int nr_elements, gfp_t flags); | ||
72 | |||
73 | This function will ensure that memory for the elements indexed in the range | ||
74 | defined by ``start`` and ``nr_elements`` has been allocated. Thereafter, a | ||
75 | ``flex_array_put()`` call on an element in that range is guaranteed not to | ||
76 | block. | ||
77 | |||
78 | Getting data back out of the array is done with :c:func:`flex_array_get()`:: | ||
79 | |||
80 | void *flex_array_get(struct flex_array *fa, unsigned int element_nr); | ||
81 | |||
82 | The return value is a pointer to the data element, or NULL if that | ||
83 | particular element has never been allocated. | ||
84 | |||
85 | Note that it is possible to get back a valid pointer for an element which | ||
86 | has never been stored in the array. Memory for array elements is allocated | ||
87 | one page at a time; a single allocation could provide memory for several | ||
88 | adjacent elements. Flexible array elements are normally initialized to the | ||
89 | value ``FLEX_ARRAY_FREE`` (defined as 0x6c in <linux/poison.h>), so errors | ||
90 | involving that number probably result from use of unstored array entries. | ||
91 | Note that, if array elements are allocated with ``__GFP_ZERO``, they will be | ||
92 | initialized to zero and this poisoning will not happen. | ||
93 | |||
94 | Individual elements in the array can be cleared with | ||
95 | :c:func:`flex_array_clear()`:: | ||
96 | |||
97 | int flex_array_clear(struct flex_array *array, unsigned int element_nr); | ||
98 | |||
99 | This function will set the given element to ``FLEX_ARRAY_FREE`` and return | ||
100 | zero. If storage for the indicated element is not allocated for the array, | ||
101 | ``flex_array_clear()`` will return ``-EINVAL`` instead. Note that clearing an | ||
102 | element does not release the storage associated with it; to reduce the | ||
103 | allocated size of an array, call :c:func:`flex_array_shrink()`:: | ||
104 | |||
105 | int flex_array_shrink(struct flex_array *array); | ||
106 | |||
107 | The return value will be the number of pages of memory actually freed. | ||
108 | This function works by scanning the array for pages containing nothing but | ||
109 | ``FLEX_ARRAY_FREE`` bytes, so (1) it can be expensive, and (2) it will not work | ||
110 | if the array's pages are allocated with ``__GFP_ZERO``. | ||
111 | |||
112 | It is possible to remove all elements of an array with a call to | ||
113 | :c:func:`flex_array_free_parts()`:: | ||
114 | |||
115 | void flex_array_free_parts(struct flex_array *array); | ||
116 | |||
117 | This call frees all elements, but leaves the array itself in place. | ||
118 | Freeing the entire array is done with :c:func:`flex_array_free()`:: | ||
119 | |||
120 | void flex_array_free(struct flex_array *array); | ||
121 | |||
122 | As of this writing, there are no users of flexible arrays in the mainline | ||
123 | kernel. The functions described here are also not exported to modules; | ||
124 | that will probably be fixed when somebody comes up with a need for it. | ||
125 | |||
126 | |||
127 | Flexible array functions | ||
128 | ------------------------ | ||
129 | |||
130 | .. kernel-doc:: include/linux/flex_array.h | ||
diff --git a/Documentation/core-api/genericirq.rst b/Documentation/core-api/genericirq.rst new file mode 100644 index 000000000000..0054bd48be84 --- /dev/null +++ b/Documentation/core-api/genericirq.rst | |||
@@ -0,0 +1,440 @@ | |||
1 | .. include:: <isonum.txt> | ||
2 | |||
3 | ========================== | ||
4 | Linux generic IRQ handling | ||
5 | ========================== | ||
6 | |||
7 | :Copyright: |copy| 2005-2010: Thomas Gleixner | ||
8 | :Copyright: |copy| 2005-2006: Ingo Molnar | ||
9 | |||
10 | Introduction | ||
11 | ============ | ||
12 | |||
13 | The generic interrupt handling layer is designed to provide a complete | ||
14 | abstraction of interrupt handling for device drivers. It is able to | ||
15 | handle all the different types of interrupt controller hardware. Device | ||
16 | drivers use generic API functions to request, enable, disable and free | ||
17 | interrupts. The drivers do not have to know anything about interrupt | ||
18 | hardware details, so they can be used on different platforms without | ||
19 | code changes. | ||
20 | |||
21 | This documentation is provided to developers who want to implement an | ||
22 | interrupt subsystem based for their architecture, with the help of the | ||
23 | generic IRQ handling layer. | ||
24 | |||
25 | Rationale | ||
26 | ========= | ||
27 | |||
28 | The original implementation of interrupt handling in Linux uses the | ||
29 | :c:func:`__do_IRQ` super-handler, which is able to deal with every type of | ||
30 | interrupt logic. | ||
31 | |||
32 | Originally, Russell King identified different types of handlers to build | ||
33 | a quite universal set for the ARM interrupt handler implementation in | ||
34 | Linux 2.5/2.6. He distinguished between: | ||
35 | |||
36 | - Level type | ||
37 | |||
38 | - Edge type | ||
39 | |||
40 | - Simple type | ||
41 | |||
42 | During the implementation we identified another type: | ||
43 | |||
44 | - Fast EOI type | ||
45 | |||
46 | In the SMP world of the :c:func:`__do_IRQ` super-handler another type was | ||
47 | identified: | ||
48 | |||
49 | - Per CPU type | ||
50 | |||
51 | This split implementation of high-level IRQ handlers allows us to | ||
52 | optimize the flow of the interrupt handling for each specific interrupt | ||
53 | type. This reduces complexity in that particular code path and allows | ||
54 | the optimized handling of a given type. | ||
55 | |||
56 | The original general IRQ implementation used hw_interrupt_type | ||
57 | structures and their ``->ack``, ``->end`` [etc.] callbacks to differentiate | ||
58 | the flow control in the super-handler. This leads to a mix of flow logic | ||
59 | and low-level hardware logic, and it also leads to unnecessary code | ||
60 | duplication: for example in i386, there is an ``ioapic_level_irq`` and an | ||
61 | ``ioapic_edge_irq`` IRQ-type which share many of the low-level details but | ||
62 | have different flow handling. | ||
63 | |||
64 | A more natural abstraction is the clean separation of the 'irq flow' and | ||
65 | the 'chip details'. | ||
66 | |||
67 | Analysing a couple of architecture's IRQ subsystem implementations | ||
68 | reveals that most of them can use a generic set of 'irq flow' methods | ||
69 | and only need to add the chip-level specific code. The separation is | ||
70 | also valuable for (sub)architectures which need specific quirks in the | ||
71 | IRQ flow itself but not in the chip details - and thus provides a more | ||
72 | transparent IRQ subsystem design. | ||
73 | |||
74 | Each interrupt descriptor is assigned its own high-level flow handler, | ||
75 | which is normally one of the generic implementations. (This high-level | ||
76 | flow handler implementation also makes it simple to provide | ||
77 | demultiplexing handlers which can be found in embedded platforms on | ||
78 | various architectures.) | ||
79 | |||
80 | The separation makes the generic interrupt handling layer more flexible | ||
81 | and extensible. For example, an (sub)architecture can use a generic | ||
82 | IRQ-flow implementation for 'level type' interrupts and add a | ||
83 | (sub)architecture specific 'edge type' implementation. | ||
84 | |||
85 | To make the transition to the new model easier and prevent the breakage | ||
86 | of existing implementations, the :c:func:`__do_IRQ` super-handler is still | ||
87 | available. This leads to a kind of duality for the time being. Over time | ||
88 | the new model should be used in more and more architectures, as it | ||
89 | enables smaller and cleaner IRQ subsystems. It's deprecated for three | ||
90 | years now and about to be removed. | ||
91 | |||
92 | Known Bugs And Assumptions | ||
93 | ========================== | ||
94 | |||
95 | None (knock on wood). | ||
96 | |||
97 | Abstraction layers | ||
98 | ================== | ||
99 | |||
100 | There are three main levels of abstraction in the interrupt code: | ||
101 | |||
102 | 1. High-level driver API | ||
103 | |||
104 | 2. High-level IRQ flow handlers | ||
105 | |||
106 | 3. Chip-level hardware encapsulation | ||
107 | |||
108 | Interrupt control flow | ||
109 | ---------------------- | ||
110 | |||
111 | Each interrupt is described by an interrupt descriptor structure | ||
112 | irq_desc. The interrupt is referenced by an 'unsigned int' numeric | ||
113 | value which selects the corresponding interrupt description structure in | ||
114 | the descriptor structures array. The descriptor structure contains | ||
115 | status information and pointers to the interrupt flow method and the | ||
116 | interrupt chip structure which are assigned to this interrupt. | ||
117 | |||
118 | Whenever an interrupt triggers, the low-level architecture code calls | ||
119 | into the generic interrupt code by calling :c:func:`desc->handle_irq`. This | ||
120 | high-level IRQ handling function only uses desc->irq_data.chip | ||
121 | primitives referenced by the assigned chip descriptor structure. | ||
122 | |||
123 | High-level Driver API | ||
124 | --------------------- | ||
125 | |||
126 | The high-level Driver API consists of following functions: | ||
127 | |||
128 | - :c:func:`request_irq` | ||
129 | |||
130 | - :c:func:`free_irq` | ||
131 | |||
132 | - :c:func:`disable_irq` | ||
133 | |||
134 | - :c:func:`enable_irq` | ||
135 | |||
136 | - :c:func:`disable_irq_nosync` (SMP only) | ||
137 | |||
138 | - :c:func:`synchronize_irq` (SMP only) | ||
139 | |||
140 | - :c:func:`irq_set_irq_type` | ||
141 | |||
142 | - :c:func:`irq_set_irq_wake` | ||
143 | |||
144 | - :c:func:`irq_set_handler_data` | ||
145 | |||
146 | - :c:func:`irq_set_chip` | ||
147 | |||
148 | - :c:func:`irq_set_chip_data` | ||
149 | |||
150 | See the autogenerated function documentation for details. | ||
151 | |||
152 | High-level IRQ flow handlers | ||
153 | ---------------------------- | ||
154 | |||
155 | The generic layer provides a set of pre-defined irq-flow methods: | ||
156 | |||
157 | - :c:func:`handle_level_irq` | ||
158 | |||
159 | - :c:func:`handle_edge_irq` | ||
160 | |||
161 | - :c:func:`handle_fasteoi_irq` | ||
162 | |||
163 | - :c:func:`handle_simple_irq` | ||
164 | |||
165 | - :c:func:`handle_percpu_irq` | ||
166 | |||
167 | - :c:func:`handle_edge_eoi_irq` | ||
168 | |||
169 | - :c:func:`handle_bad_irq` | ||
170 | |||
171 | The interrupt flow handlers (either pre-defined or architecture | ||
172 | specific) are assigned to specific interrupts by the architecture either | ||
173 | during bootup or during device initialization. | ||
174 | |||
175 | Default flow implementations | ||
176 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
177 | |||
178 | Helper functions | ||
179 | ^^^^^^^^^^^^^^^^ | ||
180 | |||
181 | The helper functions call the chip primitives and are used by the | ||
182 | default flow implementations. The following helper functions are | ||
183 | implemented (simplified excerpt):: | ||
184 | |||
185 | default_enable(struct irq_data *data) | ||
186 | { | ||
187 | desc->irq_data.chip->irq_unmask(data); | ||
188 | } | ||
189 | |||
190 | default_disable(struct irq_data *data) | ||
191 | { | ||
192 | if (!delay_disable(data)) | ||
193 | desc->irq_data.chip->irq_mask(data); | ||
194 | } | ||
195 | |||
196 | default_ack(struct irq_data *data) | ||
197 | { | ||
198 | chip->irq_ack(data); | ||
199 | } | ||
200 | |||
201 | default_mask_ack(struct irq_data *data) | ||
202 | { | ||
203 | if (chip->irq_mask_ack) { | ||
204 | chip->irq_mask_ack(data); | ||
205 | } else { | ||
206 | chip->irq_mask(data); | ||
207 | chip->irq_ack(data); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | noop(struct irq_data *data)) | ||
212 | { | ||
213 | } | ||
214 | |||
215 | |||
216 | |||
217 | Default flow handler implementations | ||
218 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
219 | |||
220 | Default Level IRQ flow handler | ||
221 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
222 | |||
223 | handle_level_irq provides a generic implementation for level-triggered | ||
224 | interrupts. | ||
225 | |||
226 | The following control flow is implemented (simplified excerpt):: | ||
227 | |||
228 | :c:func:`desc->irq_data.chip->irq_mask_ack`; | ||
229 | handle_irq_event(desc->action); | ||
230 | :c:func:`desc->irq_data.chip->irq_unmask`; | ||
231 | |||
232 | |||
233 | Default Fast EOI IRQ flow handler | ||
234 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
235 | |||
236 | handle_fasteoi_irq provides a generic implementation for interrupts, | ||
237 | which only need an EOI at the end of the handler. | ||
238 | |||
239 | The following control flow is implemented (simplified excerpt):: | ||
240 | |||
241 | handle_irq_event(desc->action); | ||
242 | :c:func:`desc->irq_data.chip->irq_eoi`; | ||
243 | |||
244 | |||
245 | Default Edge IRQ flow handler | ||
246 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
247 | |||
248 | handle_edge_irq provides a generic implementation for edge-triggered | ||
249 | interrupts. | ||
250 | |||
251 | The following control flow is implemented (simplified excerpt):: | ||
252 | |||
253 | if (desc->status & running) { | ||
254 | :c:func:`desc->irq_data.chip->irq_mask_ack`; | ||
255 | desc->status |= pending | masked; | ||
256 | return; | ||
257 | } | ||
258 | :c:func:`desc->irq_data.chip->irq_ack`; | ||
259 | desc->status |= running; | ||
260 | do { | ||
261 | if (desc->status & masked) | ||
262 | :c:func:`desc->irq_data.chip->irq_unmask`; | ||
263 | desc->status &= ~pending; | ||
264 | handle_irq_event(desc->action); | ||
265 | } while (status & pending); | ||
266 | desc->status &= ~running; | ||
267 | |||
268 | |||
269 | Default simple IRQ flow handler | ||
270 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
271 | |||
272 | handle_simple_irq provides a generic implementation for simple | ||
273 | interrupts. | ||
274 | |||
275 | .. note:: | ||
276 | |||
277 | The simple flow handler does not call any handler/chip primitives. | ||
278 | |||
279 | The following control flow is implemented (simplified excerpt):: | ||
280 | |||
281 | handle_irq_event(desc->action); | ||
282 | |||
283 | |||
284 | Default per CPU flow handler | ||
285 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
286 | |||
287 | handle_percpu_irq provides a generic implementation for per CPU | ||
288 | interrupts. | ||
289 | |||
290 | Per CPU interrupts are only available on SMP and the handler provides a | ||
291 | simplified version without locking. | ||
292 | |||
293 | The following control flow is implemented (simplified excerpt):: | ||
294 | |||
295 | if (desc->irq_data.chip->irq_ack) | ||
296 | :c:func:`desc->irq_data.chip->irq_ack`; | ||
297 | handle_irq_event(desc->action); | ||
298 | if (desc->irq_data.chip->irq_eoi) | ||
299 | :c:func:`desc->irq_data.chip->irq_eoi`; | ||
300 | |||
301 | |||
302 | EOI Edge IRQ flow handler | ||
303 | ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
304 | |||
305 | handle_edge_eoi_irq provides an abnomination of the edge handler | ||
306 | which is solely used to tame a badly wreckaged irq controller on | ||
307 | powerpc/cell. | ||
308 | |||
309 | Bad IRQ flow handler | ||
310 | ^^^^^^^^^^^^^^^^^^^^ | ||
311 | |||
312 | handle_bad_irq is used for spurious interrupts which have no real | ||
313 | handler assigned.. | ||
314 | |||
315 | Quirks and optimizations | ||
316 | ~~~~~~~~~~~~~~~~~~~~~~~~ | ||
317 | |||
318 | The generic functions are intended for 'clean' architectures and chips, | ||
319 | which have no platform-specific IRQ handling quirks. If an architecture | ||
320 | needs to implement quirks on the 'flow' level then it can do so by | ||
321 | overriding the high-level irq-flow handler. | ||
322 | |||
323 | Delayed interrupt disable | ||
324 | ~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
325 | |||
326 | This per interrupt selectable feature, which was introduced by Russell | ||
327 | King in the ARM interrupt implementation, does not mask an interrupt at | ||
328 | the hardware level when :c:func:`disable_irq` is called. The interrupt is kept | ||
329 | enabled and is masked in the flow handler when an interrupt event | ||
330 | happens. This prevents losing edge interrupts on hardware which does not | ||
331 | store an edge interrupt event while the interrupt is disabled at the | ||
332 | hardware level. When an interrupt arrives while the IRQ_DISABLED flag | ||
333 | is set, then the interrupt is masked at the hardware level and the | ||
334 | IRQ_PENDING bit is set. When the interrupt is re-enabled by | ||
335 | :c:func:`enable_irq` the pending bit is checked and if it is set, the interrupt | ||
336 | is resent either via hardware or by a software resend mechanism. (It's | ||
337 | necessary to enable CONFIG_HARDIRQS_SW_RESEND when you want to use | ||
338 | the delayed interrupt disable feature and your hardware is not capable | ||
339 | of retriggering an interrupt.) The delayed interrupt disable is not | ||
340 | configurable. | ||
341 | |||
342 | Chip-level hardware encapsulation | ||
343 | --------------------------------- | ||
344 | |||
345 | The chip-level hardware descriptor structure :c:type:`irq_chip` contains all | ||
346 | the direct chip relevant functions, which can be utilized by the irq flow | ||
347 | implementations. | ||
348 | |||
349 | - ``irq_ack`` | ||
350 | |||
351 | - ``irq_mask_ack`` - Optional, recommended for performance | ||
352 | |||
353 | - ``irq_mask`` | ||
354 | |||
355 | - ``irq_unmask`` | ||
356 | |||
357 | - ``irq_eoi`` - Optional, required for EOI flow handlers | ||
358 | |||
359 | - ``irq_retrigger`` - Optional | ||
360 | |||
361 | - ``irq_set_type`` - Optional | ||
362 | |||
363 | - ``irq_set_wake`` - Optional | ||
364 | |||
365 | These primitives are strictly intended to mean what they say: ack means | ||
366 | ACK, masking means masking of an IRQ line, etc. It is up to the flow | ||
367 | handler(s) to use these basic units of low-level functionality. | ||
368 | |||
369 | __do_IRQ entry point | ||
370 | ==================== | ||
371 | |||
372 | The original implementation :c:func:`__do_IRQ` was an alternative entry point | ||
373 | for all types of interrupts. It no longer exists. | ||
374 | |||
375 | This handler turned out to be not suitable for all interrupt hardware | ||
376 | and was therefore reimplemented with split functionality for | ||
377 | edge/level/simple/percpu interrupts. This is not only a functional | ||
378 | optimization. It also shortens code paths for interrupts. | ||
379 | |||
380 | Locking on SMP | ||
381 | ============== | ||
382 | |||
383 | The locking of chip registers is up to the architecture that defines the | ||
384 | chip primitives. The per-irq structure is protected via desc->lock, by | ||
385 | the generic layer. | ||
386 | |||
387 | Generic interrupt chip | ||
388 | ====================== | ||
389 | |||
390 | To avoid copies of identical implementations of IRQ chips the core | ||
391 | provides a configurable generic interrupt chip implementation. | ||
392 | Developers should check carefully whether the generic chip fits their | ||
393 | needs before implementing the same functionality slightly differently | ||
394 | themselves. | ||
395 | |||
396 | .. kernel-doc:: kernel/irq/generic-chip.c | ||
397 | :export: | ||
398 | |||
399 | Structures | ||
400 | ========== | ||
401 | |||
402 | This chapter contains the autogenerated documentation of the structures | ||
403 | which are used in the generic IRQ layer. | ||
404 | |||
405 | .. kernel-doc:: include/linux/irq.h | ||
406 | :internal: | ||
407 | |||
408 | .. kernel-doc:: include/linux/interrupt.h | ||
409 | :internal: | ||
410 | |||
411 | Public Functions Provided | ||
412 | ========================= | ||
413 | |||
414 | This chapter contains the autogenerated documentation of the kernel API | ||
415 | functions which are exported. | ||
416 | |||
417 | .. kernel-doc:: kernel/irq/manage.c | ||
418 | |||
419 | .. kernel-doc:: kernel/irq/chip.c | ||
420 | |||
421 | Internal Functions Provided | ||
422 | =========================== | ||
423 | |||
424 | This chapter contains the autogenerated documentation of the internal | ||
425 | functions. | ||
426 | |||
427 | .. kernel-doc:: kernel/irq/irqdesc.c | ||
428 | |||
429 | .. kernel-doc:: kernel/irq/handle.c | ||
430 | |||
431 | .. kernel-doc:: kernel/irq/chip.c | ||
432 | |||
433 | Credits | ||
434 | ======= | ||
435 | |||
436 | The following people have contributed to this document: | ||
437 | |||
438 | 1. Thomas Gleixner tglx@linutronix.de | ||
439 | |||
440 | 2. Ingo Molnar mingo@elte.hu | ||
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst index 0d93d8089136..62abd36bfffb 100644 --- a/Documentation/core-api/index.rst +++ b/Documentation/core-api/index.rst | |||
@@ -11,11 +11,14 @@ Core utilities | |||
11 | .. toctree:: | 11 | .. toctree:: |
12 | :maxdepth: 1 | 12 | :maxdepth: 1 |
13 | 13 | ||
14 | kernel-api | ||
14 | assoc_array | 15 | assoc_array |
15 | atomic_ops | 16 | atomic_ops |
16 | cpu_hotplug | 17 | cpu_hotplug |
17 | local_ops | 18 | local_ops |
18 | workqueue | 19 | workqueue |
20 | genericirq | ||
21 | flexible-arrays | ||
19 | 22 | ||
20 | Interfaces for kernel debugging | 23 | Interfaces for kernel debugging |
21 | =============================== | 24 | =============================== |
diff --git a/Documentation/core-api/kernel-api.rst b/Documentation/core-api/kernel-api.rst new file mode 100644 index 000000000000..9ec8488319dc --- /dev/null +++ b/Documentation/core-api/kernel-api.rst | |||
@@ -0,0 +1,346 @@ | |||
1 | ==================== | ||
2 | The Linux Kernel API | ||
3 | ==================== | ||
4 | |||
5 | Data Types | ||
6 | ========== | ||
7 | |||
8 | Doubly Linked Lists | ||
9 | ------------------- | ||
10 | |||
11 | .. kernel-doc:: include/linux/list.h | ||
12 | :internal: | ||
13 | |||
14 | Basic C Library Functions | ||
15 | ========================= | ||
16 | |||
17 | When writing drivers, you cannot in general use routines which are from | ||
18 | the C Library. Some of the functions have been found generally useful | ||
19 | and they are listed below. The behaviour of these functions may vary | ||
20 | slightly from those defined by ANSI, and these deviations are noted in | ||
21 | the text. | ||
22 | |||
23 | String Conversions | ||
24 | ------------------ | ||
25 | |||
26 | .. kernel-doc:: lib/vsprintf.c | ||
27 | :export: | ||
28 | |||
29 | .. kernel-doc:: include/linux/kernel.h | ||
30 | :functions: kstrtol | ||
31 | |||
32 | .. kernel-doc:: include/linux/kernel.h | ||
33 | :functions: kstrtoul | ||
34 | |||
35 | .. kernel-doc:: lib/kstrtox.c | ||
36 | :export: | ||
37 | |||
38 | String Manipulation | ||
39 | ------------------- | ||
40 | |||
41 | .. kernel-doc:: lib/string.c | ||
42 | :export: | ||
43 | |||
44 | Bit Operations | ||
45 | -------------- | ||
46 | |||
47 | .. kernel-doc:: arch/x86/include/asm/bitops.h | ||
48 | :internal: | ||
49 | |||
50 | Basic Kernel Library Functions | ||
51 | ============================== | ||
52 | |||
53 | The Linux kernel provides more basic utility functions. | ||
54 | |||
55 | Bitmap Operations | ||
56 | ----------------- | ||
57 | |||
58 | .. kernel-doc:: lib/bitmap.c | ||
59 | :export: | ||
60 | |||
61 | .. kernel-doc:: lib/bitmap.c | ||
62 | :internal: | ||
63 | |||
64 | Command-line Parsing | ||
65 | -------------------- | ||
66 | |||
67 | .. kernel-doc:: lib/cmdline.c | ||
68 | :export: | ||
69 | |||
70 | CRC Functions | ||
71 | ------------- | ||
72 | |||
73 | .. kernel-doc:: lib/crc7.c | ||
74 | :export: | ||
75 | |||
76 | .. kernel-doc:: lib/crc16.c | ||
77 | :export: | ||
78 | |||
79 | .. kernel-doc:: lib/crc-itu-t.c | ||
80 | :export: | ||
81 | |||
82 | .. kernel-doc:: lib/crc32.c | ||
83 | |||
84 | .. kernel-doc:: lib/crc-ccitt.c | ||
85 | :export: | ||
86 | |||
87 | idr/ida Functions | ||
88 | ----------------- | ||
89 | |||
90 | .. kernel-doc:: include/linux/idr.h | ||
91 | :doc: idr sync | ||
92 | |||
93 | .. kernel-doc:: lib/idr.c | ||
94 | :doc: IDA description | ||
95 | |||
96 | .. kernel-doc:: lib/idr.c | ||
97 | :export: | ||
98 | |||
99 | Memory Management in Linux | ||
100 | ========================== | ||
101 | |||
102 | The Slab Cache | ||
103 | -------------- | ||
104 | |||
105 | .. kernel-doc:: include/linux/slab.h | ||
106 | :internal: | ||
107 | |||
108 | .. kernel-doc:: mm/slab.c | ||
109 | :export: | ||
110 | |||
111 | .. kernel-doc:: mm/util.c | ||
112 | :export: | ||
113 | |||
114 | User Space Memory Access | ||
115 | ------------------------ | ||
116 | |||
117 | .. kernel-doc:: arch/x86/include/asm/uaccess_32.h | ||
118 | :internal: | ||
119 | |||
120 | .. kernel-doc:: arch/x86/lib/usercopy_32.c | ||
121 | :export: | ||
122 | |||
123 | More Memory Management Functions | ||
124 | -------------------------------- | ||
125 | |||
126 | .. kernel-doc:: mm/readahead.c | ||
127 | :export: | ||
128 | |||
129 | .. kernel-doc:: mm/filemap.c | ||
130 | :export: | ||
131 | |||
132 | .. kernel-doc:: mm/memory.c | ||
133 | :export: | ||
134 | |||
135 | .. kernel-doc:: mm/vmalloc.c | ||
136 | :export: | ||
137 | |||
138 | .. kernel-doc:: mm/page_alloc.c | ||
139 | :internal: | ||
140 | |||
141 | .. kernel-doc:: mm/mempool.c | ||
142 | :export: | ||
143 | |||
144 | .. kernel-doc:: mm/dmapool.c | ||
145 | :export: | ||
146 | |||
147 | .. kernel-doc:: mm/page-writeback.c | ||
148 | :export: | ||
149 | |||
150 | .. kernel-doc:: mm/truncate.c | ||
151 | :export: | ||
152 | |||
153 | Kernel IPC facilities | ||
154 | ===================== | ||
155 | |||
156 | IPC utilities | ||
157 | ------------- | ||
158 | |||
159 | .. kernel-doc:: ipc/util.c | ||
160 | :internal: | ||
161 | |||
162 | FIFO Buffer | ||
163 | =========== | ||
164 | |||
165 | kfifo interface | ||
166 | --------------- | ||
167 | |||
168 | .. kernel-doc:: include/linux/kfifo.h | ||
169 | :internal: | ||
170 | |||
171 | relay interface support | ||
172 | ======================= | ||
173 | |||
174 | Relay interface support is designed to provide an efficient mechanism | ||
175 | for tools and facilities to relay large amounts of data from kernel | ||
176 | space to user space. | ||
177 | |||
178 | relay interface | ||
179 | --------------- | ||
180 | |||
181 | .. kernel-doc:: kernel/relay.c | ||
182 | :export: | ||
183 | |||
184 | .. kernel-doc:: kernel/relay.c | ||
185 | :internal: | ||
186 | |||
187 | Module Support | ||
188 | ============== | ||
189 | |||
190 | Module Loading | ||
191 | -------------- | ||
192 | |||
193 | .. kernel-doc:: kernel/kmod.c | ||
194 | :export: | ||
195 | |||
196 | Inter Module support | ||
197 | -------------------- | ||
198 | |||
199 | Refer to the file kernel/module.c for more information. | ||
200 | |||
201 | Hardware Interfaces | ||
202 | =================== | ||
203 | |||
204 | Interrupt Handling | ||
205 | ------------------ | ||
206 | |||
207 | .. kernel-doc:: kernel/irq/manage.c | ||
208 | :export: | ||
209 | |||
210 | DMA Channels | ||
211 | ------------ | ||
212 | |||
213 | .. kernel-doc:: kernel/dma.c | ||
214 | :export: | ||
215 | |||
216 | Resources Management | ||
217 | -------------------- | ||
218 | |||
219 | .. kernel-doc:: kernel/resource.c | ||
220 | :internal: | ||
221 | |||
222 | .. kernel-doc:: kernel/resource.c | ||
223 | :export: | ||
224 | |||
225 | MTRR Handling | ||
226 | ------------- | ||
227 | |||
228 | .. kernel-doc:: arch/x86/kernel/cpu/mtrr/main.c | ||
229 | :export: | ||
230 | |||
231 | Security Framework | ||
232 | ================== | ||
233 | |||
234 | .. kernel-doc:: security/security.c | ||
235 | :internal: | ||
236 | |||
237 | .. kernel-doc:: security/inode.c | ||
238 | :export: | ||
239 | |||
240 | Audit Interfaces | ||
241 | ================ | ||
242 | |||
243 | .. kernel-doc:: kernel/audit.c | ||
244 | :export: | ||
245 | |||
246 | .. kernel-doc:: kernel/auditsc.c | ||
247 | :internal: | ||
248 | |||
249 | .. kernel-doc:: kernel/auditfilter.c | ||
250 | :internal: | ||
251 | |||
252 | Accounting Framework | ||
253 | ==================== | ||
254 | |||
255 | .. kernel-doc:: kernel/acct.c | ||
256 | :internal: | ||
257 | |||
258 | Block Devices | ||
259 | ============= | ||
260 | |||
261 | .. kernel-doc:: block/blk-core.c | ||
262 | :export: | ||
263 | |||
264 | .. kernel-doc:: block/blk-core.c | ||
265 | :internal: | ||
266 | |||
267 | .. kernel-doc:: block/blk-map.c | ||
268 | :export: | ||
269 | |||
270 | .. kernel-doc:: block/blk-sysfs.c | ||
271 | :internal: | ||
272 | |||
273 | .. kernel-doc:: block/blk-settings.c | ||
274 | :export: | ||
275 | |||
276 | .. kernel-doc:: block/blk-exec.c | ||
277 | :export: | ||
278 | |||
279 | .. kernel-doc:: block/blk-flush.c | ||
280 | :export: | ||
281 | |||
282 | .. kernel-doc:: block/blk-lib.c | ||
283 | :export: | ||
284 | |||
285 | .. kernel-doc:: block/blk-tag.c | ||
286 | :export: | ||
287 | |||
288 | .. kernel-doc:: block/blk-tag.c | ||
289 | :internal: | ||
290 | |||
291 | .. kernel-doc:: block/blk-integrity.c | ||
292 | :export: | ||
293 | |||
294 | .. kernel-doc:: kernel/trace/blktrace.c | ||
295 | :internal: | ||
296 | |||
297 | .. kernel-doc:: block/genhd.c | ||
298 | :internal: | ||
299 | |||
300 | .. kernel-doc:: block/genhd.c | ||
301 | :export: | ||
302 | |||
303 | Char devices | ||
304 | ============ | ||
305 | |||
306 | .. kernel-doc:: fs/char_dev.c | ||
307 | :export: | ||
308 | |||
309 | Clock Framework | ||
310 | =============== | ||
311 | |||
312 | The clock framework defines programming interfaces to support software | ||
313 | management of the system clock tree. This framework is widely used with | ||
314 | System-On-Chip (SOC) platforms to support power management and various | ||
315 | devices which may need custom clock rates. Note that these "clocks" | ||
316 | don't relate to timekeeping or real time clocks (RTCs), each of which | ||
317 | have separate frameworks. These :c:type:`struct clk <clk>` | ||
318 | instances may be used to manage for example a 96 MHz signal that is used | ||
319 | to shift bits into and out of peripherals or busses, or otherwise | ||
320 | trigger synchronous state machine transitions in system hardware. | ||
321 | |||
322 | Power management is supported by explicit software clock gating: unused | ||
323 | clocks are disabled, so the system doesn't waste power changing the | ||
324 | state of transistors that aren't in active use. On some systems this may | ||
325 | be backed by hardware clock gating, where clocks are gated without being | ||
326 | disabled in software. Sections of chips that are powered but not clocked | ||
327 | may be able to retain their last state. This low power state is often | ||
328 | called a *retention mode*. This mode still incurs leakage currents, | ||
329 | especially with finer circuit geometries, but for CMOS circuits power is | ||
330 | mostly used by clocked state changes. | ||
331 | |||
332 | Power-aware drivers only enable their clocks when the device they manage | ||
333 | is in active use. Also, system sleep states often differ according to | ||
334 | which clock domains are active: while a "standby" state may allow wakeup | ||
335 | from several active domains, a "mem" (suspend-to-RAM) state may require | ||
336 | a more wholesale shutdown of clocks derived from higher speed PLLs and | ||
337 | oscillators, limiting the number of possible wakeup event sources. A | ||
338 | driver's suspend method may need to be aware of system-specific clock | ||
339 | constraints on the target sleep state. | ||
340 | |||
341 | Some platforms support programmable clock generators. These can be used | ||
342 | by external chips of various kinds, such as other CPUs, multimedia | ||
343 | codecs, and devices with strict requirements for interface clocking. | ||
344 | |||
345 | .. kernel-doc:: include/linux/clk.h | ||
346 | :internal: | ||
diff --git a/Documentation/cpu-freq/boost.txt b/Documentation/cpu-freq/boost.txt deleted file mode 100644 index dd62e1334f0a..000000000000 --- a/Documentation/cpu-freq/boost.txt +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | Processor boosting control | ||
2 | |||
3 | - information for users - | ||
4 | |||
5 | Quick guide for the impatient: | ||
6 | -------------------- | ||
7 | /sys/devices/system/cpu/cpufreq/boost | ||
8 | controls the boost setting for the whole system. You can read and write | ||
9 | that file with either "0" (boosting disabled) or "1" (boosting allowed). | ||
10 | Reading or writing 1 does not mean that the system is boosting at this | ||
11 | very moment, but only that the CPU _may_ raise the frequency at it's | ||
12 | discretion. | ||
13 | -------------------- | ||
14 | |||
15 | Introduction | ||
16 | ------------- | ||
17 | Some CPUs support a functionality to raise the operating frequency of | ||
18 | some cores in a multi-core package if certain conditions apply, mostly | ||
19 | if the whole chip is not fully utilized and below it's intended thermal | ||
20 | budget. The decision about boost disable/enable is made either at hardware | ||
21 | (e.g. x86) or software (e.g ARM). | ||
22 | On Intel CPUs this is called "Turbo Boost", AMD calls it "Turbo-Core", | ||
23 | in technical documentation "Core performance boost". In Linux we use | ||
24 | the term "boost" for convenience. | ||
25 | |||
26 | Rationale for disable switch | ||
27 | ---------------------------- | ||
28 | |||
29 | Though the idea is to just give better performance without any user | ||
30 | intervention, sometimes the need arises to disable this functionality. | ||
31 | Most systems offer a switch in the (BIOS) firmware to disable the | ||
32 | functionality at all, but a more fine-grained and dynamic control would | ||
33 | be desirable: | ||
34 | 1. While running benchmarks, reproducible results are important. Since | ||
35 | the boosting functionality depends on the load of the whole package, | ||
36 | single thread performance can vary. By explicitly disabling the boost | ||
37 | functionality at least for the benchmark's run-time the system will run | ||
38 | at a fixed frequency and results are reproducible again. | ||
39 | 2. To examine the impact of the boosting functionality it is helpful | ||
40 | to do tests with and without boosting. | ||
41 | 3. Boosting means overclocking the processor, though under controlled | ||
42 | conditions. By raising the frequency and the voltage the processor | ||
43 | will consume more power than without the boosting, which may be | ||
44 | undesirable for instance for mobile users. Disabling boosting may | ||
45 | save power here, though this depends on the workload. | ||
46 | |||
47 | |||
48 | User controlled switch | ||
49 | ---------------------- | ||
50 | |||
51 | To allow the user to toggle the boosting functionality, the cpufreq core | ||
52 | driver exports a sysfs knob to enable or disable it. There is a file: | ||
53 | /sys/devices/system/cpu/cpufreq/boost | ||
54 | which can either read "0" (boosting disabled) or "1" (boosting enabled). | ||
55 | The file is exported only when cpufreq driver supports boosting. | ||
56 | Explicitly changing the permissions and writing to that file anyway will | ||
57 | return EINVAL. | ||
58 | |||
59 | On supported CPUs one can write either a "0" or a "1" into this file. | ||
60 | This will either disable the boost functionality on all cores in the | ||
61 | whole system (0) or will allow the software or hardware to boost at will | ||
62 | (1). | ||
63 | |||
64 | Writing a "1" does not explicitly boost the system, but just allows the | ||
65 | CPU to boost at their discretion. Some implementations take external | ||
66 | factors like the chip's temperature into account, so boosting once does | ||
67 | not necessarily mean that it will occur every time even using the exact | ||
68 | same software setup. | ||
69 | |||
70 | |||
71 | AMD legacy cpb switch | ||
72 | --------------------- | ||
73 | The AMD powernow-k8 driver used to support a very similar switch to | ||
74 | disable or enable the "Core Performance Boost" feature of some AMD CPUs. | ||
75 | This switch was instantiated in each CPU's cpufreq directory | ||
76 | (/sys/devices/system/cpu[0-9]*/cpufreq) and was called "cpb". | ||
77 | Though the per CPU existence hints at a more fine grained control, the | ||
78 | actual implementation only supported a system-global switch semantics, | ||
79 | which was simply reflected into each CPU's file. Writing a 0 or 1 into it | ||
80 | would pull the other CPUs to the same state. | ||
81 | For compatibility reasons this file and its behavior is still supported | ||
82 | on AMD CPUs, though it is now protected by a config switch | ||
83 | (X86_ACPI_CPUFREQ_CPB). On Intel CPUs this file will never be created, | ||
84 | even with the config option set. | ||
85 | This functionality is considered legacy and will be removed in some future | ||
86 | kernel version. | ||
87 | |||
88 | More fine grained boosting control | ||
89 | ---------------------------------- | ||
90 | |||
91 | Technically it is possible to switch the boosting functionality at least | ||
92 | on a per package basis, for some CPUs even per core. Currently the driver | ||
93 | does not support it, but this may be implemented in the future. | ||
diff --git a/Documentation/cpu-freq/cpu-drivers.txt b/Documentation/cpu-freq/cpu-drivers.txt index f71e6be26b83..434c49cc7330 100644 --- a/Documentation/cpu-freq/cpu-drivers.txt +++ b/Documentation/cpu-freq/cpu-drivers.txt | |||
@@ -231,7 +231,7 @@ the reference implementation in drivers/cpufreq/longrun.c | |||
231 | Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION unset. | 231 | Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION unset. |
232 | 232 | ||
233 | get_intermediate should return a stable intermediate frequency platform wants to | 233 | get_intermediate should return a stable intermediate frequency platform wants to |
234 | switch to, and target_intermediate() should set CPU to to that frequency, before | 234 | switch to, and target_intermediate() should set CPU to that frequency, before |
235 | jumping to the frequency corresponding to 'index'. Core will take care of | 235 | jumping to the frequency corresponding to 'index'. Core will take care of |
236 | sending notifications and driver doesn't have to handle them in | 236 | sending notifications and driver doesn't have to handle them in |
237 | target_intermediate() or target_index(). | 237 | target_intermediate() or target_index(). |
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt deleted file mode 100644 index 61b3184b6c24..000000000000 --- a/Documentation/cpu-freq/governors.txt +++ /dev/null | |||
@@ -1,301 +0,0 @@ | |||
1 | CPU frequency and voltage scaling code in the Linux(TM) kernel | ||
2 | |||
3 | |||
4 | L i n u x C P U F r e q | ||
5 | |||
6 | C P U F r e q G o v e r n o r s | ||
7 | |||
8 | - information for users and developers - | ||
9 | |||
10 | |||
11 | Dominik Brodowski <linux@brodo.de> | ||
12 | some additions and corrections by Nico Golde <nico@ngolde.de> | ||
13 | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
14 | Viresh Kumar <viresh.kumar@linaro.org> | ||
15 | |||
16 | |||
17 | |||
18 | Clock scaling allows you to change the clock speed of the CPUs on the | ||
19 | fly. This is a nice method to save battery power, because the lower | ||
20 | the clock speed, the less power the CPU consumes. | ||
21 | |||
22 | |||
23 | Contents: | ||
24 | --------- | ||
25 | 1. What is a CPUFreq Governor? | ||
26 | |||
27 | 2. Governors In the Linux Kernel | ||
28 | 2.1 Performance | ||
29 | 2.2 Powersave | ||
30 | 2.3 Userspace | ||
31 | 2.4 Ondemand | ||
32 | 2.5 Conservative | ||
33 | 2.6 Schedutil | ||
34 | |||
35 | 3. The Governor Interface in the CPUfreq Core | ||
36 | |||
37 | 4. References | ||
38 | |||
39 | |||
40 | 1. What Is A CPUFreq Governor? | ||
41 | ============================== | ||
42 | |||
43 | Most cpufreq drivers (except the intel_pstate and longrun) or even most | ||
44 | cpu frequency scaling algorithms only allow the CPU frequency to be set | ||
45 | to predefined fixed values. In order to offer dynamic frequency | ||
46 | scaling, the cpufreq core must be able to tell these drivers of a | ||
47 | "target frequency". So these specific drivers will be transformed to | ||
48 | offer a "->target/target_index/fast_switch()" call instead of the | ||
49 | "->setpolicy()" call. For set_policy drivers, all stays the same, | ||
50 | though. | ||
51 | |||
52 | How to decide what frequency within the CPUfreq policy should be used? | ||
53 | That's done using "cpufreq governors". | ||
54 | |||
55 | Basically, it's the following flow graph: | ||
56 | |||
57 | CPU can be set to switch independently | CPU can only be set | ||
58 | within specific "limits" | to specific frequencies | ||
59 | |||
60 | "CPUfreq policy" | ||
61 | consists of frequency limits (policy->{min,max}) | ||
62 | and CPUfreq governor to be used | ||
63 | / \ | ||
64 | / \ | ||
65 | / the cpufreq governor decides | ||
66 | / (dynamically or statically) | ||
67 | / what target_freq to set within | ||
68 | / the limits of policy->{min,max} | ||
69 | / \ | ||
70 | / \ | ||
71 | Using the ->setpolicy call, Using the ->target/target_index/fast_switch call, | ||
72 | the limits and the the frequency closest | ||
73 | "policy" is set. to target_freq is set. | ||
74 | It is assured that it | ||
75 | is within policy->{min,max} | ||
76 | |||
77 | |||
78 | 2. Governors In the Linux Kernel | ||
79 | ================================ | ||
80 | |||
81 | 2.1 Performance | ||
82 | --------------- | ||
83 | |||
84 | The CPUfreq governor "performance" sets the CPU statically to the | ||
85 | highest frequency within the borders of scaling_min_freq and | ||
86 | scaling_max_freq. | ||
87 | |||
88 | |||
89 | 2.2 Powersave | ||
90 | ------------- | ||
91 | |||
92 | The CPUfreq governor "powersave" sets the CPU statically to the | ||
93 | lowest frequency within the borders of scaling_min_freq and | ||
94 | scaling_max_freq. | ||
95 | |||
96 | |||
97 | 2.3 Userspace | ||
98 | ------------- | ||
99 | |||
100 | The CPUfreq governor "userspace" allows the user, or any userspace | ||
101 | program running with UID "root", to set the CPU to a specific frequency | ||
102 | by making a sysfs file "scaling_setspeed" available in the CPU-device | ||
103 | directory. | ||
104 | |||
105 | |||
106 | 2.4 Ondemand | ||
107 | ------------ | ||
108 | |||
109 | The CPUfreq governor "ondemand" sets the CPU frequency depending on the | ||
110 | current system load. Load estimation is triggered by the scheduler | ||
111 | through the update_util_data->func hook; when triggered, cpufreq checks | ||
112 | the CPU-usage statistics over the last period and the governor sets the | ||
113 | CPU accordingly. The CPU must have the capability to switch the | ||
114 | frequency very quickly. | ||
115 | |||
116 | Sysfs files: | ||
117 | |||
118 | * sampling_rate: | ||
119 | |||
120 | Measured in uS (10^-6 seconds), this is how often you want the kernel | ||
121 | to look at the CPU usage and to make decisions on what to do about the | ||
122 | frequency. Typically this is set to values of around '10000' or more. | ||
123 | It's default value is (cmp. with users-guide.txt): transition_latency | ||
124 | * 1000. Be aware that transition latency is in ns and sampling_rate | ||
125 | is in us, so you get the same sysfs value by default. Sampling rate | ||
126 | should always get adjusted considering the transition latency to set | ||
127 | the sampling rate 750 times as high as the transition latency in the | ||
128 | bash (as said, 1000 is default), do: | ||
129 | |||
130 | $ echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate | ||
131 | |||
132 | * sampling_rate_min: | ||
133 | |||
134 | The sampling rate is limited by the HW transition latency: | ||
135 | transition_latency * 100 | ||
136 | |||
137 | Or by kernel restrictions: | ||
138 | - If CONFIG_NO_HZ_COMMON is set, the limit is 10ms fixed. | ||
139 | - If CONFIG_NO_HZ_COMMON is not set or nohz=off boot parameter is | ||
140 | used, the limits depend on the CONFIG_HZ option: | ||
141 | HZ=1000: min=20000us (20ms) | ||
142 | HZ=250: min=80000us (80ms) | ||
143 | HZ=100: min=200000us (200ms) | ||
144 | |||
145 | The highest value of kernel and HW latency restrictions is shown and | ||
146 | used as the minimum sampling rate. | ||
147 | |||
148 | * up_threshold: | ||
149 | |||
150 | This defines what the average CPU usage between the samplings of | ||
151 | 'sampling_rate' needs to be for the kernel to make a decision on | ||
152 | whether it should increase the frequency. For example when it is set | ||
153 | to its default value of '95' it means that between the checking | ||
154 | intervals the CPU needs to be on average more than 95% in use to then | ||
155 | decide that the CPU frequency needs to be increased. | ||
156 | |||
157 | * ignore_nice_load: | ||
158 | |||
159 | This parameter takes a value of '0' or '1'. When set to '0' (its | ||
160 | default), all processes are counted towards the 'cpu utilisation' | ||
161 | value. When set to '1', the processes that are run with a 'nice' | ||
162 | value will not count (and thus be ignored) in the overall usage | ||
163 | calculation. This is useful if you are running a CPU intensive | ||
164 | calculation on your laptop that you do not care how long it takes to | ||
165 | complete as you can 'nice' it and prevent it from taking part in the | ||
166 | deciding process of whether to increase your CPU frequency. | ||
167 | |||
168 | * sampling_down_factor: | ||
169 | |||
170 | This parameter controls the rate at which the kernel makes a decision | ||
171 | on when to decrease the frequency while running at top speed. When set | ||
172 | to 1 (the default) decisions to reevaluate load are made at the same | ||
173 | interval regardless of current clock speed. But when set to greater | ||
174 | than 1 (e.g. 100) it acts as a multiplier for the scheduling interval | ||
175 | for reevaluating load when the CPU is at its top speed due to high | ||
176 | load. This improves performance by reducing the overhead of load | ||
177 | evaluation and helping the CPU stay at its top speed when truly busy, | ||
178 | rather than shifting back and forth in speed. This tunable has no | ||
179 | effect on behavior at lower speeds/lower CPU loads. | ||
180 | |||
181 | * powersave_bias: | ||
182 | |||
183 | This parameter takes a value between 0 to 1000. It defines the | ||
184 | percentage (times 10) value of the target frequency that will be | ||
185 | shaved off of the target. For example, when set to 100 -- 10%, when | ||
186 | ondemand governor would have targeted 1000 MHz, it will target | ||
187 | 1000 MHz - (10% of 1000 MHz) = 900 MHz instead. This is set to 0 | ||
188 | (disabled) by default. | ||
189 | |||
190 | When AMD frequency sensitivity powersave bias driver -- | ||
191 | drivers/cpufreq/amd_freq_sensitivity.c is loaded, this parameter | ||
192 | defines the workload frequency sensitivity threshold in which a lower | ||
193 | frequency is chosen instead of ondemand governor's original target. | ||
194 | The frequency sensitivity is a hardware reported (on AMD Family 16h | ||
195 | Processors and above) value between 0 to 100% that tells software how | ||
196 | the performance of the workload running on a CPU will change when | ||
197 | frequency changes. A workload with sensitivity of 0% (memory/IO-bound) | ||
198 | will not perform any better on higher core frequency, whereas a | ||
199 | workload with sensitivity of 100% (CPU-bound) will perform better | ||
200 | higher the frequency. When the driver is loaded, this is set to 400 by | ||
201 | default -- for CPUs running workloads with sensitivity value below | ||
202 | 40%, a lower frequency is chosen. Unloading the driver or writing 0 | ||
203 | will disable this feature. | ||
204 | |||
205 | |||
206 | 2.5 Conservative | ||
207 | ---------------- | ||
208 | |||
209 | The CPUfreq governor "conservative", much like the "ondemand" | ||
210 | governor, sets the CPU frequency depending on the current usage. It | ||
211 | differs in behaviour in that it gracefully increases and decreases the | ||
212 | CPU speed rather than jumping to max speed the moment there is any load | ||
213 | on the CPU. This behaviour is more suitable in a battery powered | ||
214 | environment. The governor is tweaked in the same manner as the | ||
215 | "ondemand" governor through sysfs with the addition of: | ||
216 | |||
217 | * freq_step: | ||
218 | |||
219 | This describes what percentage steps the cpu freq should be increased | ||
220 | and decreased smoothly by. By default the cpu frequency will increase | ||
221 | in 5% chunks of your maximum cpu frequency. You can change this value | ||
222 | to anywhere between 0 and 100 where '0' will effectively lock your CPU | ||
223 | at a speed regardless of its load whilst '100' will, in theory, make | ||
224 | it behave identically to the "ondemand" governor. | ||
225 | |||
226 | * down_threshold: | ||
227 | |||
228 | Same as the 'up_threshold' found for the "ondemand" governor but for | ||
229 | the opposite direction. For example when set to its default value of | ||
230 | '20' it means that if the CPU usage needs to be below 20% between | ||
231 | samples to have the frequency decreased. | ||
232 | |||
233 | * sampling_down_factor: | ||
234 | |||
235 | Similar functionality as in "ondemand" governor. But in | ||
236 | "conservative", it controls the rate at which the kernel makes a | ||
237 | decision on when to decrease the frequency while running in any speed. | ||
238 | Load for frequency increase is still evaluated every sampling rate. | ||
239 | |||
240 | |||
241 | 2.6 Schedutil | ||
242 | ------------- | ||
243 | |||
244 | The "schedutil" governor aims at better integration with the Linux | ||
245 | kernel scheduler. Load estimation is achieved through the scheduler's | ||
246 | Per-Entity Load Tracking (PELT) mechanism, which also provides | ||
247 | information about the recent load [1]. This governor currently does | ||
248 | load based DVFS only for tasks managed by CFS. RT and DL scheduler tasks | ||
249 | are always run at the highest frequency. Unlike all the other | ||
250 | governors, the code is located under the kernel/sched/ directory. | ||
251 | |||
252 | Sysfs files: | ||
253 | |||
254 | * rate_limit_us: | ||
255 | |||
256 | This contains a value in microseconds. The governor waits for | ||
257 | rate_limit_us time before reevaluating the load again, after it has | ||
258 | evaluated the load once. | ||
259 | |||
260 | For an in-depth comparison with the other governors refer to [2]. | ||
261 | |||
262 | |||
263 | 3. The Governor Interface in the CPUfreq Core | ||
264 | ============================================= | ||
265 | |||
266 | A new governor must register itself with the CPUfreq core using | ||
267 | "cpufreq_register_governor". The struct cpufreq_governor, which has to | ||
268 | be passed to that function, must contain the following values: | ||
269 | |||
270 | governor->name - A unique name for this governor. | ||
271 | governor->owner - .THIS_MODULE for the governor module (if appropriate). | ||
272 | |||
273 | plus a set of hooks to the functions implementing the governor's logic. | ||
274 | |||
275 | The CPUfreq governor may call the CPU processor driver using one of | ||
276 | these two functions: | ||
277 | |||
278 | int cpufreq_driver_target(struct cpufreq_policy *policy, | ||
279 | unsigned int target_freq, | ||
280 | unsigned int relation); | ||
281 | |||
282 | int __cpufreq_driver_target(struct cpufreq_policy *policy, | ||
283 | unsigned int target_freq, | ||
284 | unsigned int relation); | ||
285 | |||
286 | target_freq must be within policy->min and policy->max, of course. | ||
287 | What's the difference between these two functions? When your governor is | ||
288 | in a direct code path of a call to governor callbacks, like | ||
289 | governor->start(), the policy->rwsem is still held in the cpufreq core, | ||
290 | and there's no need to lock it again (in fact, this would cause a | ||
291 | deadlock). So use __cpufreq_driver_target only in these cases. In all | ||
292 | other cases (for example, when there's a "daemonized" function that | ||
293 | wakes up every second), use cpufreq_driver_target to take policy->rwsem | ||
294 | before the command is passed to the cpufreq driver. | ||
295 | |||
296 | 4. References | ||
297 | ============= | ||
298 | |||
299 | [1] Per-entity load tracking: https://lwn.net/Articles/531853/ | ||
300 | [2] Improvements in CPU frequency management: https://lwn.net/Articles/682391/ | ||
301 | |||
diff --git a/Documentation/cpu-freq/index.txt b/Documentation/cpu-freq/index.txt index ef1d39247b05..03a7cee6ac73 100644 --- a/Documentation/cpu-freq/index.txt +++ b/Documentation/cpu-freq/index.txt | |||
@@ -21,8 +21,6 @@ Documents in this directory: | |||
21 | 21 | ||
22 | amd-powernow.txt - AMD powernow driver specific file. | 22 | amd-powernow.txt - AMD powernow driver specific file. |
23 | 23 | ||
24 | boost.txt - Frequency boosting support. | ||
25 | |||
26 | core.txt - General description of the CPUFreq core and | 24 | core.txt - General description of the CPUFreq core and |
27 | of CPUFreq notifiers. | 25 | of CPUFreq notifiers. |
28 | 26 | ||
@@ -32,17 +30,12 @@ cpufreq-nforce2.txt - nVidia nForce2 platform specific file. | |||
32 | 30 | ||
33 | cpufreq-stats.txt - General description of sysfs cpufreq stats. | 31 | cpufreq-stats.txt - General description of sysfs cpufreq stats. |
34 | 32 | ||
35 | governors.txt - What are cpufreq governors and how to | ||
36 | implement them? | ||
37 | |||
38 | index.txt - File index, Mailing list and Links (this document) | 33 | index.txt - File index, Mailing list and Links (this document) |
39 | 34 | ||
40 | intel-pstate.txt - Intel pstate cpufreq driver specific file. | 35 | intel-pstate.txt - Intel pstate cpufreq driver specific file. |
41 | 36 | ||
42 | pcc-cpufreq.txt - PCC cpufreq driver specific file. | 37 | pcc-cpufreq.txt - PCC cpufreq driver specific file. |
43 | 38 | ||
44 | user-guide.txt - User Guide to CPUFreq | ||
45 | |||
46 | 39 | ||
47 | Mailing List | 40 | Mailing List |
48 | ------------ | 41 | ------------ |
diff --git a/Documentation/cpu-freq/user-guide.txt b/Documentation/cpu-freq/user-guide.txt deleted file mode 100644 index 391da64e9492..000000000000 --- a/Documentation/cpu-freq/user-guide.txt +++ /dev/null | |||
@@ -1,228 +0,0 @@ | |||
1 | CPU frequency and voltage scaling code in the Linux(TM) kernel | ||
2 | |||
3 | |||
4 | L i n u x C P U F r e q | ||
5 | |||
6 | U S E R G U I D E | ||
7 | |||
8 | |||
9 | Dominik Brodowski <linux@brodo.de> | ||
10 | |||
11 | |||
12 | |||
13 | Clock scaling allows you to change the clock speed of the CPUs on the | ||
14 | fly. This is a nice method to save battery power, because the lower | ||
15 | the clock speed, the less power the CPU consumes. | ||
16 | |||
17 | |||
18 | Contents: | ||
19 | --------- | ||
20 | 1. Supported Architectures and Processors | ||
21 | 1.1 ARM and ARM64 | ||
22 | 1.2 x86 | ||
23 | 1.3 sparc64 | ||
24 | 1.4 ppc | ||
25 | 1.5 SuperH | ||
26 | 1.6 Blackfin | ||
27 | |||
28 | 2. "Policy" / "Governor"? | ||
29 | 2.1 Policy | ||
30 | 2.2 Governor | ||
31 | |||
32 | 3. How to change the CPU cpufreq policy and/or speed | ||
33 | 3.1 Preferred interface: sysfs | ||
34 | |||
35 | |||
36 | |||
37 | 1. Supported Architectures and Processors | ||
38 | ========================================= | ||
39 | |||
40 | 1.1 ARM and ARM64 | ||
41 | ----------------- | ||
42 | |||
43 | Almost all ARM and ARM64 platforms support CPU frequency scaling. | ||
44 | |||
45 | 1.2 x86 | ||
46 | ------- | ||
47 | |||
48 | The following processors for the x86 architecture are supported by cpufreq: | ||
49 | |||
50 | AMD Elan - SC400, SC410 | ||
51 | AMD mobile K6-2+ | ||
52 | AMD mobile K6-3+ | ||
53 | AMD mobile Duron | ||
54 | AMD mobile Athlon | ||
55 | AMD Opteron | ||
56 | AMD Athlon 64 | ||
57 | Cyrix Media GXm | ||
58 | Intel mobile PIII and Intel mobile PIII-M on certain chipsets | ||
59 | Intel Pentium 4, Intel Xeon | ||
60 | Intel Pentium M (Centrino) | ||
61 | National Semiconductors Geode GX | ||
62 | Transmeta Crusoe | ||
63 | Transmeta Efficeon | ||
64 | VIA Cyrix 3 / C3 | ||
65 | various processors on some ACPI 2.0-compatible systems [*] | ||
66 | And many more | ||
67 | |||
68 | [*] Only if "ACPI Processor Performance States" are available | ||
69 | to the ACPI<->BIOS interface. | ||
70 | |||
71 | |||
72 | 1.3 sparc64 | ||
73 | ----------- | ||
74 | |||
75 | The following processors for the sparc64 architecture are supported by | ||
76 | cpufreq: | ||
77 | |||
78 | UltraSPARC-III | ||
79 | |||
80 | |||
81 | 1.4 ppc | ||
82 | ------- | ||
83 | |||
84 | Several "PowerBook" and "iBook2" notebooks are supported. | ||
85 | The following POWER processors are supported in powernv mode: | ||
86 | POWER8 | ||
87 | POWER9 | ||
88 | |||
89 | 1.5 SuperH | ||
90 | ---------- | ||
91 | |||
92 | All SuperH processors supporting rate rounding through the clock | ||
93 | framework are supported by cpufreq. | ||
94 | |||
95 | 1.6 Blackfin | ||
96 | ------------ | ||
97 | |||
98 | The following Blackfin processors are supported by cpufreq: | ||
99 | |||
100 | BF522, BF523, BF524, BF525, BF526, BF527, Rev 0.1 or higher | ||
101 | BF531, BF532, BF533, Rev 0.3 or higher | ||
102 | BF534, BF536, BF537, Rev 0.2 or higher | ||
103 | BF561, Rev 0.3 or higher | ||
104 | BF542, BF544, BF547, BF548, BF549, Rev 0.1 or higher | ||
105 | |||
106 | |||
107 | 2. "Policy" / "Governor" ? | ||
108 | ========================== | ||
109 | |||
110 | Some CPU frequency scaling-capable processor switch between various | ||
111 | frequencies and operating voltages "on the fly" without any kernel or | ||
112 | user involvement. This guarantees very fast switching to a frequency | ||
113 | which is high enough to serve the user's needs, but low enough to save | ||
114 | power. | ||
115 | |||
116 | |||
117 | 2.1 Policy | ||
118 | ---------- | ||
119 | |||
120 | On these systems, all you can do is select the lower and upper | ||
121 | frequency limit as well as whether you want more aggressive | ||
122 | power-saving or more instantly available processing power. | ||
123 | |||
124 | |||
125 | 2.2 Governor | ||
126 | ------------ | ||
127 | |||
128 | On all other cpufreq implementations, these boundaries still need to | ||
129 | be set. Then, a "governor" must be selected. Such a "governor" decides | ||
130 | what speed the processor shall run within the boundaries. One such | ||
131 | "governor" is the "userspace" governor. This one allows the user - or | ||
132 | a yet-to-implement userspace program - to decide what specific speed | ||
133 | the processor shall run at. | ||
134 | |||
135 | |||
136 | 3. How to change the CPU cpufreq policy and/or speed | ||
137 | ==================================================== | ||
138 | |||
139 | 3.1 Preferred Interface: sysfs | ||
140 | ------------------------------ | ||
141 | |||
142 | The preferred interface is located in the sysfs filesystem. If you | ||
143 | mounted it at /sys, the cpufreq interface is located in a subdirectory | ||
144 | "cpufreq" within the cpu-device directory | ||
145 | (e.g. /sys/devices/system/cpu/cpu0/cpufreq/ for the first CPU). | ||
146 | |||
147 | affected_cpus : List of Online CPUs that require software | ||
148 | coordination of frequency. | ||
149 | |||
150 | cpuinfo_cur_freq : Current frequency of the CPU as obtained from | ||
151 | the hardware, in KHz. This is the frequency | ||
152 | the CPU actually runs at. | ||
153 | |||
154 | cpuinfo_min_freq : this file shows the minimum operating | ||
155 | frequency the processor can run at(in kHz) | ||
156 | |||
157 | cpuinfo_max_freq : this file shows the maximum operating | ||
158 | frequency the processor can run at(in kHz) | ||
159 | |||
160 | cpuinfo_transition_latency The time it takes on this CPU to | ||
161 | switch between two frequencies in nano | ||
162 | seconds. If unknown or known to be | ||
163 | that high that the driver does not | ||
164 | work with the ondemand governor, -1 | ||
165 | (CPUFREQ_ETERNAL) will be returned. | ||
166 | Using this information can be useful | ||
167 | to choose an appropriate polling | ||
168 | frequency for a kernel governor or | ||
169 | userspace daemon. Make sure to not | ||
170 | switch the frequency too often | ||
171 | resulting in performance loss. | ||
172 | |||
173 | related_cpus : List of Online + Offline CPUs that need software | ||
174 | coordination of frequency. | ||
175 | |||
176 | scaling_available_frequencies : List of available frequencies, in KHz. | ||
177 | |||
178 | scaling_available_governors : this file shows the CPUfreq governors | ||
179 | available in this kernel. You can see the | ||
180 | currently activated governor in | ||
181 | |||
182 | scaling_cur_freq : Current frequency of the CPU as determined by | ||
183 | the governor and cpufreq core, in KHz. This is | ||
184 | the frequency the kernel thinks the CPU runs | ||
185 | at. | ||
186 | |||
187 | scaling_driver : this file shows what cpufreq driver is | ||
188 | used to set the frequency on this CPU | ||
189 | |||
190 | scaling_governor, and by "echoing" the name of another | ||
191 | governor you can change it. Please note | ||
192 | that some governors won't load - they only | ||
193 | work on some specific architectures or | ||
194 | processors. | ||
195 | |||
196 | scaling_min_freq and | ||
197 | scaling_max_freq show the current "policy limits" (in | ||
198 | kHz). By echoing new values into these | ||
199 | files, you can change these limits. | ||
200 | NOTE: when setting a policy you need to | ||
201 | first set scaling_max_freq, then | ||
202 | scaling_min_freq. | ||
203 | |||
204 | scaling_setspeed This can be read to get the currently programmed | ||
205 | value by the governor. This can be written to | ||
206 | change the current frequency for a group of | ||
207 | CPUs, represented by a policy. This is supported | ||
208 | currently only by the userspace governor. | ||
209 | |||
210 | bios_limit : If the BIOS tells the OS to limit a CPU to | ||
211 | lower frequencies, the user can read out the | ||
212 | maximum available frequency from this file. | ||
213 | This typically can happen through (often not | ||
214 | intended) BIOS settings, restrictions | ||
215 | triggered through a service processor or other | ||
216 | BIOS/HW based implementations. | ||
217 | This does not cover thermal ACPI limitations | ||
218 | which can be detected through the generic | ||
219 | thermal driver. | ||
220 | |||
221 | If you have selected the "userspace" governor which allows you to | ||
222 | set the CPU operating frequency to a specific value, you can read out | ||
223 | the current frequency in | ||
224 | |||
225 | scaling_setspeed. By "echoing" a new frequency into this | ||
226 | you can change the speed of the CPU, | ||
227 | but only within the limits of | ||
228 | scaling_min_freq and scaling_max_freq. | ||
diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt index f722f227a73b..127c9d8c2174 100644 --- a/Documentation/cputopology.txt +++ b/Documentation/cputopology.txt | |||
@@ -100,7 +100,7 @@ not defined by include/asm-XXX/topology.h: | |||
100 | 100 | ||
101 | For architectures that don't support books (CONFIG_SCHED_BOOK) there are no | 101 | For architectures that don't support books (CONFIG_SCHED_BOOK) there are no |
102 | default definitions for topology_book_id() and topology_book_cpumask(). | 102 | default definitions for topology_book_id() and topology_book_cpumask(). |
103 | For architectures that don't support drawes (CONFIG_SCHED_DRAWER) there are | 103 | For architectures that don't support drawers (CONFIG_SCHED_DRAWER) there are |
104 | no default definitions for topology_drawer_id() and topology_drawer_cpumask(). | 104 | no default definitions for topology_drawer_id() and topology_drawer_cpumask(). |
105 | 105 | ||
106 | Additionally, CPU topology information is provided under | 106 | Additionally, CPU topology information is provided under |
diff --git a/Documentation/debugging-via-ohci1394.txt b/Documentation/debugging-via-ohci1394.txt index 03703afc4d30..9ff026d22b75 100644 --- a/Documentation/debugging-via-ohci1394.txt +++ b/Documentation/debugging-via-ohci1394.txt | |||
@@ -100,8 +100,8 @@ Step-by-step instructions for using firescope with early OHCI initialization: | |||
100 | CardBus and even some Express cards which are fully compliant to OHCI-1394 | 100 | CardBus and even some Express cards which are fully compliant to OHCI-1394 |
101 | specification are available. If it requires no driver for Windows operating | 101 | specification are available. If it requires no driver for Windows operating |
102 | systems, it most likely is. Only specialized shops have cards which are not | 102 | systems, it most likely is. Only specialized shops have cards which are not |
103 | compliant, they are based on TI PCILynx chips and require drivers for Win- | 103 | compliant, they are based on TI PCILynx chips and require drivers for Windows |
104 | dows operating systems. | 104 | operating systems. |
105 | 105 | ||
106 | The mentioned kernel log message contains the string "physUB" if the | 106 | The mentioned kernel log message contains the string "physUB" if the |
107 | controller implements a writable Physical Upper Bound register. This is | 107 | controller implements a writable Physical Upper Bound register. This is |
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.txt index f228604ddbcd..cdfd0feb294e 100644 --- a/Documentation/device-mapper/cache.txt +++ b/Documentation/device-mapper/cache.txt | |||
@@ -290,7 +290,7 @@ message, which takes an arbitrary number of cblock ranges. Each cblock | |||
290 | range's end value is "one past the end", meaning 5-10 expresses a range | 290 | range's end value is "one past the end", meaning 5-10 expresses a range |
291 | of values from 5 to 9. Each cblock must be expressed as a decimal | 291 | of values from 5 to 9. Each cblock must be expressed as a decimal |
292 | value, in the future a variant message that takes cblock ranges | 292 | value, in the future a variant message that takes cblock ranges |
293 | expressed in hexidecimal may be needed to better support efficient | 293 | expressed in hexadecimal may be needed to better support efficient |
294 | invalidation of larger caches. The cache must be in passthrough mode | 294 | invalidation of larger caches. The cache must be in passthrough mode |
295 | when invalidate_cblocks is used. | 295 | when invalidate_cblocks is used. |
296 | 296 | ||
diff --git a/Documentation/doc-guide/hello.dot b/Documentation/doc-guide/hello.dot new file mode 100644 index 000000000000..504621dfc595 --- /dev/null +++ b/Documentation/doc-guide/hello.dot | |||
@@ -0,0 +1,3 @@ | |||
1 | graph G { | ||
2 | Hello -- World | ||
3 | } | ||
diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst index 96fe7ccb2c67..731334de3efd 100644 --- a/Documentation/doc-guide/sphinx.rst +++ b/Documentation/doc-guide/sphinx.rst | |||
@@ -34,8 +34,9 @@ format-specific subdirectories under ``Documentation/output``. | |||
34 | 34 | ||
35 | To generate documentation, Sphinx (``sphinx-build``) must obviously be | 35 | To generate documentation, Sphinx (``sphinx-build``) must obviously be |
36 | installed. For prettier HTML output, the Read the Docs Sphinx theme | 36 | installed. For prettier HTML output, the Read the Docs Sphinx theme |
37 | (``sphinx_rtd_theme``) is used if available. For PDF output, ``rst2pdf`` is also | 37 | (``sphinx_rtd_theme``) is used if available. For PDF output you'll also need |
38 | needed. All of these are widely available and packaged in distributions. | 38 | ``XeLaTeX`` and ``convert(1)`` from ImageMagick (https://www.imagemagick.org). |
39 | All of these are widely available and packaged in distributions. | ||
39 | 40 | ||
40 | To pass extra options to Sphinx, you can use the ``SPHINXOPTS`` make | 41 | To pass extra options to Sphinx, you can use the ``SPHINXOPTS`` make |
41 | variable. For example, use ``make SPHINXOPTS=-v htmldocs`` to get more verbose | 42 | variable. For example, use ``make SPHINXOPTS=-v htmldocs`` to get more verbose |
@@ -73,7 +74,16 @@ Specific guidelines for the kernel documentation | |||
73 | 74 | ||
74 | Here are some specific guidelines for the kernel documentation: | 75 | Here are some specific guidelines for the kernel documentation: |
75 | 76 | ||
76 | * Please don't go overboard with reStructuredText markup. Keep it simple. | 77 | * Please don't go overboard with reStructuredText markup. Keep it |
78 | simple. For the most part the documentation should be plain text with | ||
79 | just enough consistency in formatting that it can be converted to | ||
80 | other formats. | ||
81 | |||
82 | * Please keep the formatting changes minimal when converting existing | ||
83 | documentation to reStructuredText. | ||
84 | |||
85 | * Also update the content, not just the formatting, when converting | ||
86 | documentation. | ||
77 | 87 | ||
78 | * Please stick to this order of heading adornments: | 88 | * Please stick to this order of heading adornments: |
79 | 89 | ||
@@ -103,6 +113,12 @@ Here are some specific guidelines for the kernel documentation: | |||
103 | the order as encountered."), having the higher levels the same overall makes | 113 | the order as encountered."), having the higher levels the same overall makes |
104 | it easier to follow the documents. | 114 | it easier to follow the documents. |
105 | 115 | ||
116 | * For inserting fixed width text blocks (for code examples, use case | ||
117 | examples, etc.), use ``::`` for anything that doesn't really benefit | ||
118 | from syntax highlighting, especially short snippets. Use | ||
119 | ``.. code-block:: <language>`` for longer code blocks that benefit | ||
120 | from highlighting. | ||
121 | |||
106 | 122 | ||
107 | the C domain | 123 | the C domain |
108 | ------------ | 124 | ------------ |
@@ -217,3 +233,96 @@ Rendered as: | |||
217 | * .. _`last row`: | 233 | * .. _`last row`: |
218 | 234 | ||
219 | - column 3 | 235 | - column 3 |
236 | |||
237 | |||
238 | Figures & Images | ||
239 | ================ | ||
240 | |||
241 | If you want to add an image, you should use the ``kernel-figure`` and | ||
242 | ``kernel-image`` directives. E.g. to insert a figure with a scalable | ||
243 | image format use SVG (:ref:`svg_image_example`):: | ||
244 | |||
245 | .. kernel-figure:: svg_image.svg | ||
246 | :alt: simple SVG image | ||
247 | |||
248 | SVG image example | ||
249 | |||
250 | .. _svg_image_example: | ||
251 | |||
252 | .. kernel-figure:: svg_image.svg | ||
253 | :alt: simple SVG image | ||
254 | |||
255 | SVG image example | ||
256 | |||
257 | The kernel figure (and image) directive support **DOT** formated files, see | ||
258 | |||
259 | * DOT: http://graphviz.org/pdf/dotguide.pdf | ||
260 | * Graphviz: http://www.graphviz.org/content/dot-language | ||
261 | |||
262 | A simple example (:ref:`hello_dot_file`):: | ||
263 | |||
264 | .. kernel-figure:: hello.dot | ||
265 | :alt: hello world | ||
266 | |||
267 | DOT's hello world example | ||
268 | |||
269 | .. _hello_dot_file: | ||
270 | |||
271 | .. kernel-figure:: hello.dot | ||
272 | :alt: hello world | ||
273 | |||
274 | DOT's hello world example | ||
275 | |||
276 | Embed *render* markups (or languages) like Graphviz's **DOT** is provided by the | ||
277 | ``kernel-render`` directives.:: | ||
278 | |||
279 | .. kernel-render:: DOT | ||
280 | :alt: foobar digraph | ||
281 | :caption: Embedded **DOT** (Graphviz) code | ||
282 | |||
283 | digraph foo { | ||
284 | "bar" -> "baz"; | ||
285 | } | ||
286 | |||
287 | How this will be rendered depends on the installed tools. If Graphviz is | ||
288 | installed, you will see an vector image. If not the raw markup is inserted as | ||
289 | *literal-block* (:ref:`hello_dot_render`). | ||
290 | |||
291 | .. _hello_dot_render: | ||
292 | |||
293 | .. kernel-render:: DOT | ||
294 | :alt: foobar digraph | ||
295 | :caption: Embedded **DOT** (Graphviz) code | ||
296 | |||
297 | digraph foo { | ||
298 | "bar" -> "baz"; | ||
299 | } | ||
300 | |||
301 | The *render* directive has all the options known from the *figure* directive, | ||
302 | plus option ``caption``. If ``caption`` has a value, a *figure* node is | ||
303 | inserted. If not, a *image* node is inserted. A ``caption`` is also needed, if | ||
304 | you want to refer it (:ref:`hello_svg_render`). | ||
305 | |||
306 | Embedded **SVG**:: | ||
307 | |||
308 | .. kernel-render:: SVG | ||
309 | :caption: Embedded **SVG** markup | ||
310 | :alt: so-nw-arrow | ||
311 | |||
312 | <?xml version="1.0" encoding="UTF-8"?> | ||
313 | <svg xmlns="http://www.w3.org/2000/svg" version="1.1" ...> | ||
314 | ... | ||
315 | </svg> | ||
316 | |||
317 | .. _hello_svg_render: | ||
318 | |||
319 | .. kernel-render:: SVG | ||
320 | :caption: Embedded **SVG** markup | ||
321 | :alt: so-nw-arrow | ||
322 | |||
323 | <?xml version="1.0" encoding="UTF-8"?> | ||
324 | <svg xmlns="http://www.w3.org/2000/svg" | ||
325 | version="1.1" baseProfile="full" width="70px" height="40px" viewBox="0 0 700 400"> | ||
326 | <line x1="180" y1="370" x2="500" y2="50" stroke="black" stroke-width="15px"/> | ||
327 | <polygon points="585 0 525 25 585 50" transform="rotate(135 525 25)"/> | ||
328 | </svg> | ||
diff --git a/Documentation/doc-guide/svg_image.svg b/Documentation/doc-guide/svg_image.svg new file mode 100644 index 000000000000..5405f85b8137 --- /dev/null +++ b/Documentation/doc-guide/svg_image.svg | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!-- originate: https://commons.wikimedia.org/wiki/File:Variable_Resistor.svg --> | ||
3 | <svg xmlns="http://www.w3.org/2000/svg" | ||
4 | version="1.1" baseProfile="full" | ||
5 | width="70px" height="40px" viewBox="0 0 700 400"> | ||
6 | <line x1="0" y1="200" x2="700" y2="200" stroke="black" stroke-width="20px"/> | ||
7 | <rect x="100" y="100" width="500" height="200" fill="white" stroke="black" stroke-width="20px"/> | ||
8 | <line x1="180" y1="370" x2="500" y2="50" stroke="black" stroke-width="15px"/> | ||
9 | <polygon points="585 0 525 25 585 50" transform="rotate(135 525 25)"/> | ||
10 | </svg> | ||
diff --git a/Documentation/driver-api/basics.rst b/Documentation/driver-api/basics.rst index 935b9b8d456c..472e7a664d13 100644 --- a/Documentation/driver-api/basics.rst +++ b/Documentation/driver-api/basics.rst | |||
@@ -7,6 +7,12 @@ Driver Entry and Exit points | |||
7 | .. kernel-doc:: include/linux/init.h | 7 | .. kernel-doc:: include/linux/init.h |
8 | :internal: | 8 | :internal: |
9 | 9 | ||
10 | Driver device table | ||
11 | ------------------- | ||
12 | |||
13 | .. kernel-doc:: include/linux/mod_devicetable.h | ||
14 | :internal: | ||
15 | |||
10 | Atomic and pointer manipulation | 16 | Atomic and pointer manipulation |
11 | ------------------------------- | 17 | ------------------------------- |
12 | 18 | ||
diff --git a/Documentation/driver-api/firmware/index.rst b/Documentation/driver-api/firmware/index.rst index 1abe01793031..29da39ec4b8a 100644 --- a/Documentation/driver-api/firmware/index.rst +++ b/Documentation/driver-api/firmware/index.rst | |||
@@ -7,6 +7,7 @@ Linux Firmware API | |||
7 | introduction | 7 | introduction |
8 | core | 8 | core |
9 | request_firmware | 9 | request_firmware |
10 | other_interfaces | ||
10 | 11 | ||
11 | .. only:: subproject and html | 12 | .. only:: subproject and html |
12 | 13 | ||
diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Documentation/driver-api/firmware/other_interfaces.rst new file mode 100644 index 000000000000..36c47b1e9824 --- /dev/null +++ b/Documentation/driver-api/firmware/other_interfaces.rst | |||
@@ -0,0 +1,15 @@ | |||
1 | Other Firmware Interfaces | ||
2 | ========================= | ||
3 | |||
4 | DMI Interfaces | ||
5 | -------------- | ||
6 | |||
7 | .. kernel-doc:: drivers/firmware/dmi_scan.c | ||
8 | :export: | ||
9 | |||
10 | EDD Interfaces | ||
11 | -------------- | ||
12 | |||
13 | .. kernel-doc:: drivers/firmware/edd.c | ||
14 | :internal: | ||
15 | |||
diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst index 60db00d1532b..8058a87c1c74 100644 --- a/Documentation/driver-api/index.rst +++ b/Documentation/driver-api/index.rst | |||
@@ -26,7 +26,8 @@ available subsections can be seen below. | |||
26 | regulator | 26 | regulator |
27 | iio/index | 27 | iio/index |
28 | input | 28 | input |
29 | usb | 29 | usb/index |
30 | pci | ||
30 | spi | 31 | spi |
31 | i2c | 32 | i2c |
32 | hsi | 33 | hsi |
@@ -36,6 +37,7 @@ available subsections can be seen below. | |||
36 | 80211/index | 37 | 80211/index |
37 | uio-howto | 38 | uio-howto |
38 | firmware/index | 39 | firmware/index |
40 | misc_devices | ||
39 | 41 | ||
40 | .. only:: subproject and html | 42 | .. only:: subproject and html |
41 | 43 | ||
diff --git a/Documentation/driver-api/misc_devices.rst b/Documentation/driver-api/misc_devices.rst new file mode 100644 index 000000000000..c7ee7b02ba88 --- /dev/null +++ b/Documentation/driver-api/misc_devices.rst | |||
@@ -0,0 +1,5 @@ | |||
1 | Miscellaneous Devices | ||
2 | ===================== | ||
3 | |||
4 | .. kernel-doc:: drivers/char/misc.c | ||
5 | :export: | ||
diff --git a/Documentation/driver-api/pci.rst b/Documentation/driver-api/pci.rst new file mode 100644 index 000000000000..01a6c8b7d3a7 --- /dev/null +++ b/Documentation/driver-api/pci.rst | |||
@@ -0,0 +1,50 @@ | |||
1 | PCI Support Library | ||
2 | ------------------- | ||
3 | |||
4 | .. kernel-doc:: drivers/pci/pci.c | ||
5 | :export: | ||
6 | |||
7 | .. kernel-doc:: drivers/pci/pci-driver.c | ||
8 | :export: | ||
9 | |||
10 | .. kernel-doc:: drivers/pci/remove.c | ||
11 | :export: | ||
12 | |||
13 | .. kernel-doc:: drivers/pci/search.c | ||
14 | :export: | ||
15 | |||
16 | .. kernel-doc:: drivers/pci/msi.c | ||
17 | :export: | ||
18 | |||
19 | .. kernel-doc:: drivers/pci/bus.c | ||
20 | :export: | ||
21 | |||
22 | .. kernel-doc:: drivers/pci/access.c | ||
23 | :export: | ||
24 | |||
25 | .. kernel-doc:: drivers/pci/irq.c | ||
26 | :export: | ||
27 | |||
28 | .. kernel-doc:: drivers/pci/htirq.c | ||
29 | :export: | ||
30 | |||
31 | .. kernel-doc:: drivers/pci/probe.c | ||
32 | :export: | ||
33 | |||
34 | .. kernel-doc:: drivers/pci/slot.c | ||
35 | :export: | ||
36 | |||
37 | .. kernel-doc:: drivers/pci/rom.c | ||
38 | :export: | ||
39 | |||
40 | .. kernel-doc:: drivers/pci/iov.c | ||
41 | :export: | ||
42 | |||
43 | .. kernel-doc:: drivers/pci/pci-sysfs.c | ||
44 | :internal: | ||
45 | |||
46 | PCI Hotplug Support Library | ||
47 | --------------------------- | ||
48 | |||
49 | .. kernel-doc:: drivers/pci/hotplug/pci_hotplug_core.c | ||
50 | :export: | ||
diff --git a/Documentation/usb/URB.txt b/Documentation/driver-api/usb/URB.rst index 50da0d455444..61a54da9fce9 100644 --- a/Documentation/usb/URB.txt +++ b/Documentation/driver-api/usb/URB.rst | |||
@@ -1,28 +1,37 @@ | |||
1 | Revised: 2000-Dec-05. | 1 | .. _usb-urb: |
2 | Again: 2002-Jul-06 | ||
3 | Again: 2005-Sep-19 | ||
4 | 2 | ||
5 | NOTE: | 3 | USB Request Block (URB) |
4 | ~~~~~~~~~~~~~~~~~~~~~~~ | ||
6 | 5 | ||
7 | The USB subsystem now has a substantial section in "The Linux Kernel API" | 6 | :Revised: 2000-Dec-05 |
8 | guide (in Documentation/DocBook), generated from the current source | 7 | :Again: 2002-Jul-06 |
9 | code. This particular documentation file isn't particularly current or | 8 | :Again: 2005-Sep-19 |
10 | complete; don't rely on it except for a quick overview. | 9 | :Again: 2017-Mar-29 |
11 | 10 | ||
12 | 11 | ||
13 | 1.1. Basic concept or 'What is an URB?' | 12 | .. note:: |
14 | 13 | ||
15 | The basic idea of the new driver is message passing, the message itself is | 14 | The USB subsystem now has a substantial section at :ref:`usb-hostside-api` |
16 | called USB Request Block, or URB for short. | 15 | section, generated from the current source code. |
16 | This particular documentation file isn't complete and may not be | ||
17 | updated to the last version; don't rely on it except for a quick | ||
18 | overview. | ||
17 | 19 | ||
18 | - An URB consists of all relevant information to execute any USB transaction | 20 | Basic concept or 'What is an URB?' |
19 | and deliver the data and status back. | 21 | ================================== |
20 | 22 | ||
21 | - Execution of an URB is inherently an asynchronous operation, i.e. the | 23 | The basic idea of the new driver is message passing, the message itself is |
22 | usb_submit_urb(urb) call returns immediately after it has successfully | 24 | called USB Request Block, or URB for short. |
25 | |||
26 | - An URB consists of all relevant information to execute any USB transaction | ||
27 | and deliver the data and status back. | ||
28 | |||
29 | - Execution of an URB is inherently an asynchronous operation, i.e. the | ||
30 | :c:func:`usb_submit_urb` call returns immediately after it has successfully | ||
23 | queued the requested action. | 31 | queued the requested action. |
24 | 32 | ||
25 | - Transfers for one URB can be canceled with usb_unlink_urb(urb) at any time. | 33 | - Transfers for one URB can be canceled with :c:func:`usb_unlink_urb` |
34 | at any time. | ||
26 | 35 | ||
27 | - Each URB has a completion handler, which is called after the action | 36 | - Each URB has a completion handler, which is called after the action |
28 | has been successfully completed or canceled. The URB also contains a | 37 | has been successfully completed or canceled. The URB also contains a |
@@ -35,53 +44,55 @@ called USB Request Block, or URB for short. | |||
35 | of data to (or from) devices when using periodic transfer modes. | 44 | of data to (or from) devices when using periodic transfer modes. |
36 | 45 | ||
37 | 46 | ||
38 | 1.2. The URB structure | 47 | The URB structure |
48 | ================= | ||
39 | 49 | ||
40 | Some of the fields in an URB are: | 50 | Some of the fields in struct :c:type:`urb` are:: |
41 | 51 | ||
42 | struct urb | 52 | struct urb |
43 | { | 53 | { |
44 | // (IN) device and pipe specify the endpoint queue | 54 | // (IN) device and pipe specify the endpoint queue |
45 | struct usb_device *dev; // pointer to associated USB device | 55 | struct usb_device *dev; // pointer to associated USB device |
46 | unsigned int pipe; // endpoint information | 56 | unsigned int pipe; // endpoint information |
47 | 57 | ||
48 | unsigned int transfer_flags; // ISO_ASAP, SHORT_NOT_OK, etc. | 58 | unsigned int transfer_flags; // URB_ISO_ASAP, URB_SHORT_NOT_OK, etc. |
49 | 59 | ||
50 | // (IN) all urbs need completion routines | 60 | // (IN) all urbs need completion routines |
51 | void *context; // context for completion routine | 61 | void *context; // context for completion routine |
52 | void (*complete)(struct urb *); // pointer to completion routine | 62 | usb_complete_t complete; // pointer to completion routine |
53 | 63 | ||
54 | // (OUT) status after each completion | 64 | // (OUT) status after each completion |
55 | int status; // returned status | 65 | int status; // returned status |
56 | 66 | ||
57 | // (IN) buffer used for data transfers | 67 | // (IN) buffer used for data transfers |
58 | void *transfer_buffer; // associated data buffer | 68 | void *transfer_buffer; // associated data buffer |
59 | int transfer_buffer_length; // data buffer length | 69 | u32 transfer_buffer_length; // data buffer length |
60 | int number_of_packets; // size of iso_frame_desc | 70 | int number_of_packets; // size of iso_frame_desc |
61 | 71 | ||
62 | // (OUT) sometimes only part of CTRL/BULK/INTR transfer_buffer is used | 72 | // (OUT) sometimes only part of CTRL/BULK/INTR transfer_buffer is used |
63 | int actual_length; // actual data buffer length | 73 | u32 actual_length; // actual data buffer length |
64 | 74 | ||
65 | // (IN) setup stage for CTRL (pass a struct usb_ctrlrequest) | 75 | // (IN) setup stage for CTRL (pass a struct usb_ctrlrequest) |
66 | unsigned char* setup_packet; // setup packet (control only) | 76 | unsigned char *setup_packet; // setup packet (control only) |
67 | 77 | ||
68 | // Only for PERIODIC transfers (ISO, INTERRUPT) | 78 | // Only for PERIODIC transfers (ISO, INTERRUPT) |
69 | // (IN/OUT) start_frame is set unless ISO_ASAP isn't set | 79 | // (IN/OUT) start_frame is set unless URB_ISO_ASAP isn't set |
70 | int start_frame; // start frame | 80 | int start_frame; // start frame |
71 | int interval; // polling interval | 81 | int interval; // polling interval |
72 | 82 | ||
73 | // ISO only: packets are only "best effort"; each can have errors | 83 | // ISO only: packets are only "best effort"; each can have errors |
74 | int error_count; // number of errors | 84 | int error_count; // number of errors |
75 | struct usb_iso_packet_descriptor iso_frame_desc[0]; | 85 | struct usb_iso_packet_descriptor iso_frame_desc[0]; |
76 | }; | 86 | }; |
77 | 87 | ||
78 | Your driver must create the "pipe" value using values from the appropriate | 88 | Your driver must create the "pipe" value using values from the appropriate |
79 | endpoint descriptor in an interface that it's claimed. | 89 | endpoint descriptor in an interface that it's claimed. |
80 | 90 | ||
81 | 91 | ||
82 | 1.3. How to get an URB? | 92 | How to get an URB? |
93 | ================== | ||
83 | 94 | ||
84 | URBs are allocated with the following call | 95 | URBs are allocated by calling :c:func:`usb_alloc_urb`:: |
85 | 96 | ||
86 | struct urb *usb_alloc_urb(int isoframes, int mem_flags) | 97 | struct urb *usb_alloc_urb(int isoframes, int mem_flags) |
87 | 98 | ||
@@ -91,7 +102,7 @@ you want to schedule. For CTRL/BULK/INT, use 0. The mem_flags parameter | |||
91 | holds standard memory allocation flags, letting you control (among other | 102 | holds standard memory allocation flags, letting you control (among other |
92 | things) whether the underlying code may block or not. | 103 | things) whether the underlying code may block or not. |
93 | 104 | ||
94 | To free an URB, use | 105 | To free an URB, use :c:func:`usb_free_urb`:: |
95 | 106 | ||
96 | void usb_free_urb(struct urb *urb) | 107 | void usb_free_urb(struct urb *urb) |
97 | 108 | ||
@@ -100,78 +111,84 @@ returned to you in a completion callback. It will automatically be | |||
100 | deallocated when it is no longer in use. | 111 | deallocated when it is no longer in use. |
101 | 112 | ||
102 | 113 | ||
103 | 1.4. What has to be filled in? | 114 | What has to be filled in? |
115 | ========================= | ||
104 | 116 | ||
105 | Depending on the type of transaction, there are some inline functions | 117 | Depending on the type of transaction, there are some inline functions |
106 | defined in <linux/usb.h> to simplify the initialization, such as | 118 | defined in ``linux/usb.h`` to simplify the initialization, such as |
107 | fill_control_urb() and fill_bulk_urb(). In general, they need the usb | 119 | :c:func:`usb_fill_control_urb`, :c:func:`usb_fill_bulk_urb` and |
108 | device pointer, the pipe (usual format from usb.h), the transfer buffer, | 120 | :c:func:`usb_fill_int_urb`. In general, they need the usb device pointer, |
109 | the desired transfer length, the completion handler, and its context. | 121 | the pipe (usual format from usb.h), the transfer buffer, the desired transfer |
110 | Take a look at the some existing drivers to see how they're used. | 122 | length, the completion handler, and its context. Take a look at the some |
123 | existing drivers to see how they're used. | ||
111 | 124 | ||
112 | Flags: | 125 | Flags: |
113 | For ISO there are two startup behaviors: Specified start_frame or ASAP. | ||
114 | For ASAP set URB_ISO_ASAP in transfer_flags. | ||
115 | 126 | ||
116 | If short packets should NOT be tolerated, set URB_SHORT_NOT_OK in | 127 | - For ISO there are two startup behaviors: Specified start_frame or ASAP. |
128 | - For ASAP set ``URB_ISO_ASAP`` in transfer_flags. | ||
129 | |||
130 | If short packets should NOT be tolerated, set ``URB_SHORT_NOT_OK`` in | ||
117 | transfer_flags. | 131 | transfer_flags. |
118 | 132 | ||
119 | 133 | ||
120 | 1.5. How to submit an URB? | 134 | How to submit an URB? |
135 | ===================== | ||
121 | 136 | ||
122 | Just call | 137 | Just call :c:func:`usb_submit_urb`:: |
123 | 138 | ||
124 | int usb_submit_urb(struct urb *urb, int mem_flags) | 139 | int usb_submit_urb(struct urb *urb, int mem_flags) |
125 | 140 | ||
126 | The mem_flags parameter, such as SLAB_ATOMIC, controls memory allocation, | 141 | The ``mem_flags`` parameter, such as ``GFP_ATOMIC``, controls memory |
127 | such as whether the lower levels may block when memory is tight. | 142 | allocation, such as whether the lower levels may block when memory is tight. |
128 | 143 | ||
129 | It immediately returns, either with status 0 (request queued) or some | 144 | It immediately returns, either with status 0 (request queued) or some |
130 | error code, usually caused by the following: | 145 | error code, usually caused by the following: |
131 | 146 | ||
132 | - Out of memory (-ENOMEM) | 147 | - Out of memory (``-ENOMEM``) |
133 | - Unplugged device (-ENODEV) | 148 | - Unplugged device (``-ENODEV``) |
134 | - Stalled endpoint (-EPIPE) | 149 | - Stalled endpoint (``-EPIPE``) |
135 | - Too many queued ISO transfers (-EAGAIN) | 150 | - Too many queued ISO transfers (``-EAGAIN``) |
136 | - Too many requested ISO frames (-EFBIG) | 151 | - Too many requested ISO frames (``-EFBIG``) |
137 | - Invalid INT interval (-EINVAL) | 152 | - Invalid INT interval (``-EINVAL``) |
138 | - More than one packet for INT (-EINVAL) | 153 | - More than one packet for INT (``-EINVAL``) |
139 | 154 | ||
140 | After submission, urb->status is -EINPROGRESS; however, you should never | 155 | After submission, ``urb->status`` is ``-EINPROGRESS``; however, you should |
141 | look at that value except in your completion callback. | 156 | never look at that value except in your completion callback. |
142 | 157 | ||
143 | For isochronous endpoints, your completion handlers should (re)submit | 158 | For isochronous endpoints, your completion handlers should (re)submit |
144 | URBs to the same endpoint with the ISO_ASAP flag, using multi-buffering, | 159 | URBs to the same endpoint with the ``URB_ISO_ASAP`` flag, using |
145 | to get seamless ISO streaming. | 160 | multi-buffering, to get seamless ISO streaming. |
146 | 161 | ||
147 | 162 | ||
148 | 1.6. How to cancel an already running URB? | 163 | How to cancel an already running URB? |
164 | ===================================== | ||
149 | 165 | ||
150 | There are two ways to cancel an URB you've submitted but which hasn't | 166 | There are two ways to cancel an URB you've submitted but which hasn't |
151 | been returned to your driver yet. For an asynchronous cancel, call | 167 | been returned to your driver yet. For an asynchronous cancel, call |
168 | :c:func:`usb_unlink_urb`:: | ||
152 | 169 | ||
153 | int usb_unlink_urb(struct urb *urb) | 170 | int usb_unlink_urb(struct urb *urb) |
154 | 171 | ||
155 | It removes the urb from the internal list and frees all allocated | 172 | It removes the urb from the internal list and frees all allocated |
156 | HW descriptors. The status is changed to reflect unlinking. Note | 173 | HW descriptors. The status is changed to reflect unlinking. Note |
157 | that the URB will not normally have finished when usb_unlink_urb() | 174 | that the URB will not normally have finished when :c:func:`usb_unlink_urb` |
158 | returns; you must still wait for the completion handler to be called. | 175 | returns; you must still wait for the completion handler to be called. |
159 | 176 | ||
160 | To cancel an URB synchronously, call | 177 | To cancel an URB synchronously, call :c:func:`usb_kill_urb`:: |
161 | 178 | ||
162 | void usb_kill_urb(struct urb *urb) | 179 | void usb_kill_urb(struct urb *urb) |
163 | 180 | ||
164 | It does everything usb_unlink_urb does, and in addition it waits | 181 | It does everything :c:func:`usb_unlink_urb` does, and in addition it waits |
165 | until after the URB has been returned and the completion handler | 182 | until after the URB has been returned and the completion handler |
166 | has finished. It also marks the URB as temporarily unusable, so | 183 | has finished. It also marks the URB as temporarily unusable, so |
167 | that if the completion handler or anyone else tries to resubmit it | 184 | that if the completion handler or anyone else tries to resubmit it |
168 | they will get a -EPERM error. Thus you can be sure that when | 185 | they will get a ``-EPERM`` error. Thus you can be sure that when |
169 | usb_kill_urb() returns, the URB is totally idle. | 186 | :c:func:`usb_kill_urb` returns, the URB is totally idle. |
170 | 187 | ||
171 | There is a lifetime issue to consider. An URB may complete at any | 188 | There is a lifetime issue to consider. An URB may complete at any |
172 | time, and the completion handler may free the URB. If this happens | 189 | time, and the completion handler may free the URB. If this happens |
173 | while usb_unlink_urb or usb_kill_urb is running, it will cause a | 190 | while :c:func:`usb_unlink_urb` or :c:func:`usb_kill_urb` is running, it will |
174 | memory-access violation. The driver is responsible for avoiding this, | 191 | cause a memory-access violation. The driver is responsible for avoiding this, |
175 | which often means some sort of lock will be needed to prevent the URB | 192 | which often means some sort of lock will be needed to prevent the URB |
176 | from being deallocated while it is still in use. | 193 | from being deallocated while it is still in use. |
177 | 194 | ||
@@ -181,24 +198,25 @@ when usb_unlink_urb is invoked. The general solution to this problem | |||
181 | is to increment the URB's reference count while holding the lock, then | 198 | is to increment the URB's reference count while holding the lock, then |
182 | drop the lock and call usb_unlink_urb or usb_kill_urb, and then | 199 | drop the lock and call usb_unlink_urb or usb_kill_urb, and then |
183 | decrement the URB's reference count. You increment the reference | 200 | decrement the URB's reference count. You increment the reference |
184 | count by calling | 201 | count by calling :c:func`usb_get_urb`:: |
185 | 202 | ||
186 | struct urb *usb_get_urb(struct urb *urb) | 203 | struct urb *usb_get_urb(struct urb *urb) |
187 | 204 | ||
188 | (ignore the return value; it is the same as the argument) and | 205 | (ignore the return value; it is the same as the argument) and |
189 | decrement the reference count by calling usb_free_urb. Of course, | 206 | decrement the reference count by calling :c:func:`usb_free_urb`. Of course, |
190 | none of this is necessary if there's no danger of the URB being freed | 207 | none of this is necessary if there's no danger of the URB being freed |
191 | by the completion handler. | 208 | by the completion handler. |
192 | 209 | ||
193 | 210 | ||
194 | 1.7. What about the completion handler? | 211 | What about the completion handler? |
212 | ================================== | ||
195 | 213 | ||
196 | The handler is of the following type: | 214 | The handler is of the following type:: |
197 | 215 | ||
198 | typedef void (*usb_complete_t)(struct urb *) | 216 | typedef void (*usb_complete_t)(struct urb *) |
199 | 217 | ||
200 | I.e., it gets the URB that caused the completion call. In the completion | 218 | I.e., it gets the URB that caused the completion call. In the completion |
201 | handler, you should have a look at urb->status to detect any USB errors. | 219 | handler, you should have a look at ``urb->status`` to detect any USB errors. |
202 | Since the context parameter is included in the URB, you can pass | 220 | Since the context parameter is included in the URB, you can pass |
203 | information to the completion handler. | 221 | information to the completion handler. |
204 | 222 | ||
@@ -208,54 +226,65 @@ sixteen packets to transfer your 1KByte buffer, and ten of them might | |||
208 | have transferred successfully before the completion was called. | 226 | have transferred successfully before the completion was called. |
209 | 227 | ||
210 | 228 | ||
211 | NOTE: ***** WARNING ***** | 229 | .. warning:: |
212 | NEVER SLEEP IN A COMPLETION HANDLER. These are often called in atomic | 230 | |
213 | context. | 231 | NEVER SLEEP IN A COMPLETION HANDLER. |
232 | |||
233 | These are often called in atomic context. | ||
214 | 234 | ||
215 | In the current kernel, completion handlers run with local interrupts | 235 | In the current kernel, completion handlers run with local interrupts |
216 | disabled, but in the future this will be changed, so don't assume that | 236 | disabled, but in the future this will be changed, so don't assume that |
217 | local IRQs are always disabled inside completion handlers. | 237 | local IRQs are always disabled inside completion handlers. |
218 | 238 | ||
219 | 1.8. How to do isochronous (ISO) transfers? | 239 | How to do isochronous (ISO) transfers? |
240 | ====================================== | ||
241 | |||
242 | Besides the fields present on a bulk transfer, for ISO, you also | ||
243 | also have to set ``urb->interval`` to say how often to make transfers; it's | ||
244 | often one per frame (which is once every microframe for highspeed devices). | ||
245 | The actual interval used will be a power of two that's no bigger than what | ||
246 | you specify. You can use the :c:func:`usb_fill_int_urb` macro to fill | ||
247 | most ISO transfer fields. | ||
220 | 248 | ||
221 | For ISO transfers you have to fill a usb_iso_packet_descriptor structure, | 249 | For ISO transfers you also have to fill a :c:type:`usb_iso_packet_descriptor` |
222 | allocated at the end of the URB by usb_alloc_urb(n,mem_flags), for each | 250 | structure, allocated at the end of the URB by :c:func:`usb_alloc_urb`, for |
223 | packet you want to schedule. You also have to set urb->interval to say | 251 | each packet you want to schedule. |
224 | how often to make transfers; it's often one per frame (which is once | ||
225 | every microframe for highspeed devices). The actual interval used will | ||
226 | be a power of two that's no bigger than what you specify. | ||
227 | 252 | ||
228 | The usb_submit_urb() call modifies urb->interval to the implemented interval | 253 | The :c:func:`usb_submit_urb` call modifies ``urb->interval`` to the implemented |
229 | value that is less than or equal to the requested interval value. If | 254 | interval value that is less than or equal to the requested interval value. If |
230 | ISO_ASAP scheduling is used, urb->start_frame is also updated. | 255 | ``URB_ISO_ASAP`` scheduling is used, ``urb->start_frame`` is also updated. |
231 | 256 | ||
232 | For each entry you have to specify the data offset for this frame (base is | 257 | For each entry you have to specify the data offset for this frame (base is |
233 | transfer_buffer), and the length you want to write/expect to read. | 258 | transfer_buffer), and the length you want to write/expect to read. |
234 | After completion, actual_length contains the actual transferred length and | 259 | After completion, actual_length contains the actual transferred length and |
235 | status contains the resulting status for the ISO transfer for this frame. | 260 | status contains the resulting status for the ISO transfer for this frame. |
236 | It is allowed to specify a varying length from frame to frame (e.g. for | 261 | It is allowed to specify a varying length from frame to frame (e.g. for |
237 | audio synchronisation/adaptive transfer rates). You can also use the length | 262 | audio synchronisation/adaptive transfer rates). You can also use the length |
238 | 0 to omit one or more frames (striping). | 263 | 0 to omit one or more frames (striping). |
239 | 264 | ||
240 | For scheduling you can choose your own start frame or ISO_ASAP. As explained | 265 | For scheduling you can choose your own start frame or ``URB_ISO_ASAP``. As |
241 | earlier, if you always keep at least one URB queued and your completion | 266 | explained earlier, if you always keep at least one URB queued and your |
242 | keeps (re)submitting a later URB, you'll get smooth ISO streaming (if usb | 267 | completion keeps (re)submitting a later URB, you'll get smooth ISO streaming |
243 | bandwidth utilization allows). | 268 | (if usb bandwidth utilization allows). |
244 | 269 | ||
245 | If you specify your own start frame, make sure it's several frames in advance | 270 | If you specify your own start frame, make sure it's several frames in advance |
246 | of the current frame. You might want this model if you're synchronizing | 271 | of the current frame. You might want this model if you're synchronizing |
247 | ISO data with some other event stream. | 272 | ISO data with some other event stream. |
248 | 273 | ||
249 | 274 | ||
250 | 1.9. How to start interrupt (INT) transfers? | 275 | How to start interrupt (INT) transfers? |
276 | ======================================= | ||
251 | 277 | ||
252 | Interrupt transfers, like isochronous transfers, are periodic, and happen | 278 | Interrupt transfers, like isochronous transfers, are periodic, and happen |
253 | in intervals that are powers of two (1, 2, 4 etc) units. Units are frames | 279 | in intervals that are powers of two (1, 2, 4 etc) units. Units are frames |
254 | for full and low speed devices, and microframes for high speed ones. | 280 | for full and low speed devices, and microframes for high speed ones. |
255 | The usb_submit_urb() call modifies urb->interval to the implemented interval | 281 | You can use the :c:func:`usb_fill_int_urb` macro to fill INT transfer fields. |
256 | value that is less than or equal to the requested interval value. | 282 | |
283 | The :c:func:`usb_submit_urb` call modifies ``urb->interval`` to the implemented | ||
284 | interval value that is less than or equal to the requested interval value. | ||
257 | 285 | ||
258 | In Linux 2.6, unlike earlier versions, interrupt URBs are not automagically | 286 | In Linux 2.6, unlike earlier versions, interrupt URBs are not automagically |
259 | restarted when they complete. They end when the completion handler is | 287 | restarted when they complete. They end when the completion handler is |
260 | called, just like other URBs. If you want an interrupt URB to be restarted, | 288 | called, just like other URBs. If you want an interrupt URB to be restarted, |
261 | your completion handler must resubmit it. | 289 | your completion handler must resubmit it. |
290 | s | ||
diff --git a/Documentation/usb/anchors.txt b/Documentation/driver-api/usb/anchors.rst index fe6a99a32bbd..4b248e691bd6 100644 --- a/Documentation/usb/anchors.txt +++ b/Documentation/driver-api/usb/anchors.rst | |||
@@ -1,3 +1,6 @@ | |||
1 | USB Anchors | ||
2 | ~~~~~~~~~~~ | ||
3 | |||
1 | What is anchor? | 4 | What is anchor? |
2 | =============== | 5 | =============== |
3 | 6 | ||
@@ -13,7 +16,7 @@ Allocation and Initialisation | |||
13 | ============================= | 16 | ============================= |
14 | 17 | ||
15 | There's no API to allocate an anchor. It is simply declared | 18 | There's no API to allocate an anchor. It is simply declared |
16 | as struct usb_anchor. init_usb_anchor() must be called to | 19 | as struct usb_anchor. :c:func:`init_usb_anchor` must be called to |
17 | initialise the data structure. | 20 | initialise the data structure. |
18 | 21 | ||
19 | Deallocation | 22 | Deallocation |
@@ -26,52 +29,53 @@ Association and disassociation of URBs with anchors | |||
26 | =================================================== | 29 | =================================================== |
27 | 30 | ||
28 | An association of URBs to an anchor is made by an explicit | 31 | An association of URBs to an anchor is made by an explicit |
29 | call to usb_anchor_urb(). The association is maintained until | 32 | call to :c:func:`usb_anchor_urb`. The association is maintained until |
30 | an URB is finished by (successful) completion. Thus disassociation | 33 | an URB is finished by (successful) completion. Thus disassociation |
31 | is automatic. A function is provided to forcibly finish (kill) | 34 | is automatic. A function is provided to forcibly finish (kill) |
32 | all URBs associated with an anchor. | 35 | all URBs associated with an anchor. |
33 | Furthermore, disassociation can be made with usb_unanchor_urb() | 36 | Furthermore, disassociation can be made with :c:func:`usb_unanchor_urb` |
34 | 37 | ||
35 | Operations on multitudes of URBs | 38 | Operations on multitudes of URBs |
36 | ================================ | 39 | ================================ |
37 | 40 | ||
38 | usb_kill_anchored_urbs() | 41 | :c:func:`usb_kill_anchored_urbs` |
39 | ------------------------ | 42 | -------------------------------- |
40 | 43 | ||
41 | This function kills all URBs associated with an anchor. The URBs | 44 | This function kills all URBs associated with an anchor. The URBs |
42 | are called in the reverse temporal order they were submitted. | 45 | are called in the reverse temporal order they were submitted. |
43 | This way no data can be reordered. | 46 | This way no data can be reordered. |
44 | 47 | ||
45 | usb_unlink_anchored_urbs() | 48 | :c:func:`usb_unlink_anchored_urbs` |
46 | -------------------------- | 49 | ---------------------------------- |
50 | |||
47 | 51 | ||
48 | This function unlinks all URBs associated with an anchor. The URBs | 52 | This function unlinks all URBs associated with an anchor. The URBs |
49 | are processed in the reverse temporal order they were submitted. | 53 | are processed in the reverse temporal order they were submitted. |
50 | This is similar to usb_kill_anchored_urbs(), but it will not sleep. | 54 | This is similar to :c:func:`usb_kill_anchored_urbs`, but it will not sleep. |
51 | Therefore no guarantee is made that the URBs have been unlinked when | 55 | Therefore no guarantee is made that the URBs have been unlinked when |
52 | the call returns. They may be unlinked later but will be unlinked in | 56 | the call returns. They may be unlinked later but will be unlinked in |
53 | finite time. | 57 | finite time. |
54 | 58 | ||
55 | usb_scuttle_anchored_urbs() | 59 | :c:func:`usb_scuttle_anchored_urbs` |
56 | --------------------------- | 60 | ----------------------------------- |
57 | 61 | ||
58 | All URBs of an anchor are unanchored en masse. | 62 | All URBs of an anchor are unanchored en masse. |
59 | 63 | ||
60 | usb_wait_anchor_empty_timeout() | 64 | :c:func:`usb_wait_anchor_empty_timeout` |
61 | ------------------------------- | 65 | --------------------------------------- |
62 | 66 | ||
63 | This function waits for all URBs associated with an anchor to finish | 67 | This function waits for all URBs associated with an anchor to finish |
64 | or a timeout, whichever comes first. Its return value will tell you | 68 | or a timeout, whichever comes first. Its return value will tell you |
65 | whether the timeout was reached. | 69 | whether the timeout was reached. |
66 | 70 | ||
67 | usb_anchor_empty() | 71 | :c:func:`usb_anchor_empty` |
68 | ------------------ | 72 | -------------------------- |
69 | 73 | ||
70 | Returns true if no URBs are associated with an anchor. Locking | 74 | Returns true if no URBs are associated with an anchor. Locking |
71 | is the caller's responsibility. | 75 | is the caller's responsibility. |
72 | 76 | ||
73 | usb_get_from_anchor() | 77 | :c:func:`usb_get_from_anchor` |
74 | --------------------- | 78 | ----------------------------- |
75 | 79 | ||
76 | Returns the oldest anchored URB of an anchor. The URB is unanchored | 80 | Returns the oldest anchored URB of an anchor. The URB is unanchored |
77 | and returned with a reference. As you may mix URBs to several | 81 | and returned with a reference. As you may mix URBs to several |
diff --git a/Documentation/usb/bulk-streams.txt b/Documentation/driver-api/usb/bulk-streams.rst index ffc02021863e..99b515babdeb 100644 --- a/Documentation/usb/bulk-streams.txt +++ b/Documentation/driver-api/usb/bulk-streams.rst | |||
@@ -1,3 +1,6 @@ | |||
1 | USB bulk streams | ||
2 | ~~~~~~~~~~~~~~~~ | ||
3 | |||
1 | Background | 4 | Background |
2 | ========== | 5 | ========== |
3 | 6 | ||
@@ -25,7 +28,9 @@ time. | |||
25 | Driver implications | 28 | Driver implications |
26 | =================== | 29 | =================== |
27 | 30 | ||
28 | int usb_alloc_streams(struct usb_interface *interface, | 31 | :: |
32 | |||
33 | int usb_alloc_streams(struct usb_interface *interface, | ||
29 | struct usb_host_endpoint **eps, unsigned int num_eps, | 34 | struct usb_host_endpoint **eps, unsigned int num_eps, |
30 | unsigned int num_streams, gfp_t mem_flags); | 35 | unsigned int num_streams, gfp_t mem_flags); |
31 | 36 | ||
@@ -53,7 +58,7 @@ controller driver, and may change in the future. | |||
53 | 58 | ||
54 | 59 | ||
55 | Picking new Stream IDs to use | 60 | Picking new Stream IDs to use |
56 | ============================ | 61 | ============================= |
57 | 62 | ||
58 | Stream ID 0 is reserved, and should not be used to communicate with devices. If | 63 | Stream ID 0 is reserved, and should not be used to communicate with devices. If |
59 | usb_alloc_streams() returns with a value of N, you may use streams 1 though N. | 64 | usb_alloc_streams() returns with a value of N, you may use streams 1 though N. |
@@ -68,9 +73,9 @@ Clean up | |||
68 | ======== | 73 | ======== |
69 | 74 | ||
70 | If a driver wishes to stop using streams to communicate with the device, it | 75 | If a driver wishes to stop using streams to communicate with the device, it |
71 | should call | 76 | should call:: |
72 | 77 | ||
73 | void usb_free_streams(struct usb_interface *interface, | 78 | void usb_free_streams(struct usb_interface *interface, |
74 | struct usb_host_endpoint **eps, unsigned int num_eps, | 79 | struct usb_host_endpoint **eps, unsigned int num_eps, |
75 | gfp_t mem_flags); | 80 | gfp_t mem_flags); |
76 | 81 | ||
diff --git a/Documentation/usb/callbacks.txt b/Documentation/driver-api/usb/callbacks.rst index 9e85846bdb98..2b80cf54bcc3 100644 --- a/Documentation/usb/callbacks.txt +++ b/Documentation/driver-api/usb/callbacks.rst | |||
@@ -1,3 +1,6 @@ | |||
1 | USB core callbacks | ||
2 | ~~~~~~~~~~~~~~~~~~ | ||
3 | |||
1 | What callbacks will usbcore do? | 4 | What callbacks will usbcore do? |
2 | =============================== | 5 | =============================== |
3 | 6 | ||
@@ -5,40 +8,52 @@ Usbcore will call into a driver through callbacks defined in the driver | |||
5 | structure and through the completion handler of URBs a driver submits. | 8 | structure and through the completion handler of URBs a driver submits. |
6 | Only the former are in the scope of this document. These two kinds of | 9 | Only the former are in the scope of this document. These two kinds of |
7 | callbacks are completely independent of each other. Information on the | 10 | callbacks are completely independent of each other. Information on the |
8 | completion callback can be found in Documentation/usb/URB.txt. | 11 | completion callback can be found in :ref:`usb-urb`. |
9 | 12 | ||
10 | The callbacks defined in the driver structure are: | 13 | The callbacks defined in the driver structure are: |
11 | 14 | ||
12 | 1. Hotplugging callbacks: | 15 | 1. Hotplugging callbacks: |
13 | 16 | ||
14 | * @probe: Called to see if the driver is willing to manage a particular | 17 | - @probe: |
15 | * interface on a device. | 18 | Called to see if the driver is willing to manage a particular |
16 | * @disconnect: Called when the interface is no longer accessible, usually | 19 | interface on a device. |
17 | * because its device has been (or is being) disconnected or the | 20 | |
18 | * driver module is being unloaded. | 21 | - @disconnect: |
22 | Called when the interface is no longer accessible, usually | ||
23 | because its device has been (or is being) disconnected or the | ||
24 | driver module is being unloaded. | ||
19 | 25 | ||
20 | 2. Odd backdoor through usbfs: | 26 | 2. Odd backdoor through usbfs: |
21 | 27 | ||
22 | * @ioctl: Used for drivers that want to talk to userspace through | 28 | - @ioctl: |
23 | * the "usbfs" filesystem. This lets devices provide ways to | 29 | Used for drivers that want to talk to userspace through |
24 | * expose information to user space regardless of where they | 30 | the "usbfs" filesystem. This lets devices provide ways to |
25 | * do (or don't) show up otherwise in the filesystem. | 31 | expose information to user space regardless of where they |
32 | do (or don't) show up otherwise in the filesystem. | ||
26 | 33 | ||
27 | 3. Power management (PM) callbacks: | 34 | 3. Power management (PM) callbacks: |
28 | 35 | ||
29 | * @suspend: Called when the device is going to be suspended. | 36 | - @suspend: |
30 | * @resume: Called when the device is being resumed. | 37 | Called when the device is going to be suspended. |
31 | * @reset_resume: Called when the suspended device has been reset instead | 38 | |
32 | * of being resumed. | 39 | - @resume: |
40 | Called when the device is being resumed. | ||
41 | |||
42 | - @reset_resume: | ||
43 | Called when the suspended device has been reset instead | ||
44 | of being resumed. | ||
33 | 45 | ||
34 | 4. Device level operations: | 46 | 4. Device level operations: |
35 | 47 | ||
36 | * @pre_reset: Called when the device is about to be reset. | 48 | - @pre_reset: |
37 | * @post_reset: Called after the device has been reset | 49 | Called when the device is about to be reset. |
50 | |||
51 | - @post_reset: | ||
52 | Called after the device has been reset | ||
38 | 53 | ||
39 | The ioctl interface (2) should be used only if you have a very good | 54 | The ioctl interface (2) should be used only if you have a very good |
40 | reason. Sysfs is preferred these days. The PM callbacks are covered | 55 | reason. Sysfs is preferred these days. The PM callbacks are covered |
41 | separately in Documentation/usb/power-management.txt. | 56 | separately in :ref:`usb-power-management`. |
42 | 57 | ||
43 | Calling conventions | 58 | Calling conventions |
44 | =================== | 59 | =================== |
@@ -58,7 +73,9 @@ an interface. A driver's bond to an interface is exclusive. | |||
58 | The probe() callback | 73 | The probe() callback |
59 | -------------------- | 74 | -------------------- |
60 | 75 | ||
61 | int (*probe) (struct usb_interface *intf, | 76 | :: |
77 | |||
78 | int (*probe) (struct usb_interface *intf, | ||
62 | const struct usb_device_id *id); | 79 | const struct usb_device_id *id); |
63 | 80 | ||
64 | Accept or decline an interface. If you accept the device return 0, | 81 | Accept or decline an interface. If you accept the device return 0, |
@@ -75,7 +92,9 @@ initialisation that doesn't take too long is a good idea here. | |||
75 | The disconnect() callback | 92 | The disconnect() callback |
76 | ------------------------- | 93 | ------------------------- |
77 | 94 | ||
78 | void (*disconnect) (struct usb_interface *intf); | 95 | :: |
96 | |||
97 | void (*disconnect) (struct usb_interface *intf); | ||
79 | 98 | ||
80 | This callback is a signal to break any connection with an interface. | 99 | This callback is a signal to break any connection with an interface. |
81 | You are not allowed any IO to a device after returning from this | 100 | You are not allowed any IO to a device after returning from this |
@@ -93,7 +112,9 @@ Device level callbacks | |||
93 | pre_reset | 112 | pre_reset |
94 | --------- | 113 | --------- |
95 | 114 | ||
96 | int (*pre_reset)(struct usb_interface *intf); | 115 | :: |
116 | |||
117 | int (*pre_reset)(struct usb_interface *intf); | ||
97 | 118 | ||
98 | A driver or user space is triggering a reset on the device which | 119 | A driver or user space is triggering a reset on the device which |
99 | contains the interface passed as an argument. Cease IO, wait for all | 120 | contains the interface passed as an argument. Cease IO, wait for all |
@@ -107,7 +128,9 @@ are in atomic context. | |||
107 | post_reset | 128 | post_reset |
108 | ---------- | 129 | ---------- |
109 | 130 | ||
110 | int (*post_reset)(struct usb_interface *intf); | 131 | :: |
132 | |||
133 | int (*post_reset)(struct usb_interface *intf); | ||
111 | 134 | ||
112 | The reset has completed. Restore any saved device state and begin | 135 | The reset has completed. Restore any saved device state and begin |
113 | using the device again. | 136 | using the device again. |
diff --git a/Documentation/usb/dma.txt b/Documentation/driver-api/usb/dma.rst index 444651e70d95..59d5aee89e37 100644 --- a/Documentation/usb/dma.txt +++ b/Documentation/driver-api/usb/dma.rst | |||
@@ -1,16 +1,19 @@ | |||
1 | USB DMA | ||
2 | ~~~~~~~ | ||
3 | |||
1 | In Linux 2.5 kernels (and later), USB device drivers have additional control | 4 | In Linux 2.5 kernels (and later), USB device drivers have additional control |
2 | over how DMA may be used to perform I/O operations. The APIs are detailed | 5 | over how DMA may be used to perform I/O operations. The APIs are detailed |
3 | in the kernel usb programming guide (kerneldoc, from the source code). | 6 | in the kernel usb programming guide (kerneldoc, from the source code). |
4 | 7 | ||
5 | 8 | API overview | |
6 | API OVERVIEW | 9 | ============ |
7 | 10 | ||
8 | The big picture is that USB drivers can continue to ignore most DMA issues, | 11 | The big picture is that USB drivers can continue to ignore most DMA issues, |
9 | though they still must provide DMA-ready buffers (see | 12 | though they still must provide DMA-ready buffers (see |
10 | Documentation/DMA-API-HOWTO.txt). That's how they've worked through | 13 | ``Documentation/DMA-API-HOWTO.txt``). That's how they've worked through |
11 | the 2.4 (and earlier) kernels. | 14 | the 2.4 (and earlier) kernels, or they can now be DMA-aware. |
12 | 15 | ||
13 | OR: they can now be DMA-aware. | 16 | DMA-aware usb drivers: |
14 | 17 | ||
15 | - New calls enable DMA-aware drivers, letting them allocate dma buffers and | 18 | - New calls enable DMA-aware drivers, letting them allocate dma buffers and |
16 | manage dma mappings for existing dma-ready buffers (see below). | 19 | manage dma mappings for existing dma-ready buffers (see below). |
@@ -20,15 +23,15 @@ OR: they can now be DMA-aware. | |||
20 | drivers must not use it.) | 23 | drivers must not use it.) |
21 | 24 | ||
22 | - "usbcore" will map this DMA address, if a DMA-aware driver didn't do | 25 | - "usbcore" will map this DMA address, if a DMA-aware driver didn't do |
23 | it first and set URB_NO_TRANSFER_DMA_MAP. HCDs | 26 | it first and set ``URB_NO_TRANSFER_DMA_MAP``. HCDs |
24 | don't manage dma mappings for URBs. | 27 | don't manage dma mappings for URBs. |
25 | 28 | ||
26 | - There's a new "generic DMA API", parts of which are usable by USB device | 29 | - There's a new "generic DMA API", parts of which are usable by USB device |
27 | drivers. Never use dma_set_mask() on any USB interface or device; that | 30 | drivers. Never use dma_set_mask() on any USB interface or device; that |
28 | would potentially break all devices sharing that bus. | 31 | would potentially break all devices sharing that bus. |
29 | 32 | ||
30 | 33 | Eliminating copies | |
31 | ELIMINATING COPIES | 34 | ================== |
32 | 35 | ||
33 | It's good to avoid making CPUs copy data needlessly. The costs can add up, | 36 | It's good to avoid making CPUs copy data needlessly. The costs can add up, |
34 | and effects like cache-trashing can impose subtle penalties. | 37 | and effects like cache-trashing can impose subtle penalties. |
@@ -41,7 +44,7 @@ and effects like cache-trashing can impose subtle penalties. | |||
41 | For those specific cases, USB has primitives to allocate less expensive | 44 | For those specific cases, USB has primitives to allocate less expensive |
42 | memory. They work like kmalloc and kfree versions that give you the right | 45 | memory. They work like kmalloc and kfree versions that give you the right |
43 | kind of addresses to store in urb->transfer_buffer and urb->transfer_dma. | 46 | kind of addresses to store in urb->transfer_buffer and urb->transfer_dma. |
44 | You'd also set URB_NO_TRANSFER_DMA_MAP in urb->transfer_flags: | 47 | You'd also set ``URB_NO_TRANSFER_DMA_MAP`` in urb->transfer_flags:: |
45 | 48 | ||
46 | void *usb_alloc_coherent (struct usb_device *dev, size_t size, | 49 | void *usb_alloc_coherent (struct usb_device *dev, size_t size, |
47 | int mem_flags, dma_addr_t *dma); | 50 | int mem_flags, dma_addr_t *dma); |
@@ -49,15 +52,15 @@ and effects like cache-trashing can impose subtle penalties. | |||
49 | void usb_free_coherent (struct usb_device *dev, size_t size, | 52 | void usb_free_coherent (struct usb_device *dev, size_t size, |
50 | void *addr, dma_addr_t dma); | 53 | void *addr, dma_addr_t dma); |
51 | 54 | ||
52 | Most drivers should *NOT* be using these primitives; they don't need | 55 | Most drivers should **NOT** be using these primitives; they don't need |
53 | to use this type of memory ("dma-coherent"), and memory returned from | 56 | to use this type of memory ("dma-coherent"), and memory returned from |
54 | kmalloc() will work just fine. | 57 | :c:func:`kmalloc` will work just fine. |
55 | 58 | ||
56 | The memory buffer returned is "dma-coherent"; sometimes you might need to | 59 | The memory buffer returned is "dma-coherent"; sometimes you might need to |
57 | force a consistent memory access ordering by using memory barriers. It's | 60 | force a consistent memory access ordering by using memory barriers. It's |
58 | not using a streaming DMA mapping, so it's good for small transfers on | 61 | not using a streaming DMA mapping, so it's good for small transfers on |
59 | systems where the I/O would otherwise thrash an IOMMU mapping. (See | 62 | systems where the I/O would otherwise thrash an IOMMU mapping. (See |
60 | Documentation/DMA-API-HOWTO.txt for definitions of "coherent" and | 63 | ``Documentation/DMA-API-HOWTO.txt`` for definitions of "coherent" and |
61 | "streaming" DMA mappings.) | 64 | "streaming" DMA mappings.) |
62 | 65 | ||
63 | Asking for 1/Nth of a page (as well as asking for N pages) is reasonably | 66 | Asking for 1/Nth of a page (as well as asking for N pages) is reasonably |
@@ -75,15 +78,15 @@ and effects like cache-trashing can impose subtle penalties. | |||
75 | way to expose these capabilities ... and in any case, HIGHMEM is mostly a | 78 | way to expose these capabilities ... and in any case, HIGHMEM is mostly a |
76 | design wart specific to x86_32. So your best bet is to ensure you never | 79 | design wart specific to x86_32. So your best bet is to ensure you never |
77 | pass a highmem buffer into a USB driver. That's easy; it's the default | 80 | pass a highmem buffer into a USB driver. That's easy; it's the default |
78 | behavior. Just don't override it; e.g. with NETIF_F_HIGHDMA. | 81 | behavior. Just don't override it; e.g. with ``NETIF_F_HIGHDMA``. |
79 | 82 | ||
80 | This may force your callers to do some bounce buffering, copying from | 83 | This may force your callers to do some bounce buffering, copying from |
81 | high memory to "normal" DMA memory. If you can come up with a good way | 84 | high memory to "normal" DMA memory. If you can come up with a good way |
82 | to fix this issue (for x86_32 machines with over 1 GByte of memory), | 85 | to fix this issue (for x86_32 machines with over 1 GByte of memory), |
83 | feel free to submit patches. | 86 | feel free to submit patches. |
84 | 87 | ||
85 | 88 | Working with existing buffers | |
86 | WORKING WITH EXISTING BUFFERS | 89 | ============================= |
87 | 90 | ||
88 | Existing buffers aren't usable for DMA without first being mapped into the | 91 | Existing buffers aren't usable for DMA without first being mapped into the |
89 | DMA address space of the device. However, most buffers passed to your | 92 | DMA address space of the device. However, most buffers passed to your |
@@ -92,7 +95,7 @@ of Documentation/DMA-API-HOWTO.txt, titled "What memory is DMA-able?") | |||
92 | 95 | ||
93 | - When you're using scatterlists, you can map everything at once. On some | 96 | - When you're using scatterlists, you can map everything at once. On some |
94 | systems, this kicks in an IOMMU and turns the scatterlists into single | 97 | systems, this kicks in an IOMMU and turns the scatterlists into single |
95 | DMA transactions: | 98 | DMA transactions:: |
96 | 99 | ||
97 | int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, | 100 | int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, |
98 | struct scatterlist *sg, int nents); | 101 | struct scatterlist *sg, int nents); |
@@ -103,7 +106,7 @@ of Documentation/DMA-API-HOWTO.txt, titled "What memory is DMA-able?") | |||
103 | void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, | 106 | void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, |
104 | struct scatterlist *sg, int n_hw_ents); | 107 | struct scatterlist *sg, int n_hw_ents); |
105 | 108 | ||
106 | It's probably easier to use the new usb_sg_*() calls, which do the DMA | 109 | It's probably easier to use the new ``usb_sg_*()`` calls, which do the DMA |
107 | mapping and apply other tweaks to make scatterlist i/o be fast. | 110 | mapping and apply other tweaks to make scatterlist i/o be fast. |
108 | 111 | ||
109 | - Some drivers may prefer to work with the model that they're mapping large | 112 | - Some drivers may prefer to work with the model that they're mapping large |
@@ -112,10 +115,10 @@ of Documentation/DMA-API-HOWTO.txt, titled "What memory is DMA-able?") | |||
112 | here, since it's cheaper to just synchronize the buffer than to unmap it | 115 | here, since it's cheaper to just synchronize the buffer than to unmap it |
113 | each time an urb completes and then re-map it on during resubmission. | 116 | each time an urb completes and then re-map it on during resubmission. |
114 | 117 | ||
115 | These calls all work with initialized urbs: urb->dev, urb->pipe, | 118 | These calls all work with initialized urbs: ``urb->dev``, ``urb->pipe``, |
116 | urb->transfer_buffer, and urb->transfer_buffer_length must all be | 119 | ``urb->transfer_buffer``, and ``urb->transfer_buffer_length`` must all be |
117 | valid when these calls are used (urb->setup_packet must be valid too | 120 | valid when these calls are used (``urb->setup_packet`` must be valid too |
118 | if urb is a control request): | 121 | if urb is a control request):: |
119 | 122 | ||
120 | struct urb *usb_buffer_map (struct urb *urb); | 123 | struct urb *usb_buffer_map (struct urb *urb); |
121 | 124 | ||
@@ -123,9 +126,9 @@ of Documentation/DMA-API-HOWTO.txt, titled "What memory is DMA-able?") | |||
123 | 126 | ||
124 | void usb_buffer_unmap (struct urb *urb); | 127 | void usb_buffer_unmap (struct urb *urb); |
125 | 128 | ||
126 | The calls manage urb->transfer_dma for you, and set URB_NO_TRANSFER_DMA_MAP | 129 | The calls manage ``urb->transfer_dma`` for you, and set |
127 | so that usbcore won't map or unmap the buffer. They cannot be used for | 130 | ``URB_NO_TRANSFER_DMA_MAP`` so that usbcore won't map or unmap the buffer. |
128 | setup_packet buffers in control requests. | 131 | They cannot be used for setup_packet buffers in control requests. |
129 | 132 | ||
130 | Note that several of those interfaces are currently commented out, since | 133 | Note that several of those interfaces are currently commented out, since |
131 | they don't have current users. See the source code. Other than the dmasync | 134 | they don't have current users. See the source code. Other than the dmasync |
diff --git a/Documentation/driver-api/usb/error-codes.rst b/Documentation/driver-api/usb/error-codes.rst new file mode 100644 index 000000000000..a3e84bfac776 --- /dev/null +++ b/Documentation/driver-api/usb/error-codes.rst | |||
@@ -0,0 +1,207 @@ | |||
1 | .. _usb-error-codes: | ||
2 | |||
3 | USB Error codes | ||
4 | ~~~~~~~~~~~~~~~ | ||
5 | |||
6 | :Revised: 2004-Oct-21 | ||
7 | |||
8 | This is the documentation of (hopefully) all possible error codes (and | ||
9 | their interpretation) that can be returned from usbcore. | ||
10 | |||
11 | Some of them are returned by the Host Controller Drivers (HCDs), which | ||
12 | device drivers only see through usbcore. As a rule, all the HCDs should | ||
13 | behave the same except for transfer speed dependent behaviors and the | ||
14 | way certain faults are reported. | ||
15 | |||
16 | |||
17 | Error codes returned by :c:func:`usb_submit_urb` | ||
18 | ================================================ | ||
19 | |||
20 | Non-USB-specific: | ||
21 | |||
22 | |||
23 | =============== =============================================== | ||
24 | 0 URB submission went fine | ||
25 | |||
26 | ``-ENOMEM`` no memory for allocation of internal structures | ||
27 | =============== =============================================== | ||
28 | |||
29 | USB-specific: | ||
30 | |||
31 | ======================= ======================================================= | ||
32 | ``-EBUSY`` The URB is already active. | ||
33 | |||
34 | ``-ENODEV`` specified USB-device or bus doesn't exist | ||
35 | |||
36 | ``-ENOENT`` specified interface or endpoint does not exist or | ||
37 | is not enabled | ||
38 | |||
39 | ``-ENXIO`` host controller driver does not support queuing of | ||
40 | this type of urb. (treat as a host controller bug.) | ||
41 | |||
42 | ``-EINVAL`` a) Invalid transfer type specified (or not supported) | ||
43 | b) Invalid or unsupported periodic transfer interval | ||
44 | c) ISO: attempted to change transfer interval | ||
45 | d) ISO: ``number_of_packets`` is < 0 | ||
46 | e) various other cases | ||
47 | |||
48 | ``-EXDEV`` ISO: ``URB_ISO_ASAP`` wasn't specified and all the | ||
49 | frames the URB would be scheduled in have already | ||
50 | expired. | ||
51 | |||
52 | ``-EFBIG`` Host controller driver can't schedule that many ISO | ||
53 | frames. | ||
54 | |||
55 | ``-EPIPE`` The pipe type specified in the URB doesn't match the | ||
56 | endpoint's actual type. | ||
57 | |||
58 | ``-EMSGSIZE`` (a) endpoint maxpacket size is zero; it is not usable | ||
59 | in the current interface altsetting. | ||
60 | (b) ISO packet is larger than the endpoint maxpacket. | ||
61 | (c) requested data transfer length is invalid: negative | ||
62 | or too large for the host controller. | ||
63 | |||
64 | ``-ENOSPC`` This request would overcommit the usb bandwidth reserved | ||
65 | for periodic transfers (interrupt, isochronous). | ||
66 | |||
67 | ``-ESHUTDOWN`` The device or host controller has been disabled due to | ||
68 | some problem that could not be worked around. | ||
69 | |||
70 | ``-EPERM`` Submission failed because ``urb->reject`` was set. | ||
71 | |||
72 | ``-EHOSTUNREACH`` URB was rejected because the device is suspended. | ||
73 | |||
74 | ``-ENOEXEC`` A control URB doesn't contain a Setup packet. | ||
75 | ======================= ======================================================= | ||
76 | |||
77 | Error codes returned by ``in urb->status`` or in ``iso_frame_desc[n].status`` (for ISO) | ||
78 | ======================================================================================= | ||
79 | |||
80 | USB device drivers may only test urb status values in completion handlers. | ||
81 | This is because otherwise there would be a race between HCDs updating | ||
82 | these values on one CPU, and device drivers testing them on another CPU. | ||
83 | |||
84 | A transfer's actual_length may be positive even when an error has been | ||
85 | reported. That's because transfers often involve several packets, so that | ||
86 | one or more packets could finish before an error stops further endpoint I/O. | ||
87 | |||
88 | For isochronous URBs, the urb status value is non-zero only if the URB is | ||
89 | unlinked, the device is removed, the host controller is disabled, or the total | ||
90 | transferred length is less than the requested length and the | ||
91 | ``URB_SHORT_NOT_OK`` flag is set. Completion handlers for isochronous URBs | ||
92 | should only see ``urb->status`` set to zero, ``-ENOENT``, ``-ECONNRESET``, | ||
93 | ``-ESHUTDOWN``, or ``-EREMOTEIO``. Individual frame descriptor status fields | ||
94 | may report more status codes. | ||
95 | |||
96 | |||
97 | =============================== =============================================== | ||
98 | 0 Transfer completed successfully | ||
99 | |||
100 | ``-ENOENT`` URB was synchronously unlinked by | ||
101 | :c:func:`usb_unlink_urb` | ||
102 | |||
103 | ``-EINPROGRESS`` URB still pending, no results yet | ||
104 | (That is, if drivers see this it's a bug.) | ||
105 | |||
106 | ``-EPROTO`` [#f1]_, [#f2]_ a) bitstuff error | ||
107 | b) no response packet received within the | ||
108 | prescribed bus turn-around time | ||
109 | c) unknown USB error | ||
110 | |||
111 | ``-EILSEQ`` [#f1]_, [#f2]_ a) CRC mismatch | ||
112 | b) no response packet received within the | ||
113 | prescribed bus turn-around time | ||
114 | c) unknown USB error | ||
115 | |||
116 | Note that often the controller hardware does | ||
117 | not distinguish among cases a), b), and c), so | ||
118 | a driver cannot tell whether there was a | ||
119 | protocol error, a failure to respond (often | ||
120 | caused by device disconnect), or some other | ||
121 | fault. | ||
122 | |||
123 | ``-ETIME`` [#f2]_ No response packet received within the | ||
124 | prescribed bus turn-around time. This error | ||
125 | may instead be reported as | ||
126 | ``-EPROTO`` or ``-EILSEQ``. | ||
127 | |||
128 | ``-ETIMEDOUT`` Synchronous USB message functions use this code | ||
129 | to indicate timeout expired before the transfer | ||
130 | completed, and no other error was reported | ||
131 | by HC. | ||
132 | |||
133 | ``-EPIPE`` [#f2]_ Endpoint stalled. For non-control endpoints, | ||
134 | reset this status with | ||
135 | :c:func:`usb_clear_halt`. | ||
136 | |||
137 | ``-ECOMM`` During an IN transfer, the host controller | ||
138 | received data from an endpoint faster than it | ||
139 | could be written to system memory | ||
140 | |||
141 | ``-ENOSR`` During an OUT transfer, the host controller | ||
142 | could not retrieve data from system memory fast | ||
143 | enough to keep up with the USB data rate | ||
144 | |||
145 | ``-EOVERFLOW`` [#f1]_ The amount of data returned by the endpoint was | ||
146 | greater than either the max packet size of the | ||
147 | endpoint or the remaining buffer size. | ||
148 | "Babble". | ||
149 | |||
150 | ``-EREMOTEIO`` The data read from the endpoint did not fill | ||
151 | the specified buffer, and ``URB_SHORT_NOT_OK`` | ||
152 | was set in ``urb->transfer_flags``. | ||
153 | |||
154 | ``-ENODEV`` Device was removed. Often preceded by a burst | ||
155 | of other errors, since the hub driver doesn't | ||
156 | detect device removal events immediately. | ||
157 | |||
158 | ``-EXDEV`` ISO transfer only partially completed | ||
159 | (only set in ``iso_frame_desc[n].status``, | ||
160 | not ``urb->status``) | ||
161 | |||
162 | ``-EINVAL`` ISO madness, if this happens: Log off and | ||
163 | go home | ||
164 | |||
165 | ``-ECONNRESET`` URB was asynchronously unlinked by | ||
166 | :c:func:`usb_unlink_urb` | ||
167 | |||
168 | ``-ESHUTDOWN`` The device or host controller has been | ||
169 | disabled due to some problem that could not | ||
170 | be worked around, such as a physical | ||
171 | disconnect. | ||
172 | =============================== =============================================== | ||
173 | |||
174 | |||
175 | .. [#f1] | ||
176 | |||
177 | Error codes like ``-EPROTO``, ``-EILSEQ`` and ``-EOVERFLOW`` normally | ||
178 | indicate hardware problems such as bad devices (including firmware) | ||
179 | or cables. | ||
180 | |||
181 | .. [#f2] | ||
182 | |||
183 | This is also one of several codes that different kinds of host | ||
184 | controller use to indicate a transfer has failed because of device | ||
185 | disconnect. In the interval before the hub driver starts disconnect | ||
186 | processing, devices may receive such fault reports for every request. | ||
187 | |||
188 | |||
189 | |||
190 | Error codes returned by usbcore-functions | ||
191 | ========================================= | ||
192 | |||
193 | .. note:: expect also other submit and transfer status codes | ||
194 | |||
195 | :c:func:`usb_register`: | ||
196 | |||
197 | ======================= =================================== | ||
198 | ``-EINVAL`` error during registering new driver | ||
199 | ======================= =================================== | ||
200 | |||
201 | ``usb_get_*/usb_set_*()``, | ||
202 | :c:func:`usb_control_msg`, | ||
203 | :c:func:`usb_bulk_msg()`: | ||
204 | |||
205 | ======================= ============================================== | ||
206 | ``-ETIMEDOUT`` Timeout expired before the transfer completed. | ||
207 | ======================= ============================================== | ||
diff --git a/Documentation/driver-api/usb/gadget.rst b/Documentation/driver-api/usb/gadget.rst new file mode 100644 index 000000000000..3e8a3809c0b8 --- /dev/null +++ b/Documentation/driver-api/usb/gadget.rst | |||
@@ -0,0 +1,510 @@ | |||
1 | ======================== | ||
2 | USB Gadget API for Linux | ||
3 | ======================== | ||
4 | |||
5 | :Author: David Brownell | ||
6 | :Date: 20 August 2004 | ||
7 | |||
8 | Introduction | ||
9 | ============ | ||
10 | |||
11 | This document presents a Linux-USB "Gadget" kernel mode API, for use | ||
12 | within peripherals and other USB devices that embed Linux. It provides | ||
13 | an overview of the API structure, and shows how that fits into a system | ||
14 | development project. This is the first such API released on Linux to | ||
15 | address a number of important problems, including: | ||
16 | |||
17 | - Supports USB 2.0, for high speed devices which can stream data at | ||
18 | several dozen megabytes per second. | ||
19 | |||
20 | - Handles devices with dozens of endpoints just as well as ones with | ||
21 | just two fixed-function ones. Gadget drivers can be written so | ||
22 | they're easy to port to new hardware. | ||
23 | |||
24 | - Flexible enough to expose more complex USB device capabilities such | ||
25 | as multiple configurations, multiple interfaces, composite devices, | ||
26 | and alternate interface settings. | ||
27 | |||
28 | - USB "On-The-Go" (OTG) support, in conjunction with updates to the | ||
29 | Linux-USB host side. | ||
30 | |||
31 | - Sharing data structures and API models with the Linux-USB host side | ||
32 | API. This helps the OTG support, and looks forward to more-symmetric | ||
33 | frameworks (where the same I/O model is used by both host and device | ||
34 | side drivers). | ||
35 | |||
36 | - Minimalist, so it's easier to support new device controller hardware. | ||
37 | I/O processing doesn't imply large demands for memory or CPU | ||
38 | resources. | ||
39 | |||
40 | Most Linux developers will not be able to use this API, since they have | ||
41 | USB ``host`` hardware in a PC, workstation, or server. Linux users with | ||
42 | embedded systems are more likely to have USB peripheral hardware. To | ||
43 | distinguish drivers running inside such hardware from the more familiar | ||
44 | Linux "USB device drivers", which are host side proxies for the real USB | ||
45 | devices, a different term is used: the drivers inside the peripherals | ||
46 | are "USB gadget drivers". In USB protocol interactions, the device | ||
47 | driver is the master (or "client driver") and the gadget driver is the | ||
48 | slave (or "function driver"). | ||
49 | |||
50 | The gadget API resembles the host side Linux-USB API in that both use | ||
51 | queues of request objects to package I/O buffers, and those requests may | ||
52 | be submitted or canceled. They share common definitions for the standard | ||
53 | USB *Chapter 9* messages, structures, and constants. Also, both APIs | ||
54 | bind and unbind drivers to devices. The APIs differ in detail, since the | ||
55 | host side's current URB framework exposes a number of implementation | ||
56 | details and assumptions that are inappropriate for a gadget API. While | ||
57 | the model for control transfers and configuration management is | ||
58 | necessarily different (one side is a hardware-neutral master, the other | ||
59 | is a hardware-aware slave), the endpoint I/0 API used here should also | ||
60 | be usable for an overhead-reduced host side API. | ||
61 | |||
62 | Structure of Gadget Drivers | ||
63 | =========================== | ||
64 | |||
65 | A system running inside a USB peripheral normally has at least three | ||
66 | layers inside the kernel to handle USB protocol processing, and may have | ||
67 | additional layers in user space code. The ``gadget`` API is used by the | ||
68 | middle layer to interact with the lowest level (which directly handles | ||
69 | hardware). | ||
70 | |||
71 | In Linux, from the bottom up, these layers are: | ||
72 | |||
73 | *USB Controller Driver* | ||
74 | This is the lowest software level. It is the only layer that talks | ||
75 | to hardware, through registers, fifos, dma, irqs, and the like. The | ||
76 | ``<linux/usb/gadget.h>`` API abstracts the peripheral controller | ||
77 | endpoint hardware. That hardware is exposed through endpoint | ||
78 | objects, which accept streams of IN/OUT buffers, and through | ||
79 | callbacks that interact with gadget drivers. Since normal USB | ||
80 | devices only have one upstream port, they only have one of these | ||
81 | drivers. The controller driver can support any number of different | ||
82 | gadget drivers, but only one of them can be used at a time. | ||
83 | |||
84 | Examples of such controller hardware include the PCI-based NetChip | ||
85 | 2280 USB 2.0 high speed controller, the SA-11x0 or PXA-25x UDC | ||
86 | (found within many PDAs), and a variety of other products. | ||
87 | |||
88 | *Gadget Driver* | ||
89 | The lower boundary of this driver implements hardware-neutral USB | ||
90 | functions, using calls to the controller driver. Because such | ||
91 | hardware varies widely in capabilities and restrictions, and is used | ||
92 | in embedded environments where space is at a premium, the gadget | ||
93 | driver is often configured at compile time to work with endpoints | ||
94 | supported by one particular controller. Gadget drivers may be | ||
95 | portable to several different controllers, using conditional | ||
96 | compilation. (Recent kernels substantially simplify the work | ||
97 | involved in supporting new hardware, by *autoconfiguring* endpoints | ||
98 | automatically for many bulk-oriented drivers.) Gadget driver | ||
99 | responsibilities include: | ||
100 | |||
101 | - handling setup requests (ep0 protocol responses) possibly | ||
102 | including class-specific functionality | ||
103 | |||
104 | - returning configuration and string descriptors | ||
105 | |||
106 | - (re)setting configurations and interface altsettings, including | ||
107 | enabling and configuring endpoints | ||
108 | |||
109 | - handling life cycle events, such as managing bindings to | ||
110 | hardware, USB suspend/resume, remote wakeup, and disconnection | ||
111 | from the USB host. | ||
112 | |||
113 | - managing IN and OUT transfers on all currently enabled endpoints | ||
114 | |||
115 | Such drivers may be modules of proprietary code, although that | ||
116 | approach is discouraged in the Linux community. | ||
117 | |||
118 | *Upper Level* | ||
119 | Most gadget drivers have an upper boundary that connects to some | ||
120 | Linux driver or framework in Linux. Through that boundary flows the | ||
121 | data which the gadget driver produces and/or consumes through | ||
122 | protocol transfers over USB. Examples include: | ||
123 | |||
124 | - user mode code, using generic (gadgetfs) or application specific | ||
125 | files in ``/dev`` | ||
126 | |||
127 | - networking subsystem (for network gadgets, like the CDC Ethernet | ||
128 | Model gadget driver) | ||
129 | |||
130 | - data capture drivers, perhaps video4Linux or a scanner driver; or | ||
131 | test and measurement hardware. | ||
132 | |||
133 | - input subsystem (for HID gadgets) | ||
134 | |||
135 | - sound subsystem (for audio gadgets) | ||
136 | |||
137 | - file system (for PTP gadgets) | ||
138 | |||
139 | - block i/o subsystem (for usb-storage gadgets) | ||
140 | |||
141 | - ... and more | ||
142 | |||
143 | *Additional Layers* | ||
144 | Other layers may exist. These could include kernel layers, such as | ||
145 | network protocol stacks, as well as user mode applications building | ||
146 | on standard POSIX system call APIs such as ``open()``, ``close()``, | ||
147 | ``read()`` and ``write()``. On newer systems, POSIX Async I/O calls may | ||
148 | be an option. Such user mode code will not necessarily be subject to | ||
149 | the GNU General Public License (GPL). | ||
150 | |||
151 | OTG-capable systems will also need to include a standard Linux-USB host | ||
152 | side stack, with ``usbcore``, one or more *Host Controller Drivers* | ||
153 | (HCDs), *USB Device Drivers* to support the OTG "Targeted Peripheral | ||
154 | List", and so forth. There will also be an *OTG Controller Driver*, | ||
155 | which is visible to gadget and device driver developers only indirectly. | ||
156 | That helps the host and device side USB controllers implement the two | ||
157 | new OTG protocols (HNP and SRP). Roles switch (host to peripheral, or | ||
158 | vice versa) using HNP during USB suspend processing, and SRP can be | ||
159 | viewed as a more battery-friendly kind of device wakeup protocol. | ||
160 | |||
161 | Over time, reusable utilities are evolving to help make some gadget | ||
162 | driver tasks simpler. For example, building configuration descriptors | ||
163 | from vectors of descriptors for the configurations interfaces and | ||
164 | endpoints is now automated, and many drivers now use autoconfiguration | ||
165 | to choose hardware endpoints and initialize their descriptors. A | ||
166 | potential example of particular interest is code implementing standard | ||
167 | USB-IF protocols for HID, networking, storage, or audio classes. Some | ||
168 | developers are interested in KDB or KGDB hooks, to let target hardware | ||
169 | be remotely debugged. Most such USB protocol code doesn't need to be | ||
170 | hardware-specific, any more than network protocols like X11, HTTP, or | ||
171 | NFS are. Such gadget-side interface drivers should eventually be | ||
172 | combined, to implement composite devices. | ||
173 | |||
174 | Kernel Mode Gadget API | ||
175 | ====================== | ||
176 | |||
177 | Gadget drivers declare themselves through a struct | ||
178 | :c:type:`usb_gadget_driver`, which is responsible for most parts of enumeration | ||
179 | for a struct :c:type:`usb_gadget`. The response to a set_configuration usually | ||
180 | involves enabling one or more of the struct :c:type:`usb_ep` objects exposed by | ||
181 | the gadget, and submitting one or more struct :c:type:`usb_request` buffers to | ||
182 | transfer data. Understand those four data types, and their operations, | ||
183 | and you will understand how this API works. | ||
184 | |||
185 | .. Note:: | ||
186 | |||
187 | Other than the "Chapter 9" data types, most of the significant data | ||
188 | types and functions are described here. | ||
189 | |||
190 | However, some relevant information is likely omitted from what you | ||
191 | are reading. One example of such information is endpoint | ||
192 | autoconfiguration. You'll have to read the header file, and use | ||
193 | example source code (such as that for "Gadget Zero"), to fully | ||
194 | understand the API. | ||
195 | |||
196 | The part of the API implementing some basic driver capabilities is | ||
197 | specific to the version of the Linux kernel that's in use. The 2.6 | ||
198 | and upper kernel versions include a *driver model* framework that has | ||
199 | no analogue on earlier kernels; so those parts of the gadget API are | ||
200 | not fully portable. (They are implemented on 2.4 kernels, but in a | ||
201 | different way.) The driver model state is another part of this API that is | ||
202 | ignored by the kerneldoc tools. | ||
203 | |||
204 | The core API does not expose every possible hardware feature, only the | ||
205 | most widely available ones. There are significant hardware features, | ||
206 | such as device-to-device DMA (without temporary storage in a memory | ||
207 | buffer) that would be added using hardware-specific APIs. | ||
208 | |||
209 | This API allows drivers to use conditional compilation to handle | ||
210 | endpoint capabilities of different hardware, but doesn't require that. | ||
211 | Hardware tends to have arbitrary restrictions, relating to transfer | ||
212 | types, addressing, packet sizes, buffering, and availability. As a rule, | ||
213 | such differences only matter for "endpoint zero" logic that handles | ||
214 | device configuration and management. The API supports limited run-time | ||
215 | detection of capabilities, through naming conventions for endpoints. | ||
216 | Many drivers will be able to at least partially autoconfigure | ||
217 | themselves. In particular, driver init sections will often have endpoint | ||
218 | autoconfiguration logic that scans the hardware's list of endpoints to | ||
219 | find ones matching the driver requirements (relying on those | ||
220 | conventions), to eliminate some of the most common reasons for | ||
221 | conditional compilation. | ||
222 | |||
223 | Like the Linux-USB host side API, this API exposes the "chunky" nature | ||
224 | of USB messages: I/O requests are in terms of one or more "packets", and | ||
225 | packet boundaries are visible to drivers. Compared to RS-232 serial | ||
226 | protocols, USB resembles synchronous protocols like HDLC (N bytes per | ||
227 | frame, multipoint addressing, host as the primary station and devices as | ||
228 | secondary stations) more than asynchronous ones (tty style: 8 data bits | ||
229 | per frame, no parity, one stop bit). So for example the controller | ||
230 | drivers won't buffer two single byte writes into a single two-byte USB | ||
231 | IN packet, although gadget drivers may do so when they implement | ||
232 | protocols where packet boundaries (and "short packets") are not | ||
233 | significant. | ||
234 | |||
235 | Driver Life Cycle | ||
236 | ----------------- | ||
237 | |||
238 | Gadget drivers make endpoint I/O requests to hardware without needing to | ||
239 | know many details of the hardware, but driver setup/configuration code | ||
240 | needs to handle some differences. Use the API like this: | ||
241 | |||
242 | 1. Register a driver for the particular device side usb controller | ||
243 | hardware, such as the net2280 on PCI (USB 2.0), sa11x0 or pxa25x as | ||
244 | found in Linux PDAs, and so on. At this point the device is logically | ||
245 | in the USB ch9 initial state (``attached``), drawing no power and not | ||
246 | usable (since it does not yet support enumeration). Any host should | ||
247 | not see the device, since it's not activated the data line pullup | ||
248 | used by the host to detect a device, even if VBUS power is available. | ||
249 | |||
250 | 2. Register a gadget driver that implements some higher level device | ||
251 | function. That will then bind() to a :c:type:`usb_gadget`, which activates | ||
252 | the data line pullup sometime after detecting VBUS. | ||
253 | |||
254 | 3. The hardware driver can now start enumerating. The steps it handles | ||
255 | are to accept USB ``power`` and ``set_address`` requests. Other steps are | ||
256 | handled by the gadget driver. If the gadget driver module is unloaded | ||
257 | before the host starts to enumerate, steps before step 7 are skipped. | ||
258 | |||
259 | 4. The gadget driver's ``setup()`` call returns usb descriptors, based both | ||
260 | on what the bus interface hardware provides and on the functionality | ||
261 | being implemented. That can involve alternate settings or | ||
262 | configurations, unless the hardware prevents such operation. For OTG | ||
263 | devices, each configuration descriptor includes an OTG descriptor. | ||
264 | |||
265 | 5. The gadget driver handles the last step of enumeration, when the USB | ||
266 | host issues a ``set_configuration`` call. It enables all endpoints used | ||
267 | in that configuration, with all interfaces in their default settings. | ||
268 | That involves using a list of the hardware's endpoints, enabling each | ||
269 | endpoint according to its descriptor. It may also involve using | ||
270 | ``usb_gadget_vbus_draw`` to let more power be drawn from VBUS, as | ||
271 | allowed by that configuration. For OTG devices, setting a | ||
272 | configuration may also involve reporting HNP capabilities through a | ||
273 | user interface. | ||
274 | |||
275 | 6. Do real work and perform data transfers, possibly involving changes | ||
276 | to interface settings or switching to new configurations, until the | ||
277 | device is disconnect()ed from the host. Queue any number of transfer | ||
278 | requests to each endpoint. It may be suspended and resumed several | ||
279 | times before being disconnected. On disconnect, the drivers go back | ||
280 | to step 3 (above). | ||
281 | |||
282 | 7. When the gadget driver module is being unloaded, the driver unbind() | ||
283 | callback is issued. That lets the controller driver be unloaded. | ||
284 | |||
285 | Drivers will normally be arranged so that just loading the gadget driver | ||
286 | module (or statically linking it into a Linux kernel) allows the | ||
287 | peripheral device to be enumerated, but some drivers will defer | ||
288 | enumeration until some higher level component (like a user mode daemon) | ||
289 | enables it. Note that at this lowest level there are no policies about | ||
290 | how ep0 configuration logic is implemented, except that it should obey | ||
291 | USB specifications. Such issues are in the domain of gadget drivers, | ||
292 | including knowing about implementation constraints imposed by some USB | ||
293 | controllers or understanding that composite devices might happen to be | ||
294 | built by integrating reusable components. | ||
295 | |||
296 | Note that the lifecycle above can be slightly different for OTG devices. | ||
297 | Other than providing an additional OTG descriptor in each configuration, | ||
298 | only the HNP-related differences are particularly visible to driver | ||
299 | code. They involve reporting requirements during the ``SET_CONFIGURATION`` | ||
300 | request, and the option to invoke HNP during some suspend callbacks. | ||
301 | Also, SRP changes the semantics of ``usb_gadget_wakeup`` slightly. | ||
302 | |||
303 | USB 2.0 Chapter 9 Types and Constants | ||
304 | ------------------------------------- | ||
305 | |||
306 | Gadget drivers rely on common USB structures and constants defined in | ||
307 | the :ref:`linux/usb/ch9.h <usb_chapter9>` header file, which is standard in | ||
308 | Linux 2.6+ kernels. These are the same types and constants used by host side | ||
309 | drivers (and usbcore). | ||
310 | |||
311 | Core Objects and Methods | ||
312 | ------------------------ | ||
313 | |||
314 | These are declared in ``<linux/usb/gadget.h>``, and are used by gadget | ||
315 | drivers to interact with USB peripheral controller drivers. | ||
316 | |||
317 | .. kernel-doc:: include/linux/usb/gadget.h | ||
318 | :internal: | ||
319 | |||
320 | Optional Utilities | ||
321 | ------------------ | ||
322 | |||
323 | The core API is sufficient for writing a USB Gadget Driver, but some | ||
324 | optional utilities are provided to simplify common tasks. These | ||
325 | utilities include endpoint autoconfiguration. | ||
326 | |||
327 | .. kernel-doc:: drivers/usb/gadget/usbstring.c | ||
328 | :export: | ||
329 | |||
330 | .. kernel-doc:: drivers/usb/gadget/config.c | ||
331 | :export: | ||
332 | |||
333 | Composite Device Framework | ||
334 | -------------------------- | ||
335 | |||
336 | The core API is sufficient for writing drivers for composite USB devices | ||
337 | (with more than one function in a given configuration), and also | ||
338 | multi-configuration devices (also more than one function, but not | ||
339 | necessarily sharing a given configuration). There is however an optional | ||
340 | framework which makes it easier to reuse and combine functions. | ||
341 | |||
342 | Devices using this framework provide a struct :c:type:`usb_composite_driver`, | ||
343 | which in turn provides one or more struct :c:type:`usb_configuration` | ||
344 | instances. Each such configuration includes at least one struct | ||
345 | :c:type:`usb_function`, which packages a user visible role such as "network | ||
346 | link" or "mass storage device". Management functions may also exist, | ||
347 | such as "Device Firmware Upgrade". | ||
348 | |||
349 | .. kernel-doc:: include/linux/usb/composite.h | ||
350 | :internal: | ||
351 | |||
352 | .. kernel-doc:: drivers/usb/gadget/composite.c | ||
353 | :export: | ||
354 | |||
355 | Composite Device Functions | ||
356 | -------------------------- | ||
357 | |||
358 | At this writing, a few of the current gadget drivers have been converted | ||
359 | to this framework. Near-term plans include converting all of them, | ||
360 | except for ``gadgetfs``. | ||
361 | |||
362 | Peripheral Controller Drivers | ||
363 | ============================= | ||
364 | |||
365 | The first hardware supporting this API was the NetChip 2280 controller, | ||
366 | which supports USB 2.0 high speed and is based on PCI. This is the | ||
367 | ``net2280`` driver module. The driver supports Linux kernel versions 2.4 | ||
368 | and 2.6; contact NetChip Technologies for development boards and product | ||
369 | information. | ||
370 | |||
371 | Other hardware working in the ``gadget`` framework includes: Intel's PXA | ||
372 | 25x and IXP42x series processors (``pxa2xx_udc``), Toshiba TC86c001 | ||
373 | "Goku-S" (``goku_udc``), Renesas SH7705/7727 (``sh_udc``), MediaQ 11xx | ||
374 | (``mq11xx_udc``), Hynix HMS30C7202 (``h7202_udc``), National 9303/4 | ||
375 | (``n9604_udc``), Texas Instruments OMAP (``omap_udc``), Sharp LH7A40x | ||
376 | (``lh7a40x_udc``), and more. Most of those are full speed controllers. | ||
377 | |||
378 | At this writing, there are people at work on drivers in this framework | ||
379 | for several other USB device controllers, with plans to make many of | ||
380 | them be widely available. | ||
381 | |||
382 | A partial USB simulator, the ``dummy_hcd`` driver, is available. It can | ||
383 | act like a net2280, a pxa25x, or an sa11x0 in terms of available | ||
384 | endpoints and device speeds; and it simulates control, bulk, and to some | ||
385 | extent interrupt transfers. That lets you develop some parts of a gadget | ||
386 | driver on a normal PC, without any special hardware, and perhaps with | ||
387 | the assistance of tools such as GDB running with User Mode Linux. At | ||
388 | least one person has expressed interest in adapting that approach, | ||
389 | hooking it up to a simulator for a microcontroller. Such simulators can | ||
390 | help debug subsystems where the runtime hardware is unfriendly to | ||
391 | software development, or is not yet available. | ||
392 | |||
393 | Support for other controllers is expected to be developed and | ||
394 | contributed over time, as this driver framework evolves. | ||
395 | |||
396 | Gadget Drivers | ||
397 | ============== | ||
398 | |||
399 | In addition to *Gadget Zero* (used primarily for testing and development | ||
400 | with drivers for usb controller hardware), other gadget drivers exist. | ||
401 | |||
402 | There's an ``ethernet`` gadget driver, which implements one of the most | ||
403 | useful *Communications Device Class* (CDC) models. One of the standards | ||
404 | for cable modem interoperability even specifies the use of this ethernet | ||
405 | model as one of two mandatory options. Gadgets using this code look to a | ||
406 | USB host as if they're an Ethernet adapter. It provides access to a | ||
407 | network where the gadget's CPU is one host, which could easily be | ||
408 | bridging, routing, or firewalling access to other networks. Since some | ||
409 | hardware can't fully implement the CDC Ethernet requirements, this | ||
410 | driver also implements a "good parts only" subset of CDC Ethernet. (That | ||
411 | subset doesn't advertise itself as CDC Ethernet, to avoid creating | ||
412 | problems.) | ||
413 | |||
414 | Support for Microsoft's ``RNDIS`` protocol has been contributed by | ||
415 | Pengutronix and Auerswald GmbH. This is like CDC Ethernet, but it runs | ||
416 | on more slightly USB hardware (but less than the CDC subset). However, | ||
417 | its main claim to fame is being able to connect directly to recent | ||
418 | versions of Windows, using drivers that Microsoft bundles and supports, | ||
419 | making it much simpler to network with Windows. | ||
420 | |||
421 | There is also support for user mode gadget drivers, using ``gadgetfs``. | ||
422 | This provides a *User Mode API* that presents each endpoint as a single | ||
423 | file descriptor. I/O is done using normal ``read()`` and ``read()`` calls. | ||
424 | Familiar tools like GDB and pthreads can be used to develop and debug | ||
425 | user mode drivers, so that once a robust controller driver is available | ||
426 | many applications for it won't require new kernel mode software. Linux | ||
427 | 2.6 *Async I/O (AIO)* support is available, so that user mode software | ||
428 | can stream data with only slightly more overhead than a kernel driver. | ||
429 | |||
430 | There's a USB Mass Storage class driver, which provides a different | ||
431 | solution for interoperability with systems such as MS-Windows and MacOS. | ||
432 | That *Mass Storage* driver uses a file or block device as backing store | ||
433 | for a drive, like the ``loop`` driver. The USB host uses the BBB, CB, or | ||
434 | CBI versions of the mass storage class specification, using transparent | ||
435 | SCSI commands to access the data from the backing store. | ||
436 | |||
437 | There's a "serial line" driver, useful for TTY style operation over USB. | ||
438 | The latest version of that driver supports CDC ACM style operation, like | ||
439 | a USB modem, and so on most hardware it can interoperate easily with | ||
440 | MS-Windows. One interesting use of that driver is in boot firmware (like | ||
441 | a BIOS), which can sometimes use that model with very small systems | ||
442 | without real serial lines. | ||
443 | |||
444 | Support for other kinds of gadget is expected to be developed and | ||
445 | contributed over time, as this driver framework evolves. | ||
446 | |||
447 | USB On-The-GO (OTG) | ||
448 | =================== | ||
449 | |||
450 | USB OTG support on Linux 2.6 was initially developed by Texas | ||
451 | Instruments for `OMAP <http://www.omap.com>`__ 16xx and 17xx series | ||
452 | processors. Other OTG systems should work in similar ways, but the | ||
453 | hardware level details could be very different. | ||
454 | |||
455 | Systems need specialized hardware support to implement OTG, notably | ||
456 | including a special *Mini-AB* jack and associated transceiver to support | ||
457 | *Dual-Role* operation: they can act either as a host, using the standard | ||
458 | Linux-USB host side driver stack, or as a peripheral, using this | ||
459 | ``gadget`` framework. To do that, the system software relies on small | ||
460 | additions to those programming interfaces, and on a new internal | ||
461 | component (here called an "OTG Controller") affecting which driver stack | ||
462 | connects to the OTG port. In each role, the system can re-use the | ||
463 | existing pool of hardware-neutral drivers, layered on top of the | ||
464 | controller driver interfaces (:c:type:`usb_bus` or :c:type:`usb_gadget`). | ||
465 | Such drivers need at most minor changes, and most of the calls added to | ||
466 | support OTG can also benefit non-OTG products. | ||
467 | |||
468 | - Gadget drivers test the ``is_otg`` flag, and use it to determine | ||
469 | whether or not to include an OTG descriptor in each of their | ||
470 | configurations. | ||
471 | |||
472 | - Gadget drivers may need changes to support the two new OTG protocols, | ||
473 | exposed in new gadget attributes such as ``b_hnp_enable`` flag. HNP | ||
474 | support should be reported through a user interface (two LEDs could | ||
475 | suffice), and is triggered in some cases when the host suspends the | ||
476 | peripheral. SRP support can be user-initiated just like remote | ||
477 | wakeup, probably by pressing the same button. | ||
478 | |||
479 | - On the host side, USB device drivers need to be taught to trigger HNP | ||
480 | at appropriate moments, using ``usb_suspend_device()``. That also | ||
481 | conserves battery power, which is useful even for non-OTG | ||
482 | configurations. | ||
483 | |||
484 | - Also on the host side, a driver must support the OTG "Targeted | ||
485 | Peripheral List". That's just a whitelist, used to reject peripherals | ||
486 | not supported with a given Linux OTG host. *This whitelist is | ||
487 | product-specific; each product must modify* ``otg_whitelist.h`` *to | ||
488 | match its interoperability specification.* | ||
489 | |||
490 | Non-OTG Linux hosts, like PCs and workstations, normally have some | ||
491 | solution for adding drivers, so that peripherals that aren't | ||
492 | recognized can eventually be supported. That approach is unreasonable | ||
493 | for consumer products that may never have their firmware upgraded, | ||
494 | and where it's usually unrealistic to expect traditional | ||
495 | PC/workstation/server kinds of support model to work. For example, | ||
496 | it's often impractical to change device firmware once the product has | ||
497 | been distributed, so driver bugs can't normally be fixed if they're | ||
498 | found after shipment. | ||
499 | |||
500 | Additional changes are needed below those hardware-neutral :c:type:`usb_bus` | ||
501 | and :c:type:`usb_gadget` driver interfaces; those aren't discussed here in any | ||
502 | detail. Those affect the hardware-specific code for each USB Host or | ||
503 | Peripheral controller, and how the HCD initializes (since OTG can be | ||
504 | active only on a single port). They also involve what may be called an | ||
505 | *OTG Controller Driver*, managing the OTG transceiver and the OTG state | ||
506 | machine logic as well as much of the root hub behavior for the OTG port. | ||
507 | The OTG controller driver needs to activate and deactivate USB | ||
508 | controllers depending on the relevant device role. Some related changes | ||
509 | were needed inside usbcore, so that it can identify OTG-capable devices | ||
510 | and respond appropriately to HNP or SRP protocols. | ||
diff --git a/Documentation/usb/hotplug.txt b/Documentation/driver-api/usb/hotplug.rst index 5b243f315b2c..79663e653ca1 100644 --- a/Documentation/usb/hotplug.txt +++ b/Documentation/driver-api/usb/hotplug.rst | |||
@@ -1,4 +1,9 @@ | |||
1 | LINUX HOTPLUGGING | 1 | USB hotplugging |
2 | ~~~~~~~~~~~~~~~ | ||
3 | |||
4 | Linux Hotplugging | ||
5 | ================= | ||
6 | |||
2 | 7 | ||
3 | In hotpluggable busses like USB (and Cardbus PCI), end-users plug devices | 8 | In hotpluggable busses like USB (and Cardbus PCI), end-users plug devices |
4 | into the bus with power on. In most cases, users expect the devices to become | 9 | into the bus with power on. In most cases, users expect the devices to become |
@@ -30,11 +35,11 @@ Because some of those actions rely on information about drivers (metadata) | |||
30 | that is currently available only when the drivers are dynamically linked, | 35 | that is currently available only when the drivers are dynamically linked, |
31 | you get the best hotplugging when you configure a highly modular system. | 36 | you get the best hotplugging when you configure a highly modular system. |
32 | 37 | ||
38 | Kernel Hotplug Helper (``/sbin/hotplug``) | ||
39 | ========================================= | ||
33 | 40 | ||
34 | KERNEL HOTPLUG HELPER (/sbin/hotplug) | 41 | There is a kernel parameter: ``/proc/sys/kernel/hotplug``, which normally |
35 | 42 | holds the pathname ``/sbin/hotplug``. That parameter names a program | |
36 | There is a kernel parameter: /proc/sys/kernel/hotplug, which normally | ||
37 | holds the pathname "/sbin/hotplug". That parameter names a program | ||
38 | which the kernel may invoke at various times. | 43 | which the kernel may invoke at various times. |
39 | 44 | ||
40 | The /sbin/hotplug program can be invoked by any subsystem as part of its | 45 | The /sbin/hotplug program can be invoked by any subsystem as part of its |
@@ -51,26 +56,26 @@ Hotplug software and other resources is available at: | |||
51 | Mailing list information is also available at that site. | 56 | Mailing list information is also available at that site. |
52 | 57 | ||
53 | 58 | ||
54 | -------------------------------------------------------------------------- | 59 | USB Policy Agent |
55 | 60 | ================ | |
56 | 61 | ||
57 | USB POLICY AGENT | 62 | The USB subsystem currently invokes ``/sbin/hotplug`` when USB devices |
58 | |||
59 | The USB subsystem currently invokes /sbin/hotplug when USB devices | ||
60 | are added or removed from system. The invocation is done by the kernel | 63 | are added or removed from system. The invocation is done by the kernel |
61 | hub workqueue [hub_wq], or else as part of root hub initialization | 64 | hub workqueue [hub_wq], or else as part of root hub initialization |
62 | (done by init, modprobe, kapmd, etc). Its single command line parameter | 65 | (done by init, modprobe, kapmd, etc). Its single command line parameter |
63 | is the string "usb", and it passes these environment variables: | 66 | is the string "usb", and it passes these environment variables: |
64 | 67 | ||
65 | ACTION ... "add", "remove" | 68 | ========== ============================================ |
66 | PRODUCT ... USB vendor, product, and version codes (hex) | 69 | ACTION ``add``, ``remove`` |
67 | TYPE ... device class codes (decimal) | 70 | PRODUCT USB vendor, product, and version codes (hex) |
68 | INTERFACE ... interface 0 class codes (decimal) | 71 | TYPE device class codes (decimal) |
72 | INTERFACE interface 0 class codes (decimal) | ||
73 | ========== ============================================ | ||
69 | 74 | ||
70 | If "usbdevfs" is configured, DEVICE and DEVFS are also passed. DEVICE is | 75 | If "usbdevfs" is configured, DEVICE and DEVFS are also passed. DEVICE is |
71 | the pathname of the device, and is useful for devices with multiple and/or | 76 | the pathname of the device, and is useful for devices with multiple and/or |
72 | alternate interfaces that complicate driver selection. By design, USB | 77 | alternate interfaces that complicate driver selection. By design, USB |
73 | hotplugging is independent of "usbdevfs": you can do most essential parts | 78 | hotplugging is independent of ``usbdevfs``: you can do most essential parts |
74 | of USB device setup without using that filesystem, and without running a | 79 | of USB device setup without using that filesystem, and without running a |
75 | user mode daemon to detect changes in system configuration. | 80 | user mode daemon to detect changes in system configuration. |
76 | 81 | ||
@@ -79,19 +84,20 @@ modules, and can invoke driver-specific setup scripts. The newest ones | |||
79 | leverage USB module-init-tools support. Later agents might unload drivers. | 84 | leverage USB module-init-tools support. Later agents might unload drivers. |
80 | 85 | ||
81 | 86 | ||
82 | USB MODUTILS SUPPORT | 87 | USB Modutils Support |
88 | ==================== | ||
83 | 89 | ||
84 | Current versions of module-init-tools will create a "modules.usbmap" file | 90 | Current versions of module-init-tools will create a ``modules.usbmap`` file |
85 | which contains the entries from each driver's MODULE_DEVICE_TABLE. Such | 91 | which contains the entries from each driver's ``MODULE_DEVICE_TABLE``. Such |
86 | files can be used by various user mode policy agents to make sure all the | 92 | files can be used by various user mode policy agents to make sure all the |
87 | right driver modules get loaded, either at boot time or later. | 93 | right driver modules get loaded, either at boot time or later. |
88 | 94 | ||
89 | See <linux/usb.h> for full information about such table entries; or look | 95 | See ``linux/usb.h`` for full information about such table entries; or look |
90 | at existing drivers. Each table entry describes one or more criteria to | 96 | at existing drivers. Each table entry describes one or more criteria to |
91 | be used when matching a driver to a device or class of devices. The | 97 | be used when matching a driver to a device or class of devices. The |
92 | specific criteria are identified by bits set in "match_flags", paired | 98 | specific criteria are identified by bits set in "match_flags", paired |
93 | with field values. You can construct the criteria directly, or with | 99 | with field values. You can construct the criteria directly, or with |
94 | macros such as these, and use driver_info to store more information. | 100 | macros such as these, and use driver_info to store more information:: |
95 | 101 | ||
96 | USB_DEVICE (vendorId, productId) | 102 | USB_DEVICE (vendorId, productId) |
97 | ... matching devices with specified vendor and product ids | 103 | ... matching devices with specified vendor and product ids |
@@ -103,7 +109,7 @@ macros such as these, and use driver_info to store more information. | |||
103 | ... matching specified device class info | 109 | ... matching specified device class info |
104 | 110 | ||
105 | A short example, for a driver that supports several specific USB devices | 111 | A short example, for a driver that supports several specific USB devices |
106 | and their quirks, might have a MODULE_DEVICE_TABLE like this: | 112 | and their quirks, might have a MODULE_DEVICE_TABLE like this:: |
107 | 113 | ||
108 | static const struct usb_device_id mydriver_id_table[] = { | 114 | static const struct usb_device_id mydriver_id_table[] = { |
109 | { USB_DEVICE (0x9999, 0xaaaa), driver_info: QUIRK_X }, | 115 | { USB_DEVICE (0x9999, 0xaaaa), driver_info: QUIRK_X }, |
@@ -116,10 +122,10 @@ and their quirks, might have a MODULE_DEVICE_TABLE like this: | |||
116 | Most USB device drivers should pass these tables to the USB subsystem as | 122 | Most USB device drivers should pass these tables to the USB subsystem as |
117 | well as to the module management subsystem. Not all, though: some driver | 123 | well as to the module management subsystem. Not all, though: some driver |
118 | frameworks connect using interfaces layered over USB, and so they won't | 124 | frameworks connect using interfaces layered over USB, and so they won't |
119 | need such a "struct usb_driver". | 125 | need such a struct :c:type:`usb_driver`. |
120 | 126 | ||
121 | Drivers that connect directly to the USB subsystem should be declared | 127 | Drivers that connect directly to the USB subsystem should be declared |
122 | something like this: | 128 | something like this:: |
123 | 129 | ||
124 | static struct usb_driver mydriver = { | 130 | static struct usb_driver mydriver = { |
125 | .name = "mydriver", | 131 | .name = "mydriver", |
@@ -138,11 +144,11 @@ something like this: | |||
138 | 144 | ||
139 | When the USB subsystem knows about a driver's device ID table, it's used when | 145 | When the USB subsystem knows about a driver's device ID table, it's used when |
140 | choosing drivers to probe(). The thread doing new device processing checks | 146 | choosing drivers to probe(). The thread doing new device processing checks |
141 | drivers' device ID entries from the MODULE_DEVICE_TABLE against interface and | 147 | drivers' device ID entries from the ``MODULE_DEVICE_TABLE`` against interface |
142 | device descriptors for the device. It will only call probe() if there is a | 148 | and device descriptors for the device. It will only call ``probe()`` if there |
143 | match, and the third argument to probe() will be the entry that matched. | 149 | is a match, and the third argument to ``probe()`` will be the entry that |
144 | 150 | matched. | |
145 | If you don't provide an id_table for your driver, then your driver may get | 151 | |
146 | probed for each new device; the third parameter to probe() will be null. | 152 | If you don't provide an ``id_table`` for your driver, then your driver may get |
147 | 153 | probed for each new device; the third parameter to ``probe()`` will be | |
148 | 154 | ``NULL``. | |
diff --git a/Documentation/driver-api/usb/index.rst b/Documentation/driver-api/usb/index.rst new file mode 100644 index 000000000000..1bf64edc8c8a --- /dev/null +++ b/Documentation/driver-api/usb/index.rst | |||
@@ -0,0 +1,26 @@ | |||
1 | ============= | ||
2 | Linux USB API | ||
3 | ============= | ||
4 | |||
5 | .. toctree:: | ||
6 | |||
7 | usb | ||
8 | gadget | ||
9 | anchors | ||
10 | bulk-streams | ||
11 | callbacks | ||
12 | dma | ||
13 | URB | ||
14 | power-management | ||
15 | hotplug | ||
16 | persist | ||
17 | error-codes | ||
18 | writing_usb_driver | ||
19 | writing_musb_glue_layer | ||
20 | |||
21 | .. only:: subproject and html | ||
22 | |||
23 | Indices | ||
24 | ======= | ||
25 | |||
26 | * :ref:`genindex` | ||
diff --git a/Documentation/usb/persist.txt b/Documentation/driver-api/usb/persist.rst index 35d70eda9ad6..08cafc6292c1 100644 --- a/Documentation/usb/persist.txt +++ b/Documentation/driver-api/usb/persist.rst | |||
@@ -1,11 +1,14 @@ | |||
1 | USB device persistence during system suspend | 1 | .. _usb-persist: |
2 | 2 | ||
3 | Alan Stern <stern@rowland.harvard.edu> | 3 | USB device persistence during system suspend |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
4 | 5 | ||
5 | September 2, 2006 (Updated February 25, 2008) | 6 | :Author: Alan Stern <stern@rowland.harvard.edu> |
7 | :Date: September 2, 2006 (Updated February 25, 2008) | ||
6 | 8 | ||
7 | 9 | ||
8 | What is the problem? | 10 | What is the problem? |
11 | ==================== | ||
9 | 12 | ||
10 | According to the USB specification, when a USB bus is suspended the | 13 | According to the USB specification, when a USB bus is suspended the |
11 | bus must continue to supply suspend current (around 1-5 mA). This | 14 | bus must continue to supply suspend current (around 1-5 mA). This |
@@ -63,7 +66,8 @@ suspended -- but it will crash as soon as it wakes up, which isn't | |||
63 | much better.) | 66 | much better.) |
64 | 67 | ||
65 | 68 | ||
66 | What is the solution? | 69 | What is the solution? |
70 | ===================== | ||
67 | 71 | ||
68 | The kernel includes a feature called USB-persist. It tries to work | 72 | The kernel includes a feature called USB-persist. It tries to work |
69 | around these issues by allowing the core USB device data structures to | 73 | around these issues by allowing the core USB device data structures to |
@@ -99,7 +103,7 @@ now a good and happy place. | |||
99 | 103 | ||
100 | Note that the "USB-persist" feature will be applied only to those | 104 | Note that the "USB-persist" feature will be applied only to those |
101 | devices for which it is enabled. You can enable the feature by doing | 105 | devices for which it is enabled. You can enable the feature by doing |
102 | (as root): | 106 | (as root):: |
103 | 107 | ||
104 | echo 1 >/sys/bus/usb/devices/.../power/persist | 108 | echo 1 >/sys/bus/usb/devices/.../power/persist |
105 | 109 | ||
@@ -110,7 +114,8 @@ doesn't even exist, so you only have to worry about setting it for | |||
110 | devices where it really matters. | 114 | devices where it really matters. |
111 | 115 | ||
112 | 116 | ||
113 | Is this the best solution? | 117 | Is this the best solution? |
118 | ========================== | ||
114 | 119 | ||
115 | Perhaps not. Arguably, keeping track of mounted filesystems and | 120 | Perhaps not. Arguably, keeping track of mounted filesystems and |
116 | memory mappings across device disconnects should be handled by a | 121 | memory mappings across device disconnects should be handled by a |
@@ -130,7 +135,8 @@ just mass-storage devices. It might turn out to be equally useful for | |||
130 | other device types, such as network interfaces. | 135 | other device types, such as network interfaces. |
131 | 136 | ||
132 | 137 | ||
133 | WARNING: USB-persist can be dangerous!! | 138 | WARNING: USB-persist can be dangerous!! |
139 | ======================================= | ||
134 | 140 | ||
135 | When recovering an interrupted power session the kernel does its best | 141 | When recovering an interrupted power session the kernel does its best |
136 | to make sure the USB device hasn't been changed; that is, the same | 142 | to make sure the USB device hasn't been changed; that is, the same |
diff --git a/Documentation/usb/power-management.txt b/Documentation/driver-api/usb/power-management.rst index 00e706997130..79beb807996b 100644 --- a/Documentation/usb/power-management.txt +++ b/Documentation/driver-api/usb/power-management.rst | |||
@@ -1,10 +1,12 @@ | |||
1 | Power Management for USB | 1 | .. _usb-power-management: |
2 | 2 | ||
3 | Alan Stern <stern@rowland.harvard.edu> | 3 | Power Management for USB |
4 | 4 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 | Last-updated: February 2014 | ||
6 | 5 | ||
6 | :Author: Alan Stern <stern@rowland.harvard.edu> | ||
7 | :Date: Last-updated: February 2014 | ||
7 | 8 | ||
9 | .. | ||
8 | Contents: | 10 | Contents: |
9 | --------- | 11 | --------- |
10 | * What is Power Management? | 12 | * What is Power Management? |
@@ -25,14 +27,14 @@ | |||
25 | * Suggested Userspace Port Power Policy | 27 | * Suggested Userspace Port Power Policy |
26 | 28 | ||
27 | 29 | ||
28 | What is Power Management? | 30 | What is Power Management? |
29 | ------------------------- | 31 | ------------------------- |
30 | 32 | ||
31 | Power Management (PM) is the practice of saving energy by suspending | 33 | Power Management (PM) is the practice of saving energy by suspending |
32 | parts of a computer system when they aren't being used. While a | 34 | parts of a computer system when they aren't being used. While a |
33 | component is "suspended" it is in a nonfunctional low-power state; it | 35 | component is ``suspended`` it is in a nonfunctional low-power state; it |
34 | might even be turned off completely. A suspended component can be | 36 | might even be turned off completely. A suspended component can be |
35 | "resumed" (returned to a functional full-power state) when the kernel | 37 | ``resumed`` (returned to a functional full-power state) when the kernel |
36 | needs to use it. (There also are forms of PM in which components are | 38 | needs to use it. (There also are forms of PM in which components are |
37 | placed in a less functional but still usable state instead of being | 39 | placed in a less functional but still usable state instead of being |
38 | suspended; an example would be reducing the CPU's clock rate. This | 40 | suspended; an example would be reducing the CPU's clock rate. This |
@@ -44,22 +46,25 @@ device is turned off while the system as a whole remains running, we | |||
44 | call it a "dynamic suspend" (also known as a "runtime suspend" or | 46 | call it a "dynamic suspend" (also known as a "runtime suspend" or |
45 | "selective suspend"). This document concentrates mostly on how | 47 | "selective suspend"). This document concentrates mostly on how |
46 | dynamic PM is implemented in the USB subsystem, although system PM is | 48 | dynamic PM is implemented in the USB subsystem, although system PM is |
47 | covered to some extent (see Documentation/power/*.txt for more | 49 | covered to some extent (see ``Documentation/power/*.txt`` for more |
48 | information about system PM). | 50 | information about system PM). |
49 | 51 | ||
50 | System PM support is present only if the kernel was built with CONFIG_SUSPEND | 52 | System PM support is present only if the kernel was built with |
51 | or CONFIG_HIBERNATION enabled. Dynamic PM support for USB is present whenever | 53 | ``CONFIG_SUSPEND`` or ``CONFIG_HIBERNATION`` enabled. Dynamic PM support |
52 | the kernel was built with CONFIG_PM enabled. | 54 | |
55 | for USB is present whenever | ||
56 | the kernel was built with ``CONFIG_PM`` enabled. | ||
53 | 57 | ||
54 | [Historically, dynamic PM support for USB was present only if the | 58 | [Historically, dynamic PM support for USB was present only if the |
55 | kernel had been built with CONFIG_USB_SUSPEND enabled (which depended on | 59 | kernel had been built with ``CONFIG_USB_SUSPEND`` enabled (which depended on |
56 | CONFIG_PM_RUNTIME). Starting with the 3.10 kernel release, dynamic PM support | 60 | ``CONFIG_PM_RUNTIME``). Starting with the 3.10 kernel release, dynamic PM |
57 | for USB was present whenever the kernel was built with CONFIG_PM_RUNTIME | 61 | support for USB was present whenever the kernel was built with |
58 | enabled. The CONFIG_USB_SUSPEND option had been eliminated.] | 62 | ``CONFIG_PM_RUNTIME`` enabled. The ``CONFIG_USB_SUSPEND`` option had been |
63 | eliminated.] | ||
59 | 64 | ||
60 | 65 | ||
61 | What is Remote Wakeup? | 66 | What is Remote Wakeup? |
62 | ---------------------- | 67 | ---------------------- |
63 | 68 | ||
64 | When a device has been suspended, it generally doesn't resume until | 69 | When a device has been suspended, it generally doesn't resume until |
65 | the computer tells it to. Likewise, if the entire computer has been | 70 | the computer tells it to. Likewise, if the entire computer has been |
@@ -76,8 +81,8 @@ event. Examples include a suspended keyboard resuming when a key is | |||
76 | pressed, or a suspended USB hub resuming when a device is plugged in. | 81 | pressed, or a suspended USB hub resuming when a device is plugged in. |
77 | 82 | ||
78 | 83 | ||
79 | When is a USB device idle? | 84 | When is a USB device idle? |
80 | -------------------------- | 85 | -------------------------- |
81 | 86 | ||
82 | A device is idle whenever the kernel thinks it's not busy doing | 87 | A device is idle whenever the kernel thinks it's not busy doing |
83 | anything important and thus is a candidate for being suspended. The | 88 | anything important and thus is a candidate for being suspended. The |
@@ -92,11 +97,11 @@ If a USB device has no driver, its usbfs file isn't open, and it isn't | |||
92 | being accessed through sysfs, then it definitely is idle. | 97 | being accessed through sysfs, then it definitely is idle. |
93 | 98 | ||
94 | 99 | ||
95 | Forms of dynamic PM | 100 | Forms of dynamic PM |
96 | ------------------- | 101 | ------------------- |
97 | 102 | ||
98 | Dynamic suspends occur when the kernel decides to suspend an idle | 103 | Dynamic suspends occur when the kernel decides to suspend an idle |
99 | device. This is called "autosuspend" for short. In general, a device | 104 | device. This is called ``autosuspend`` for short. In general, a device |
100 | won't be autosuspended unless it has been idle for some minimum period | 105 | won't be autosuspended unless it has been idle for some minimum period |
101 | of time, the so-called idle-delay time. | 106 | of time, the so-called idle-delay time. |
102 | 107 | ||
@@ -125,51 +130,51 @@ all dynamic suspend events are internal; external agents are not | |||
125 | allowed to issue dynamic suspends. | 130 | allowed to issue dynamic suspends. |
126 | 131 | ||
127 | 132 | ||
128 | The user interface for dynamic PM | 133 | The user interface for dynamic PM |
129 | --------------------------------- | 134 | --------------------------------- |
130 | 135 | ||
131 | The user interface for controlling dynamic PM is located in the power/ | 136 | The user interface for controlling dynamic PM is located in the ``power/`` |
132 | subdirectory of each USB device's sysfs directory, that is, in | 137 | subdirectory of each USB device's sysfs directory, that is, in |
133 | /sys/bus/usb/devices/.../power/ where "..." is the device's ID. The | 138 | ``/sys/bus/usb/devices/.../power/`` where "..." is the device's ID. The |
134 | relevant attribute files are: wakeup, control, and | 139 | relevant attribute files are: wakeup, control, and |
135 | autosuspend_delay_ms. (There may also be a file named "level"; this | 140 | ``autosuspend_delay_ms``. (There may also be a file named ``level``; this |
136 | file was deprecated as of the 2.6.35 kernel and replaced by the | 141 | file was deprecated as of the 2.6.35 kernel and replaced by the |
137 | "control" file. In 2.6.38 the "autosuspend" file will be deprecated | 142 | ``control`` file. In 2.6.38 the ``autosuspend`` file will be deprecated |
138 | and replaced by the "autosuspend_delay_ms" file. The only difference | 143 | and replaced by the ``autosuspend_delay_ms`` file. The only difference |
139 | is that the newer file expresses the delay in milliseconds whereas the | 144 | is that the newer file expresses the delay in milliseconds whereas the |
140 | older file uses seconds. Confusingly, both files are present in 2.6.37 | 145 | older file uses seconds. Confusingly, both files are present in 2.6.37 |
141 | but only "autosuspend" works.) | 146 | but only ``autosuspend`` works.) |
142 | 147 | ||
143 | power/wakeup | 148 | ``power/wakeup`` |
144 | 149 | ||
145 | This file is empty if the device does not support | 150 | This file is empty if the device does not support |
146 | remote wakeup. Otherwise the file contains either the | 151 | remote wakeup. Otherwise the file contains either the |
147 | word "enabled" or the word "disabled", and you can | 152 | word ``enabled`` or the word ``disabled``, and you can |
148 | write those words to the file. The setting determines | 153 | write those words to the file. The setting determines |
149 | whether or not remote wakeup will be enabled when the | 154 | whether or not remote wakeup will be enabled when the |
150 | device is next suspended. (If the setting is changed | 155 | device is next suspended. (If the setting is changed |
151 | while the device is suspended, the change won't take | 156 | while the device is suspended, the change won't take |
152 | effect until the following suspend.) | 157 | effect until the following suspend.) |
153 | 158 | ||
154 | power/control | 159 | ``power/control`` |
155 | 160 | ||
156 | This file contains one of two words: "on" or "auto". | 161 | This file contains one of two words: ``on`` or ``auto``. |
157 | You can write those words to the file to change the | 162 | You can write those words to the file to change the |
158 | device's setting. | 163 | device's setting. |
159 | 164 | ||
160 | "on" means that the device should be resumed and | 165 | - ``on`` means that the device should be resumed and |
161 | autosuspend is not allowed. (Of course, system | 166 | autosuspend is not allowed. (Of course, system |
162 | suspends are still allowed.) | 167 | suspends are still allowed.) |
163 | 168 | ||
164 | "auto" is the normal state in which the kernel is | 169 | - ``auto`` is the normal state in which the kernel is |
165 | allowed to autosuspend and autoresume the device. | 170 | allowed to autosuspend and autoresume the device. |
166 | 171 | ||
167 | (In kernels up to 2.6.32, you could also specify | 172 | (In kernels up to 2.6.32, you could also specify |
168 | "suspend", meaning that the device should remain | 173 | ``suspend``, meaning that the device should remain |
169 | suspended and autoresume was not allowed. This | 174 | suspended and autoresume was not allowed. This |
170 | setting is no longer supported.) | 175 | setting is no longer supported.) |
171 | 176 | ||
172 | power/autosuspend_delay_ms | 177 | ``power/autosuspend_delay_ms`` |
173 | 178 | ||
174 | This file contains an integer value, which is the | 179 | This file contains an integer value, which is the |
175 | number of milliseconds the device should remain idle | 180 | number of milliseconds the device should remain idle |
@@ -180,31 +185,31 @@ but only "autosuspend" works.) | |||
180 | number to the file to change the autosuspend | 185 | number to the file to change the autosuspend |
181 | idle-delay time. | 186 | idle-delay time. |
182 | 187 | ||
183 | Writing "-1" to power/autosuspend_delay_ms and writing "on" to | 188 | Writing ``-1`` to ``power/autosuspend_delay_ms`` and writing ``on`` to |
184 | power/control do essentially the same thing -- they both prevent the | 189 | ``power/control`` do essentially the same thing -- they both prevent the |
185 | device from being autosuspended. Yes, this is a redundancy in the | 190 | device from being autosuspended. Yes, this is a redundancy in the |
186 | API. | 191 | API. |
187 | 192 | ||
188 | (In 2.6.21 writing "0" to power/autosuspend would prevent the device | 193 | (In 2.6.21 writing ``0`` to ``power/autosuspend`` would prevent the device |
189 | from being autosuspended; the behavior was changed in 2.6.22. The | 194 | from being autosuspended; the behavior was changed in 2.6.22. The |
190 | power/autosuspend attribute did not exist prior to 2.6.21, and the | 195 | ``power/autosuspend`` attribute did not exist prior to 2.6.21, and the |
191 | power/level attribute did not exist prior to 2.6.22. power/control | 196 | ``power/level`` attribute did not exist prior to 2.6.22. ``power/control`` |
192 | was added in 2.6.34, and power/autosuspend_delay_ms was added in | 197 | was added in 2.6.34, and ``power/autosuspend_delay_ms`` was added in |
193 | 2.6.37 but did not become functional until 2.6.38.) | 198 | 2.6.37 but did not become functional until 2.6.38.) |
194 | 199 | ||
195 | 200 | ||
196 | Changing the default idle-delay time | 201 | Changing the default idle-delay time |
197 | ------------------------------------ | 202 | ------------------------------------ |
198 | 203 | ||
199 | The default autosuspend idle-delay time (in seconds) is controlled by | 204 | The default autosuspend idle-delay time (in seconds) is controlled by |
200 | a module parameter in usbcore. You can specify the value when usbcore | 205 | a module parameter in usbcore. You can specify the value when usbcore |
201 | is loaded. For example, to set it to 5 seconds instead of 2 you would | 206 | is loaded. For example, to set it to 5 seconds instead of 2 you would |
202 | do: | 207 | do:: |
203 | 208 | ||
204 | modprobe usbcore autosuspend=5 | 209 | modprobe usbcore autosuspend=5 |
205 | 210 | ||
206 | Equivalently, you could add to a configuration file in /etc/modprobe.d | 211 | Equivalently, you could add to a configuration file in /etc/modprobe.d |
207 | a line saying: | 212 | a line saying:: |
208 | 213 | ||
209 | options usbcore autosuspend=5 | 214 | options usbcore autosuspend=5 |
210 | 215 | ||
@@ -214,14 +219,14 @@ image. To alter the parameter value you would have to rebuild that | |||
214 | image. | 219 | image. |
215 | 220 | ||
216 | If usbcore is compiled into the kernel rather than built as a loadable | 221 | If usbcore is compiled into the kernel rather than built as a loadable |
217 | module, you can add | 222 | module, you can add:: |
218 | 223 | ||
219 | usbcore.autosuspend=5 | 224 | usbcore.autosuspend=5 |
220 | 225 | ||
221 | to the kernel's boot command line. | 226 | to the kernel's boot command line. |
222 | 227 | ||
223 | Finally, the parameter value can be changed while the system is | 228 | Finally, the parameter value can be changed while the system is |
224 | running. If you do: | 229 | running. If you do:: |
225 | 230 | ||
226 | echo 5 >/sys/module/usbcore/parameters/autosuspend | 231 | echo 5 >/sys/module/usbcore/parameters/autosuspend |
227 | 232 | ||
@@ -234,8 +239,8 @@ autosuspend of any USB device. This has the benefit of allowing you | |||
234 | then to enable autosuspend for selected devices. | 239 | then to enable autosuspend for selected devices. |
235 | 240 | ||
236 | 241 | ||
237 | Warnings | 242 | Warnings |
238 | -------- | 243 | -------- |
239 | 244 | ||
240 | The USB specification states that all USB devices must support power | 245 | The USB specification states that all USB devices must support power |
241 | management. Nevertheless, the sad fact is that many devices do not | 246 | management. Nevertheless, the sad fact is that many devices do not |
@@ -246,7 +251,7 @@ among printers and scanners, but plenty of other types of device have | |||
246 | the same deficiency. | 251 | the same deficiency. |
247 | 252 | ||
248 | For this reason, by default the kernel disables autosuspend (the | 253 | For this reason, by default the kernel disables autosuspend (the |
249 | power/control attribute is initialized to "on") for all devices other | 254 | ``power/control`` attribute is initialized to ``on``) for all devices other |
250 | than hubs. Hubs, at least, appear to be reasonably well-behaved in | 255 | than hubs. Hubs, at least, appear to be reasonably well-behaved in |
251 | this regard. | 256 | this regard. |
252 | 257 | ||
@@ -284,30 +289,30 @@ device by suspending it at the wrong time. (Highly unlikely, but | |||
284 | possible.) Take care. | 289 | possible.) Take care. |
285 | 290 | ||
286 | 291 | ||
287 | The driver interface for Power Management | 292 | The driver interface for Power Management |
288 | ----------------------------------------- | 293 | ----------------------------------------- |
289 | 294 | ||
290 | The requirements for a USB driver to support external power management | 295 | The requirements for a USB driver to support external power management |
291 | are pretty modest; the driver need only define | 296 | are pretty modest; the driver need only define:: |
292 | 297 | ||
293 | .suspend | 298 | .suspend |
294 | .resume | 299 | .resume |
295 | .reset_resume | 300 | .reset_resume |
296 | 301 | ||
297 | methods in its usb_driver structure, and the reset_resume method is | 302 | methods in its :c:type:`usb_driver` structure, and the ``reset_resume`` method |
298 | optional. The methods' jobs are quite simple: | 303 | is optional. The methods' jobs are quite simple: |
299 | 304 | ||
300 | The suspend method is called to warn the driver that the | 305 | - The ``suspend`` method is called to warn the driver that the |
301 | device is going to be suspended. If the driver returns a | 306 | device is going to be suspended. If the driver returns a |
302 | negative error code, the suspend will be aborted. Normally | 307 | negative error code, the suspend will be aborted. Normally |
303 | the driver will return 0, in which case it must cancel all | 308 | the driver will return 0, in which case it must cancel all |
304 | outstanding URBs (usb_kill_urb()) and not submit any more. | 309 | outstanding URBs (:c:func:`usb_kill_urb`) and not submit any more. |
305 | 310 | ||
306 | The resume method is called to tell the driver that the | 311 | - The ``resume`` method is called to tell the driver that the |
307 | device has been resumed and the driver can return to normal | 312 | device has been resumed and the driver can return to normal |
308 | operation. URBs may once more be submitted. | 313 | operation. URBs may once more be submitted. |
309 | 314 | ||
310 | The reset_resume method is called to tell the driver that | 315 | - The ``reset_resume`` method is called to tell the driver that |
311 | the device has been resumed and it also has been reset. | 316 | the device has been resumed and it also has been reset. |
312 | The driver should redo any necessary device initialization, | 317 | The driver should redo any necessary device initialization, |
313 | since the device has probably lost most or all of its state | 318 | since the device has probably lost most or all of its state |
@@ -315,22 +320,22 @@ optional. The methods' jobs are quite simple: | |||
315 | before the suspend). | 320 | before the suspend). |
316 | 321 | ||
317 | If the device is disconnected or powered down while it is suspended, | 322 | If the device is disconnected or powered down while it is suspended, |
318 | the disconnect method will be called instead of the resume or | 323 | the ``disconnect`` method will be called instead of the ``resume`` or |
319 | reset_resume method. This is also quite likely to happen when | 324 | ``reset_resume`` method. This is also quite likely to happen when |
320 | waking up from hibernation, as many systems do not maintain suspend | 325 | waking up from hibernation, as many systems do not maintain suspend |
321 | current to the USB host controllers during hibernation. (It's | 326 | current to the USB host controllers during hibernation. (It's |
322 | possible to work around the hibernation-forces-disconnect problem by | 327 | possible to work around the hibernation-forces-disconnect problem by |
323 | using the USB Persist facility.) | 328 | using the USB Persist facility.) |
324 | 329 | ||
325 | The reset_resume method is used by the USB Persist facility (see | 330 | The ``reset_resume`` method is used by the USB Persist facility (see |
326 | Documentation/usb/persist.txt) and it can also be used under certain | 331 | :ref:`usb-persist`) and it can also be used under certain |
327 | circumstances when CONFIG_USB_PERSIST is not enabled. Currently, if a | 332 | circumstances when ``CONFIG_USB_PERSIST`` is not enabled. Currently, if a |
328 | device is reset during a resume and the driver does not have a | 333 | device is reset during a resume and the driver does not have a |
329 | reset_resume method, the driver won't receive any notification about | 334 | ``reset_resume`` method, the driver won't receive any notification about |
330 | the resume. Later kernels will call the driver's disconnect method; | 335 | the resume. Later kernels will call the driver's ``disconnect`` method; |
331 | 2.6.23 doesn't do this. | 336 | 2.6.23 doesn't do this. |
332 | 337 | ||
333 | USB drivers are bound to interfaces, so their suspend and resume | 338 | USB drivers are bound to interfaces, so their ``suspend`` and ``resume`` |
334 | methods get called when the interfaces are suspended or resumed. In | 339 | methods get called when the interfaces are suspended or resumed. In |
335 | principle one might want to suspend some interfaces on a device (i.e., | 340 | principle one might want to suspend some interfaces on a device (i.e., |
336 | force the drivers for those interface to stop all activity) without | 341 | force the drivers for those interface to stop all activity) without |
@@ -341,15 +346,15 @@ to suspend or resume some but not all of a device's interfaces. The | |||
341 | closest you can come is to unbind the interfaces' drivers. | 346 | closest you can come is to unbind the interfaces' drivers. |
342 | 347 | ||
343 | 348 | ||
344 | The driver interface for autosuspend and autoresume | 349 | The driver interface for autosuspend and autoresume |
345 | --------------------------------------------------- | 350 | --------------------------------------------------- |
346 | 351 | ||
347 | To support autosuspend and autoresume, a driver should implement all | 352 | To support autosuspend and autoresume, a driver should implement all |
348 | three of the methods listed above. In addition, a driver indicates | 353 | three of the methods listed above. In addition, a driver indicates |
349 | that it supports autosuspend by setting the .supports_autosuspend flag | 354 | that it supports autosuspend by setting the ``.supports_autosuspend`` flag |
350 | in its usb_driver structure. It is then responsible for informing the | 355 | in its usb_driver structure. It is then responsible for informing the |
351 | USB core whenever one of its interfaces becomes busy or idle. The | 356 | USB core whenever one of its interfaces becomes busy or idle. The |
352 | driver does so by calling these six functions: | 357 | driver does so by calling these six functions:: |
353 | 358 | ||
354 | int usb_autopm_get_interface(struct usb_interface *intf); | 359 | int usb_autopm_get_interface(struct usb_interface *intf); |
355 | void usb_autopm_put_interface(struct usb_interface *intf); | 360 | void usb_autopm_put_interface(struct usb_interface *intf); |
@@ -368,41 +373,41 @@ autosuspend the device. | |||
368 | Drivers need not be concerned about balancing changes to the usage | 373 | Drivers need not be concerned about balancing changes to the usage |
369 | counter; the USB core will undo any remaining "get"s when a driver | 374 | counter; the USB core will undo any remaining "get"s when a driver |
370 | is unbound from its interface. As a corollary, drivers must not call | 375 | is unbound from its interface. As a corollary, drivers must not call |
371 | any of the usb_autopm_* functions after their disconnect() routine has | 376 | any of the ``usb_autopm_*`` functions after their ``disconnect`` |
372 | returned. | 377 | routine has returned. |
373 | 378 | ||
374 | Drivers using the async routines are responsible for their own | 379 | Drivers using the async routines are responsible for their own |
375 | synchronization and mutual exclusion. | 380 | synchronization and mutual exclusion. |
376 | 381 | ||
377 | usb_autopm_get_interface() increments the usage counter and | 382 | :c:func:`usb_autopm_get_interface` increments the usage counter and |
378 | does an autoresume if the device is suspended. If the | 383 | does an autoresume if the device is suspended. If the |
379 | autoresume fails, the counter is decremented back. | 384 | autoresume fails, the counter is decremented back. |
380 | 385 | ||
381 | usb_autopm_put_interface() decrements the usage counter and | 386 | :c:func:`usb_autopm_put_interface` decrements the usage counter and |
382 | attempts an autosuspend if the new value is = 0. | 387 | attempts an autosuspend if the new value is = 0. |
383 | 388 | ||
384 | usb_autopm_get_interface_async() and | 389 | :c:func:`usb_autopm_get_interface_async` and |
385 | usb_autopm_put_interface_async() do almost the same things as | 390 | :c:func:`usb_autopm_put_interface_async` do almost the same things as |
386 | their non-async counterparts. The big difference is that they | 391 | their non-async counterparts. The big difference is that they |
387 | use a workqueue to do the resume or suspend part of their | 392 | use a workqueue to do the resume or suspend part of their |
388 | jobs. As a result they can be called in an atomic context, | 393 | jobs. As a result they can be called in an atomic context, |
389 | such as an URB's completion handler, but when they return the | 394 | such as an URB's completion handler, but when they return the |
390 | device will generally not yet be in the desired state. | 395 | device will generally not yet be in the desired state. |
391 | 396 | ||
392 | usb_autopm_get_interface_no_resume() and | 397 | :c:func:`usb_autopm_get_interface_no_resume` and |
393 | usb_autopm_put_interface_no_suspend() merely increment or | 398 | :c:func:`usb_autopm_put_interface_no_suspend` merely increment or |
394 | decrement the usage counter; they do not attempt to carry out | 399 | decrement the usage counter; they do not attempt to carry out |
395 | an autoresume or an autosuspend. Hence they can be called in | 400 | an autoresume or an autosuspend. Hence they can be called in |
396 | an atomic context. | 401 | an atomic context. |
397 | 402 | ||
398 | The simplest usage pattern is that a driver calls | 403 | The simplest usage pattern is that a driver calls |
399 | usb_autopm_get_interface() in its open routine and | 404 | :c:func:`usb_autopm_get_interface` in its open routine and |
400 | usb_autopm_put_interface() in its close or release routine. But other | 405 | :c:func:`usb_autopm_put_interface` in its close or release routine. But other |
401 | patterns are possible. | 406 | patterns are possible. |
402 | 407 | ||
403 | The autosuspend attempts mentioned above will often fail for one | 408 | The autosuspend attempts mentioned above will often fail for one |
404 | reason or another. For example, the power/control attribute might be | 409 | reason or another. For example, the ``power/control`` attribute might be |
405 | set to "on", or another interface in the same device might not be | 410 | set to ``on``, or another interface in the same device might not be |
406 | idle. This is perfectly normal. If the reason for failure was that | 411 | idle. This is perfectly normal. If the reason for failure was that |
407 | the device hasn't been idle for long enough, a timer is scheduled to | 412 | the device hasn't been idle for long enough, a timer is scheduled to |
408 | carry out the operation automatically when the autosuspend idle-delay | 413 | carry out the operation automatically when the autosuspend idle-delay |
@@ -413,37 +418,37 @@ the device is no longer present or operating properly. Unlike | |||
413 | autosuspend, there's no idle-delay for an autoresume. | 418 | autosuspend, there's no idle-delay for an autoresume. |
414 | 419 | ||
415 | 420 | ||
416 | Other parts of the driver interface | 421 | Other parts of the driver interface |
417 | ----------------------------------- | 422 | ----------------------------------- |
418 | 423 | ||
419 | Drivers can enable autosuspend for their devices by calling | 424 | Drivers can enable autosuspend for their devices by calling:: |
420 | 425 | ||
421 | usb_enable_autosuspend(struct usb_device *udev); | 426 | usb_enable_autosuspend(struct usb_device *udev); |
422 | 427 | ||
423 | in their probe() routine, if they know that the device is capable of | 428 | in their :c:func:`probe` routine, if they know that the device is capable of |
424 | suspending and resuming correctly. This is exactly equivalent to | 429 | suspending and resuming correctly. This is exactly equivalent to |
425 | writing "auto" to the device's power/control attribute. Likewise, | 430 | writing ``auto`` to the device's ``power/control`` attribute. Likewise, |
426 | drivers can disable autosuspend by calling | 431 | drivers can disable autosuspend by calling:: |
427 | 432 | ||
428 | usb_disable_autosuspend(struct usb_device *udev); | 433 | usb_disable_autosuspend(struct usb_device *udev); |
429 | 434 | ||
430 | This is exactly the same as writing "on" to the power/control attribute. | 435 | This is exactly the same as writing ``on`` to the ``power/control`` attribute. |
431 | 436 | ||
432 | Sometimes a driver needs to make sure that remote wakeup is enabled | 437 | Sometimes a driver needs to make sure that remote wakeup is enabled |
433 | during autosuspend. For example, there's not much point | 438 | during autosuspend. For example, there's not much point |
434 | autosuspending a keyboard if the user can't cause the keyboard to do a | 439 | autosuspending a keyboard if the user can't cause the keyboard to do a |
435 | remote wakeup by typing on it. If the driver sets | 440 | remote wakeup by typing on it. If the driver sets |
436 | intf->needs_remote_wakeup to 1, the kernel won't autosuspend the | 441 | ``intf->needs_remote_wakeup`` to 1, the kernel won't autosuspend the |
437 | device if remote wakeup isn't available. (If the device is already | 442 | device if remote wakeup isn't available. (If the device is already |
438 | autosuspended, though, setting this flag won't cause the kernel to | 443 | autosuspended, though, setting this flag won't cause the kernel to |
439 | autoresume it. Normally a driver would set this flag in its probe | 444 | autoresume it. Normally a driver would set this flag in its ``probe`` |
440 | method, at which time the device is guaranteed not to be | 445 | method, at which time the device is guaranteed not to be |
441 | autosuspended.) | 446 | autosuspended.) |
442 | 447 | ||
443 | If a driver does its I/O asynchronously in interrupt context, it | 448 | If a driver does its I/O asynchronously in interrupt context, it |
444 | should call usb_autopm_get_interface_async() before starting output and | 449 | should call :c:func:`usb_autopm_get_interface_async` before starting output and |
445 | usb_autopm_put_interface_async() when the output queue drains. When | 450 | :c:func:`usb_autopm_put_interface_async` when the output queue drains. When |
446 | it receives an input event, it should call | 451 | it receives an input event, it should call:: |
447 | 452 | ||
448 | usb_mark_last_busy(struct usb_device *udev); | 453 | usb_mark_last_busy(struct usb_device *udev); |
449 | 454 | ||
@@ -453,41 +458,41 @@ be pushed back. Many of the usb_autopm_* routines also make this call, | |||
453 | so drivers need to worry only when interrupt-driven input arrives. | 458 | so drivers need to worry only when interrupt-driven input arrives. |
454 | 459 | ||
455 | Asynchronous operation is always subject to races. For example, a | 460 | Asynchronous operation is always subject to races. For example, a |
456 | driver may call the usb_autopm_get_interface_async() routine at a time | 461 | driver may call the :c:func:`usb_autopm_get_interface_async` routine at a time |
457 | when the core has just finished deciding the device has been idle for | 462 | when the core has just finished deciding the device has been idle for |
458 | long enough but not yet gotten around to calling the driver's suspend | 463 | long enough but not yet gotten around to calling the driver's ``suspend`` |
459 | method. The suspend method must be responsible for synchronizing with | 464 | method. The ``suspend`` method must be responsible for synchronizing with |
460 | the I/O request routine and the URB completion handler; it should | 465 | the I/O request routine and the URB completion handler; it should |
461 | cause autosuspends to fail with -EBUSY if the driver needs to use the | 466 | cause autosuspends to fail with -EBUSY if the driver needs to use the |
462 | device. | 467 | device. |
463 | 468 | ||
464 | External suspend calls should never be allowed to fail in this way, | 469 | External suspend calls should never be allowed to fail in this way, |
465 | only autosuspend calls. The driver can tell them apart by applying | 470 | only autosuspend calls. The driver can tell them apart by applying |
466 | the PMSG_IS_AUTO() macro to the message argument to the suspend | 471 | the :c:func:`PMSG_IS_AUTO` macro to the message argument to the ``suspend`` |
467 | method; it will return True for internal PM events (autosuspend) and | 472 | method; it will return True for internal PM events (autosuspend) and |
468 | False for external PM events. | 473 | False for external PM events. |
469 | 474 | ||
470 | 475 | ||
471 | Mutual exclusion | 476 | Mutual exclusion |
472 | ---------------- | 477 | ---------------- |
473 | 478 | ||
474 | For external events -- but not necessarily for autosuspend or | 479 | For external events -- but not necessarily for autosuspend or |
475 | autoresume -- the device semaphore (udev->dev.sem) will be held when a | 480 | autoresume -- the device semaphore (udev->dev.sem) will be held when a |
476 | suspend or resume method is called. This implies that external | 481 | ``suspend`` or ``resume`` method is called. This implies that external |
477 | suspend/resume events are mutually exclusive with calls to probe, | 482 | suspend/resume events are mutually exclusive with calls to ``probe``, |
478 | disconnect, pre_reset, and post_reset; the USB core guarantees that | 483 | ``disconnect``, ``pre_reset``, and ``post_reset``; the USB core guarantees that |
479 | this is true of autosuspend/autoresume events as well. | 484 | this is true of autosuspend/autoresume events as well. |
480 | 485 | ||
481 | If a driver wants to block all suspend/resume calls during some | 486 | If a driver wants to block all suspend/resume calls during some |
482 | critical section, the best way is to lock the device and call | 487 | critical section, the best way is to lock the device and call |
483 | usb_autopm_get_interface() (and do the reverse at the end of the | 488 | :c:func:`usb_autopm_get_interface` (and do the reverse at the end of the |
484 | critical section). Holding the device semaphore will block all | 489 | critical section). Holding the device semaphore will block all |
485 | external PM calls, and the usb_autopm_get_interface() will prevent any | 490 | external PM calls, and the :c:func:`usb_autopm_get_interface` will prevent any |
486 | internal PM calls, even if it fails. (Exercise: Why?) | 491 | internal PM calls, even if it fails. (Exercise: Why?) |
487 | 492 | ||
488 | 493 | ||
489 | Interaction between dynamic PM and system PM | 494 | Interaction between dynamic PM and system PM |
490 | -------------------------------------------- | 495 | -------------------------------------------- |
491 | 496 | ||
492 | Dynamic power management and system power management can interact in | 497 | Dynamic power management and system power management can interact in |
493 | a couple of ways. | 498 | a couple of ways. |
@@ -512,8 +517,8 @@ wakeup may fail and get lost. Which outcome occurs depends on timing | |||
512 | and on the hardware and firmware design. | 517 | and on the hardware and firmware design. |
513 | 518 | ||
514 | 519 | ||
515 | xHCI hardware link PM | 520 | xHCI hardware link PM |
516 | --------------------- | 521 | --------------------- |
517 | 522 | ||
518 | xHCI host controller provides hardware link power management to usb2.0 | 523 | xHCI host controller provides hardware link power management to usb2.0 |
519 | (xHCI 1.0 feature) and usb3.0 devices which support link PM. By | 524 | (xHCI 1.0 feature) and usb3.0 devices which support link PM. By |
@@ -522,11 +527,11 @@ lower power state(L1 for usb2.0 devices, or U1/U2 for usb3.0 devices), | |||
522 | which state device can enter and resume very quickly. | 527 | which state device can enter and resume very quickly. |
523 | 528 | ||
524 | The user interface for controlling hardware LPM is located in the | 529 | The user interface for controlling hardware LPM is located in the |
525 | power/ subdirectory of each USB device's sysfs directory, that is, in | 530 | ``power/`` subdirectory of each USB device's sysfs directory, that is, in |
526 | /sys/bus/usb/devices/.../power/ where "..." is the device's ID. The | 531 | ``/sys/bus/usb/devices/.../power/`` where "..." is the device's ID. The |
527 | relevant attribute files are usb2_hardware_lpm and usb3_hardware_lpm. | 532 | relevant attribute files are ``usb2_hardware_lpm`` and ``usb3_hardware_lpm``. |
528 | 533 | ||
529 | power/usb2_hardware_lpm | 534 | ``power/usb2_hardware_lpm`` |
530 | 535 | ||
531 | When a USB2 device which support LPM is plugged to a | 536 | When a USB2 device which support LPM is plugged to a |
532 | xHCI host root hub which support software LPM, the | 537 | xHCI host root hub which support software LPM, the |
@@ -537,8 +542,8 @@ relevant attribute files are usb2_hardware_lpm and usb3_hardware_lpm. | |||
537 | can write y/Y/1 or n/N/0 to the file to enable/disable | 542 | can write y/Y/1 or n/N/0 to the file to enable/disable |
538 | USB2 hardware LPM manually. This is for test purpose mainly. | 543 | USB2 hardware LPM manually. This is for test purpose mainly. |
539 | 544 | ||
540 | power/usb3_hardware_lpm_u1 | 545 | ``power/usb3_hardware_lpm_u1`` |
541 | power/usb3_hardware_lpm_u2 | 546 | ``power/usb3_hardware_lpm_u2`` |
542 | 547 | ||
543 | When a USB 3.0 lpm-capable device is plugged in to a | 548 | When a USB 3.0 lpm-capable device is plugged in to a |
544 | xHCI host which supports link PM, it will check if U1 | 549 | xHCI host which supports link PM, it will check if U1 |
@@ -550,29 +555,31 @@ relevant attribute files are usb2_hardware_lpm and usb3_hardware_lpm. | |||
550 | indicating whether or not USB3 hardware LPM U1 or U2 | 555 | indicating whether or not USB3 hardware LPM U1 or U2 |
551 | is enabled for the device. | 556 | is enabled for the device. |
552 | 557 | ||
553 | USB Port Power Control | 558 | USB Port Power Control |
554 | ---------------------- | 559 | ---------------------- |
555 | 560 | ||
556 | In addition to suspending endpoint devices and enabling hardware | 561 | In addition to suspending endpoint devices and enabling hardware |
557 | controlled link power management, the USB subsystem also has the | 562 | controlled link power management, the USB subsystem also has the |
558 | capability to disable power to ports under some conditions. Power is | 563 | capability to disable power to ports under some conditions. Power is |
559 | controlled through Set/ClearPortFeature(PORT_POWER) requests to a hub. | 564 | controlled through ``Set/ClearPortFeature(PORT_POWER)`` requests to a hub. |
560 | In the case of a root or platform-internal hub the host controller | 565 | In the case of a root or platform-internal hub the host controller |
561 | driver translates PORT_POWER requests into platform firmware (ACPI) | 566 | driver translates ``PORT_POWER`` requests into platform firmware (ACPI) |
562 | method calls to set the port power state. For more background see the | 567 | method calls to set the port power state. For more background see the |
563 | Linux Plumbers Conference 2012 slides [1] and video [2]: | 568 | Linux Plumbers Conference 2012 slides [#f1]_ and video [#f2]_: |
564 | 569 | ||
565 | Upon receiving a ClearPortFeature(PORT_POWER) request a USB port is | 570 | Upon receiving a ``ClearPortFeature(PORT_POWER)`` request a USB port is |
566 | logically off, and may trigger the actual loss of VBUS to the port [3]. | 571 | logically off, and may trigger the actual loss of VBUS to the port [#f3]_. |
567 | VBUS may be maintained in the case where a hub gangs multiple ports into | 572 | VBUS may be maintained in the case where a hub gangs multiple ports into |
568 | a shared power well causing power to remain until all ports in the gang | 573 | a shared power well causing power to remain until all ports in the gang |
569 | are turned off. VBUS may also be maintained by hub ports configured for | 574 | are turned off. VBUS may also be maintained by hub ports configured for |
570 | a charging application. In any event a logically off port will lose | 575 | a charging application. In any event a logically off port will lose |
571 | connection with its device, not respond to hotplug events, and not | 576 | connection with its device, not respond to hotplug events, and not |
572 | respond to remote wakeup events*. | 577 | respond to remote wakeup events. |
578 | |||
579 | .. warning:: | ||
573 | 580 | ||
574 | WARNING: turning off a port may result in the inability to hot add a device. | 581 | turning off a port may result in the inability to hot add a device. |
575 | Please see "User Interface for Port Power Control" for details. | 582 | Please see "User Interface for Port Power Control" for details. |
576 | 583 | ||
577 | As far as the effect on the device itself it is similar to what a device | 584 | As far as the effect on the device itself it is similar to what a device |
578 | goes through during system suspend, i.e. the power session is lost. Any | 585 | goes through during system suspend, i.e. the power session is lost. Any |
@@ -581,38 +588,49 @@ similarly affected by a port power cycle event. For this reason the | |||
581 | implementation shares the same device recovery path (and honors the same | 588 | implementation shares the same device recovery path (and honors the same |
582 | quirks) as the system resume path for the hub. | 589 | quirks) as the system resume path for the hub. |
583 | 590 | ||
584 | [1]: http://dl.dropbox.com/u/96820575/sarah-sharp-lpt-port-power-off2-mini.pdf | 591 | .. [#f1] |
585 | [2]: http://linuxplumbers.ubicast.tv/videos/usb-port-power-off-kerneluserspace-api/ | 592 | |
586 | [3]: USB 3.1 Section 10.12 | 593 | http://dl.dropbox.com/u/96820575/sarah-sharp-lpt-port-power-off2-mini.pdf |
587 | * wakeup note: if a device is configured to send wakeup events the port | 594 | |
595 | .. [#f2] | ||
596 | |||
597 | http://linuxplumbers.ubicast.tv/videos/usb-port-power-off-kerneluserspace-api/ | ||
598 | |||
599 | .. [#f3] | ||
600 | |||
601 | USB 3.1 Section 10.12 | ||
602 | |||
603 | wakeup note: if a device is configured to send wakeup events the port | ||
588 | power control implementation will block poweroff attempts on that | 604 | power control implementation will block poweroff attempts on that |
589 | port. | 605 | port. |
590 | 606 | ||
591 | 607 | ||
592 | User Interface for Port Power Control | 608 | User Interface for Port Power Control |
593 | ------------------------------------- | 609 | ------------------------------------- |
594 | 610 | ||
595 | The port power control mechanism uses the PM runtime system. Poweroff is | 611 | The port power control mechanism uses the PM runtime system. Poweroff is |
596 | requested by clearing the power/pm_qos_no_power_off flag of the port device | 612 | requested by clearing the ``power/pm_qos_no_power_off`` flag of the port device |
597 | (defaults to 1). If the port is disconnected it will immediately receive a | 613 | (defaults to 1). If the port is disconnected it will immediately receive a |
598 | ClearPortFeature(PORT_POWER) request. Otherwise, it will honor the pm runtime | 614 | ``ClearPortFeature(PORT_POWER)`` request. Otherwise, it will honor the pm |
599 | rules and require the attached child device and all descendants to be suspended. | 615 | runtime rules and require the attached child device and all descendants to be |
600 | This mechanism is dependent on the hub advertising port power switching in its | 616 | suspended. This mechanism is dependent on the hub advertising port power |
601 | hub descriptor (wHubCharacteristics logical power switching mode field). | 617 | switching in its hub descriptor (wHubCharacteristics logical power switching |
618 | mode field). | ||
602 | 619 | ||
603 | Note, some interface devices/drivers do not support autosuspend. Userspace may | 620 | Note, some interface devices/drivers do not support autosuspend. Userspace may |
604 | need to unbind the interface drivers before the usb_device will suspend. An | 621 | need to unbind the interface drivers before the :c:type:`usb_device` will |
605 | unbound interface device is suspended by default. When unbinding, be careful | 622 | suspend. An unbound interface device is suspended by default. When unbinding, |
606 | to unbind interface drivers, not the driver of the parent usb device. Also, | 623 | be careful to unbind interface drivers, not the driver of the parent usb |
607 | leave hub interface drivers bound. If the driver for the usb device (not | 624 | device. Also, leave hub interface drivers bound. If the driver for the usb |
608 | interface) is unbound the kernel is no longer able to resume the device. If a | 625 | device (not interface) is unbound the kernel is no longer able to resume the |
609 | hub interface driver is unbound, control of its child ports is lost and all | 626 | device. If a hub interface driver is unbound, control of its child ports is |
610 | attached child-devices will disconnect. A good rule of thumb is that if the | 627 | lost and all attached child-devices will disconnect. A good rule of thumb is |
611 | 'driver/module' link for a device points to /sys/module/usbcore then unbinding | 628 | that if the 'driver/module' link for a device points to |
612 | it will interfere with port power control. | 629 | ``/sys/module/usbcore`` then unbinding it will interfere with port power |
630 | control. | ||
613 | 631 | ||
614 | Example of the relevant files for port power control. Note, in this example | 632 | Example of the relevant files for port power control. Note, in this example |
615 | these files are relative to a usb hub device (prefix). | 633 | these files are relative to a usb hub device (prefix):: |
616 | 634 | ||
617 | prefix=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-1 | 635 | prefix=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-1 |
618 | 636 | ||
@@ -631,10 +649,10 @@ these files are relative to a usb hub device (prefix). | |||
631 | 649 | ||
632 | In addition to these files some ports may have a 'peer' link to a port on | 650 | In addition to these files some ports may have a 'peer' link to a port on |
633 | another hub. The expectation is that all superspeed ports have a | 651 | another hub. The expectation is that all superspeed ports have a |
634 | hi-speed peer. | 652 | hi-speed peer:: |
635 | 653 | ||
636 | $prefix/3-1:1.0/3-1-port1/peer -> ../../../../usb2/2-1/2-1:1.0/2-1-port1 | 654 | $prefix/3-1:1.0/3-1-port1/peer -> ../../../../usb2/2-1/2-1:1.0/2-1-port1 |
637 | ../../../../usb2/2-1/2-1:1.0/2-1-port1/peer -> ../../../../usb3/3-1/3-1:1.0/3-1-port1 | 655 | ../../../../usb2/2-1/2-1:1.0/2-1-port1/peer -> ../../../../usb3/3-1/3-1:1.0/3-1-port1 |
638 | 656 | ||
639 | Distinct from 'companion ports', or 'ehci/xhci shared switchover ports' | 657 | Distinct from 'companion ports', or 'ehci/xhci shared switchover ports' |
640 | peer ports are simply the hi-speed and superspeed interface pins that | 658 | peer ports are simply the hi-speed and superspeed interface pins that |
@@ -645,24 +663,26 @@ While a superspeed port is powered off a device may downgrade its | |||
645 | connection and attempt to connect to the hi-speed pins. The | 663 | connection and attempt to connect to the hi-speed pins. The |
646 | implementation takes steps to prevent this: | 664 | implementation takes steps to prevent this: |
647 | 665 | ||
648 | 1/ Port suspend is sequenced to guarantee that hi-speed ports are powered-off | 666 | 1. Port suspend is sequenced to guarantee that hi-speed ports are powered-off |
649 | before their superspeed peer is permitted to power-off. The implication is | 667 | before their superspeed peer is permitted to power-off. The implication is |
650 | that the setting pm_qos_no_power_off to zero on a superspeed port may not cause | 668 | that the setting ``pm_qos_no_power_off`` to zero on a superspeed port may |
651 | the port to power-off until its highspeed peer has gone to its runtime suspend | 669 | not cause the port to power-off until its highspeed peer has gone to its |
652 | state. Userspace must take care to order the suspensions if it wants to | 670 | runtime suspend state. Userspace must take care to order the suspensions |
653 | guarantee that a superspeed port will power-off. | 671 | if it wants to guarantee that a superspeed port will power-off. |
654 | 672 | ||
655 | 2/ Port resume is sequenced to force a superspeed port to power-on prior to its | 673 | 2. Port resume is sequenced to force a superspeed port to power-on prior to its |
656 | highspeed peer. | 674 | highspeed peer. |
657 | 675 | ||
658 | 3/ Port resume always triggers an attached child device to resume. After a | 676 | 3. Port resume always triggers an attached child device to resume. After a |
659 | power session is lost the device may have been removed, or need reset. | 677 | power session is lost the device may have been removed, or need reset. |
660 | Resuming the child device when the parent port regains power resolves those | 678 | Resuming the child device when the parent port regains power resolves those |
661 | states and clamps the maximum port power cycle frequency at the rate the child | 679 | states and clamps the maximum port power cycle frequency at the rate the |
662 | device can suspend (autosuspend-delay) and resume (reset-resume latency). | 680 | child device can suspend (autosuspend-delay) and resume (reset-resume |
681 | latency). | ||
663 | 682 | ||
664 | Sysfs files relevant for port power control: | 683 | Sysfs files relevant for port power control: |
665 | <hubdev-portX>/power/pm_qos_no_power_off: | 684 | |
685 | ``<hubdev-portX>/power/pm_qos_no_power_off``: | ||
666 | This writable flag controls the state of an idle port. | 686 | This writable flag controls the state of an idle port. |
667 | Once all children and descendants have suspended the | 687 | Once all children and descendants have suspended the |
668 | port may suspend/poweroff provided that | 688 | port may suspend/poweroff provided that |
@@ -670,24 +690,24 @@ Sysfs files relevant for port power control: | |||
670 | '1' the port will remain active/powered regardless of | 690 | '1' the port will remain active/powered regardless of |
671 | the stats of descendants. Defaults to 1. | 691 | the stats of descendants. Defaults to 1. |
672 | 692 | ||
673 | <hubdev-portX>/power/runtime_status: | 693 | ``<hubdev-portX>/power/runtime_status``: |
674 | This file reflects whether the port is 'active' (power is on) | 694 | This file reflects whether the port is 'active' (power is on) |
675 | or 'suspended' (logically off). There is no indication to | 695 | or 'suspended' (logically off). There is no indication to |
676 | userspace whether VBUS is still supplied. | 696 | userspace whether VBUS is still supplied. |
677 | 697 | ||
678 | <hubdev-portX>/connect_type: | 698 | ``<hubdev-portX>/connect_type``: |
679 | An advisory read-only flag to userspace indicating the | 699 | An advisory read-only flag to userspace indicating the |
680 | location and connection type of the port. It returns | 700 | location and connection type of the port. It returns |
681 | one of four values 'hotplug', 'hardwired', 'not used', | 701 | one of four values 'hotplug', 'hardwired', 'not used', |
682 | and 'unknown'. All values, besides unknown, are set by | 702 | and 'unknown'. All values, besides unknown, are set by |
683 | platform firmware. | 703 | platform firmware. |
684 | 704 | ||
685 | "hotplug" indicates an externally connectable/visible | 705 | ``hotplug`` indicates an externally connectable/visible |
686 | port on the platform. Typically userspace would choose | 706 | port on the platform. Typically userspace would choose |
687 | to keep such a port powered to handle new device | 707 | to keep such a port powered to handle new device |
688 | connection events. | 708 | connection events. |
689 | 709 | ||
690 | "hardwired" refers to a port that is not visible but | 710 | ``hardwired`` refers to a port that is not visible but |
691 | connectable. Examples are internal ports for USB | 711 | connectable. Examples are internal ports for USB |
692 | bluetooth that can be disconnected via an external | 712 | bluetooth that can be disconnected via an external |
693 | switch or a port with a hardwired USB camera. It is | 713 | switch or a port with a hardwired USB camera. It is |
@@ -698,48 +718,50 @@ Sysfs files relevant for port power control: | |||
698 | powering off, or to activate the port prior to enabling | 718 | powering off, or to activate the port prior to enabling |
699 | connection via a switch. | 719 | connection via a switch. |
700 | 720 | ||
701 | "not used" refers to an internal port that is expected | 721 | ``not used`` refers to an internal port that is expected |
702 | to never have a device connected to it. These may be | 722 | to never have a device connected to it. These may be |
703 | empty internal ports, or ports that are not physically | 723 | empty internal ports, or ports that are not physically |
704 | exposed on a platform. Considered safe to be | 724 | exposed on a platform. Considered safe to be |
705 | powered-off at all times. | 725 | powered-off at all times. |
706 | 726 | ||
707 | "unknown" means platform firmware does not provide | 727 | ``unknown`` means platform firmware does not provide |
708 | information for this port. Most commonly refers to | 728 | information for this port. Most commonly refers to |
709 | external hub ports which should be considered 'hotplug' | 729 | external hub ports which should be considered 'hotplug' |
710 | for policy decisions. | 730 | for policy decisions. |
711 | 731 | ||
712 | NOTE1: since we are relying on the BIOS to get this ACPI | 732 | .. note:: |
713 | information correct, the USB port descriptions may be | 733 | |
714 | missing or wrong. | 734 | - since we are relying on the BIOS to get this ACPI |
735 | information correct, the USB port descriptions may | ||
736 | be missing or wrong. | ||
715 | 737 | ||
716 | NOTE2: Take care in clearing pm_qos_no_power_off. Once | 738 | - Take care in clearing ``pm_qos_no_power_off``. Once |
717 | power is off this port will | 739 | power is off this port will |
718 | not respond to new connect events. | 740 | not respond to new connect events. |
719 | 741 | ||
720 | Once a child device is attached additional constraints are | 742 | Once a child device is attached additional constraints are |
721 | applied before the port is allowed to poweroff. | 743 | applied before the port is allowed to poweroff. |
722 | 744 | ||
723 | <child>/power/control: | 745 | ``<child>/power/control``: |
724 | Must be 'auto', and the port will not | 746 | Must be ``auto``, and the port will not |
725 | power down until <child>/power/runtime_status | 747 | power down until ``<child>/power/runtime_status`` |
726 | reflects the 'suspended' state. Default | 748 | reflects the 'suspended' state. Default |
727 | value is controlled by child device driver. | 749 | value is controlled by child device driver. |
728 | 750 | ||
729 | <child>/power/persist: | 751 | ``<child>/power/persist``: |
730 | This defaults to '1' for most devices and indicates if | 752 | This defaults to ``1`` for most devices and indicates if |
731 | kernel can persist the device's configuration across a | 753 | kernel can persist the device's configuration across a |
732 | power session loss (suspend / port-power event). When | 754 | power session loss (suspend / port-power event). When |
733 | this value is '0' (quirky devices), port poweroff is | 755 | this value is ``0`` (quirky devices), port poweroff is |
734 | disabled. | 756 | disabled. |
735 | 757 | ||
736 | <child>/driver/unbind: | 758 | ``<child>/driver/unbind``: |
737 | Wakeup capable devices will block port poweroff. At | 759 | Wakeup capable devices will block port poweroff. At |
738 | this time the only mechanism to clear the usb-internal | 760 | this time the only mechanism to clear the usb-internal |
739 | wakeup-capability for an interface device is to unbind | 761 | wakeup-capability for an interface device is to unbind |
740 | its driver. | 762 | its driver. |
741 | 763 | ||
742 | Summary of poweroff pre-requisite settings relative to a port device: | 764 | Summary of poweroff pre-requisite settings relative to a port device:: |
743 | 765 | ||
744 | echo 0 > power/pm_qos_no_power_off | 766 | echo 0 > power/pm_qos_no_power_off |
745 | echo 0 > peer/power/pm_qos_no_power_off # if it exists | 767 | echo 0 > peer/power/pm_qos_no_power_off # if it exists |
@@ -747,14 +769,14 @@ Summary of poweroff pre-requisite settings relative to a port device: | |||
747 | echo auto > <child>/power/control | 769 | echo auto > <child>/power/control |
748 | echo 1 > <child>/power/persist # this is the default value | 770 | echo 1 > <child>/power/persist # this is the default value |
749 | 771 | ||
750 | Suggested Userspace Port Power Policy | 772 | Suggested Userspace Port Power Policy |
751 | ------------------------------------- | 773 | ------------------------------------- |
752 | 774 | ||
753 | As noted above userspace needs to be careful and deliberate about what | 775 | As noted above userspace needs to be careful and deliberate about what |
754 | ports are enabled for poweroff. | 776 | ports are enabled for poweroff. |
755 | 777 | ||
756 | The default configuration is that all ports start with | 778 | The default configuration is that all ports start with |
757 | power/pm_qos_no_power_off set to '1' causing ports to always remain | 779 | ``power/pm_qos_no_power_off`` set to ``1`` causing ports to always remain |
758 | active. | 780 | active. |
759 | 781 | ||
760 | Given confidence in the platform firmware's description of the ports | 782 | Given confidence in the platform firmware's description of the ports |
@@ -764,7 +786,7 @@ done for 'hardwired' ports provided poweroff is coordinated with any | |||
764 | connection switch for the port. | 786 | connection switch for the port. |
765 | 787 | ||
766 | A more aggressive userspace policy is to enable USB port power off for | 788 | A more aggressive userspace policy is to enable USB port power off for |
767 | all ports (set <hubdev-portX>/power/pm_qos_no_power_off to '0') when | 789 | all ports (set ``<hubdev-portX>/power/pm_qos_no_power_off`` to ``0``) when |
768 | some external factor indicates the user has stopped interacting with the | 790 | some external factor indicates the user has stopped interacting with the |
769 | system. For example, a distro may want to enable power off all USB | 791 | system. For example, a distro may want to enable power off all USB |
770 | ports when the screen blanks, and re-power them when the screen becomes | 792 | ports when the screen blanks, and re-power them when the screen becomes |
diff --git a/Documentation/driver-api/usb.rst b/Documentation/driver-api/usb/usb.rst index 851cc40b66b5..dba0f876b36f 100644 --- a/Documentation/driver-api/usb.rst +++ b/Documentation/driver-api/usb/usb.rst | |||
@@ -1,3 +1,5 @@ | |||
1 | .. _usb-hostside-api: | ||
2 | |||
1 | =========================== | 3 | =========================== |
2 | The Linux-USB Host Side API | 4 | The Linux-USB Host Side API |
3 | =========================== | 5 | =========================== |
@@ -102,16 +104,21 @@ disconnect testing (while the device is active) with each different host | |||
102 | controller driver, to make sure drivers don't have bugs of their own as | 104 | controller driver, to make sure drivers don't have bugs of their own as |
103 | well as to make sure they aren't relying on some HCD-specific behavior. | 105 | well as to make sure they aren't relying on some HCD-specific behavior. |
104 | 106 | ||
107 | .. _usb_chapter9: | ||
108 | |||
105 | USB-Standard Types | 109 | USB-Standard Types |
106 | ================== | 110 | ================== |
107 | 111 | ||
108 | In ``<linux/usb/ch9.h>`` you will find the USB data types defined in | 112 | In ``<linux/usb/ch9.h>`` you will find the USB data types defined in |
109 | chapter 9 of the USB specification. These data types are used throughout | 113 | chapter 9 of the USB specification. These data types are used throughout |
110 | USB, and in APIs including this host side API, gadget APIs, and usbfs. | 114 | USB, and in APIs including this host side API, gadget APIs, usb character |
115 | devices and debugfs interfaces. | ||
111 | 116 | ||
112 | .. kernel-doc:: include/linux/usb/ch9.h | 117 | .. kernel-doc:: include/linux/usb/ch9.h |
113 | :internal: | 118 | :internal: |
114 | 119 | ||
120 | .. _usb_header: | ||
121 | |||
115 | Host-Side Data Types and Macros | 122 | Host-Side Data Types and Macros |
116 | =============================== | 123 | =============================== |
117 | 124 | ||
@@ -198,173 +205,110 @@ significantly reduce hcd-specific behaviors. | |||
198 | .. kernel-doc:: drivers/usb/core/buffer.c | 205 | .. kernel-doc:: drivers/usb/core/buffer.c |
199 | :internal: | 206 | :internal: |
200 | 207 | ||
201 | The USB Filesystem (usbfs) | 208 | The USB character device nodes |
202 | ========================== | 209 | ============================== |
203 | 210 | ||
204 | This chapter presents the Linux *usbfs*. You may prefer to avoid writing | 211 | This chapter presents the Linux character device nodes. You may prefer |
205 | new kernel code for your USB driver; that's the problem that usbfs set | 212 | to avoid writing new kernel code for your USB driver. User mode device |
206 | out to solve. User mode device drivers are usually packaged as | 213 | drivers are usually packaged as applications or libraries, and may use |
207 | applications or libraries, and may use usbfs through some programming | 214 | character devices through some programming library that wraps it. |
208 | library that wraps it. Such libraries include | 215 | Such libraries include: |
209 | `libusb <http://libusb.sourceforge.net>`__ for C/C++, and | ||
210 | `jUSB <http://jUSB.sourceforge.net>`__ for Java. | ||
211 | 216 | ||
212 | **Note** | 217 | - `libusb <http://libusb.sourceforge.net>`__ for C/C++, and |
218 | - `jUSB <http://jUSB.sourceforge.net>`__ for Java. | ||
213 | 219 | ||
214 | This particular documentation is incomplete, especially with respect | 220 | Some old information about it can be seen at the "USB Device Filesystem" |
215 | to the asynchronous mode. As of kernel 2.5.66 the code and this | 221 | section of the USB Guide. The latest copy of the USB Guide can be found |
216 | (new) documentation need to be cross-reviewed. | 222 | at http://www.linux-usb.org/ |
217 | 223 | ||
218 | Configure usbfs into Linux kernels by enabling the *USB filesystem* | 224 | .. note:: |
219 | option (CONFIG_USB_DEVICEFS), and you get basic support for user mode | ||
220 | USB device drivers. Until relatively recently it was often (confusingly) | ||
221 | called *usbdevfs* although it wasn't solving what *devfs* was. Every USB | ||
222 | device will appear in usbfs, regardless of whether or not it has a | ||
223 | kernel driver. | ||
224 | 225 | ||
225 | What files are in "usbfs"? | 226 | - They were used to be implemented via *usbfs*, but this is not part of |
226 | -------------------------- | 227 | the sysfs debug interface. |
227 | 228 | ||
228 | Conventionally mounted at ``/proc/bus/usb``, usbfs features include: | 229 | - This particular documentation is incomplete, especially with respect |
230 | to the asynchronous mode. As of kernel 2.5.66 the code and this | ||
231 | (new) documentation need to be cross-reviewed. | ||
229 | 232 | ||
230 | - ``/proc/bus/usb/devices`` ... a text file showing each of the USB | 233 | What files are in "devtmpfs"? |
231 | devices on known to the kernel, and their configuration descriptors. | 234 | ----------------------------- |
232 | You can also poll() this to learn about new devices. | ||
233 | 235 | ||
234 | - ``/proc/bus/usb/BBB/DDD`` ... magic files exposing the each device's | 236 | Conventionally mounted at ``/dev/bus/usb/``, usbfs features include: |
237 | |||
238 | - ``/dev/bus/usb/BBB/DDD`` ... magic files exposing the each device's | ||
235 | configuration descriptors, and supporting a series of ioctls for | 239 | configuration descriptors, and supporting a series of ioctls for |
236 | making device requests, including I/O to devices. (Purely for access | 240 | making device requests, including I/O to devices. (Purely for access |
237 | by programs.) | 241 | by programs.) |
238 | 242 | ||
239 | Each bus is given a number (BBB) based on when it was enumerated; within | 243 | Each bus is given a number (``BBB``) based on when it was enumerated; within |
240 | each bus, each device is given a similar number (DDD). Those BBB/DDD | 244 | each bus, each device is given a similar number (``DDD``). Those ``BBB/DDD`` |
241 | paths are not "stable" identifiers; expect them to change even if you | 245 | paths are not "stable" identifiers; expect them to change even if you |
242 | always leave the devices plugged in to the same hub port. *Don't even | 246 | always leave the devices plugged in to the same hub port. *Don't even |
243 | think of saving these in application configuration files.* Stable | 247 | think of saving these in application configuration files.* Stable |
244 | identifiers are available, for user mode applications that want to use | 248 | identifiers are available, for user mode applications that want to use |
245 | them. HID and networking devices expose these stable IDs, so that for | 249 | them. HID and networking devices expose these stable IDs, so that for |
246 | example you can be sure that you told the right UPS to power down its | 250 | example you can be sure that you told the right UPS to power down its |
247 | second server. "usbfs" doesn't (yet) expose those IDs. | 251 | second server. Pleast note that it doesn't (yet) expose those IDs. |
248 | |||
249 | Mounting and Access Control | ||
250 | --------------------------- | ||
251 | |||
252 | There are a number of mount options for usbfs, which will be of most | ||
253 | interest to you if you need to override the default access control | ||
254 | policy. That policy is that only root may read or write device files | ||
255 | (``/proc/bus/BBB/DDD``) although anyone may read the ``devices`` or | ||
256 | ``drivers`` files. I/O requests to the device also need the | ||
257 | CAP_SYS_RAWIO capability, | ||
258 | |||
259 | The significance of that is that by default, all user mode device | ||
260 | drivers need super-user privileges. You can change modes or ownership in | ||
261 | a driver setup when the device hotplugs, or maye just start the driver | ||
262 | right then, as a privileged server (or some activity within one). That's | ||
263 | the most secure approach for multi-user systems, but for single user | ||
264 | systems ("trusted" by that user) it's more convenient just to grant | ||
265 | everyone all access (using the *devmode=0666* option) so the driver can | ||
266 | start whenever it's needed. | ||
267 | |||
268 | The mount options for usbfs, usable in /etc/fstab or in command line | ||
269 | invocations of *mount*, are: | ||
270 | |||
271 | *busgid*\ =NNNNN | ||
272 | Controls the GID used for the /proc/bus/usb/BBB directories. | ||
273 | (Default: 0) | ||
274 | |||
275 | *busmode*\ =MMM | ||
276 | Controls the file mode used for the /proc/bus/usb/BBB directories. | ||
277 | (Default: 0555) | ||
278 | |||
279 | *busuid*\ =NNNNN | ||
280 | Controls the UID used for the /proc/bus/usb/BBB directories. | ||
281 | (Default: 0) | ||
282 | |||
283 | *devgid*\ =NNNNN | ||
284 | Controls the GID used for the /proc/bus/usb/BBB/DDD files. (Default: | ||
285 | 0) | ||
286 | |||
287 | *devmode*\ =MMM | ||
288 | Controls the file mode used for the /proc/bus/usb/BBB/DDD files. | ||
289 | (Default: 0644) | ||
290 | |||
291 | *devuid*\ =NNNNN | ||
292 | Controls the UID used for the /proc/bus/usb/BBB/DDD files. (Default: | ||
293 | 0) | ||
294 | |||
295 | *listgid*\ =NNNNN | ||
296 | Controls the GID used for the /proc/bus/usb/devices and drivers | ||
297 | files. (Default: 0) | ||
298 | |||
299 | *listmode*\ =MMM | ||
300 | Controls the file mode used for the /proc/bus/usb/devices and | ||
301 | drivers files. (Default: 0444) | ||
302 | 252 | ||
303 | *listuid*\ =NNNNN | 253 | /dev/bus/usb/BBB/DDD |
304 | Controls the UID used for the /proc/bus/usb/devices and drivers | 254 | -------------------- |
305 | files. (Default: 0) | ||
306 | |||
307 | Note that many Linux distributions hard-wire the mount options for usbfs | ||
308 | in their init scripts, such as ``/etc/rc.d/rc.sysinit``, rather than | ||
309 | making it easy to set this per-system policy in ``/etc/fstab``. | ||
310 | |||
311 | /proc/bus/usb/devices | ||
312 | --------------------- | ||
313 | |||
314 | This file is handy for status viewing tools in user mode, which can scan | ||
315 | the text format and ignore most of it. More detailed device status | ||
316 | (including class and vendor status) is available from device-specific | ||
317 | files. For information about the current format of this file, see the | ||
318 | ``Documentation/usb/proc_usb_info.txt`` file in your Linux kernel | ||
319 | sources. | ||
320 | |||
321 | This file, in combination with the poll() system call, can also be used | ||
322 | to detect when devices are added or removed: | ||
323 | |||
324 | :: | ||
325 | |||
326 | int fd; | ||
327 | struct pollfd pfd; | ||
328 | |||
329 | fd = open("/proc/bus/usb/devices", O_RDONLY); | ||
330 | pfd = { fd, POLLIN, 0 }; | ||
331 | for (;;) { | ||
332 | /* The first time through, this call will return immediately. */ | ||
333 | poll(&pfd, 1, -1); | ||
334 | |||
335 | /* To see what's changed, compare the file's previous and current | ||
336 | contents or scan the filesystem. (Scanning is more precise.) */ | ||
337 | } | ||
338 | |||
339 | Note that this behavior is intended to be used for informational and | ||
340 | debug purposes. It would be more appropriate to use programs such as | ||
341 | udev or HAL to initialize a device or start a user-mode helper program, | ||
342 | for instance. | ||
343 | |||
344 | /proc/bus/usb/BBB/DDD | ||
345 | --------------------- | ||
346 | 255 | ||
347 | Use these files in one of these basic ways: | 256 | Use these files in one of these basic ways: |
348 | 257 | ||
349 | *They can be read,* producing first the device descriptor (18 bytes) and | 258 | - *They can be read,* producing first the device descriptor (18 bytes) and |
350 | then the descriptors for the current configuration. See the USB 2.0 spec | 259 | then the descriptors for the current configuration. See the USB 2.0 spec |
351 | for details about those binary data formats. You'll need to convert most | 260 | for details about those binary data formats. You'll need to convert most |
352 | multibyte values from little endian format to your native host byte | 261 | multibyte values from little endian format to your native host byte |
353 | order, although a few of the fields in the device descriptor (both of | 262 | order, although a few of the fields in the device descriptor (both of |
354 | the BCD-encoded fields, and the vendor and product IDs) will be | 263 | the BCD-encoded fields, and the vendor and product IDs) will be |
355 | byteswapped for you. Note that configuration descriptors include | 264 | byteswapped for you. Note that configuration descriptors include |
356 | descriptors for interfaces, altsettings, endpoints, and maybe additional | 265 | descriptors for interfaces, altsettings, endpoints, and maybe additional |
357 | class descriptors. | 266 | class descriptors. |
358 | 267 | ||
359 | *Perform USB operations* using *ioctl()* requests to make endpoint I/O | 268 | - *Perform USB operations* using *ioctl()* requests to make endpoint I/O |
360 | requests (synchronously or asynchronously) or manage the device. These | 269 | requests (synchronously or asynchronously) or manage the device. These |
361 | requests need the CAP_SYS_RAWIO capability, as well as filesystem | 270 | requests need the ``CAP_SYS_RAWIO`` capability, as well as filesystem |
362 | access permissions. Only one ioctl request can be made on one of these | 271 | access permissions. Only one ioctl request can be made on one of these |
363 | device files at a time. This means that if you are synchronously reading | 272 | device files at a time. This means that if you are synchronously reading |
364 | an endpoint from one thread, you won't be able to write to a different | 273 | an endpoint from one thread, you won't be able to write to a different |
365 | endpoint from another thread until the read completes. This works for | 274 | endpoint from another thread until the read completes. This works for |
366 | *half duplex* protocols, but otherwise you'd use asynchronous i/o | 275 | *half duplex* protocols, but otherwise you'd use asynchronous i/o |
367 | requests. | 276 | requests. |
277 | |||
278 | Each connected USB device has one file. The ``BBB`` indicates the bus | ||
279 | number. The ``DDD`` indicates the device address on that bus. Both | ||
280 | of these numbers are assigned sequentially, and can be reused, so | ||
281 | you can't rely on them for stable access to devices. For example, | ||
282 | it's relatively common for devices to re-enumerate while they are | ||
283 | still connected (perhaps someone jostled their power supply, hub, | ||
284 | or USB cable), so a device might be ``002/027`` when you first connect | ||
285 | it and ``002/048`` sometime later. | ||
286 | |||
287 | These files can be read as binary data. The binary data consists | ||
288 | of first the device descriptor, then the descriptors for each | ||
289 | configuration of the device. Multi-byte fields in the device descriptor | ||
290 | are converted to host endianness by the kernel. The configuration | ||
291 | descriptors are in bus endian format! The configuration descriptor | ||
292 | are wTotalLength bytes apart. If a device returns less configuration | ||
293 | descriptor data than indicated by wTotalLength there will be a hole in | ||
294 | the file for the missing bytes. This information is also shown | ||
295 | in text form by the ``/sys/kernel/debug/usb/devices`` file, described later. | ||
296 | |||
297 | These files may also be used to write user-level drivers for the USB | ||
298 | devices. You would open the ``/dev/bus/usb/BBB/DDD`` file read/write, | ||
299 | read its descriptors to make sure it's the device you expect, and then | ||
300 | bind to an interface (or perhaps several) using an ioctl call. You | ||
301 | would issue more ioctls to the device to communicate to it using | ||
302 | control, bulk, or other kinds of USB transfers. The IOCTLs are | ||
303 | listed in the ``<linux/usbdevice_fs.h>`` file, and at this writing the | ||
304 | source code (``linux/drivers/usb/core/devio.c``) is the primary reference | ||
305 | for how to access devices through those files. | ||
306 | |||
307 | Note that since by default these ``BBB/DDD`` files are writable only by | ||
308 | root, only root can write such user mode drivers. You can selectively | ||
309 | grant read/write permissions to other users by using ``chmod``. Also, | ||
310 | usbfs mount options such as ``devmode=0666`` may be helpful. | ||
311 | |||
368 | 312 | ||
369 | Life Cycle of User Mode Drivers | 313 | Life Cycle of User Mode Drivers |
370 | ------------------------------- | 314 | ------------------------------- |
@@ -372,7 +316,7 @@ Life Cycle of User Mode Drivers | |||
372 | Such a driver first needs to find a device file for a device it knows | 316 | Such a driver first needs to find a device file for a device it knows |
373 | how to handle. Maybe it was told about it because a ``/sbin/hotplug`` | 317 | how to handle. Maybe it was told about it because a ``/sbin/hotplug`` |
374 | event handling agent chose that driver to handle the new device. Or | 318 | event handling agent chose that driver to handle the new device. Or |
375 | maybe it's an application that scans all the /proc/bus/usb device files, | 319 | maybe it's an application that scans all the ``/dev/bus/usb`` device files, |
376 | and ignores most devices. In either case, it should :c:func:`read()` | 320 | and ignores most devices. In either case, it should :c:func:`read()` |
377 | all the descriptors from the device file, and check them against what it | 321 | all the descriptors from the device file, and check them against what it |
378 | knows how to handle. It might just reject everything except a particular | 322 | knows how to handle. It might just reject everything except a particular |
@@ -407,9 +351,7 @@ The ioctl() Requests | |||
407 | -------------------- | 351 | -------------------- |
408 | 352 | ||
409 | To use these ioctls, you need to include the following headers in your | 353 | To use these ioctls, you need to include the following headers in your |
410 | userspace program: | 354 | userspace program:: |
411 | |||
412 | :: | ||
413 | 355 | ||
414 | #include <linux/usb.h> | 356 | #include <linux/usb.h> |
415 | #include <linux/usbdevice_fs.h> | 357 | #include <linux/usbdevice_fs.h> |
@@ -422,8 +364,8 @@ header. | |||
422 | Unless noted otherwise, the ioctl requests described here will update | 364 | Unless noted otherwise, the ioctl requests described here will update |
423 | the modification time on the usbfs file to which they are applied | 365 | the modification time on the usbfs file to which they are applied |
424 | (unless they fail). A return of zero indicates success; otherwise, a | 366 | (unless they fail). A return of zero indicates success; otherwise, a |
425 | standard USB error code is returned. (These are documented in | 367 | standard USB error code is returned (These are documented in |
426 | ``Documentation/usb/error-codes.txt`` in your kernel sources.) | 368 | :ref:`usb-error-codes`). |
427 | 369 | ||
428 | Each of these files multiplexes access to several I/O streams, one per | 370 | Each of these files multiplexes access to several I/O streams, one per |
429 | endpoint. Each device has one control endpoint (endpoint zero) which | 371 | endpoint. Each device has one control endpoint (endpoint zero) which |
@@ -458,14 +400,12 @@ USBDEVFS_CLAIMINTERFACE | |||
458 | 400 | ||
459 | USBDEVFS_CONNECTINFO | 401 | USBDEVFS_CONNECTINFO |
460 | Says whether the device is lowspeed. The ioctl parameter points to a | 402 | Says whether the device is lowspeed. The ioctl parameter points to a |
461 | structure like this: | 403 | structure like this:: |
462 | |||
463 | :: | ||
464 | 404 | ||
465 | struct usbdevfs_connectinfo { | 405 | struct usbdevfs_connectinfo { |
466 | unsigned int devnum; | 406 | unsigned int devnum; |
467 | unsigned char slow; | 407 | unsigned char slow; |
468 | }; | 408 | }; |
469 | 409 | ||
470 | File modification time is not updated by this request. | 410 | File modification time is not updated by this request. |
471 | 411 | ||
@@ -477,45 +417,41 @@ USBDEVFS_CONNECTINFO | |||
477 | USBDEVFS_GETDRIVER | 417 | USBDEVFS_GETDRIVER |
478 | Returns the name of the kernel driver bound to a given interface (a | 418 | Returns the name of the kernel driver bound to a given interface (a |
479 | string). Parameter is a pointer to this structure, which is | 419 | string). Parameter is a pointer to this structure, which is |
480 | modified: | 420 | modified:: |
481 | 421 | ||
482 | :: | 422 | struct usbdevfs_getdriver { |
483 | 423 | unsigned int interface; | |
484 | struct usbdevfs_getdriver { | 424 | char driver[USBDEVFS_MAXDRIVERNAME + 1]; |
485 | unsigned int interface; | 425 | }; |
486 | char driver[USBDEVFS_MAXDRIVERNAME + 1]; | ||
487 | }; | ||
488 | 426 | ||
489 | File modification time is not updated by this request. | 427 | File modification time is not updated by this request. |
490 | 428 | ||
491 | USBDEVFS_IOCTL | 429 | USBDEVFS_IOCTL |
492 | Passes a request from userspace through to a kernel driver that has | 430 | Passes a request from userspace through to a kernel driver that has |
493 | an ioctl entry in the *struct usb_driver* it registered. | 431 | an ioctl entry in the *struct usb_driver* it registered:: |
494 | 432 | ||
495 | :: | 433 | struct usbdevfs_ioctl { |
496 | 434 | int ifno; | |
497 | struct usbdevfs_ioctl { | 435 | int ioctl_code; |
498 | int ifno; | 436 | void *data; |
499 | int ioctl_code; | 437 | }; |
500 | void *data; | 438 | |
501 | }; | 439 | /* user mode call looks like this. |
502 | 440 | * 'request' becomes the driver->ioctl() 'code' parameter. | |
503 | /* user mode call looks like this. | 441 | * the size of 'param' is encoded in 'request', and that data |
504 | * 'request' becomes the driver->ioctl() 'code' parameter. | 442 | * is copied to or from the driver->ioctl() 'buf' parameter. |
505 | * the size of 'param' is encoded in 'request', and that data | 443 | */ |
506 | * is copied to or from the driver->ioctl() 'buf' parameter. | 444 | static int |
507 | */ | 445 | usbdev_ioctl (int fd, int ifno, unsigned request, void *param) |
508 | static int | 446 | { |
509 | usbdev_ioctl (int fd, int ifno, unsigned request, void *param) | 447 | struct usbdevfs_ioctl wrapper; |
510 | { | 448 | |
511 | struct usbdevfs_ioctl wrapper; | 449 | wrapper.ifno = ifno; |
512 | 450 | wrapper.ioctl_code = request; | |
513 | wrapper.ifno = ifno; | 451 | wrapper.data = param; |
514 | wrapper.ioctl_code = request; | 452 | |
515 | wrapper.data = param; | 453 | return ioctl (fd, USBDEVFS_IOCTL, &wrapper); |
516 | 454 | } | |
517 | return ioctl (fd, USBDEVFS_IOCTL, &wrapper); | ||
518 | } | ||
519 | 455 | ||
520 | File modification time is not updated by this request. | 456 | File modification time is not updated by this request. |
521 | 457 | ||
@@ -534,11 +470,11 @@ USBDEVFS_RELEASEINTERFACE | |||
534 | the number of the interface (bInterfaceNumber from descriptor); File | 470 | the number of the interface (bInterfaceNumber from descriptor); File |
535 | modification time is not updated by this request. | 471 | modification time is not updated by this request. |
536 | 472 | ||
537 | **Warning** | 473 | .. warning:: |
538 | 474 | ||
539 | *No security check is made to ensure that the task which made | 475 | *No security check is made to ensure that the task which made |
540 | the claim is the one which is releasing it. This means that user | 476 | the claim is the one which is releasing it. This means that user |
541 | mode driver may interfere other ones.* | 477 | mode driver may interfere other ones.* |
542 | 478 | ||
543 | USBDEVFS_RESETEP | 479 | USBDEVFS_RESETEP |
544 | Resets the data toggle value for an endpoint (bulk or interrupt) to | 480 | Resets the data toggle value for an endpoint (bulk or interrupt) to |
@@ -546,13 +482,13 @@ USBDEVFS_RESETEP | |||
546 | as identified in the endpoint descriptor), with USB_DIR_IN added | 482 | as identified in the endpoint descriptor), with USB_DIR_IN added |
547 | if the device's endpoint sends data to the host. | 483 | if the device's endpoint sends data to the host. |
548 | 484 | ||
549 | **Warning** | 485 | .. Warning:: |
550 | 486 | ||
551 | *Avoid using this request. It should probably be removed.* Using | 487 | *Avoid using this request. It should probably be removed.* Using |
552 | it typically means the device and driver will lose toggle | 488 | it typically means the device and driver will lose toggle |
553 | synchronization. If you really lost synchronization, you likely | 489 | synchronization. If you really lost synchronization, you likely |
554 | need to completely handshake with the device, using a request | 490 | need to completely handshake with the device, using a request |
555 | like CLEAR_HALT or SET_INTERFACE. | 491 | like CLEAR_HALT or SET_INTERFACE. |
556 | 492 | ||
557 | USBDEVFS_DROP_PRIVILEGES | 493 | USBDEVFS_DROP_PRIVILEGES |
558 | This is used to relinquish the ability to do certain operations | 494 | This is used to relinquish the ability to do certain operations |
@@ -574,21 +510,19 @@ a time. | |||
574 | 510 | ||
575 | USBDEVFS_BULK | 511 | USBDEVFS_BULK |
576 | Issues a bulk read or write request to the device. The ioctl | 512 | Issues a bulk read or write request to the device. The ioctl |
577 | parameter is a pointer to this structure: | 513 | parameter is a pointer to this structure:: |
578 | |||
579 | :: | ||
580 | 514 | ||
581 | struct usbdevfs_bulktransfer { | 515 | struct usbdevfs_bulktransfer { |
582 | unsigned int ep; | 516 | unsigned int ep; |
583 | unsigned int len; | 517 | unsigned int len; |
584 | unsigned int timeout; /* in milliseconds */ | 518 | unsigned int timeout; /* in milliseconds */ |
585 | void *data; | 519 | void *data; |
586 | }; | 520 | }; |
587 | 521 | ||
588 | The "ep" value identifies a bulk endpoint number (1 to 15, as | 522 | The ``ep`` value identifies a bulk endpoint number (1 to 15, as |
589 | identified in an endpoint descriptor), masked with USB_DIR_IN when | 523 | identified in an endpoint descriptor), masked with USB_DIR_IN when |
590 | referring to an endpoint which sends data to the host from the | 524 | referring to an endpoint which sends data to the host from the |
591 | device. The length of the data buffer is identified by "len"; Recent | 525 | device. The length of the data buffer is identified by ``len``; Recent |
592 | kernels support requests up to about 128KBytes. *FIXME say how read | 526 | kernels support requests up to about 128KBytes. *FIXME say how read |
593 | length is returned, and how short reads are handled.*. | 527 | length is returned, and how short reads are handled.*. |
594 | 528 | ||
@@ -600,31 +534,29 @@ USBDEVFS_CLEAR_HALT | |||
600 | which sends data to the host from the device. | 534 | which sends data to the host from the device. |
601 | 535 | ||
602 | Use this on bulk or interrupt endpoints which have stalled, | 536 | Use this on bulk or interrupt endpoints which have stalled, |
603 | returning *-EPIPE* status to a data transfer request. Do not issue | 537 | returning ``-EPIPE`` status to a data transfer request. Do not issue |
604 | the control request directly, since that could invalidate the host's | 538 | the control request directly, since that could invalidate the host's |
605 | record of the data toggle. | 539 | record of the data toggle. |
606 | 540 | ||
607 | USBDEVFS_CONTROL | 541 | USBDEVFS_CONTROL |
608 | Issues a control request to the device. The ioctl parameter points | 542 | Issues a control request to the device. The ioctl parameter points |
609 | to a structure like this: | 543 | to a structure like this:: |
610 | 544 | ||
611 | :: | 545 | struct usbdevfs_ctrltransfer { |
612 | 546 | __u8 bRequestType; | |
613 | struct usbdevfs_ctrltransfer { | 547 | __u8 bRequest; |
614 | __u8 bRequestType; | 548 | __u16 wValue; |
615 | __u8 bRequest; | 549 | __u16 wIndex; |
616 | __u16 wValue; | 550 | __u16 wLength; |
617 | __u16 wIndex; | 551 | __u32 timeout; /* in milliseconds */ |
618 | __u16 wLength; | 552 | void *data; |
619 | __u32 timeout; /* in milliseconds */ | 553 | }; |
620 | void *data; | ||
621 | }; | ||
622 | 554 | ||
623 | The first eight bytes of this structure are the contents of the | 555 | The first eight bytes of this structure are the contents of the |
624 | SETUP packet to be sent to the device; see the USB 2.0 specification | 556 | SETUP packet to be sent to the device; see the USB 2.0 specification |
625 | for details. The bRequestType value is composed by combining a | 557 | for details. The bRequestType value is composed by combining a |
626 | USB_TYPE_\* value, a USB_DIR_\* value, and a USB_RECIP_\* | 558 | ``USB_TYPE_*`` value, a ``USB_DIR_*`` value, and a ``USB_RECIP_*`` |
627 | value (from *<linux/usb.h>*). If wLength is nonzero, it describes | 559 | value (from ``linux/usb.h``). If wLength is nonzero, it describes |
628 | the length of the data buffer, which is either written to the device | 560 | the length of the data buffer, which is either written to the device |
629 | (USB_DIR_OUT) or read from the device (USB_DIR_IN). | 561 | (USB_DIR_OUT) or read from the device (USB_DIR_IN). |
630 | 562 | ||
@@ -638,22 +570,20 @@ USBDEVFS_RESET | |||
638 | the reset, this rebinds all device interfaces. File modification | 570 | the reset, this rebinds all device interfaces. File modification |
639 | time is not updated by this request. | 571 | time is not updated by this request. |
640 | 572 | ||
641 | **Warning** | 573 | .. warning:: |
642 | 574 | ||
643 | *Avoid using this call* until some usbcore bugs get fixed, since | 575 | *Avoid using this call* until some usbcore bugs get fixed, since |
644 | it does not fully synchronize device, interface, and driver (not | 576 | it does not fully synchronize device, interface, and driver (not |
645 | just usbfs) state. | 577 | just usbfs) state. |
646 | 578 | ||
647 | USBDEVFS_SETINTERFACE | 579 | USBDEVFS_SETINTERFACE |
648 | Sets the alternate setting for an interface. The ioctl parameter is | 580 | Sets the alternate setting for an interface. The ioctl parameter is |
649 | a pointer to a structure like this: | 581 | a pointer to a structure like this:: |
650 | 582 | ||
651 | :: | 583 | struct usbdevfs_setinterface { |
652 | 584 | unsigned int interface; | |
653 | struct usbdevfs_setinterface { | 585 | unsigned int altsetting; |
654 | unsigned int interface; | 586 | }; |
655 | unsigned int altsetting; | ||
656 | }; | ||
657 | 587 | ||
658 | File modification time is not updated by this request. | 588 | File modification time is not updated by this request. |
659 | 589 | ||
@@ -669,11 +599,11 @@ USBDEVFS_SETCONFIGURATION | |||
669 | configuration (bConfigurationValue from descriptor). File | 599 | configuration (bConfigurationValue from descriptor). File |
670 | modification time is not updated by this request. | 600 | modification time is not updated by this request. |
671 | 601 | ||
672 | **Warning** | 602 | .. warning:: |
673 | 603 | ||
674 | *Avoid using this call* until some usbcore bugs get fixed, since | 604 | *Avoid using this call* until some usbcore bugs get fixed, since |
675 | it does not fully synchronize device, interface, and driver (not | 605 | it does not fully synchronize device, interface, and driver (not |
676 | just usbfs) state. | 606 | just usbfs) state. |
677 | 607 | ||
678 | Asynchronous I/O Support | 608 | Asynchronous I/O Support |
679 | ~~~~~~~~~~~~~~~~~~~~~~~~ | 609 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
@@ -688,7 +618,7 @@ the blocking is separate. | |||
688 | 618 | ||
689 | These requests are packaged into a structure that resembles the URB used | 619 | These requests are packaged into a structure that resembles the URB used |
690 | by kernel device drivers. (No POSIX Async I/O support here, sorry.) It | 620 | by kernel device drivers. (No POSIX Async I/O support here, sorry.) It |
691 | identifies the endpoint type (USBDEVFS_URB_TYPE_\*), endpoint | 621 | identifies the endpoint type (``USBDEVFS_URB_TYPE_*``), endpoint |
692 | (number, masked with USB_DIR_IN as appropriate), buffer and length, | 622 | (number, masked with USB_DIR_IN as appropriate), buffer and length, |
693 | and a user "context" value serving to uniquely identify each request. | 623 | and a user "context" value serving to uniquely identify each request. |
694 | (It's usually a pointer to per-request data.) Flags can modify requests | 624 | (It's usually a pointer to per-request data.) Flags can modify requests |
@@ -702,30 +632,28 @@ When usbfs returns these urbs, the status value is updated, and the | |||
702 | buffer may have been modified. Except for isochronous transfers, the | 632 | buffer may have been modified. Except for isochronous transfers, the |
703 | actual_length is updated to say how many bytes were transferred; if the | 633 | actual_length is updated to say how many bytes were transferred; if the |
704 | USBDEVFS_URB_DISABLE_SPD flag is set ("short packets are not OK"), if | 634 | USBDEVFS_URB_DISABLE_SPD flag is set ("short packets are not OK"), if |
705 | fewer bytes were read than were requested then you get an error report. | 635 | fewer bytes were read than were requested then you get an error report:: |
706 | |||
707 | :: | ||
708 | 636 | ||
709 | struct usbdevfs_iso_packet_desc { | 637 | struct usbdevfs_iso_packet_desc { |
710 | unsigned int length; | 638 | unsigned int length; |
711 | unsigned int actual_length; | 639 | unsigned int actual_length; |
712 | unsigned int status; | 640 | unsigned int status; |
713 | }; | 641 | }; |
714 | 642 | ||
715 | struct usbdevfs_urb { | 643 | struct usbdevfs_urb { |
716 | unsigned char type; | 644 | unsigned char type; |
717 | unsigned char endpoint; | 645 | unsigned char endpoint; |
718 | int status; | 646 | int status; |
719 | unsigned int flags; | 647 | unsigned int flags; |
720 | void *buffer; | 648 | void *buffer; |
721 | int buffer_length; | 649 | int buffer_length; |
722 | int actual_length; | 650 | int actual_length; |
723 | int start_frame; | 651 | int start_frame; |
724 | int number_of_packets; | 652 | int number_of_packets; |
725 | int error_count; | 653 | int error_count; |
726 | unsigned int signr; | 654 | unsigned int signr; |
727 | void *usercontext; | 655 | void *usercontext; |
728 | struct usbdevfs_iso_packet_desc iso_frame_desc[]; | 656 | struct usbdevfs_iso_packet_desc iso_frame_desc[]; |
729 | }; | 657 | }; |
730 | 658 | ||
731 | For these asynchronous requests, the file modification time reflects | 659 | For these asynchronous requests, the file modification time reflects |
@@ -746,3 +674,374 @@ USBDEVFS_REAPURBNDELAY | |||
746 | 674 | ||
747 | USBDEVFS_SUBMITURB | 675 | USBDEVFS_SUBMITURB |
748 | *TBS* | 676 | *TBS* |
677 | |||
678 | The USB devices | ||
679 | =============== | ||
680 | |||
681 | The USB devices are now exported via debugfs: | ||
682 | |||
683 | - ``/sys/kernel/debug/usb/devices`` ... a text file showing each of the USB | ||
684 | devices on known to the kernel, and their configuration descriptors. | ||
685 | You can also poll() this to learn about new devices. | ||
686 | |||
687 | /sys/kernel/debug/usb/devices | ||
688 | ----------------------------- | ||
689 | |||
690 | This file is handy for status viewing tools in user mode, which can scan | ||
691 | the text format and ignore most of it. More detailed device status | ||
692 | (including class and vendor status) is available from device-specific | ||
693 | files. For information about the current format of this file, see the | ||
694 | ``Documentation/usb/proc_usb_info.txt`` file in your Linux kernel | ||
695 | sources. | ||
696 | |||
697 | This file, in combination with the poll() system call, can also be used | ||
698 | to detect when devices are added or removed:: | ||
699 | |||
700 | int fd; | ||
701 | struct pollfd pfd; | ||
702 | |||
703 | fd = open("/sys/kernel/debug/usb/devices", O_RDONLY); | ||
704 | pfd = { fd, POLLIN, 0 }; | ||
705 | for (;;) { | ||
706 | /* The first time through, this call will return immediately. */ | ||
707 | poll(&pfd, 1, -1); | ||
708 | |||
709 | /* To see what's changed, compare the file's previous and current | ||
710 | contents or scan the filesystem. (Scanning is more precise.) */ | ||
711 | } | ||
712 | |||
713 | Note that this behavior is intended to be used for informational and | ||
714 | debug purposes. It would be more appropriate to use programs such as | ||
715 | udev or HAL to initialize a device or start a user-mode helper program, | ||
716 | for instance. | ||
717 | |||
718 | In this file, each device's output has multiple lines of ASCII output. | ||
719 | |||
720 | I made it ASCII instead of binary on purpose, so that someone | ||
721 | can obtain some useful data from it without the use of an | ||
722 | auxiliary program. However, with an auxiliary program, the numbers | ||
723 | in the first 4 columns of each ``T:`` line (topology info: | ||
724 | Lev, Prnt, Port, Cnt) can be used to build a USB topology diagram. | ||
725 | |||
726 | Each line is tagged with a one-character ID for that line:: | ||
727 | |||
728 | T = Topology (etc.) | ||
729 | B = Bandwidth (applies only to USB host controllers, which are | ||
730 | virtualized as root hubs) | ||
731 | D = Device descriptor info. | ||
732 | P = Product ID info. (from Device descriptor, but they won't fit | ||
733 | together on one line) | ||
734 | S = String descriptors. | ||
735 | C = Configuration descriptor info. (* = active configuration) | ||
736 | I = Interface descriptor info. | ||
737 | E = Endpoint descriptor info. | ||
738 | |||
739 | /sys/kernel/debug/usb/devices output format | ||
740 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
741 | |||
742 | Legend:: | ||
743 | d = decimal number (may have leading spaces or 0's) | ||
744 | x = hexadecimal number (may have leading spaces or 0's) | ||
745 | s = string | ||
746 | |||
747 | |||
748 | |||
749 | Topology info | ||
750 | ^^^^^^^^^^^^^ | ||
751 | |||
752 | :: | ||
753 | |||
754 | T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=dddd MxCh=dd | ||
755 | | | | | | | | | |__MaxChildren | ||
756 | | | | | | | | |__Device Speed in Mbps | ||
757 | | | | | | | |__DeviceNumber | ||
758 | | | | | | |__Count of devices at this level | ||
759 | | | | | |__Connector/Port on Parent for this device | ||
760 | | | | |__Parent DeviceNumber | ||
761 | | | |__Level in topology for this bus | ||
762 | | |__Bus number | ||
763 | |__Topology info tag | ||
764 | |||
765 | Speed may be: | ||
766 | |||
767 | ======= ====================================================== | ||
768 | 1.5 Mbit/s for low speed USB | ||
769 | 12 Mbit/s for full speed USB | ||
770 | 480 Mbit/s for high speed USB (added for USB 2.0); | ||
771 | also used for Wireless USB, which has no fixed speed | ||
772 | 5000 Mbit/s for SuperSpeed USB (added for USB 3.0) | ||
773 | ======= ====================================================== | ||
774 | |||
775 | For reasons lost in the mists of time, the Port number is always | ||
776 | too low by 1. For example, a device plugged into port 4 will | ||
777 | show up with ``Port=03``. | ||
778 | |||
779 | Bandwidth info | ||
780 | ^^^^^^^^^^^^^^ | ||
781 | |||
782 | :: | ||
783 | |||
784 | B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd | ||
785 | | | | |__Number of isochronous requests | ||
786 | | | |__Number of interrupt requests | ||
787 | | |__Total Bandwidth allocated to this bus | ||
788 | |__Bandwidth info tag | ||
789 | |||
790 | Bandwidth allocation is an approximation of how much of one frame | ||
791 | (millisecond) is in use. It reflects only periodic transfers, which | ||
792 | are the only transfers that reserve bandwidth. Control and bulk | ||
793 | transfers use all other bandwidth, including reserved bandwidth that | ||
794 | is not used for transfers (such as for short packets). | ||
795 | |||
796 | The percentage is how much of the "reserved" bandwidth is scheduled by | ||
797 | those transfers. For a low or full speed bus (loosely, "USB 1.1"), | ||
798 | 90% of the bus bandwidth is reserved. For a high speed bus (loosely, | ||
799 | "USB 2.0") 80% is reserved. | ||
800 | |||
801 | |||
802 | Device descriptor info & Product ID info | ||
803 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
804 | |||
805 | :: | ||
806 | |||
807 | D: Ver=x.xx Cls=xx(s) Sub=xx Prot=xx MxPS=dd #Cfgs=dd | ||
808 | P: Vendor=xxxx ProdID=xxxx Rev=xx.xx | ||
809 | |||
810 | where:: | ||
811 | |||
812 | D: Ver=x.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd | ||
813 | | | | | | | |__NumberConfigurations | ||
814 | | | | | | |__MaxPacketSize of Default Endpoint | ||
815 | | | | | |__DeviceProtocol | ||
816 | | | | |__DeviceSubClass | ||
817 | | | |__DeviceClass | ||
818 | | |__Device USB version | ||
819 | |__Device info tag #1 | ||
820 | |||
821 | where:: | ||
822 | |||
823 | P: Vendor=xxxx ProdID=xxxx Rev=xx.xx | ||
824 | | | | |__Product revision number | ||
825 | | | |__Product ID code | ||
826 | | |__Vendor ID code | ||
827 | |__Device info tag #2 | ||
828 | |||
829 | |||
830 | String descriptor info | ||
831 | ^^^^^^^^^^^^^^^^^^^^^^ | ||
832 | :: | ||
833 | |||
834 | S: Manufacturer=ssss | ||
835 | | |__Manufacturer of this device as read from the device. | ||
836 | | For USB host controller drivers (virtual root hubs) this may | ||
837 | | be omitted, or (for newer drivers) will identify the kernel | ||
838 | | version and the driver which provides this hub emulation. | ||
839 | |__String info tag | ||
840 | |||
841 | S: Product=ssss | ||
842 | | |__Product description of this device as read from the device. | ||
843 | | For older USB host controller drivers (virtual root hubs) this | ||
844 | | indicates the driver; for newer ones, it's a product (and vendor) | ||
845 | | description that often comes from the kernel's PCI ID database. | ||
846 | |__String info tag | ||
847 | |||
848 | S: SerialNumber=ssss | ||
849 | | |__Serial Number of this device as read from the device. | ||
850 | | For USB host controller drivers (virtual root hubs) this is | ||
851 | | some unique ID, normally a bus ID (address or slot name) that | ||
852 | | can't be shared with any other device. | ||
853 | |__String info tag | ||
854 | |||
855 | |||
856 | |||
857 | Configuration descriptor info | ||
858 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
859 | :: | ||
860 | |||
861 | C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA | ||
862 | | | | | | |__MaxPower in mA | ||
863 | | | | | |__Attributes | ||
864 | | | | |__ConfiguratioNumber | ||
865 | | | |__NumberOfInterfaces | ||
866 | | |__ "*" indicates the active configuration (others are " ") | ||
867 | |__Config info tag | ||
868 | |||
869 | USB devices may have multiple configurations, each of which act | ||
870 | rather differently. For example, a bus-powered configuration | ||
871 | might be much less capable than one that is self-powered. Only | ||
872 | one device configuration can be active at a time; most devices | ||
873 | have only one configuration. | ||
874 | |||
875 | Each configuration consists of one or more interfaces. Each | ||
876 | interface serves a distinct "function", which is typically bound | ||
877 | to a different USB device driver. One common example is a USB | ||
878 | speaker with an audio interface for playback, and a HID interface | ||
879 | for use with software volume control. | ||
880 | |||
881 | Interface descriptor info (can be multiple per Config) | ||
882 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
883 | :: | ||
884 | |||
885 | I:* If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss | ||
886 | | | | | | | | | |__Driver name | ||
887 | | | | | | | | | or "(none)" | ||
888 | | | | | | | | |__InterfaceProtocol | ||
889 | | | | | | | |__InterfaceSubClass | ||
890 | | | | | | |__InterfaceClass | ||
891 | | | | | |__NumberOfEndpoints | ||
892 | | | | |__AlternateSettingNumber | ||
893 | | | |__InterfaceNumber | ||
894 | | |__ "*" indicates the active altsetting (others are " ") | ||
895 | |__Interface info tag | ||
896 | |||
897 | A given interface may have one or more "alternate" settings. | ||
898 | For example, default settings may not use more than a small | ||
899 | amount of periodic bandwidth. To use significant fractions | ||
900 | of bus bandwidth, drivers must select a non-default altsetting. | ||
901 | |||
902 | Only one setting for an interface may be active at a time, and | ||
903 | only one driver may bind to an interface at a time. Most devices | ||
904 | have only one alternate setting per interface. | ||
905 | |||
906 | |||
907 | Endpoint descriptor info (can be multiple per Interface) | ||
908 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
909 | |||
910 | :: | ||
911 | |||
912 | E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=dddss | ||
913 | | | | | |__Interval (max) between transfers | ||
914 | | | | |__EndpointMaxPacketSize | ||
915 | | | |__Attributes(EndpointType) | ||
916 | | |__EndpointAddress(I=In,O=Out) | ||
917 | |__Endpoint info tag | ||
918 | |||
919 | The interval is nonzero for all periodic (interrupt or isochronous) | ||
920 | endpoints. For high speed endpoints the transfer interval may be | ||
921 | measured in microseconds rather than milliseconds. | ||
922 | |||
923 | For high speed periodic endpoints, the ``EndpointMaxPacketSize`` reflects | ||
924 | the per-microframe data transfer size. For "high bandwidth" | ||
925 | endpoints, that can reflect two or three packets (for up to | ||
926 | 3KBytes every 125 usec) per endpoint. | ||
927 | |||
928 | With the Linux-USB stack, periodic bandwidth reservations use the | ||
929 | transfer intervals and sizes provided by URBs, which can be less | ||
930 | than those found in endpoint descriptor. | ||
931 | |||
932 | Usage examples | ||
933 | ~~~~~~~~~~~~~~ | ||
934 | |||
935 | If a user or script is interested only in Topology info, for | ||
936 | example, use something like ``grep ^T: /sys/kernel/debug/usb/devices`` | ||
937 | for only the Topology lines. A command like | ||
938 | ``grep -i ^[tdp]: /sys/kernel/debug/usb/devices`` can be used to list | ||
939 | only the lines that begin with the characters in square brackets, | ||
940 | where the valid characters are TDPCIE. With a slightly more able | ||
941 | script, it can display any selected lines (for example, only T, D, | ||
942 | and P lines) and change their output format. (The ``procusb`` | ||
943 | Perl script is the beginning of this idea. It will list only | ||
944 | selected lines [selected from TBDPSCIE] or "All" lines from | ||
945 | ``/sys/kernel/debug/usb/devices``.) | ||
946 | |||
947 | The Topology lines can be used to generate a graphic/pictorial | ||
948 | of the USB devices on a system's root hub. (See more below | ||
949 | on how to do this.) | ||
950 | |||
951 | The Interface lines can be used to determine what driver is | ||
952 | being used for each device, and which altsetting it activated. | ||
953 | |||
954 | The Configuration lines could be used to list maximum power | ||
955 | (in milliamps) that a system's USB devices are using. | ||
956 | For example, ``grep ^C: /sys/kernel/debug/usb/devices``. | ||
957 | |||
958 | |||
959 | Here's an example, from a system which has a UHCI root hub, | ||
960 | an external hub connected to the root hub, and a mouse and | ||
961 | a serial converter connected to the external hub. | ||
962 | |||
963 | :: | ||
964 | |||
965 | T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 | ||
966 | B: Alloc= 28/900 us ( 3%), #Int= 2, #Iso= 0 | ||
967 | D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | ||
968 | P: Vendor=0000 ProdID=0000 Rev= 0.00 | ||
969 | S: Product=USB UHCI Root Hub | ||
970 | S: SerialNumber=dce0 | ||
971 | C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA | ||
972 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub | ||
973 | E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms | ||
974 | |||
975 | T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4 | ||
976 | D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | ||
977 | P: Vendor=0451 ProdID=1446 Rev= 1.00 | ||
978 | C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA | ||
979 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub | ||
980 | E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms | ||
981 | |||
982 | T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0 | ||
983 | D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | ||
984 | P: Vendor=04b4 ProdID=0001 Rev= 0.00 | ||
985 | C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA | ||
986 | I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse | ||
987 | E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms | ||
988 | |||
989 | T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0 | ||
990 | D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | ||
991 | P: Vendor=0565 ProdID=0001 Rev= 1.08 | ||
992 | S: Manufacturer=Peracom Networks, Inc. | ||
993 | S: Product=Peracom USB to Serial Converter | ||
994 | C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA | ||
995 | I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial | ||
996 | E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl= 16ms | ||
997 | E: Ad=01(O) Atr=02(Bulk) MxPS= 16 Ivl= 16ms | ||
998 | E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl= 8ms | ||
999 | |||
1000 | |||
1001 | Selecting only the ``T:`` and ``I:`` lines from this (for example, by using | ||
1002 | ``procusb ti``), we have | ||
1003 | |||
1004 | :: | ||
1005 | |||
1006 | T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 | ||
1007 | T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4 | ||
1008 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub | ||
1009 | T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0 | ||
1010 | I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse | ||
1011 | T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0 | ||
1012 | I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial | ||
1013 | |||
1014 | |||
1015 | Physically this looks like (or could be converted to):: | ||
1016 | |||
1017 | +------------------+ | ||
1018 | | PC/root_hub (12)| Dev# = 1 | ||
1019 | +------------------+ (nn) is Mbps. | ||
1020 | Level 0 | CN.0 | CN.1 | [CN = connector/port #] | ||
1021 | +------------------+ | ||
1022 | / | ||
1023 | / | ||
1024 | +-----------------------+ | ||
1025 | Level 1 | Dev#2: 4-port hub (12)| | ||
1026 | +-----------------------+ | ||
1027 | |CN.0 |CN.1 |CN.2 |CN.3 | | ||
1028 | +-----------------------+ | ||
1029 | \ \____________________ | ||
1030 | \_____ \ | ||
1031 | \ \ | ||
1032 | +--------------------+ +--------------------+ | ||
1033 | Level 2 | Dev# 3: mouse (1.5)| | Dev# 4: serial (12)| | ||
1034 | +--------------------+ +--------------------+ | ||
1035 | |||
1036 | |||
1037 | |||
1038 | Or, in a more tree-like structure (ports [Connectors] without | ||
1039 | connections could be omitted):: | ||
1040 | |||
1041 | PC: Dev# 1, root hub, 2 ports, 12 Mbps | ||
1042 | |_ CN.0: Dev# 2, hub, 4 ports, 12 Mbps | ||
1043 | |_ CN.0: Dev #3, mouse, 1.5 Mbps | ||
1044 | |_ CN.1: | ||
1045 | |_ CN.2: Dev #4, serial, 12 Mbps | ||
1046 | |_ CN.3: | ||
1047 | |_ CN.1: | ||
diff --git a/Documentation/driver-api/usb/writing_musb_glue_layer.rst b/Documentation/driver-api/usb/writing_musb_glue_layer.rst new file mode 100644 index 000000000000..e90e8fa95600 --- /dev/null +++ b/Documentation/driver-api/usb/writing_musb_glue_layer.rst | |||
@@ -0,0 +1,723 @@ | |||
1 | ========================= | ||
2 | Writing a MUSB Glue Layer | ||
3 | ========================= | ||
4 | |||
5 | :Author: Apelete Seketeli | ||
6 | |||
7 | Introduction | ||
8 | ============ | ||
9 | |||
10 | The Linux MUSB subsystem is part of the larger Linux USB subsystem. It | ||
11 | provides support for embedded USB Device Controllers (UDC) that do not | ||
12 | use Universal Host Controller Interface (UHCI) or Open Host Controller | ||
13 | Interface (OHCI). | ||
14 | |||
15 | Instead, these embedded UDC rely on the USB On-the-Go (OTG) | ||
16 | specification which they implement at least partially. The silicon | ||
17 | reference design used in most cases is the Multipoint USB Highspeed | ||
18 | Dual-Role Controller (MUSB HDRC) found in the Mentor Graphics Inventraâ„¢ | ||
19 | design. | ||
20 | |||
21 | As a self-taught exercise I have written an MUSB glue layer for the | ||
22 | Ingenic JZ4740 SoC, modelled after the many MUSB glue layers in the | ||
23 | kernel source tree. This layer can be found at | ||
24 | ``drivers/usb/musb/jz4740.c``. In this documentation I will walk through the | ||
25 | basics of the ``jz4740.c`` glue layer, explaining the different pieces and | ||
26 | what needs to be done in order to write your own device glue layer. | ||
27 | |||
28 | .. _musb-basics: | ||
29 | |||
30 | Linux MUSB Basics | ||
31 | ================= | ||
32 | |||
33 | To get started on the topic, please read USB On-the-Go Basics (see | ||
34 | Resources) which provides an introduction of USB OTG operation at the | ||
35 | hardware level. A couple of wiki pages by Texas Instruments and Analog | ||
36 | Devices also provide an overview of the Linux kernel MUSB configuration, | ||
37 | albeit focused on some specific devices provided by these companies. | ||
38 | Finally, getting acquainted with the USB specification at USB home page | ||
39 | may come in handy, with practical instance provided through the Writing | ||
40 | USB Device Drivers documentation (again, see Resources). | ||
41 | |||
42 | Linux USB stack is a layered architecture in which the MUSB controller | ||
43 | hardware sits at the lowest. The MUSB controller driver abstract the | ||
44 | MUSB controller hardware to the Linux USB stack:: | ||
45 | |||
46 | ------------------------ | ||
47 | | | <------- drivers/usb/gadget | ||
48 | | Linux USB Core Stack | <------- drivers/usb/host | ||
49 | | | <------- drivers/usb/core | ||
50 | ------------------------ | ||
51 | ⬠| ||
52 | -------------------------- | ||
53 | | | <------ drivers/usb/musb/musb_gadget.c | ||
54 | | MUSB Controller driver | <------ drivers/usb/musb/musb_host.c | ||
55 | | | <------ drivers/usb/musb/musb_core.c | ||
56 | -------------------------- | ||
57 | ⬠| ||
58 | --------------------------------- | ||
59 | | MUSB Platform Specific Driver | | ||
60 | | | <-- drivers/usb/musb/jz4740.c | ||
61 | | aka "Glue Layer" | | ||
62 | --------------------------------- | ||
63 | ⬠| ||
64 | --------------------------------- | ||
65 | | MUSB Controller Hardware | | ||
66 | --------------------------------- | ||
67 | |||
68 | As outlined above, the glue layer is actually the platform specific code | ||
69 | sitting in between the controller driver and the controller hardware. | ||
70 | |||
71 | Just like a Linux USB driver needs to register itself with the Linux USB | ||
72 | subsystem, the MUSB glue layer needs first to register itself with the | ||
73 | MUSB controller driver. This will allow the controller driver to know | ||
74 | about which device the glue layer supports and which functions to call | ||
75 | when a supported device is detected or released; remember we are talking | ||
76 | about an embedded controller chip here, so no insertion or removal at | ||
77 | run-time. | ||
78 | |||
79 | All of this information is passed to the MUSB controller driver through | ||
80 | a :c:type:`platform_driver` structure defined in the glue layer as:: | ||
81 | |||
82 | static struct platform_driver jz4740_driver = { | ||
83 | .probe = jz4740_probe, | ||
84 | .remove = jz4740_remove, | ||
85 | .driver = { | ||
86 | .name = "musb-jz4740", | ||
87 | }, | ||
88 | }; | ||
89 | |||
90 | The probe and remove function pointers are called when a matching device | ||
91 | is detected and, respectively, released. The name string describes the | ||
92 | device supported by this glue layer. In the current case it matches a | ||
93 | platform_device structure declared in ``arch/mips/jz4740/platform.c``. Note | ||
94 | that we are not using device tree bindings here. | ||
95 | |||
96 | In order to register itself to the controller driver, the glue layer | ||
97 | goes through a few steps, basically allocating the controller hardware | ||
98 | resources and initialising a couple of circuits. To do so, it needs to | ||
99 | keep track of the information used throughout these steps. This is done | ||
100 | by defining a private ``jz4740_glue`` structure:: | ||
101 | |||
102 | struct jz4740_glue { | ||
103 | struct device *dev; | ||
104 | struct platform_device *musb; | ||
105 | struct clk *clk; | ||
106 | }; | ||
107 | |||
108 | |||
109 | The dev and musb members are both device structure variables. The first | ||
110 | one holds generic information about the device, since it's the basic | ||
111 | device structure, and the latter holds information more closely related | ||
112 | to the subsystem the device is registered to. The clk variable keeps | ||
113 | information related to the device clock operation. | ||
114 | |||
115 | Let's go through the steps of the probe function that leads the glue | ||
116 | layer to register itself to the controller driver. | ||
117 | |||
118 | .. note:: | ||
119 | |||
120 | For the sake of readability each function will be split in logical | ||
121 | parts, each part being shown as if it was independent from the others. | ||
122 | |||
123 | .. code-block:: c | ||
124 | :emphasize-lines: 8,12,18 | ||
125 | |||
126 | static int jz4740_probe(struct platform_device *pdev) | ||
127 | { | ||
128 | struct platform_device *musb; | ||
129 | struct jz4740_glue *glue; | ||
130 | struct clk *clk; | ||
131 | int ret; | ||
132 | |||
133 | glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); | ||
134 | if (!glue) | ||
135 | return -ENOMEM; | ||
136 | |||
137 | musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); | ||
138 | if (!musb) { | ||
139 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | ||
140 | return -ENOMEM; | ||
141 | } | ||
142 | |||
143 | clk = devm_clk_get(&pdev->dev, "udc"); | ||
144 | if (IS_ERR(clk)) { | ||
145 | dev_err(&pdev->dev, "failed to get clock\n"); | ||
146 | ret = PTR_ERR(clk); | ||
147 | goto err_platform_device_put; | ||
148 | } | ||
149 | |||
150 | ret = clk_prepare_enable(clk); | ||
151 | if (ret) { | ||
152 | dev_err(&pdev->dev, "failed to enable clock\n"); | ||
153 | goto err_platform_device_put; | ||
154 | } | ||
155 | |||
156 | musb->dev.parent = &pdev->dev; | ||
157 | |||
158 | glue->dev = &pdev->dev; | ||
159 | glue->musb = musb; | ||
160 | glue->clk = clk; | ||
161 | |||
162 | return 0; | ||
163 | |||
164 | err_platform_device_put: | ||
165 | platform_device_put(musb); | ||
166 | return ret; | ||
167 | } | ||
168 | |||
169 | The first few lines of the probe function allocate and assign the glue, | ||
170 | musb and clk variables. The ``GFP_KERNEL`` flag (line 8) allows the | ||
171 | allocation process to sleep and wait for memory, thus being usable in a | ||
172 | locking situation. The ``PLATFORM_DEVID_AUTO`` flag (line 12) allows | ||
173 | automatic allocation and management of device IDs in order to avoid | ||
174 | device namespace collisions with explicit IDs. With :c:func:`devm_clk_get` | ||
175 | (line 18) the glue layer allocates the clock -- the ``devm_`` prefix | ||
176 | indicates that :c:func:`clk_get` is managed: it automatically frees the | ||
177 | allocated clock resource data when the device is released -- and enable | ||
178 | it. | ||
179 | |||
180 | |||
181 | |||
182 | Then comes the registration steps: | ||
183 | |||
184 | .. code-block:: c | ||
185 | :emphasize-lines: 3,5,7,9,16 | ||
186 | |||
187 | static int jz4740_probe(struct platform_device *pdev) | ||
188 | { | ||
189 | struct musb_hdrc_platform_data *pdata = &jz4740_musb_platform_data; | ||
190 | |||
191 | pdata->platform_ops = &jz4740_musb_ops; | ||
192 | |||
193 | platform_set_drvdata(pdev, glue); | ||
194 | |||
195 | ret = platform_device_add_resources(musb, pdev->resource, | ||
196 | pdev->num_resources); | ||
197 | if (ret) { | ||
198 | dev_err(&pdev->dev, "failed to add resources\n"); | ||
199 | goto err_clk_disable; | ||
200 | } | ||
201 | |||
202 | ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); | ||
203 | if (ret) { | ||
204 | dev_err(&pdev->dev, "failed to add platform_data\n"); | ||
205 | goto err_clk_disable; | ||
206 | } | ||
207 | |||
208 | return 0; | ||
209 | |||
210 | err_clk_disable: | ||
211 | clk_disable_unprepare(clk); | ||
212 | err_platform_device_put: | ||
213 | platform_device_put(musb); | ||
214 | return ret; | ||
215 | } | ||
216 | |||
217 | The first step is to pass the device data privately held by the glue | ||
218 | layer on to the controller driver through :c:func:`platform_set_drvdata` | ||
219 | (line 7). Next is passing on the device resources information, also privately | ||
220 | held at that point, through :c:func:`platform_device_add_resources` (line 9). | ||
221 | |||
222 | Finally comes passing on the platform specific data to the controller | ||
223 | driver (line 16). Platform data will be discussed in | ||
224 | :ref:`musb-dev-platform-data`, but here we are looking at the | ||
225 | ``platform_ops`` function pointer (line 5) in ``musb_hdrc_platform_data`` | ||
226 | structure (line 3). This function pointer allows the MUSB controller | ||
227 | driver to know which function to call for device operation:: | ||
228 | |||
229 | static const struct musb_platform_ops jz4740_musb_ops = { | ||
230 | .init = jz4740_musb_init, | ||
231 | .exit = jz4740_musb_exit, | ||
232 | }; | ||
233 | |||
234 | Here we have the minimal case where only init and exit functions are | ||
235 | called by the controller driver when needed. Fact is the JZ4740 MUSB | ||
236 | controller is a basic controller, lacking some features found in other | ||
237 | controllers, otherwise we may also have pointers to a few other | ||
238 | functions like a power management function or a function to switch | ||
239 | between OTG and non-OTG modes, for instance. | ||
240 | |||
241 | At that point of the registration process, the controller driver | ||
242 | actually calls the init function: | ||
243 | |||
244 | .. code-block:: c | ||
245 | :emphasize-lines: 12,14 | ||
246 | |||
247 | static int jz4740_musb_init(struct musb *musb) | ||
248 | { | ||
249 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | ||
250 | if (!musb->xceiv) { | ||
251 | pr_err("HS UDC: no transceiver configured\n"); | ||
252 | return -ENODEV; | ||
253 | } | ||
254 | |||
255 | /* Silicon does not implement ConfigData register. | ||
256 | * Set dyn_fifo to avoid reading EP config from hardware. | ||
257 | */ | ||
258 | musb->dyn_fifo = true; | ||
259 | |||
260 | musb->isr = jz4740_musb_interrupt; | ||
261 | |||
262 | return 0; | ||
263 | } | ||
264 | |||
265 | The goal of ``jz4740_musb_init()`` is to get hold of the transceiver | ||
266 | driver data of the MUSB controller hardware and pass it on to the MUSB | ||
267 | controller driver, as usual. The transceiver is the circuitry inside the | ||
268 | controller hardware responsible for sending/receiving the USB data. | ||
269 | Since it is an implementation of the physical layer of the OSI model, | ||
270 | the transceiver is also referred to as PHY. | ||
271 | |||
272 | Getting hold of the ``MUSB PHY`` driver data is done with ``usb_get_phy()`` | ||
273 | which returns a pointer to the structure containing the driver instance | ||
274 | data. The next couple of instructions (line 12 and 14) are used as a | ||
275 | quirk and to setup IRQ handling respectively. Quirks and IRQ handling | ||
276 | will be discussed later in :ref:`musb-dev-quirks` and | ||
277 | :ref:`musb-handling-irqs`\ :: | ||
278 | |||
279 | static int jz4740_musb_exit(struct musb *musb) | ||
280 | { | ||
281 | usb_put_phy(musb->xceiv); | ||
282 | |||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | Acting as the counterpart of init, the exit function releases the MUSB | ||
287 | PHY driver when the controller hardware itself is about to be released. | ||
288 | |||
289 | Again, note that init and exit are fairly simple in this case due to the | ||
290 | basic set of features of the JZ4740 controller hardware. When writing an | ||
291 | musb glue layer for a more complex controller hardware, you might need | ||
292 | to take care of more processing in those two functions. | ||
293 | |||
294 | Returning from the init function, the MUSB controller driver jumps back | ||
295 | into the probe function:: | ||
296 | |||
297 | static int jz4740_probe(struct platform_device *pdev) | ||
298 | { | ||
299 | ret = platform_device_add(musb); | ||
300 | if (ret) { | ||
301 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
302 | goto err_clk_disable; | ||
303 | } | ||
304 | |||
305 | return 0; | ||
306 | |||
307 | err_clk_disable: | ||
308 | clk_disable_unprepare(clk); | ||
309 | err_platform_device_put: | ||
310 | platform_device_put(musb); | ||
311 | return ret; | ||
312 | } | ||
313 | |||
314 | This is the last part of the device registration process where the glue | ||
315 | layer adds the controller hardware device to Linux kernel device | ||
316 | hierarchy: at this stage, all known information about the device is | ||
317 | passed on to the Linux USB core stack: | ||
318 | |||
319 | .. code-block:: c | ||
320 | :emphasize-lines: 5,6 | ||
321 | |||
322 | static int jz4740_remove(struct platform_device *pdev) | ||
323 | { | ||
324 | struct jz4740_glue *glue = platform_get_drvdata(pdev); | ||
325 | |||
326 | platform_device_unregister(glue->musb); | ||
327 | clk_disable_unprepare(glue->clk); | ||
328 | |||
329 | return 0; | ||
330 | } | ||
331 | |||
332 | Acting as the counterpart of probe, the remove function unregister the | ||
333 | MUSB controller hardware (line 5) and disable the clock (line 6), | ||
334 | allowing it to be gated. | ||
335 | |||
336 | .. _musb-handling-irqs: | ||
337 | |||
338 | Handling IRQs | ||
339 | ============= | ||
340 | |||
341 | Additionally to the MUSB controller hardware basic setup and | ||
342 | registration, the glue layer is also responsible for handling the IRQs: | ||
343 | |||
344 | .. code-block:: c | ||
345 | :emphasize-lines: 7,9-11,14,24 | ||
346 | |||
347 | static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) | ||
348 | { | ||
349 | unsigned long flags; | ||
350 | irqreturn_t retval = IRQ_NONE; | ||
351 | struct musb *musb = __hci; | ||
352 | |||
353 | spin_lock_irqsave(&musb->lock, flags); | ||
354 | |||
355 | musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); | ||
356 | musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); | ||
357 | musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); | ||
358 | |||
359 | /* | ||
360 | * The controller is gadget only, the state of the host mode IRQ bits is | ||
361 | * undefined. Mask them to make sure that the musb driver core will | ||
362 | * never see them set | ||
363 | */ | ||
364 | musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME | | ||
365 | MUSB_INTR_RESET | MUSB_INTR_SOF; | ||
366 | |||
367 | if (musb->int_usb || musb->int_tx || musb->int_rx) | ||
368 | retval = musb_interrupt(musb); | ||
369 | |||
370 | spin_unlock_irqrestore(&musb->lock, flags); | ||
371 | |||
372 | return retval; | ||
373 | } | ||
374 | |||
375 | Here the glue layer mostly has to read the relevant hardware registers | ||
376 | and pass their values on to the controller driver which will handle the | ||
377 | actual event that triggered the IRQ. | ||
378 | |||
379 | The interrupt handler critical section is protected by the | ||
380 | :c:func:`spin_lock_irqsave` and counterpart :c:func:`spin_unlock_irqrestore` | ||
381 | functions (line 7 and 24 respectively), which prevent the interrupt | ||
382 | handler code to be run by two different threads at the same time. | ||
383 | |||
384 | Then the relevant interrupt registers are read (line 9 to 11): | ||
385 | |||
386 | - ``MUSB_INTRUSB``: indicates which USB interrupts are currently active, | ||
387 | |||
388 | - ``MUSB_INTRTX``: indicates which of the interrupts for TX endpoints are | ||
389 | currently active, | ||
390 | |||
391 | - ``MUSB_INTRRX``: indicates which of the interrupts for TX endpoints are | ||
392 | currently active. | ||
393 | |||
394 | Note that :c:func:`musb_readb` is used to read 8-bit registers at most, while | ||
395 | :c:func:`musb_readw` allows us to read at most 16-bit registers. There are | ||
396 | other functions that can be used depending on the size of your device | ||
397 | registers. See ``musb_io.h`` for more information. | ||
398 | |||
399 | Instruction on line 18 is another quirk specific to the JZ4740 USB | ||
400 | device controller, which will be discussed later in :ref:`musb-dev-quirks`. | ||
401 | |||
402 | The glue layer still needs to register the IRQ handler though. Remember | ||
403 | the instruction on line 14 of the init function:: | ||
404 | |||
405 | static int jz4740_musb_init(struct musb *musb) | ||
406 | { | ||
407 | musb->isr = jz4740_musb_interrupt; | ||
408 | |||
409 | return 0; | ||
410 | } | ||
411 | |||
412 | This instruction sets a pointer to the glue layer IRQ handler function, | ||
413 | in order for the controller hardware to call the handler back when an | ||
414 | IRQ comes from the controller hardware. The interrupt handler is now | ||
415 | implemented and registered. | ||
416 | |||
417 | .. _musb-dev-platform-data: | ||
418 | |||
419 | Device Platform Data | ||
420 | ==================== | ||
421 | |||
422 | In order to write an MUSB glue layer, you need to have some data | ||
423 | describing the hardware capabilities of your controller hardware, which | ||
424 | is called the platform data. | ||
425 | |||
426 | Platform data is specific to your hardware, though it may cover a broad | ||
427 | range of devices, and is generally found somewhere in the ``arch/`` | ||
428 | directory, depending on your device architecture. | ||
429 | |||
430 | For instance, platform data for the JZ4740 SoC is found in | ||
431 | ``arch/mips/jz4740/platform.c``. In the ``platform.c`` file each device of the | ||
432 | JZ4740 SoC is described through a set of structures. | ||
433 | |||
434 | Here is the part of ``arch/mips/jz4740/platform.c`` that covers the USB | ||
435 | Device Controller (UDC): | ||
436 | |||
437 | .. code-block:: c | ||
438 | :emphasize-lines: 2,7,14-17,21,22,25,26,28,29 | ||
439 | |||
440 | /* USB Device Controller */ | ||
441 | struct platform_device jz4740_udc_xceiv_device = { | ||
442 | .name = "usb_phy_gen_xceiv", | ||
443 | .id = 0, | ||
444 | }; | ||
445 | |||
446 | static struct resource jz4740_udc_resources[] = { | ||
447 | [0] = { | ||
448 | .start = JZ4740_UDC_BASE_ADDR, | ||
449 | .end = JZ4740_UDC_BASE_ADDR + 0x10000 - 1, | ||
450 | .flags = IORESOURCE_MEM, | ||
451 | }, | ||
452 | [1] = { | ||
453 | .start = JZ4740_IRQ_UDC, | ||
454 | .end = JZ4740_IRQ_UDC, | ||
455 | .flags = IORESOURCE_IRQ, | ||
456 | .name = "mc", | ||
457 | }, | ||
458 | }; | ||
459 | |||
460 | struct platform_device jz4740_udc_device = { | ||
461 | .name = "musb-jz4740", | ||
462 | .id = -1, | ||
463 | .dev = { | ||
464 | .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask, | ||
465 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
466 | }, | ||
467 | .num_resources = ARRAY_SIZE(jz4740_udc_resources), | ||
468 | .resource = jz4740_udc_resources, | ||
469 | }; | ||
470 | |||
471 | The ``jz4740_udc_xceiv_device`` platform device structure (line 2) | ||
472 | describes the UDC transceiver with a name and id number. | ||
473 | |||
474 | At the time of this writing, note that ``usb_phy_gen_xceiv`` is the | ||
475 | specific name to be used for all transceivers that are either built-in | ||
476 | with reference USB IP or autonomous and doesn't require any PHY | ||
477 | programming. You will need to set ``CONFIG_NOP_USB_XCEIV=y`` in the | ||
478 | kernel configuration to make use of the corresponding transceiver | ||
479 | driver. The id field could be set to -1 (equivalent to | ||
480 | ``PLATFORM_DEVID_NONE``), -2 (equivalent to ``PLATFORM_DEVID_AUTO``) or | ||
481 | start with 0 for the first device of this kind if we want a specific id | ||
482 | number. | ||
483 | |||
484 | The ``jz4740_udc_resources`` resource structure (line 7) defines the UDC | ||
485 | registers base addresses. | ||
486 | |||
487 | The first array (line 9 to 11) defines the UDC registers base memory | ||
488 | addresses: start points to the first register memory address, end points | ||
489 | to the last register memory address and the flags member defines the | ||
490 | type of resource we are dealing with. So ``IORESOURCE_MEM`` is used to | ||
491 | define the registers memory addresses. The second array (line 14 to 17) | ||
492 | defines the UDC IRQ registers addresses. Since there is only one IRQ | ||
493 | register available for the JZ4740 UDC, start and end point at the same | ||
494 | address. The ``IORESOURCE_IRQ`` flag tells that we are dealing with IRQ | ||
495 | resources, and the name ``mc`` is in fact hard-coded in the MUSB core in | ||
496 | order for the controller driver to retrieve this IRQ resource by | ||
497 | querying it by its name. | ||
498 | |||
499 | Finally, the ``jz4740_udc_device`` platform device structure (line 21) | ||
500 | describes the UDC itself. | ||
501 | |||
502 | The ``musb-jz4740`` name (line 22) defines the MUSB driver that is used | ||
503 | for this device; remember this is in fact the name that we used in the | ||
504 | ``jz4740_driver`` platform driver structure in :ref:`musb-basics`. | ||
505 | The id field (line 23) is set to -1 (equivalent to ``PLATFORM_DEVID_NONE``) | ||
506 | since we do not need an id for the device: the MUSB controller driver was | ||
507 | already set to allocate an automatic id in :ref:`musb-basics`. In the dev field | ||
508 | we care for DMA related information here. The ``dma_mask`` field (line 25) | ||
509 | defines the width of the DMA mask that is going to be used, and | ||
510 | ``coherent_dma_mask`` (line 26) has the same purpose but for the | ||
511 | ``alloc_coherent`` DMA mappings: in both cases we are using a 32 bits mask. | ||
512 | Then the resource field (line 29) is simply a pointer to the resource | ||
513 | structure defined before, while the ``num_resources`` field (line 28) keeps | ||
514 | track of the number of arrays defined in the resource structure (in this | ||
515 | case there were two resource arrays defined before). | ||
516 | |||
517 | With this quick overview of the UDC platform data at the ``arch/`` level now | ||
518 | done, let's get back to the MUSB glue layer specific platform data in | ||
519 | ``drivers/usb/musb/jz4740.c``: | ||
520 | |||
521 | .. code-block:: c | ||
522 | :emphasize-lines: 3,5,7-9,11 | ||
523 | |||
524 | static struct musb_hdrc_config jz4740_musb_config = { | ||
525 | /* Silicon does not implement USB OTG. */ | ||
526 | .multipoint = 0, | ||
527 | /* Max EPs scanned, driver will decide which EP can be used. */ | ||
528 | .num_eps = 4, | ||
529 | /* RAMbits needed to configure EPs from table */ | ||
530 | .ram_bits = 9, | ||
531 | .fifo_cfg = jz4740_musb_fifo_cfg, | ||
532 | .fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg), | ||
533 | }; | ||
534 | |||
535 | static struct musb_hdrc_platform_data jz4740_musb_platform_data = { | ||
536 | .mode = MUSB_PERIPHERAL, | ||
537 | .config = &jz4740_musb_config, | ||
538 | }; | ||
539 | |||
540 | First the glue layer configures some aspects of the controller driver | ||
541 | operation related to the controller hardware specifics. This is done | ||
542 | through the ``jz4740_musb_config`` :c:type:`musb_hdrc_config` structure. | ||
543 | |||
544 | Defining the OTG capability of the controller hardware, the multipoint | ||
545 | member (line 3) is set to 0 (equivalent to false) since the JZ4740 UDC | ||
546 | is not OTG compatible. Then ``num_eps`` (line 5) defines the number of USB | ||
547 | endpoints of the controller hardware, including endpoint 0: here we have | ||
548 | 3 endpoints + endpoint 0. Next is ``ram_bits`` (line 7) which is the width | ||
549 | of the RAM address bus for the MUSB controller hardware. This | ||
550 | information is needed when the controller driver cannot automatically | ||
551 | configure endpoints by reading the relevant controller hardware | ||
552 | registers. This issue will be discussed when we get to device quirks in | ||
553 | :ref:`musb-dev-quirks`. Last two fields (line 8 and 9) are also | ||
554 | about device quirks: ``fifo_cfg`` points to the USB endpoints configuration | ||
555 | table and ``fifo_cfg_size`` keeps track of the size of the number of | ||
556 | entries in that configuration table. More on that later in | ||
557 | :ref:`musb-dev-quirks`. | ||
558 | |||
559 | Then this configuration is embedded inside ``jz4740_musb_platform_data`` | ||
560 | :c:type:`musb_hdrc_platform_data` structure (line 11): config is a pointer to | ||
561 | the configuration structure itself, and mode tells the controller driver | ||
562 | if the controller hardware may be used as ``MUSB_HOST`` only, | ||
563 | ``MUSB_PERIPHERAL`` only or ``MUSB_OTG`` which is a dual mode. | ||
564 | |||
565 | Remember that ``jz4740_musb_platform_data`` is then used to convey | ||
566 | platform data information as we have seen in the probe function in | ||
567 | :ref:`musb-basics`. | ||
568 | |||
569 | .. _musb-dev-quirks: | ||
570 | |||
571 | Device Quirks | ||
572 | ============= | ||
573 | |||
574 | Completing the platform data specific to your device, you may also need | ||
575 | to write some code in the glue layer to work around some device specific | ||
576 | limitations. These quirks may be due to some hardware bugs, or simply be | ||
577 | the result of an incomplete implementation of the USB On-the-Go | ||
578 | specification. | ||
579 | |||
580 | The JZ4740 UDC exhibits such quirks, some of which we will discuss here | ||
581 | for the sake of insight even though these might not be found in the | ||
582 | controller hardware you are working on. | ||
583 | |||
584 | Let's get back to the init function first: | ||
585 | |||
586 | .. code-block:: c | ||
587 | :emphasize-lines: 12 | ||
588 | |||
589 | static int jz4740_musb_init(struct musb *musb) | ||
590 | { | ||
591 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | ||
592 | if (!musb->xceiv) { | ||
593 | pr_err("HS UDC: no transceiver configured\n"); | ||
594 | return -ENODEV; | ||
595 | } | ||
596 | |||
597 | /* Silicon does not implement ConfigData register. | ||
598 | * Set dyn_fifo to avoid reading EP config from hardware. | ||
599 | */ | ||
600 | musb->dyn_fifo = true; | ||
601 | |||
602 | musb->isr = jz4740_musb_interrupt; | ||
603 | |||
604 | return 0; | ||
605 | } | ||
606 | |||
607 | Instruction on line 12 helps the MUSB controller driver to work around | ||
608 | the fact that the controller hardware is missing registers that are used | ||
609 | for USB endpoints configuration. | ||
610 | |||
611 | Without these registers, the controller driver is unable to read the | ||
612 | endpoints configuration from the hardware, so we use line 12 instruction | ||
613 | to bypass reading the configuration from silicon, and rely on a | ||
614 | hard-coded table that describes the endpoints configuration instead:: | ||
615 | |||
616 | static struct musb_fifo_cfg jz4740_musb_fifo_cfg[] = { | ||
617 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, | ||
618 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, | ||
619 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, }, | ||
620 | }; | ||
621 | |||
622 | Looking at the configuration table above, we see that each endpoints is | ||
623 | described by three fields: ``hw_ep_num`` is the endpoint number, style is | ||
624 | its direction (either ``FIFO_TX`` for the controller driver to send packets | ||
625 | in the controller hardware, or ``FIFO_RX`` to receive packets from | ||
626 | hardware), and maxpacket defines the maximum size of each data packet | ||
627 | that can be transmitted over that endpoint. Reading from the table, the | ||
628 | controller driver knows that endpoint 1 can be used to send and receive | ||
629 | USB data packets of 512 bytes at once (this is in fact a bulk in/out | ||
630 | endpoint), and endpoint 2 can be used to send data packets of 64 bytes | ||
631 | at once (this is in fact an interrupt endpoint). | ||
632 | |||
633 | Note that there is no information about endpoint 0 here: that one is | ||
634 | implemented by default in every silicon design, with a predefined | ||
635 | configuration according to the USB specification. For more examples of | ||
636 | endpoint configuration tables, see ``musb_core.c``. | ||
637 | |||
638 | Let's now get back to the interrupt handler function: | ||
639 | |||
640 | .. code-block:: c | ||
641 | :emphasize-lines: 18-19 | ||
642 | |||
643 | static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) | ||
644 | { | ||
645 | unsigned long flags; | ||
646 | irqreturn_t retval = IRQ_NONE; | ||
647 | struct musb *musb = __hci; | ||
648 | |||
649 | spin_lock_irqsave(&musb->lock, flags); | ||
650 | |||
651 | musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); | ||
652 | musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); | ||
653 | musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); | ||
654 | |||
655 | /* | ||
656 | * The controller is gadget only, the state of the host mode IRQ bits is | ||
657 | * undefined. Mask them to make sure that the musb driver core will | ||
658 | * never see them set | ||
659 | */ | ||
660 | musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME | | ||
661 | MUSB_INTR_RESET | MUSB_INTR_SOF; | ||
662 | |||
663 | if (musb->int_usb || musb->int_tx || musb->int_rx) | ||
664 | retval = musb_interrupt(musb); | ||
665 | |||
666 | spin_unlock_irqrestore(&musb->lock, flags); | ||
667 | |||
668 | return retval; | ||
669 | } | ||
670 | |||
671 | Instruction on line 18 above is a way for the controller driver to work | ||
672 | around the fact that some interrupt bits used for USB host mode | ||
673 | operation are missing in the ``MUSB_INTRUSB`` register, thus left in an | ||
674 | undefined hardware state, since this MUSB controller hardware is used in | ||
675 | peripheral mode only. As a consequence, the glue layer masks these | ||
676 | missing bits out to avoid parasite interrupts by doing a logical AND | ||
677 | operation between the value read from ``MUSB_INTRUSB`` and the bits that | ||
678 | are actually implemented in the register. | ||
679 | |||
680 | These are only a couple of the quirks found in the JZ4740 USB device | ||
681 | controller. Some others were directly addressed in the MUSB core since | ||
682 | the fixes were generic enough to provide a better handling of the issues | ||
683 | for others controller hardware eventually. | ||
684 | |||
685 | Conclusion | ||
686 | ========== | ||
687 | |||
688 | Writing a Linux MUSB glue layer should be a more accessible task, as | ||
689 | this documentation tries to show the ins and outs of this exercise. | ||
690 | |||
691 | The JZ4740 USB device controller being fairly simple, I hope its glue | ||
692 | layer serves as a good example for the curious mind. Used with the | ||
693 | current MUSB glue layers, this documentation should provide enough | ||
694 | guidance to get started; should anything gets out of hand, the linux-usb | ||
695 | mailing list archive is another helpful resource to browse through. | ||
696 | |||
697 | Acknowledgements | ||
698 | ================ | ||
699 | |||
700 | Many thanks to Lars-Peter Clausen and Maarten ter Huurne for answering | ||
701 | my questions while I was writing the JZ4740 glue layer and for helping | ||
702 | me out getting the code in good shape. | ||
703 | |||
704 | I would also like to thank the Qi-Hardware community at large for its | ||
705 | cheerful guidance and support. | ||
706 | |||
707 | Resources | ||
708 | ========= | ||
709 | |||
710 | USB Home Page: http://www.usb.org | ||
711 | |||
712 | linux-usb Mailing List Archives: http://marc.info/?l=linux-usb | ||
713 | |||
714 | USB On-the-Go Basics: | ||
715 | http://www.maximintegrated.com/app-notes/index.mvp/id/1822 | ||
716 | |||
717 | :ref:`Writing USB Device Drivers <writing-usb-driver>` | ||
718 | |||
719 | Texas Instruments USB Configuration Wiki Page: | ||
720 | http://processors.wiki.ti.com/index.php/Usbgeneralpage | ||
721 | |||
722 | Analog Devices Blackfin MUSB Configuration: | ||
723 | http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:musb | ||
diff --git a/Documentation/driver-api/usb/writing_usb_driver.rst b/Documentation/driver-api/usb/writing_usb_driver.rst new file mode 100644 index 000000000000..69f077dcdb78 --- /dev/null +++ b/Documentation/driver-api/usb/writing_usb_driver.rst | |||
@@ -0,0 +1,326 @@ | |||
1 | .. _writing-usb-driver: | ||
2 | |||
3 | ========================== | ||
4 | Writing USB Device Drivers | ||
5 | ========================== | ||
6 | |||
7 | :Author: Greg Kroah-Hartman | ||
8 | |||
9 | Introduction | ||
10 | ============ | ||
11 | |||
12 | The Linux USB subsystem has grown from supporting only two different | ||
13 | types of devices in the 2.2.7 kernel (mice and keyboards), to over 20 | ||
14 | different types of devices in the 2.4 kernel. Linux currently supports | ||
15 | almost all USB class devices (standard types of devices like keyboards, | ||
16 | mice, modems, printers and speakers) and an ever-growing number of | ||
17 | vendor-specific devices (such as USB to serial converters, digital | ||
18 | cameras, Ethernet devices and MP3 players). For a full list of the | ||
19 | different USB devices currently supported, see Resources. | ||
20 | |||
21 | The remaining kinds of USB devices that do not have support on Linux are | ||
22 | almost all vendor-specific devices. Each vendor decides to implement a | ||
23 | custom protocol to talk to their device, so a custom driver usually | ||
24 | needs to be created. Some vendors are open with their USB protocols and | ||
25 | help with the creation of Linux drivers, while others do not publish | ||
26 | them, and developers are forced to reverse-engineer. See Resources for | ||
27 | some links to handy reverse-engineering tools. | ||
28 | |||
29 | Because each different protocol causes a new driver to be created, I | ||
30 | have written a generic USB driver skeleton, modelled after the | ||
31 | pci-skeleton.c file in the kernel source tree upon which many PCI | ||
32 | network drivers have been based. This USB skeleton can be found at | ||
33 | drivers/usb/usb-skeleton.c in the kernel source tree. In this article I | ||
34 | will walk through the basics of the skeleton driver, explaining the | ||
35 | different pieces and what needs to be done to customize it to your | ||
36 | specific device. | ||
37 | |||
38 | Linux USB Basics | ||
39 | ================ | ||
40 | |||
41 | If you are going to write a Linux USB driver, please become familiar | ||
42 | with the USB protocol specification. It can be found, along with many | ||
43 | other useful documents, at the USB home page (see Resources). An | ||
44 | excellent introduction to the Linux USB subsystem can be found at the | ||
45 | USB Working Devices List (see Resources). It explains how the Linux USB | ||
46 | subsystem is structured and introduces the reader to the concept of USB | ||
47 | urbs (USB Request Blocks), which are essential to USB drivers. | ||
48 | |||
49 | The first thing a Linux USB driver needs to do is register itself with | ||
50 | the Linux USB subsystem, giving it some information about which devices | ||
51 | the driver supports and which functions to call when a device supported | ||
52 | by the driver is inserted or removed from the system. All of this | ||
53 | information is passed to the USB subsystem in the :c:type:`usb_driver` | ||
54 | structure. The skeleton driver declares a :c:type:`usb_driver` as:: | ||
55 | |||
56 | static struct usb_driver skel_driver = { | ||
57 | .name = "skeleton", | ||
58 | .probe = skel_probe, | ||
59 | .disconnect = skel_disconnect, | ||
60 | .fops = &skel_fops, | ||
61 | .minor = USB_SKEL_MINOR_BASE, | ||
62 | .id_table = skel_table, | ||
63 | }; | ||
64 | |||
65 | |||
66 | The variable name is a string that describes the driver. It is used in | ||
67 | informational messages printed to the system log. The probe and | ||
68 | disconnect function pointers are called when a device that matches the | ||
69 | information provided in the ``id_table`` variable is either seen or | ||
70 | removed. | ||
71 | |||
72 | The fops and minor variables are optional. Most USB drivers hook into | ||
73 | another kernel subsystem, such as the SCSI, network or TTY subsystem. | ||
74 | These types of drivers register themselves with the other kernel | ||
75 | subsystem, and any user-space interactions are provided through that | ||
76 | interface. But for drivers that do not have a matching kernel subsystem, | ||
77 | such as MP3 players or scanners, a method of interacting with user space | ||
78 | is needed. The USB subsystem provides a way to register a minor device | ||
79 | number and a set of :c:type:`file_operations` function pointers that enable | ||
80 | this user-space interaction. The skeleton driver needs this kind of | ||
81 | interface, so it provides a minor starting number and a pointer to its | ||
82 | :c:type:`file_operations` functions. | ||
83 | |||
84 | The USB driver is then registered with a call to :c:func:`usb_register`, | ||
85 | usually in the driver's init function, as shown here:: | ||
86 | |||
87 | static int __init usb_skel_init(void) | ||
88 | { | ||
89 | int result; | ||
90 | |||
91 | /* register this driver with the USB subsystem */ | ||
92 | result = usb_register(&skel_driver); | ||
93 | if (result < 0) { | ||
94 | err("usb_register failed for the "__FILE__ "driver." | ||
95 | "Error number %d", result); | ||
96 | return -1; | ||
97 | } | ||
98 | |||
99 | return 0; | ||
100 | } | ||
101 | module_init(usb_skel_init); | ||
102 | |||
103 | |||
104 | When the driver is unloaded from the system, it needs to deregister | ||
105 | itself with the USB subsystem. This is done with the :c:func:`usb_deregister` | ||
106 | function:: | ||
107 | |||
108 | static void __exit usb_skel_exit(void) | ||
109 | { | ||
110 | /* deregister this driver with the USB subsystem */ | ||
111 | usb_deregister(&skel_driver); | ||
112 | } | ||
113 | module_exit(usb_skel_exit); | ||
114 | |||
115 | |||
116 | To enable the linux-hotplug system to load the driver automatically when | ||
117 | the device is plugged in, you need to create a ``MODULE_DEVICE_TABLE``. | ||
118 | The following code tells the hotplug scripts that this module supports a | ||
119 | single device with a specific vendor and product ID:: | ||
120 | |||
121 | /* table of devices that work with this driver */ | ||
122 | static struct usb_device_id skel_table [] = { | ||
123 | { USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) }, | ||
124 | { } /* Terminating entry */ | ||
125 | }; | ||
126 | MODULE_DEVICE_TABLE (usb, skel_table); | ||
127 | |||
128 | |||
129 | There are other macros that can be used in describing a struct | ||
130 | :c:type:`usb_device_id` for drivers that support a whole class of USB | ||
131 | drivers. See :ref:`usb.h <usb_header>` for more information on this. | ||
132 | |||
133 | Device operation | ||
134 | ================ | ||
135 | |||
136 | When a device is plugged into the USB bus that matches the device ID | ||
137 | pattern that your driver registered with the USB core, the probe | ||
138 | function is called. The :c:type:`usb_device` structure, interface number and | ||
139 | the interface ID are passed to the function:: | ||
140 | |||
141 | static int skel_probe(struct usb_interface *interface, | ||
142 | const struct usb_device_id *id) | ||
143 | |||
144 | |||
145 | The driver now needs to verify that this device is actually one that it | ||
146 | can accept. If so, it returns 0. If not, or if any error occurs during | ||
147 | initialization, an errorcode (such as ``-ENOMEM`` or ``-ENODEV``) is | ||
148 | returned from the probe function. | ||
149 | |||
150 | In the skeleton driver, we determine what end points are marked as | ||
151 | bulk-in and bulk-out. We create buffers to hold the data that will be | ||
152 | sent and received from the device, and a USB urb to write data to the | ||
153 | device is initialized. | ||
154 | |||
155 | Conversely, when the device is removed from the USB bus, the disconnect | ||
156 | function is called with the device pointer. The driver needs to clean | ||
157 | any private data that has been allocated at this time and to shut down | ||
158 | any pending urbs that are in the USB system. | ||
159 | |||
160 | Now that the device is plugged into the system and the driver is bound | ||
161 | to the device, any of the functions in the :c:type:`file_operations` structure | ||
162 | that were passed to the USB subsystem will be called from a user program | ||
163 | trying to talk to the device. The first function called will be open, as | ||
164 | the program tries to open the device for I/O. We increment our private | ||
165 | usage count and save a pointer to our internal structure in the file | ||
166 | structure. This is done so that future calls to file operations will | ||
167 | enable the driver to determine which device the user is addressing. All | ||
168 | of this is done with the following code:: | ||
169 | |||
170 | /* increment our usage count for the module */ | ||
171 | ++skel->open_count; | ||
172 | |||
173 | /* save our object in the file's private structure */ | ||
174 | file->private_data = dev; | ||
175 | |||
176 | |||
177 | After the open function is called, the read and write functions are | ||
178 | called to receive and send data to the device. In the ``skel_write`` | ||
179 | function, we receive a pointer to some data that the user wants to send | ||
180 | to the device and the size of the data. The function determines how much | ||
181 | data it can send to the device based on the size of the write urb it has | ||
182 | created (this size depends on the size of the bulk out end point that | ||
183 | the device has). Then it copies the data from user space to kernel | ||
184 | space, points the urb to the data and submits the urb to the USB | ||
185 | subsystem. This can be seen in the following code:: | ||
186 | |||
187 | /* we can only write as much as 1 urb will hold */ | ||
188 | bytes_written = (count > skel->bulk_out_size) ? skel->bulk_out_size : count; | ||
189 | |||
190 | /* copy the data from user space into our urb */ | ||
191 | copy_from_user(skel->write_urb->transfer_buffer, buffer, bytes_written); | ||
192 | |||
193 | /* set up our urb */ | ||
194 | usb_fill_bulk_urb(skel->write_urb, | ||
195 | skel->dev, | ||
196 | usb_sndbulkpipe(skel->dev, skel->bulk_out_endpointAddr), | ||
197 | skel->write_urb->transfer_buffer, | ||
198 | bytes_written, | ||
199 | skel_write_bulk_callback, | ||
200 | skel); | ||
201 | |||
202 | /* send the data out the bulk port */ | ||
203 | result = usb_submit_urb(skel->write_urb); | ||
204 | if (result) { | ||
205 | err("Failed submitting write urb, error %d", result); | ||
206 | } | ||
207 | |||
208 | |||
209 | When the write urb is filled up with the proper information using the | ||
210 | :c:func:`usb_fill_bulk_urb` function, we point the urb's completion callback | ||
211 | to call our own ``skel_write_bulk_callback`` function. This function is | ||
212 | called when the urb is finished by the USB subsystem. The callback | ||
213 | function is called in interrupt context, so caution must be taken not to | ||
214 | do very much processing at that time. Our implementation of | ||
215 | ``skel_write_bulk_callback`` merely reports if the urb was completed | ||
216 | successfully or not and then returns. | ||
217 | |||
218 | The read function works a bit differently from the write function in | ||
219 | that we do not use an urb to transfer data from the device to the | ||
220 | driver. Instead we call the :c:func:`usb_bulk_msg` function, which can be used | ||
221 | to send or receive data from a device without having to create urbs and | ||
222 | handle urb completion callback functions. We call the :c:func:`usb_bulk_msg` | ||
223 | function, giving it a buffer into which to place any data received from | ||
224 | the device and a timeout value. If the timeout period expires without | ||
225 | receiving any data from the device, the function will fail and return an | ||
226 | error message. This can be shown with the following code:: | ||
227 | |||
228 | /* do an immediate bulk read to get data from the device */ | ||
229 | retval = usb_bulk_msg (skel->dev, | ||
230 | usb_rcvbulkpipe (skel->dev, | ||
231 | skel->bulk_in_endpointAddr), | ||
232 | skel->bulk_in_buffer, | ||
233 | skel->bulk_in_size, | ||
234 | &count, HZ*10); | ||
235 | /* if the read was successful, copy the data to user space */ | ||
236 | if (!retval) { | ||
237 | if (copy_to_user (buffer, skel->bulk_in_buffer, count)) | ||
238 | retval = -EFAULT; | ||
239 | else | ||
240 | retval = count; | ||
241 | } | ||
242 | |||
243 | |||
244 | The :c:func:`usb_bulk_msg` function can be very useful for doing single reads | ||
245 | or writes to a device; however, if you need to read or write constantly to | ||
246 | a device, it is recommended to set up your own urbs and submit them to | ||
247 | the USB subsystem. | ||
248 | |||
249 | When the user program releases the file handle that it has been using to | ||
250 | talk to the device, the release function in the driver is called. In | ||
251 | this function we decrement our private usage count and wait for possible | ||
252 | pending writes:: | ||
253 | |||
254 | /* decrement our usage count for the device */ | ||
255 | --skel->open_count; | ||
256 | |||
257 | |||
258 | One of the more difficult problems that USB drivers must be able to | ||
259 | handle smoothly is the fact that the USB device may be removed from the | ||
260 | system at any point in time, even if a program is currently talking to | ||
261 | it. It needs to be able to shut down any current reads and writes and | ||
262 | notify the user-space programs that the device is no longer there. The | ||
263 | following code (function ``skel_delete``) is an example of how to do | ||
264 | this:: | ||
265 | |||
266 | static inline void skel_delete (struct usb_skel *dev) | ||
267 | { | ||
268 | kfree (dev->bulk_in_buffer); | ||
269 | if (dev->bulk_out_buffer != NULL) | ||
270 | usb_free_coherent (dev->udev, dev->bulk_out_size, | ||
271 | dev->bulk_out_buffer, | ||
272 | dev->write_urb->transfer_dma); | ||
273 | usb_free_urb (dev->write_urb); | ||
274 | kfree (dev); | ||
275 | } | ||
276 | |||
277 | |||
278 | If a program currently has an open handle to the device, we reset the | ||
279 | flag ``device_present``. For every read, write, release and other | ||
280 | functions that expect a device to be present, the driver first checks | ||
281 | this flag to see if the device is still present. If not, it releases | ||
282 | that the device has disappeared, and a ``-ENODEV`` error is returned to the | ||
283 | user-space program. When the release function is eventually called, it | ||
284 | determines if there is no device and if not, it does the cleanup that | ||
285 | the ``skel_disconnect`` function normally does if there are no open files | ||
286 | on the device (see Listing 5). | ||
287 | |||
288 | Isochronous Data | ||
289 | ================ | ||
290 | |||
291 | This usb-skeleton driver does not have any examples of interrupt or | ||
292 | isochronous data being sent to or from the device. Interrupt data is | ||
293 | sent almost exactly as bulk data is, with a few minor exceptions. | ||
294 | Isochronous data works differently with continuous streams of data being | ||
295 | sent to or from the device. The audio and video camera drivers are very | ||
296 | good examples of drivers that handle isochronous data and will be useful | ||
297 | if you also need to do this. | ||
298 | |||
299 | Conclusion | ||
300 | ========== | ||
301 | |||
302 | Writing Linux USB device drivers is not a difficult task as the | ||
303 | usb-skeleton driver shows. This driver, combined with the other current | ||
304 | USB drivers, should provide enough examples to help a beginning author | ||
305 | create a working driver in a minimal amount of time. The linux-usb-devel | ||
306 | mailing list archives also contain a lot of helpful information. | ||
307 | |||
308 | Resources | ||
309 | ========= | ||
310 | |||
311 | The Linux USB Project: | ||
312 | http://www.linux-usb.org/ | ||
313 | |||
314 | Linux Hotplug Project: | ||
315 | http://linux-hotplug.sourceforge.net/ | ||
316 | |||
317 | Linux USB Working Devices List: | ||
318 | http://www.qbik.ch/usb/devices/ | ||
319 | |||
320 | linux-usb-devel Mailing List Archives: | ||
321 | http://marc.theaimsgroup.com/?l=linux-usb-devel | ||
322 | |||
323 | Programming Guide for Linux USB Device Drivers: | ||
324 | http://usb.cs.tum.edu/usbdoc | ||
325 | |||
326 | USB Home Page: http://www.usb.org | ||
diff --git a/Documentation/early-userspace/README b/Documentation/early-userspace/README index 93e63a9af30b..2c00b072a4c8 100644 --- a/Documentation/early-userspace/README +++ b/Documentation/early-userspace/README | |||
@@ -86,7 +86,7 @@ early userspace useful. The klibc distribution is currently | |||
86 | maintained separately from the kernel. | 86 | maintained separately from the kernel. |
87 | 87 | ||
88 | You can obtain somewhat infrequent snapshots of klibc from | 88 | You can obtain somewhat infrequent snapshots of klibc from |
89 | ftp://ftp.kernel.org/pub/linux/libs/klibc/ | 89 | https://www.kernel.org/pub/linux/libs/klibc/ |
90 | 90 | ||
91 | For active users, you are better off using the klibc git | 91 | For active users, you are better off using the klibc git |
92 | repository, at http://git.kernel.org/?p=libs/klibc/klibc.git | 92 | repository, at http://git.kernel.org/?p=libs/klibc/klibc.git |
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt index 3698ed3146e3..5a8f7f4d2bca 100644 --- a/Documentation/filesystems/ext4.txt +++ b/Documentation/filesystems/ext4.txt | |||
@@ -25,7 +25,7 @@ Note: More extensive information for getting started with ext4 can be | |||
25 | 25 | ||
26 | or | 26 | or |
27 | 27 | ||
28 | ftp://ftp.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/ | 28 | https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/ |
29 | 29 | ||
30 | or grab the latest git repository from: | 30 | or grab the latest git repository from: |
31 | 31 | ||
diff --git a/Documentation/filesystems/nfs/nfs-rdma.txt b/Documentation/filesystems/nfs/nfs-rdma.txt index 1e6564545edf..22dc0dd6889c 100644 --- a/Documentation/filesystems/nfs/nfs-rdma.txt +++ b/Documentation/filesystems/nfs/nfs-rdma.txt | |||
@@ -110,10 +110,10 @@ Installation | |||
110 | - Install a Linux kernel with NFS/RDMA | 110 | - Install a Linux kernel with NFS/RDMA |
111 | 111 | ||
112 | The NFS/RDMA client and server are both included in the mainline Linux | 112 | The NFS/RDMA client and server are both included in the mainline Linux |
113 | kernel version 2.6.25 and later. This and other versions of the 2.6 Linux | 113 | kernel version 2.6.25 and later. This and other versions of the Linux |
114 | kernel can be found at: | 114 | kernel can be found at: |
115 | 115 | ||
116 | ftp://ftp.kernel.org/pub/linux/kernel/v2.6/ | 116 | https://www.kernel.org/pub/linux/kernel/ |
117 | 117 | ||
118 | Download the sources and place them in an appropriate location. | 118 | Download the sources and place them in an appropriate location. |
119 | 119 | ||
diff --git a/Documentation/hid/hidraw.txt b/Documentation/hid/hidraw.txt index 029e6cb9a7e8..c8436e354f44 100644 --- a/Documentation/hid/hidraw.txt +++ b/Documentation/hid/hidraw.txt | |||
@@ -81,7 +81,7 @@ of: | |||
81 | BUS_HIL | 81 | BUS_HIL |
82 | BUS_BLUETOOTH | 82 | BUS_BLUETOOTH |
83 | BUS_VIRTUAL | 83 | BUS_VIRTUAL |
84 | which are defined in linux/input.h. | 84 | which are defined in uapi/linux/input.h. |
85 | 85 | ||
86 | HIDIOCGRAWNAME(len): Get Raw Name | 86 | HIDIOCGRAWNAME(len): Get Raw Name |
87 | This ioctl returns a string containing the vendor and product strings of | 87 | This ioctl returns a string containing the vendor and product strings of |
diff --git a/Documentation/index.rst b/Documentation/index.rst index f6e641a54bbc..61306a22888d 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst | |||
@@ -24,6 +24,18 @@ trying to get it to work optimally on a given system. | |||
24 | 24 | ||
25 | admin-guide/index | 25 | admin-guide/index |
26 | 26 | ||
27 | Application-developer documentation | ||
28 | ----------------------------------- | ||
29 | |||
30 | The user-space API manual gathers together documents describing aspects of | ||
31 | the kernel interface as seen by application developers. | ||
32 | |||
33 | .. toctree:: | ||
34 | :maxdepth: 2 | ||
35 | |||
36 | userspace-api/index | ||
37 | |||
38 | |||
27 | Introduction to kernel development | 39 | Introduction to kernel development |
28 | ---------------------------------- | 40 | ---------------------------------- |
29 | 41 | ||
@@ -76,6 +88,14 @@ Chinese translations | |||
76 | 88 | ||
77 | translations/zh_CN/index | 89 | translations/zh_CN/index |
78 | 90 | ||
91 | Japanese translations | ||
92 | --------------------- | ||
93 | |||
94 | .. toctree:: | ||
95 | :maxdepth: 1 | ||
96 | |||
97 | translations/ja_JP/index | ||
98 | |||
79 | Indices and tables | 99 | Indices and tables |
80 | ================== | 100 | ================== |
81 | 101 | ||
diff --git a/Documentation/input/ff.txt b/Documentation/input/ff.txt index b3867bf49f8f..be742eec7aab 100644 --- a/Documentation/input/ff.txt +++ b/Documentation/input/ff.txt | |||
@@ -106,9 +106,9 @@ allocate a new effect. | |||
106 | 106 | ||
107 | Effects are file descriptor specific. | 107 | Effects are file descriptor specific. |
108 | 108 | ||
109 | See <linux/input.h> for a description of the ff_effect struct. You should also | 109 | See <uapi/linux/input.h> for a description of the ff_effect struct. You should |
110 | find help in a few sketches, contained in files shape.fig and interactive.fig. | 110 | also find help in a few sketches, contained in files shape.fig and |
111 | You need xfig to visualize these files. | 111 | interactive.fig. You need xfig to visualize these files. |
112 | 112 | ||
113 | 3.3 Removing an effect from the device | 113 | 3.3 Removing an effect from the device |
114 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 114 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
diff --git a/Documentation/input/input-programming.txt b/Documentation/input/input-programming.txt index 7f8b9d97bc47..c3b940baba42 100644 --- a/Documentation/input/input-programming.txt +++ b/Documentation/input/input-programming.txt | |||
@@ -174,8 +174,8 @@ It's reported to the input system via: | |||
174 | 174 | ||
175 | input_report_key(struct input_dev *dev, int code, int value) | 175 | input_report_key(struct input_dev *dev, int code, int value) |
176 | 176 | ||
177 | See linux/input.h for the allowable values of code (from 0 to KEY_MAX). | 177 | See uapi/linux/input-event-codes.h for the allowable values of code (from 0 to |
178 | Value is interpreted as a truth value, ie any nonzero value means key | 178 | KEY_MAX). Value is interpreted as a truth value, ie any nonzero value means key |
179 | pressed, zero value means key released. The input code generates events only | 179 | pressed, zero value means key released. The input code generates events only |
180 | in case the value is different from before. | 180 | in case the value is different from before. |
181 | 181 | ||
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt index 08244bea5048..a77ead911956 100644 --- a/Documentation/ioctl/ioctl-number.txt +++ b/Documentation/ioctl/ioctl-number.txt | |||
@@ -212,7 +212,7 @@ Code Seq#(hex) Include File Comments | |||
212 | 'c' 00-1F linux/chio.h conflict! | 212 | 'c' 00-1F linux/chio.h conflict! |
213 | 'c' 80-9F arch/s390/include/asm/chsc.h conflict! | 213 | 'c' 80-9F arch/s390/include/asm/chsc.h conflict! |
214 | 'c' A0-AF arch/x86/include/asm/msr.h conflict! | 214 | 'c' A0-AF arch/x86/include/asm/msr.h conflict! |
215 | 'd' 00-FF linux/char/drm/drm/h conflict! | 215 | 'd' 00-FF linux/char/drm/drm.h conflict! |
216 | 'd' 02-40 pcmcia/ds.h conflict! | 216 | 'd' 02-40 pcmcia/ds.h conflict! |
217 | 'd' F0-FF linux/digi1.h | 217 | 'd' F0-FF linux/digi1.h |
218 | 'e' all linux/digi1.h conflict! | 218 | 'e' all linux/digi1.h conflict! |
diff --git a/Documentation/leds/leds-lp55xx.txt b/Documentation/leds/leds-lp55xx.txt index bcea12a0c584..e23fa91ea722 100644 --- a/Documentation/leds/leds-lp55xx.txt +++ b/Documentation/leds/leds-lp55xx.txt | |||
@@ -117,7 +117,7 @@ As soon as 'loading' is set to 0, registered callback is called. | |||
117 | Inside the callback, the selected engine is loaded and memory is updated. | 117 | Inside the callback, the selected engine is loaded and memory is updated. |
118 | To run programmed pattern, 'run_engine' attribute should be enabled. | 118 | To run programmed pattern, 'run_engine' attribute should be enabled. |
119 | 119 | ||
120 | The pattern sqeuence of LP8501 is similar to LP5523. | 120 | The pattern sequence of LP8501 is similar to LP5523. |
121 | However pattern data is specific. | 121 | However pattern data is specific. |
122 | Ex 1) Engine 1 is used | 122 | Ex 1) Engine 1 is used |
123 | echo 1 > /sys/bus/i2c/devices/xxxx/select_engine | 123 | echo 1 > /sys/bus/i2c/devices/xxxx/select_engine |
diff --git a/Documentation/md/md-cluster.txt b/Documentation/md/md-cluster.txt index 38883276d31c..d22103994aef 100644 --- a/Documentation/md/md-cluster.txt +++ b/Documentation/md/md-cluster.txt | |||
@@ -77,7 +77,7 @@ There are three groups of locks for managing the device: | |||
77 | 3.1.2 RESYNCING: informs other nodes that a resync is initiated or | 77 | 3.1.2 RESYNCING: informs other nodes that a resync is initiated or |
78 | ended so that each node may suspend or resume the region. Each | 78 | ended so that each node may suspend or resume the region. Each |
79 | RESYNCING message identifies a range of the devices that the | 79 | RESYNCING message identifies a range of the devices that the |
80 | sending node is about to resync. This over-rides any pervious | 80 | sending node is about to resync. This overrides any previous |
81 | notification from that node: only one ranged can be resynced at a | 81 | notification from that node: only one ranged can be resynced at a |
82 | time per-node. | 82 | time per-node. |
83 | 83 | ||
diff --git a/Documentation/media/Makefile b/Documentation/media/Makefile index 9b3e70b2cab2..36166952d555 100644 --- a/Documentation/media/Makefile +++ b/Documentation/media/Makefile | |||
@@ -1,51 +1,6 @@ | |||
1 | # Rules to convert DOT and SVG to Sphinx images | ||
2 | |||
3 | SRC_DIR=$(srctree)/Documentation/media | ||
4 | |||
5 | DOTS = \ | ||
6 | uapi/v4l/pipeline.dot \ | ||
7 | |||
8 | IMAGES = \ | ||
9 | typical_media_device.svg \ | ||
10 | uapi/dvb/dvbstb.svg \ | ||
11 | uapi/v4l/bayer.svg \ | ||
12 | uapi/v4l/constraints.svg \ | ||
13 | uapi/v4l/crop.svg \ | ||
14 | uapi/v4l/fieldseq_bt.svg \ | ||
15 | uapi/v4l/fieldseq_tb.svg \ | ||
16 | uapi/v4l/nv12mt.svg \ | ||
17 | uapi/v4l/nv12mt_example.svg \ | ||
18 | uapi/v4l/pipeline.svg \ | ||
19 | uapi/v4l/selection.svg \ | ||
20 | uapi/v4l/subdev-image-processing-full.svg \ | ||
21 | uapi/v4l/subdev-image-processing-scaling-multi-source.svg \ | ||
22 | uapi/v4l/subdev-image-processing-crop.svg \ | ||
23 | uapi/v4l/vbi_525.svg \ | ||
24 | uapi/v4l/vbi_625.svg \ | ||
25 | uapi/v4l/vbi_hsync.svg \ | ||
26 | |||
27 | DOTTGT := $(patsubst %.dot,%.svg,$(DOTS)) | ||
28 | IMGDOT := $(patsubst %,$(SRC_DIR)/%,$(DOTTGT)) | ||
29 | |||
30 | IMGTGT := $(patsubst %.svg,%.pdf,$(IMAGES)) | ||
31 | IMGPDF := $(patsubst %,$(SRC_DIR)/%,$(IMGTGT)) | ||
32 | |||
33 | cmd = $(echo-cmd) $(cmd_$(1)) | ||
34 | |||
35 | quiet_cmd_genpdf = GENPDF $2 | ||
36 | cmd_genpdf = convert $2 $3 | ||
37 | |||
38 | quiet_cmd_gendot = DOT $2 | ||
39 | cmd_gendot = dot -Tsvg $2 > $3 || { rm -f $3; exit 1; } | ||
40 | |||
41 | %.pdf: %.svg | ||
42 | @$(call cmd,genpdf,$<,$@) | ||
43 | |||
44 | %.svg: %.dot | ||
45 | @$(call cmd,gendot,$<,$@) | ||
46 | |||
47 | # Rules to convert a .h file to inline RST documentation | 1 | # Rules to convert a .h file to inline RST documentation |
48 | 2 | ||
3 | SRC_DIR=$(srctree)/Documentation/media | ||
49 | PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl | 4 | PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl |
50 | UAPI = $(srctree)/include/uapi/linux | 5 | UAPI = $(srctree)/include/uapi/linux |
51 | KAPI = $(srctree)/include/linux | 6 | KAPI = $(srctree)/include/linux |
diff --git a/Documentation/media/intro.rst b/Documentation/media/intro.rst index 8f7490c9a8ef..9ce2e23a0236 100644 --- a/Documentation/media/intro.rst +++ b/Documentation/media/intro.rst | |||
@@ -13,9 +13,9 @@ A typical media device hardware is shown at :ref:`typical_media_device`. | |||
13 | 13 | ||
14 | .. _typical_media_device: | 14 | .. _typical_media_device: |
15 | 15 | ||
16 | .. figure:: typical_media_device.* | 16 | .. kernel-figure:: typical_media_device.svg |
17 | :alt: typical_media_device.pdf / typical_media_device.svg | 17 | :alt: typical_media_device.svg |
18 | :align: center | 18 | :align: center |
19 | 19 | ||
20 | Typical Media Device | 20 | Typical Media Device |
21 | 21 | ||
diff --git a/Documentation/media/uapi/dvb/intro.rst b/Documentation/media/uapi/dvb/intro.rst index 2ed5c23102b4..652c4aacd2c6 100644 --- a/Documentation/media/uapi/dvb/intro.rst +++ b/Documentation/media/uapi/dvb/intro.rst | |||
@@ -55,9 +55,9 @@ Overview | |||
55 | 55 | ||
56 | .. _stb_components: | 56 | .. _stb_components: |
57 | 57 | ||
58 | .. figure:: dvbstb.* | 58 | .. kernel-figure:: dvbstb.svg |
59 | :alt: dvbstb.pdf / dvbstb.svg | 59 | :alt: dvbstb.svg |
60 | :align: center | 60 | :align: center |
61 | 61 | ||
62 | Components of a DVB card/STB | 62 | Components of a DVB card/STB |
63 | 63 | ||
diff --git a/Documentation/media/uapi/v4l/crop.rst b/Documentation/media/uapi/v4l/crop.rst index be58894c9c89..182565b9ace4 100644 --- a/Documentation/media/uapi/v4l/crop.rst +++ b/Documentation/media/uapi/v4l/crop.rst | |||
@@ -53,8 +53,8 @@ Cropping Structures | |||
53 | 53 | ||
54 | .. _crop-scale: | 54 | .. _crop-scale: |
55 | 55 | ||
56 | .. figure:: crop.* | 56 | .. kernel-figure:: crop.svg |
57 | :alt: crop.pdf / crop.svg | 57 | :alt: crop.svg |
58 | :align: center | 58 | :align: center |
59 | 59 | ||
60 | Image Cropping, Insertion and Scaling | 60 | Image Cropping, Insertion and Scaling |
diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst b/Documentation/media/uapi/v4l/dev-raw-vbi.rst index baf5f2483927..2e6878b624f6 100644 --- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst | |||
@@ -221,33 +221,29 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>` does | |||
221 | 221 | ||
222 | .. _vbi-hsync: | 222 | .. _vbi-hsync: |
223 | 223 | ||
224 | .. figure:: vbi_hsync.* | 224 | .. kernel-figure:: vbi_hsync.svg |
225 | :alt: vbi_hsync.pdf / vbi_hsync.svg | 225 | :alt: vbi_hsync.svg |
226 | :align: center | 226 | :align: center |
227 | 227 | ||
228 | **Figure 4.1. Line synchronization** | 228 | **Figure 4.1. Line synchronization** |
229 | 229 | ||
230 | 230 | ||
231 | .. _vbi-525: | 231 | .. _vbi-525: |
232 | 232 | ||
233 | .. figure:: vbi_525.* | 233 | .. kernel-figure:: vbi_525.svg |
234 | :alt: vbi_525.pdf / vbi_525.svg | 234 | :alt: vbi_525.svg |
235 | :align: center | 235 | :align: center |
236 | 236 | ||
237 | **Figure 4.2. ITU-R 525 line numbering (M/NTSC and M/PAL)** | 237 | **Figure 4.2. ITU-R 525 line numbering (M/NTSC and M/PAL)** |
238 | 238 | ||
239 | |||
240 | |||
241 | .. _vbi-625: | 239 | .. _vbi-625: |
242 | 240 | ||
243 | .. figure:: vbi_625.* | 241 | .. kernel-figure:: vbi_625.svg |
244 | :alt: vbi_625.pdf / vbi_625.svg | 242 | :alt: vbi_625.svg |
245 | :align: center | 243 | :align: center |
246 | 244 | ||
247 | **Figure 4.3. ITU-R 625 line numbering** | 245 | **Figure 4.3. ITU-R 625 line numbering** |
248 | 246 | ||
249 | |||
250 | |||
251 | Remember the VBI image format depends on the selected video standard, | 247 | Remember the VBI image format depends on the selected video standard, |
252 | therefore the application must choose a new standard or query the | 248 | therefore the application must choose a new standard or query the |
253 | current standard first. Attempts to read or write data ahead of format | 249 | current standard first. Attempts to read or write data ahead of format |
diff --git a/Documentation/media/uapi/v4l/dev-subdev.rst b/Documentation/media/uapi/v4l/dev-subdev.rst index cd2870180208..f0e762167730 100644 --- a/Documentation/media/uapi/v4l/dev-subdev.rst +++ b/Documentation/media/uapi/v4l/dev-subdev.rst | |||
@@ -99,9 +99,9 @@ the video sensor and the host image processing hardware. | |||
99 | 99 | ||
100 | .. _pipeline-scaling: | 100 | .. _pipeline-scaling: |
101 | 101 | ||
102 | .. figure:: pipeline.* | 102 | .. kernel-figure:: pipeline.dot |
103 | :alt: pipeline.pdf / pipeline.svg | 103 | :alt: pipeline.dot |
104 | :align: center | 104 | :align: center |
105 | 105 | ||
106 | Image Format Negotiation on Pipelines | 106 | Image Format Negotiation on Pipelines |
107 | 107 | ||
@@ -404,9 +404,9 @@ selection will refer to the sink pad format dimensions instead. | |||
404 | 404 | ||
405 | .. _subdev-image-processing-crop: | 405 | .. _subdev-image-processing-crop: |
406 | 406 | ||
407 | .. figure:: subdev-image-processing-crop.* | 407 | .. kernel-figure:: subdev-image-processing-crop.svg |
408 | :alt: subdev-image-processing-crop.pdf / subdev-image-processing-crop.svg | 408 | :alt: subdev-image-processing-crop.svg |
409 | :align: center | 409 | :align: center |
410 | 410 | ||
411 | **Figure 4.5. Image processing in subdevs: simple crop example** | 411 | **Figure 4.5. Image processing in subdevs: simple crop example** |
412 | 412 | ||
@@ -421,9 +421,9 @@ pad. | |||
421 | 421 | ||
422 | .. _subdev-image-processing-scaling-multi-source: | 422 | .. _subdev-image-processing-scaling-multi-source: |
423 | 423 | ||
424 | .. figure:: subdev-image-processing-scaling-multi-source.* | 424 | .. kernel-figure:: subdev-image-processing-scaling-multi-source.svg |
425 | :alt: subdev-image-processing-scaling-multi-source.pdf / subdev-image-processing-scaling-multi-source.svg | 425 | :alt: subdev-image-processing-scaling-multi-source.svg |
426 | :align: center | 426 | :align: center |
427 | 427 | ||
428 | **Figure 4.6. Image processing in subdevs: scaling with multiple sources** | 428 | **Figure 4.6. Image processing in subdevs: scaling with multiple sources** |
429 | 429 | ||
@@ -437,8 +437,8 @@ an area at location specified by the source crop rectangle from it. | |||
437 | 437 | ||
438 | .. _subdev-image-processing-full: | 438 | .. _subdev-image-processing-full: |
439 | 439 | ||
440 | .. figure:: subdev-image-processing-full.* | 440 | .. kernel-figure:: subdev-image-processing-full.svg |
441 | :alt: subdev-image-processing-full.pdf / subdev-image-processing-full.svg | 441 | :alt: subdev-image-processing-full.svg |
442 | :align: center | 442 | :align: center |
443 | 443 | ||
444 | **Figure 4.7. Image processing in subdevs: scaling and composition with multiple sinks and sources** | 444 | **Figure 4.7. Image processing in subdevs: scaling and composition with multiple sinks and sources** |
diff --git a/Documentation/media/uapi/v4l/field-order.rst b/Documentation/media/uapi/v4l/field-order.rst index e05fb1041363..5f3f82cbfa34 100644 --- a/Documentation/media/uapi/v4l/field-order.rst +++ b/Documentation/media/uapi/v4l/field-order.rst | |||
@@ -141,17 +141,20 @@ enum v4l2_field | |||
141 | Field Order, Top Field First Transmitted | 141 | Field Order, Top Field First Transmitted |
142 | ======================================== | 142 | ======================================== |
143 | 143 | ||
144 | .. figure:: fieldseq_tb.* | 144 | .. kernel-figure:: fieldseq_tb.svg |
145 | :alt: fieldseq_tb.pdf / fieldseq_tb.svg | 145 | :alt: fieldseq_tb.svg |
146 | :align: center | 146 | :align: center |
147 | 147 | ||
148 | Field Order, Top Field First Transmitted | ||
149 | |||
148 | 150 | ||
149 | .. _fieldseq-bt: | 151 | .. _fieldseq-bt: |
150 | 152 | ||
151 | Field Order, Bottom Field First Transmitted | 153 | Field Order, Bottom Field First Transmitted |
152 | =========================================== | 154 | =========================================== |
153 | 155 | ||
154 | .. figure:: fieldseq_bt.* | 156 | .. kernel-figure:: fieldseq_bt.svg |
155 | :alt: fieldseq_bt.pdf / fieldseq_bt.svg | 157 | :alt: fieldseq_bt.svg |
156 | :align: center | 158 | :align: center |
157 | 159 | ||
160 | Field Order, Bottom Field First Transmitted | ||
diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst b/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst index 32d0c8743460..172a3825604e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst | |||
@@ -33,8 +33,8 @@ Layout of macroblocks in memory is presented in the following figure. | |||
33 | 33 | ||
34 | .. _nv12mt: | 34 | .. _nv12mt: |
35 | 35 | ||
36 | .. figure:: nv12mt.* | 36 | .. kernel-figure:: nv12mt.svg |
37 | :alt: nv12mt.pdf / nv12mt.svg | 37 | :alt: nv12mt.svg |
38 | :align: center | 38 | :align: center |
39 | 39 | ||
40 | V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout | 40 | V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout |
@@ -50,8 +50,8 @@ interleaved. Height of the buffer is aligned to 32. | |||
50 | 50 | ||
51 | .. _nv12mt_ex: | 51 | .. _nv12mt_ex: |
52 | 52 | ||
53 | .. figure:: nv12mt_example.* | 53 | .. kernel-figure:: nv12mt_example.svg |
54 | :alt: nv12mt_example.pdf / nv12mt_example.svg | 54 | :alt: nv12mt_example.svg |
55 | :align: center | 55 | :align: center |
56 | 56 | ||
57 | Example V4L2_PIX_FMT_NV12MT memory layout of macroblocks | 57 | Example V4L2_PIX_FMT_NV12MT memory layout of macroblocks |
diff --git a/Documentation/media/uapi/v4l/selection-api-003.rst b/Documentation/media/uapi/v4l/selection-api-003.rst index 21686f93c38f..bf7e76dfbdf9 100644 --- a/Documentation/media/uapi/v4l/selection-api-003.rst +++ b/Documentation/media/uapi/v4l/selection-api-003.rst | |||
@@ -7,9 +7,9 @@ Selection targets | |||
7 | 7 | ||
8 | .. _sel-targets-capture: | 8 | .. _sel-targets-capture: |
9 | 9 | ||
10 | .. figure:: selection.* | 10 | .. kernel-figure:: selection.svg |
11 | :alt: selection.pdf / selection.svg | 11 | :alt: selection.svg |
12 | :align: center | 12 | :align: center |
13 | 13 | ||
14 | Cropping and composing targets | 14 | Cropping and composing targets |
15 | 15 | ||
diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index d6152c907b8b..89a1fb959314 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst | |||
@@ -1514,8 +1514,8 @@ be named ``MEDIA_BUS_FMT_SRGGB10_2X8_PADHI_LE``. | |||
1514 | 1514 | ||
1515 | .. _bayer-patterns: | 1515 | .. _bayer-patterns: |
1516 | 1516 | ||
1517 | .. figure:: bayer.* | 1517 | .. kernel-figure:: bayer.svg |
1518 | :alt: bayer.pdf / bayer.svg | 1518 | :alt: bayer.svg |
1519 | :align: center | 1519 | :align: center |
1520 | 1520 | ||
1521 | **Figure 4.8 Bayer Patterns** | 1521 | **Figure 4.8 Bayer Patterns** |
diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index a606d1cdac13..90fe22a6414a 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst | |||
@@ -45,6 +45,7 @@ For more details see the file COPYING in the source distribution of Linux. | |||
45 | meye | 45 | meye |
46 | omap3isp | 46 | omap3isp |
47 | omap4_camera | 47 | omap4_camera |
48 | philips | ||
48 | pvrusb2 | 49 | pvrusb2 |
49 | pxa_camera | 50 | pxa_camera |
50 | radiotrack | 51 | radiotrack |
diff --git a/drivers/media/usb/pwc/philips.txt b/Documentation/media/v4l-drivers/philips.rst index d38dd791511e..620bcfea7af0 100644 --- a/drivers/media/usb/pwc/philips.txt +++ b/Documentation/media/v4l-drivers/philips.rst | |||
@@ -1,8 +1,12 @@ | |||
1 | Philips webcams (pwc driver) | ||
2 | ============================ | ||
3 | |||
1 | This file contains some additional information for the Philips and OEM webcams. | 4 | This file contains some additional information for the Philips and OEM webcams. |
2 | E-mail: webcam@smcc.demon.nl Last updated: 2004-01-19 | 5 | E-mail: webcam@smcc.demon.nl Last updated: 2004-01-19 |
3 | Site: http://www.smcc.demon.nl/webcam/ | 6 | Site: http://www.smcc.demon.nl/webcam/ |
4 | 7 | ||
5 | As of this moment, the following cameras are supported: | 8 | As of this moment, the following cameras are supported: |
9 | |||
6 | * Philips PCA645 | 10 | * Philips PCA645 |
7 | * Philips PCA646 | 11 | * Philips PCA646 |
8 | * Philips PCVC675 | 12 | * Philips PCVC675 |
@@ -89,7 +93,8 @@ power_save | |||
89 | compression (only useful with the plugin) | 93 | compression (only useful with the plugin) |
90 | With this option you can control the compression factor that the camera | 94 | With this option you can control the compression factor that the camera |
91 | uses to squeeze the image through the USB bus. You can set the | 95 | uses to squeeze the image through the USB bus. You can set the |
92 | parameter between 0 and 3: | 96 | parameter between 0 and 3:: |
97 | |||
93 | 0 = prefer uncompressed images; if the requested mode is not available | 98 | 0 = prefer uncompressed images; if the requested mode is not available |
94 | in an uncompressed format, the driver will silently switch to low | 99 | in an uncompressed format, the driver will silently switch to low |
95 | compression. | 100 | compression. |
@@ -109,11 +114,11 @@ compression (only useful with the plugin) | |||
109 | leds | 114 | leds |
110 | This settings takes 2 integers, that define the on/off time for the LED | 115 | This settings takes 2 integers, that define the on/off time for the LED |
111 | (in milliseconds). One of the interesting things that you can do with | 116 | (in milliseconds). One of the interesting things that you can do with |
112 | this is let the LED blink while the camera is in use. This: | 117 | this is let the LED blink while the camera is in use. This:: |
113 | 118 | ||
114 | leds=500,500 | 119 | leds=500,500 |
115 | 120 | ||
116 | will blink the LED once every second. But with: | 121 | will blink the LED once every second. But with:: |
117 | 122 | ||
118 | leds=0,0 | 123 | leds=0,0 |
119 | 124 | ||
@@ -141,7 +146,7 @@ dev_hint | |||
141 | A camera is specified by its type (the number from the camera model, | 146 | A camera is specified by its type (the number from the camera model, |
142 | like PCA645, PCVC750VC, etc) and optionally the serial number (visible | 147 | like PCA645, PCVC750VC, etc) and optionally the serial number (visible |
143 | in /proc/bus/usb/devices). A hint consists of a string with the following | 148 | in /proc/bus/usb/devices). A hint consists of a string with the following |
144 | format: | 149 | format:: |
145 | 150 | ||
146 | [type[.serialnumber]:]node | 151 | [type[.serialnumber]:]node |
147 | 152 | ||
@@ -150,7 +155,7 @@ dev_hint | |||
150 | would be rather pointless). The serialnumber is separated from the type | 155 | would be rather pointless). The serialnumber is separated from the type |
151 | by a '.'; the node number by a ':'. | 156 | by a '.'; the node number by a ':'. |
152 | 157 | ||
153 | This somewhat cryptic syntax is best explained by a few examples: | 158 | This somewhat cryptic syntax is best explained by a few examples:: |
154 | 159 | ||
155 | dev_hint=3,5 The first detected cam gets assigned | 160 | dev_hint=3,5 The first detected cam gets assigned |
156 | /dev/video3, the second /dev/video5. Any | 161 | /dev/video3, the second /dev/video5. Any |
@@ -170,6 +175,7 @@ dev_hint | |||
170 | through /dev/video6. | 175 | through /dev/video6. |
171 | 176 | ||
172 | Some points worth knowing: | 177 | Some points worth knowing: |
178 | |||
173 | - Serialnumbers are case sensitive and must be written full, including | 179 | - Serialnumbers are case sensitive and must be written full, including |
174 | leading zeroes (it's treated as a string). | 180 | leading zeroes (it's treated as a string). |
175 | - If a device node is already occupied, registration will fail and | 181 | - If a device node is already occupied, registration will fail and |
@@ -189,8 +195,10 @@ trace | |||
189 | If you want to trace something, look up the bit value(s) in the table | 195 | If you want to trace something, look up the bit value(s) in the table |
190 | below, add the values together and supply that to the trace variable. | 196 | below, add the values together and supply that to the trace variable. |
191 | 197 | ||
198 | ====== ======= ================================================ ======= | ||
192 | Value Value Description Default | 199 | Value Value Description Default |
193 | (dec) (hex) | 200 | (dec) (hex) |
201 | ====== ======= ================================================ ======= | ||
194 | 1 0x1 Module initialization; this will log messages On | 202 | 1 0x1 Module initialization; this will log messages On |
195 | while loading and unloading the module | 203 | while loading and unloading the module |
196 | 204 | ||
@@ -208,6 +216,7 @@ trace | |||
208 | 64 0x40 Show viewport and image sizes Off | 216 | 64 0x40 Show viewport and image sizes Off |
209 | 217 | ||
210 | 128 0x80 PWCX debugging Off | 218 | 128 0x80 PWCX debugging Off |
219 | ====== ======= ================================================ ======= | ||
211 | 220 | ||
212 | For example, to trace the open() & read() functions, sum 8 + 4 = 12, | 221 | For example, to trace the open() & read() functions, sum 8 + 4 = 12, |
213 | so you would supply trace=12 during insmod or modprobe. If | 222 | so you would supply trace=12 during insmod or modprobe. If |
@@ -216,7 +225,7 @@ trace | |||
216 | 225 | ||
217 | 226 | ||
218 | 227 | ||
219 | Example: | 228 | Example:: |
220 | 229 | ||
221 | # modprobe pwc size=cif fps=15 power_save=1 | 230 | # modprobe pwc size=cif fps=15 power_save=1 |
222 | 231 | ||
diff --git a/Documentation/media/v4l-drivers/zr364xx.rst b/Documentation/media/v4l-drivers/zr364xx.rst index f5280e366826..3d193f01d8bb 100644 --- a/Documentation/media/v4l-drivers/zr364xx.rst +++ b/Documentation/media/v4l-drivers/zr364xx.rst | |||
@@ -30,7 +30,7 @@ You can try the experience changing the vendor/product ID values (look | |||
30 | at the source code). | 30 | at the source code). |
31 | 31 | ||
32 | You can get these values by looking at /var/log/messages when you plug | 32 | You can get these values by looking at /var/log/messages when you plug |
33 | your camera, or by typing : cat /proc/bus/usb/devices. | 33 | your camera, or by typing : cat /sys/kernel/debug/usb/devices. |
34 | 34 | ||
35 | If you manage to use your cam with this code, you can send me a mail | 35 | If you manage to use your cam with this code, you can send me a mail |
36 | (royale@zerezo.com) with the name of your cam and a patch if needed. | 36 | (royale@zerezo.com) with the name of your cam and a patch if needed. |
diff --git a/Documentation/mmc/mmc-dev-attrs.txt b/Documentation/mmc/mmc-dev-attrs.txt index 404a0e9e92b0..2caff30b348c 100644 --- a/Documentation/mmc/mmc-dev-attrs.txt +++ b/Documentation/mmc/mmc-dev-attrs.txt | |||
@@ -13,7 +13,7 @@ SD and MMC Device Attributes | |||
13 | 13 | ||
14 | All attributes are read-only. | 14 | All attributes are read-only. |
15 | 15 | ||
16 | cid Card Identifaction Register | 16 | cid Card Identification Register |
17 | csd Card Specific Data Register | 17 | csd Card Specific Data Register |
18 | scr SD Card Configuration Register (SD only) | 18 | scr SD Card Configuration Register (SD only) |
19 | date Manufacturing Date (from CID Register) | 19 | date Manufacturing Date (from CID Register) |
@@ -71,6 +71,6 @@ Note on Erase Size and Preferred Erase Size: | |||
71 | "preferred_erase_size" is in bytes. | 71 | "preferred_erase_size" is in bytes. |
72 | 72 | ||
73 | Note on raw_rpmb_size_mult: | 73 | Note on raw_rpmb_size_mult: |
74 | "raw_rpmb_size_mult" is a mutliple of 128kB block. | 74 | "raw_rpmb_size_mult" is a multiple of 128kB block. |
75 | RPMB size in byte is calculated by using the following equation: | 75 | RPMB size in byte is calculated by using the following equation: |
76 | RPMB partition size = 128kB x raw_rpmb_size_mult | 76 | RPMB partition size = 128kB x raw_rpmb_size_mult |
diff --git a/Documentation/networking/cdc_mbim.txt b/Documentation/networking/cdc_mbim.txt index b9482ca10254..e4c376abbdad 100644 --- a/Documentation/networking/cdc_mbim.txt +++ b/Documentation/networking/cdc_mbim.txt | |||
@@ -332,7 +332,7 @@ References | |||
332 | [5] "MBIM (Mobile Broadband Interface Model) Registry" | 332 | [5] "MBIM (Mobile Broadband Interface Model) Registry" |
333 | - http://compliance.usb.org/mbim/ | 333 | - http://compliance.usb.org/mbim/ |
334 | 334 | ||
335 | [6] "/proc/bus/usb filesystem output" | 335 | [6] "/dev/bus/usb filesystem output" |
336 | - Documentation/usb/proc_usb_info.txt | 336 | - Documentation/usb/proc_usb_info.txt |
337 | 337 | ||
338 | [7] "/sys/bus/usb/devices/.../descriptors" | 338 | [7] "/sys/bus/usb/devices/.../descriptors" |
diff --git a/Documentation/networking/e100.txt b/Documentation/networking/e100.txt index 42ddbd4b52a9..54810b82c01a 100644 --- a/Documentation/networking/e100.txt +++ b/Documentation/networking/e100.txt | |||
@@ -130,7 +130,7 @@ Additional Configurations | |||
130 | version 1.6 or later is required for this functionality. | 130 | version 1.6 or later is required for this functionality. |
131 | 131 | ||
132 | The latest release of ethtool can be found from | 132 | The latest release of ethtool can be found from |
133 | http://ftp.kernel.org/pub/software/network/ethtool/ | 133 | https://www.kernel.org/pub/software/network/ethtool/ |
134 | 134 | ||
135 | Enabling Wake on LAN* (WoL) | 135 | Enabling Wake on LAN* (WoL) |
136 | --------------------------- | 136 | --------------------------- |
diff --git a/Documentation/networking/e1000.txt b/Documentation/networking/e1000.txt index 437b2099cced..1f6ed848363d 100644 --- a/Documentation/networking/e1000.txt +++ b/Documentation/networking/e1000.txt | |||
@@ -435,7 +435,7 @@ Additional Configurations | |||
435 | version 1.6 or later is required for this functionality. | 435 | version 1.6 or later is required for this functionality. |
436 | 436 | ||
437 | The latest release of ethtool can be found from | 437 | The latest release of ethtool can be found from |
438 | http://ftp.kernel.org/pub/software/network/ethtool/ | 438 | https://www.kernel.org/pub/software/network/ethtool/ |
439 | 439 | ||
440 | Enabling Wake on LAN* (WoL) | 440 | Enabling Wake on LAN* (WoL) |
441 | --------------------------- | 441 | --------------------------- |
diff --git a/Documentation/networking/e1000e.txt b/Documentation/networking/e1000e.txt index ad2d9f38ce14..12089547baed 100644 --- a/Documentation/networking/e1000e.txt +++ b/Documentation/networking/e1000e.txt | |||
@@ -274,7 +274,7 @@ Additional Configurations | |||
274 | diagnostics, as well as displaying statistical information. We | 274 | diagnostics, as well as displaying statistical information. We |
275 | strongly recommend downloading the latest version of ethtool at: | 275 | strongly recommend downloading the latest version of ethtool at: |
276 | 276 | ||
277 | http://ftp.kernel.org/pub/software/network/ethtool/ | 277 | https://kernel.org/pub/software/network/ethtool/ |
278 | 278 | ||
279 | NOTE: When validating enable/disable tests on some parts (82578, for example) | 279 | NOTE: When validating enable/disable tests on some parts (82578, for example) |
280 | you need to add a few seconds between tests when working with ethtool. | 280 | you need to add a few seconds between tests when working with ethtool. |
diff --git a/Documentation/networking/igb.txt b/Documentation/networking/igb.txt index 15534fdd09a8..f90643ef39c9 100644 --- a/Documentation/networking/igb.txt +++ b/Documentation/networking/igb.txt | |||
@@ -63,7 +63,7 @@ Additional Configurations | |||
63 | diagnostics, as well as displaying statistical information. The latest | 63 | diagnostics, as well as displaying statistical information. The latest |
64 | version of ethtool can be found at: | 64 | version of ethtool can be found at: |
65 | 65 | ||
66 | http://ftp.kernel.org/pub/software/network/ethtool/ | 66 | https://www.kernel.org/pub/software/network/ethtool/ |
67 | 67 | ||
68 | Enabling Wake on LAN* (WoL) | 68 | Enabling Wake on LAN* (WoL) |
69 | --------------------------- | 69 | --------------------------- |
diff --git a/Documentation/networking/igbvf.txt b/Documentation/networking/igbvf.txt index 40db17a6665b..bd404735fb46 100644 --- a/Documentation/networking/igbvf.txt +++ b/Documentation/networking/igbvf.txt | |||
@@ -62,7 +62,7 @@ Additional Configurations | |||
62 | version 3.0 or later is required for this functionality, although we | 62 | version 3.0 or later is required for this functionality, although we |
63 | strongly recommend downloading the latest version at: | 63 | strongly recommend downloading the latest version at: |
64 | 64 | ||
65 | http://ftp.kernel.org/pub/software/network/ethtool/ | 65 | https://www.kernel.org/pub/software/network/ethtool/ |
66 | 66 | ||
67 | Support | 67 | Support |
68 | ======= | 68 | ======= |
diff --git a/Documentation/networking/ixgb.txt b/Documentation/networking/ixgb.txt index 9b4a10a1cf50..09f71d71920a 100644 --- a/Documentation/networking/ixgb.txt +++ b/Documentation/networking/ixgb.txt | |||
@@ -313,7 +313,7 @@ Additional Configurations | |||
313 | version 1.6 or later is required for this functionality. | 313 | version 1.6 or later is required for this functionality. |
314 | 314 | ||
315 | The latest release of ethtool can be found from | 315 | The latest release of ethtool can be found from |
316 | http://ftp.kernel.org/pub/software/network/ethtool/ | 316 | https://www.kernel.org/pub/software/network/ethtool/ |
317 | 317 | ||
318 | NOTE: The ethtool version 1.6 only supports a limited set of ethtool options. | 318 | NOTE: The ethtool version 1.6 only supports a limited set of ethtool options. |
319 | Support for a more complete ethtool feature set can be enabled by | 319 | Support for a more complete ethtool feature set can be enabled by |
diff --git a/Documentation/networking/ixgbe.txt b/Documentation/networking/ixgbe.txt index 6f0cb57b59c6..687835415707 100644 --- a/Documentation/networking/ixgbe.txt +++ b/Documentation/networking/ixgbe.txt | |||
@@ -272,7 +272,7 @@ Additional Configurations | |||
272 | ethtool version is required for this functionality. | 272 | ethtool version is required for this functionality. |
273 | 273 | ||
274 | The latest release of ethtool can be found from | 274 | The latest release of ethtool can be found from |
275 | http://ftp.kernel.org/pub/software/network/ethtool/ | 275 | https://www.kernel.org/pub/software/network/ethtool/ |
276 | 276 | ||
277 | FCoE | 277 | FCoE |
278 | ---- | 278 | ---- |
diff --git a/Documentation/phy.txt b/Documentation/phy.txt index 0aa994bd9a91..383cdd863f08 100644 --- a/Documentation/phy.txt +++ b/Documentation/phy.txt | |||
@@ -97,7 +97,7 @@ should contain the phy name as given in the dt data and in the case of | |||
97 | non-dt boot, it should contain the label of the PHY. The two | 97 | non-dt boot, it should contain the label of the PHY. The two |
98 | devm_phy_get associates the device with the PHY using devres on | 98 | devm_phy_get associates the device with the PHY using devres on |
99 | successful PHY get. On driver detach, release function is invoked on | 99 | successful PHY get. On driver detach, release function is invoked on |
100 | the the devres data and devres data is freed. phy_optional_get and | 100 | the devres data and devres data is freed. phy_optional_get and |
101 | devm_phy_optional_get should be used when the phy is optional. These | 101 | devm_phy_optional_get should be used when the phy is optional. These |
102 | two functions will never return -ENODEV, but instead returns NULL when | 102 | two functions will never return -ENODEV, but instead returns NULL when |
103 | the phy cannot be found.Some generic drivers, such as ehci, may use multiple | 103 | the phy cannot be found.Some generic drivers, such as ehci, may use multiple |
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt index 8cc17ca71813..9f2f942a01cf 100644 --- a/Documentation/power/swsusp.txt +++ b/Documentation/power/swsusp.txt | |||
@@ -406,7 +406,7 @@ Firewire, CompactFlash, MMC, external SATA, or even IDE hotplug bays) | |||
406 | before suspending; then remount them after resuming. | 406 | before suspending; then remount them after resuming. |
407 | 407 | ||
408 | There is a work-around for this problem. For more information, see | 408 | There is a work-around for this problem. For more information, see |
409 | Documentation/usb/persist.txt. | 409 | Documentation/driver-api/usb/persist.rst. |
410 | 410 | ||
411 | Q: Can I suspend-to-disk using a swap partition under LVM? | 411 | Q: Can I suspend-to-disk using a swap partition under LVM? |
412 | 412 | ||
diff --git a/Documentation/process/4.Coding.rst b/Documentation/process/4.Coding.rst index 2a728d898fc5..6df19943dd4d 100644 --- a/Documentation/process/4.Coding.rst +++ b/Documentation/process/4.Coding.rst | |||
@@ -22,11 +22,11 @@ Coding style | |||
22 | ************ | 22 | ************ |
23 | 23 | ||
24 | The kernel has long had a standard coding style, described in | 24 | The kernel has long had a standard coding style, described in |
25 | Documentation/process/coding-style.rst. For much of that time, the policies described | 25 | :ref:`Documentation/process/coding-style.rst <codingstyle>`. For much of |
26 | in that file were taken as being, at most, advisory. As a result, there is | 26 | that time, the policies described in that file were taken as being, at most, |
27 | a substantial amount of code in the kernel which does not meet the coding | 27 | advisory. As a result, there is a substantial amount of code in the kernel |
28 | style guidelines. The presence of that code leads to two independent | 28 | which does not meet the coding style guidelines. The presence of that code |
29 | hazards for kernel developers. | 29 | leads to two independent hazards for kernel developers. |
30 | 30 | ||
31 | The first of these is to believe that the kernel coding standards do not | 31 | The first of these is to believe that the kernel coding standards do not |
32 | matter and are not enforced. The truth of the matter is that adding new | 32 | matter and are not enforced. The truth of the matter is that adding new |
@@ -343,9 +343,10 @@ user-space developers to know what they are working with. See | |||
343 | Documentation/ABI/README for a description of how this documentation should | 343 | Documentation/ABI/README for a description of how this documentation should |
344 | be formatted and what information needs to be provided. | 344 | be formatted and what information needs to be provided. |
345 | 345 | ||
346 | The file Documentation/admin-guide/kernel-parameters.rst describes all of the kernel's | 346 | The file :ref:`Documentation/admin-guide/kernel-parameters.rst |
347 | boot-time parameters. Any patch which adds new parameters should add the | 347 | <kernelparameters>` describes all of the kernel's boot-time parameters. |
348 | appropriate entries to this file. | 348 | Any patch which adds new parameters should add the appropriate entries to |
349 | this file. | ||
349 | 350 | ||
350 | Any new configuration options must be accompanied by help text which | 351 | Any new configuration options must be accompanied by help text which |
351 | clearly explains the options and when the user might want to select them. | 352 | clearly explains the options and when the user might want to select them. |
diff --git a/Documentation/process/applying-patches.rst b/Documentation/process/applying-patches.rst index 87825cf96f33..a0d058cc6d25 100644 --- a/Documentation/process/applying-patches.rst +++ b/Documentation/process/applying-patches.rst | |||
@@ -250,17 +250,11 @@ specific homes. | |||
250 | 250 | ||
251 | The 4.x.y (-stable) and 4.x patches live at | 251 | The 4.x.y (-stable) and 4.x patches live at |
252 | 252 | ||
253 | ftp://ftp.kernel.org/pub/linux/kernel/v4.x/ | 253 | https://www.kernel.org/pub/linux/kernel/v4.x/ |
254 | 254 | ||
255 | The -rc patches live at | 255 | The -rc patches live at |
256 | 256 | ||
257 | ftp://ftp.kernel.org/pub/linux/kernel/v4.x/testing/ | 257 | https://www.kernel.org/pub/linux/kernel/v4.x/testing/ |
258 | |||
259 | In place of ``ftp.kernel.org`` you can use ``ftp.cc.kernel.org``, where cc is a | ||
260 | country code. This way you'll be downloading from a mirror site that's most | ||
261 | likely geographically closer to you, resulting in faster downloads for you, | ||
262 | less bandwidth used globally and less load on the main kernel.org servers -- | ||
263 | these are good things, so do use mirrors when possible. | ||
264 | 258 | ||
265 | 259 | ||
266 | The 4.x kernels | 260 | The 4.x kernels |
@@ -317,7 +311,7 @@ the current stable kernel. | |||
317 | The -stable team usually do make incremental patches available as well | 311 | The -stable team usually do make incremental patches available as well |
318 | as patches against the latest mainline release, but I only cover the | 312 | as patches against the latest mainline release, but I only cover the |
319 | non-incremental ones below. The incremental ones can be found at | 313 | non-incremental ones below. The incremental ones can be found at |
320 | ftp://ftp.kernel.org/pub/linux/kernel/v4.x/incr/ | 314 | https://www.kernel.org/pub/linux/kernel/v4.x/incr/ |
321 | 315 | ||
322 | These patches are not incremental, meaning that for example the 4.7.3 | 316 | These patches are not incremental, meaning that for example the 4.7.3 |
323 | patch does not apply on top of the 4.7.2 kernel source, but rather on top | 317 | patch does not apply on top of the 4.7.2 kernel source, but rather on top |
diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst index 56ce66114665..01c5dbcd0f84 100644 --- a/Documentation/process/changes.rst +++ b/Documentation/process/changes.rst | |||
@@ -318,9 +318,10 @@ PDF outputs, it is recommended to use version 1.4.6. | |||
318 | .. note:: | 318 | .. note:: |
319 | 319 | ||
320 | Please notice that, for PDF and LaTeX output, you'll also need ``XeLaTeX`` | 320 | Please notice that, for PDF and LaTeX output, you'll also need ``XeLaTeX`` |
321 | version 3.14159265. Depending on the distribution, you may also need | 321 | version 3.14159265. Depending on the distribution, you may also need to |
322 | to install a series of ``texlive`` packages that provide the minimal | 322 | install a series of ``texlive`` packages that provide the minimal set of |
323 | set of functionalities required for ``XeLaTex`` to work. | 323 | functionalities required for ``XeLaTex`` to work. For PDF output you'll also |
324 | need ``convert(1)`` from ImageMagick (https://www.imagemagick.org). | ||
324 | 325 | ||
325 | Other tools | 326 | Other tools |
326 | ----------- | 327 | ----------- |
@@ -348,7 +349,7 @@ Make | |||
348 | Binutils | 349 | Binutils |
349 | -------- | 350 | -------- |
350 | 351 | ||
351 | - <ftp://ftp.kernel.org/pub/linux/devel/binutils/> | 352 | - <https://www.kernel.org/pub/linux/devel/binutils/> |
352 | 353 | ||
353 | OpenSSL | 354 | OpenSSL |
354 | ------- | 355 | ------- |
@@ -361,17 +362,17 @@ System utilities | |||
361 | Util-linux | 362 | Util-linux |
362 | ---------- | 363 | ---------- |
363 | 364 | ||
364 | - <ftp://ftp.kernel.org/pub/linux/utils/util-linux/> | 365 | - <https://www.kernel.org/pub/linux/utils/util-linux/> |
365 | 366 | ||
366 | Ksymoops | 367 | Ksymoops |
367 | -------- | 368 | -------- |
368 | 369 | ||
369 | - <ftp://ftp.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/> | 370 | - <https://www.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/> |
370 | 371 | ||
371 | Module-Init-Tools | 372 | Module-Init-Tools |
372 | ----------------- | 373 | ----------------- |
373 | 374 | ||
374 | - <ftp://ftp.kernel.org/pub/linux/kernel/people/rusty/modules/> | 375 | - <https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/> |
375 | 376 | ||
376 | Mkinitrd | 377 | Mkinitrd |
377 | -------- | 378 | -------- |
@@ -401,7 +402,7 @@ Xfsprogs | |||
401 | Pcmciautils | 402 | Pcmciautils |
402 | ----------- | 403 | ----------- |
403 | 404 | ||
404 | - <ftp://ftp.kernel.org/pub/linux/utils/kernel/pcmcia/> | 405 | - <https://www.kernel.org/pub/linux/utils/kernel/pcmcia/> |
405 | 406 | ||
406 | Quota-tools | 407 | Quota-tools |
407 | ----------- | 408 | ----------- |
diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py index df0419c62096..cf13ff3a656c 100644 --- a/Documentation/sphinx/cdomain.py +++ b/Documentation/sphinx/cdomain.py | |||
@@ -44,7 +44,7 @@ from sphinx.domains.c import CDomain as Base_CDomain | |||
44 | __version__ = '1.0' | 44 | __version__ = '1.0' |
45 | 45 | ||
46 | # Get Sphinx version | 46 | # Get Sphinx version |
47 | major, minor, patch = map(int, sphinx.__version__.split(".")) | 47 | major, minor, patch = sphinx.version_info[:3] |
48 | 48 | ||
49 | def setup(app): | 49 | def setup(app): |
50 | 50 | ||
diff --git a/Documentation/sphinx/kfigure.py b/Documentation/sphinx/kfigure.py new file mode 100644 index 000000000000..cef4ad19624c --- /dev/null +++ b/Documentation/sphinx/kfigure.py | |||
@@ -0,0 +1,551 @@ | |||
1 | # -*- coding: utf-8; mode: python -*- | ||
2 | # pylint: disable=C0103, R0903, R0912, R0915 | ||
3 | u""" | ||
4 | scalable figure and image handling | ||
5 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
6 | |||
7 | Sphinx extension which implements scalable image handling. | ||
8 | |||
9 | :copyright: Copyright (C) 2016 Markus Heiser | ||
10 | :license: GPL Version 2, June 1991 see Linux/COPYING for details. | ||
11 | |||
12 | The build for image formats depend on image's source format and output's | ||
13 | destination format. This extension implement methods to simplify image | ||
14 | handling from the author's POV. Directives like ``kernel-figure`` implement | ||
15 | methods *to* always get the best output-format even if some tools are not | ||
16 | installed. For more details take a look at ``convert_image(...)`` which is | ||
17 | the core of all conversions. | ||
18 | |||
19 | * ``.. kernel-image``: for image handling / a ``.. image::`` replacement | ||
20 | |||
21 | * ``.. kernel-figure``: for figure handling / a ``.. figure::`` replacement | ||
22 | |||
23 | * ``.. kernel-render``: for render markup / a concept to embed *render* | ||
24 | markups (or languages). Supported markups (see ``RENDER_MARKUP_EXT``) | ||
25 | |||
26 | - ``DOT``: render embedded Graphviz's **DOC** | ||
27 | - ``SVG``: render embedded Scalable Vector Graphics (**SVG**) | ||
28 | - ... *developable* | ||
29 | |||
30 | Used tools: | ||
31 | |||
32 | * ``dot(1)``: Graphviz (http://www.graphviz.org). If Graphviz is not | ||
33 | available, the DOT language is inserted as literal-block. | ||
34 | |||
35 | * SVG to PDF: To generate PDF, you need at least one of this tools: | ||
36 | |||
37 | - ``convert(1)``: ImageMagick (https://www.imagemagick.org) | ||
38 | |||
39 | List of customizations: | ||
40 | |||
41 | * generate PDF from SVG / used by PDF (LaTeX) builder | ||
42 | |||
43 | * generate SVG (html-builder) and PDF (latex-builder) from DOT files. | ||
44 | DOT: see http://www.graphviz.org/content/dot-language | ||
45 | |||
46 | """ | ||
47 | |||
48 | import os | ||
49 | from os import path | ||
50 | import subprocess | ||
51 | from hashlib import sha1 | ||
52 | import sys | ||
53 | |||
54 | from docutils import nodes | ||
55 | from docutils.statemachine import ViewList | ||
56 | from docutils.parsers.rst import directives | ||
57 | from docutils.parsers.rst.directives import images | ||
58 | import sphinx | ||
59 | |||
60 | from sphinx.util.nodes import clean_astext | ||
61 | from six import iteritems | ||
62 | |||
63 | PY3 = sys.version_info[0] == 3 | ||
64 | |||
65 | if PY3: | ||
66 | _unicode = str | ||
67 | else: | ||
68 | _unicode = unicode | ||
69 | |||
70 | # Get Sphinx version | ||
71 | major, minor, patch = sphinx.version_info[:3] | ||
72 | if major == 1 and minor > 3: | ||
73 | # patches.Figure only landed in Sphinx 1.4 | ||
74 | from sphinx.directives.patches import Figure # pylint: disable=C0413 | ||
75 | else: | ||
76 | Figure = images.Figure | ||
77 | |||
78 | __version__ = '1.0.0' | ||
79 | |||
80 | # simple helper | ||
81 | # ------------- | ||
82 | |||
83 | def which(cmd): | ||
84 | """Searches the ``cmd`` in the ``PATH`` enviroment. | ||
85 | |||
86 | This *which* searches the PATH for executable ``cmd`` . First match is | ||
87 | returned, if nothing is found, ``None` is returned. | ||
88 | """ | ||
89 | envpath = os.environ.get('PATH', None) or os.defpath | ||
90 | for folder in envpath.split(os.pathsep): | ||
91 | fname = folder + os.sep + cmd | ||
92 | if path.isfile(fname): | ||
93 | return fname | ||
94 | |||
95 | def mkdir(folder, mode=0o775): | ||
96 | if not path.isdir(folder): | ||
97 | os.makedirs(folder, mode) | ||
98 | |||
99 | def file2literal(fname): | ||
100 | with open(fname, "r") as src: | ||
101 | data = src.read() | ||
102 | node = nodes.literal_block(data, data) | ||
103 | return node | ||
104 | |||
105 | def isNewer(path1, path2): | ||
106 | """Returns True if ``path1`` is newer than ``path2`` | ||
107 | |||
108 | If ``path1`` exists and is newer than ``path2`` the function returns | ||
109 | ``True`` is returned otherwise ``False`` | ||
110 | """ | ||
111 | return (path.exists(path1) | ||
112 | and os.stat(path1).st_ctime > os.stat(path2).st_ctime) | ||
113 | |||
114 | def pass_handle(self, node): # pylint: disable=W0613 | ||
115 | pass | ||
116 | |||
117 | # setup conversion tools and sphinx extension | ||
118 | # ------------------------------------------- | ||
119 | |||
120 | # Graphviz's dot(1) support | ||
121 | dot_cmd = None | ||
122 | |||
123 | # ImageMagick' convert(1) support | ||
124 | convert_cmd = None | ||
125 | |||
126 | |||
127 | def setup(app): | ||
128 | # check toolchain first | ||
129 | app.connect('builder-inited', setupTools) | ||
130 | |||
131 | # image handling | ||
132 | app.add_directive("kernel-image", KernelImage) | ||
133 | app.add_node(kernel_image, | ||
134 | html = (visit_kernel_image, pass_handle), | ||
135 | latex = (visit_kernel_image, pass_handle), | ||
136 | texinfo = (visit_kernel_image, pass_handle), | ||
137 | text = (visit_kernel_image, pass_handle), | ||
138 | man = (visit_kernel_image, pass_handle), ) | ||
139 | |||
140 | # figure handling | ||
141 | app.add_directive("kernel-figure", KernelFigure) | ||
142 | app.add_node(kernel_figure, | ||
143 | html = (visit_kernel_figure, pass_handle), | ||
144 | latex = (visit_kernel_figure, pass_handle), | ||
145 | texinfo = (visit_kernel_figure, pass_handle), | ||
146 | text = (visit_kernel_figure, pass_handle), | ||
147 | man = (visit_kernel_figure, pass_handle), ) | ||
148 | |||
149 | # render handling | ||
150 | app.add_directive('kernel-render', KernelRender) | ||
151 | app.add_node(kernel_render, | ||
152 | html = (visit_kernel_render, pass_handle), | ||
153 | latex = (visit_kernel_render, pass_handle), | ||
154 | texinfo = (visit_kernel_render, pass_handle), | ||
155 | text = (visit_kernel_render, pass_handle), | ||
156 | man = (visit_kernel_render, pass_handle), ) | ||
157 | |||
158 | app.connect('doctree-read', add_kernel_figure_to_std_domain) | ||
159 | |||
160 | return dict( | ||
161 | version = __version__, | ||
162 | parallel_read_safe = True, | ||
163 | parallel_write_safe = True | ||
164 | ) | ||
165 | |||
166 | |||
167 | def setupTools(app): | ||
168 | u""" | ||
169 | Check available build tools and log some *verbose* messages. | ||
170 | |||
171 | This function is called once, when the builder is initiated. | ||
172 | """ | ||
173 | global dot_cmd, convert_cmd # pylint: disable=W0603 | ||
174 | app.verbose("kfigure: check installed tools ...") | ||
175 | |||
176 | dot_cmd = which('dot') | ||
177 | convert_cmd = which('convert') | ||
178 | |||
179 | if dot_cmd: | ||
180 | app.verbose("use dot(1) from: " + dot_cmd) | ||
181 | else: | ||
182 | app.warn("dot(1) not found, for better output quality install " | ||
183 | "graphviz from http://www.graphviz.org") | ||
184 | if convert_cmd: | ||
185 | app.verbose("use convert(1) from: " + convert_cmd) | ||
186 | else: | ||
187 | app.warn( | ||
188 | "convert(1) not found, for SVG to PDF conversion install " | ||
189 | "ImageMagick (https://www.imagemagick.org)") | ||
190 | |||
191 | |||
192 | # integrate conversion tools | ||
193 | # -------------------------- | ||
194 | |||
195 | RENDER_MARKUP_EXT = { | ||
196 | # The '.ext' must be handled by convert_image(..) function's *in_ext* input. | ||
197 | # <name> : <.ext> | ||
198 | 'DOT' : '.dot', | ||
199 | 'SVG' : '.svg' | ||
200 | } | ||
201 | |||
202 | def convert_image(img_node, translator, src_fname=None): | ||
203 | """Convert a image node for the builder. | ||
204 | |||
205 | Different builder prefer different image formats, e.g. *latex* builder | ||
206 | prefer PDF while *html* builder prefer SVG format for images. | ||
207 | |||
208 | This function handles output image formats in dependence of source the | ||
209 | format (of the image) and the translator's output format. | ||
210 | """ | ||
211 | app = translator.builder.app | ||
212 | |||
213 | fname, in_ext = path.splitext(path.basename(img_node['uri'])) | ||
214 | if src_fname is None: | ||
215 | src_fname = path.join(translator.builder.srcdir, img_node['uri']) | ||
216 | if not path.exists(src_fname): | ||
217 | src_fname = path.join(translator.builder.outdir, img_node['uri']) | ||
218 | |||
219 | dst_fname = None | ||
220 | |||
221 | # in kernel builds, use 'make SPHINXOPTS=-v' to see verbose messages | ||
222 | |||
223 | app.verbose('assert best format for: ' + img_node['uri']) | ||
224 | |||
225 | if in_ext == '.dot': | ||
226 | |||
227 | if not dot_cmd: | ||
228 | app.verbose("dot from graphviz not available / include DOT raw.") | ||
229 | img_node.replace_self(file2literal(src_fname)) | ||
230 | |||
231 | elif translator.builder.format == 'latex': | ||
232 | dst_fname = path.join(translator.builder.outdir, fname + '.pdf') | ||
233 | img_node['uri'] = fname + '.pdf' | ||
234 | img_node['candidates'] = {'*': fname + '.pdf'} | ||
235 | |||
236 | |||
237 | elif translator.builder.format == 'html': | ||
238 | dst_fname = path.join( | ||
239 | translator.builder.outdir, | ||
240 | translator.builder.imagedir, | ||
241 | fname + '.svg') | ||
242 | img_node['uri'] = path.join( | ||
243 | translator.builder.imgpath, fname + '.svg') | ||
244 | img_node['candidates'] = { | ||
245 | '*': path.join(translator.builder.imgpath, fname + '.svg')} | ||
246 | |||
247 | else: | ||
248 | # all other builder formats will include DOT as raw | ||
249 | img_node.replace_self(file2literal(src_fname)) | ||
250 | |||
251 | elif in_ext == '.svg': | ||
252 | |||
253 | if translator.builder.format == 'latex': | ||
254 | if convert_cmd is None: | ||
255 | app.verbose("no SVG to PDF conversion available / include SVG raw.") | ||
256 | img_node.replace_self(file2literal(src_fname)) | ||
257 | else: | ||
258 | dst_fname = path.join(translator.builder.outdir, fname + '.pdf') | ||
259 | img_node['uri'] = fname + '.pdf' | ||
260 | img_node['candidates'] = {'*': fname + '.pdf'} | ||
261 | |||
262 | if dst_fname: | ||
263 | # the builder needs not to copy one more time, so pop it if exists. | ||
264 | translator.builder.images.pop(img_node['uri'], None) | ||
265 | _name = dst_fname[len(translator.builder.outdir) + 1:] | ||
266 | |||
267 | if isNewer(dst_fname, src_fname): | ||
268 | app.verbose("convert: {out}/%s already exists and is newer" % _name) | ||
269 | |||
270 | else: | ||
271 | ok = False | ||
272 | mkdir(path.dirname(dst_fname)) | ||
273 | |||
274 | if in_ext == '.dot': | ||
275 | app.verbose('convert DOT to: {out}/' + _name) | ||
276 | ok = dot2format(app, src_fname, dst_fname) | ||
277 | |||
278 | elif in_ext == '.svg': | ||
279 | app.verbose('convert SVG to: {out}/' + _name) | ||
280 | ok = svg2pdf(app, src_fname, dst_fname) | ||
281 | |||
282 | if not ok: | ||
283 | img_node.replace_self(file2literal(src_fname)) | ||
284 | |||
285 | |||
286 | def dot2format(app, dot_fname, out_fname): | ||
287 | """Converts DOT file to ``out_fname`` using ``dot(1)``. | ||
288 | |||
289 | * ``dot_fname`` pathname of the input DOT file, including extension ``.dot`` | ||
290 | * ``out_fname`` pathname of the output file, including format extension | ||
291 | |||
292 | The *format extension* depends on the ``dot`` command (see ``man dot`` | ||
293 | option ``-Txxx``). Normally you will use one of the following extensions: | ||
294 | |||
295 | - ``.ps`` for PostScript, | ||
296 | - ``.svg`` or ``svgz`` for Structured Vector Graphics, | ||
297 | - ``.fig`` for XFIG graphics and | ||
298 | - ``.png`` or ``gif`` for common bitmap graphics. | ||
299 | |||
300 | """ | ||
301 | out_format = path.splitext(out_fname)[1][1:] | ||
302 | cmd = [dot_cmd, '-T%s' % out_format, dot_fname] | ||
303 | exit_code = 42 | ||
304 | |||
305 | with open(out_fname, "w") as out: | ||
306 | exit_code = subprocess.call(cmd, stdout = out) | ||
307 | if exit_code != 0: | ||
308 | app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd))) | ||
309 | return bool(exit_code == 0) | ||
310 | |||
311 | def svg2pdf(app, svg_fname, pdf_fname): | ||
312 | """Converts SVG to PDF with ``convert(1)`` command. | ||
313 | |||
314 | Uses ``convert(1)`` from ImageMagick (https://www.imagemagick.org) for | ||
315 | conversion. Returns ``True`` on success and ``False`` if an error occurred. | ||
316 | |||
317 | * ``svg_fname`` pathname of the input SVG file with extension (``.svg``) | ||
318 | * ``pdf_name`` pathname of the output PDF file with extension (``.pdf``) | ||
319 | |||
320 | """ | ||
321 | cmd = [convert_cmd, svg_fname, pdf_fname] | ||
322 | # use stdout and stderr from parent | ||
323 | exit_code = subprocess.call(cmd) | ||
324 | if exit_code != 0: | ||
325 | app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd))) | ||
326 | return bool(exit_code == 0) | ||
327 | |||
328 | |||
329 | # image handling | ||
330 | # --------------------- | ||
331 | |||
332 | def visit_kernel_image(self, node): # pylint: disable=W0613 | ||
333 | """Visitor of the ``kernel_image`` Node. | ||
334 | |||
335 | Handles the ``image`` child-node with the ``convert_image(...)``. | ||
336 | """ | ||
337 | img_node = node[0] | ||
338 | convert_image(img_node, self) | ||
339 | |||
340 | class kernel_image(nodes.image): | ||
341 | """Node for ``kernel-image`` directive.""" | ||
342 | pass | ||
343 | |||
344 | class KernelImage(images.Image): | ||
345 | u"""KernelImage directive | ||
346 | |||
347 | Earns everything from ``.. image::`` directive, except *remote URI* and | ||
348 | *glob* pattern. The KernelImage wraps a image node into a | ||
349 | kernel_image node. See ``visit_kernel_image``. | ||
350 | """ | ||
351 | |||
352 | def run(self): | ||
353 | uri = self.arguments[0] | ||
354 | if uri.endswith('.*') or uri.find('://') != -1: | ||
355 | raise self.severe( | ||
356 | 'Error in "%s: %s": glob pattern and remote images are not allowed' | ||
357 | % (self.name, uri)) | ||
358 | result = images.Image.run(self) | ||
359 | if len(result) == 2 or isinstance(result[0], nodes.system_message): | ||
360 | return result | ||
361 | (image_node,) = result | ||
362 | # wrap image node into a kernel_image node / see visitors | ||
363 | node = kernel_image('', image_node) | ||
364 | return [node] | ||
365 | |||
366 | # figure handling | ||
367 | # --------------------- | ||
368 | |||
369 | def visit_kernel_figure(self, node): # pylint: disable=W0613 | ||
370 | """Visitor of the ``kernel_figure`` Node. | ||
371 | |||
372 | Handles the ``image`` child-node with the ``convert_image(...)``. | ||
373 | """ | ||
374 | img_node = node[0][0] | ||
375 | convert_image(img_node, self) | ||
376 | |||
377 | class kernel_figure(nodes.figure): | ||
378 | """Node for ``kernel-figure`` directive.""" | ||
379 | |||
380 | class KernelFigure(Figure): | ||
381 | u"""KernelImage directive | ||
382 | |||
383 | Earns everything from ``.. figure::`` directive, except *remote URI* and | ||
384 | *glob* pattern. The KernelFigure wraps a figure node into a kernel_figure | ||
385 | node. See ``visit_kernel_figure``. | ||
386 | """ | ||
387 | |||
388 | def run(self): | ||
389 | uri = self.arguments[0] | ||
390 | if uri.endswith('.*') or uri.find('://') != -1: | ||
391 | raise self.severe( | ||
392 | 'Error in "%s: %s":' | ||
393 | ' glob pattern and remote images are not allowed' | ||
394 | % (self.name, uri)) | ||
395 | result = Figure.run(self) | ||
396 | if len(result) == 2 or isinstance(result[0], nodes.system_message): | ||
397 | return result | ||
398 | (figure_node,) = result | ||
399 | # wrap figure node into a kernel_figure node / see visitors | ||
400 | node = kernel_figure('', figure_node) | ||
401 | return [node] | ||
402 | |||
403 | |||
404 | # render handling | ||
405 | # --------------------- | ||
406 | |||
407 | def visit_kernel_render(self, node): | ||
408 | """Visitor of the ``kernel_render`` Node. | ||
409 | |||
410 | If rendering tools available, save the markup of the ``literal_block`` child | ||
411 | node into a file and replace the ``literal_block`` node with a new created | ||
412 | ``image`` node, pointing to the saved markup file. Afterwards, handle the | ||
413 | image child-node with the ``convert_image(...)``. | ||
414 | """ | ||
415 | app = self.builder.app | ||
416 | srclang = node.get('srclang') | ||
417 | |||
418 | app.verbose('visit kernel-render node lang: "%s"' % (srclang)) | ||
419 | |||
420 | tmp_ext = RENDER_MARKUP_EXT.get(srclang, None) | ||
421 | if tmp_ext is None: | ||
422 | app.warn('kernel-render: "%s" unknow / include raw.' % (srclang)) | ||
423 | return | ||
424 | |||
425 | if not dot_cmd and tmp_ext == '.dot': | ||
426 | app.verbose("dot from graphviz not available / include raw.") | ||
427 | return | ||
428 | |||
429 | literal_block = node[0] | ||
430 | |||
431 | code = literal_block.astext() | ||
432 | hashobj = code.encode('utf-8') # str(node.attributes) | ||
433 | fname = path.join('%s-%s' % (srclang, sha1(hashobj).hexdigest())) | ||
434 | |||
435 | tmp_fname = path.join( | ||
436 | self.builder.outdir, self.builder.imagedir, fname + tmp_ext) | ||
437 | |||
438 | if not path.isfile(tmp_fname): | ||
439 | mkdir(path.dirname(tmp_fname)) | ||
440 | with open(tmp_fname, "w") as out: | ||
441 | out.write(code) | ||
442 | |||
443 | img_node = nodes.image(node.rawsource, **node.attributes) | ||
444 | img_node['uri'] = path.join(self.builder.imgpath, fname + tmp_ext) | ||
445 | img_node['candidates'] = { | ||
446 | '*': path.join(self.builder.imgpath, fname + tmp_ext)} | ||
447 | |||
448 | literal_block.replace_self(img_node) | ||
449 | convert_image(img_node, self, tmp_fname) | ||
450 | |||
451 | |||
452 | class kernel_render(nodes.General, nodes.Inline, nodes.Element): | ||
453 | """Node for ``kernel-render`` directive.""" | ||
454 | pass | ||
455 | |||
456 | class KernelRender(Figure): | ||
457 | u"""KernelRender directive | ||
458 | |||
459 | Render content by external tool. Has all the options known from the | ||
460 | *figure* directive, plus option ``caption``. If ``caption`` has a | ||
461 | value, a figure node with the *caption* is inserted. If not, a image node is | ||
462 | inserted. | ||
463 | |||
464 | The KernelRender directive wraps the text of the directive into a | ||
465 | literal_block node and wraps it into a kernel_render node. See | ||
466 | ``visit_kernel_render``. | ||
467 | """ | ||
468 | has_content = True | ||
469 | required_arguments = 1 | ||
470 | optional_arguments = 0 | ||
471 | final_argument_whitespace = False | ||
472 | |||
473 | # earn options from 'figure' | ||
474 | option_spec = Figure.option_spec.copy() | ||
475 | option_spec['caption'] = directives.unchanged | ||
476 | |||
477 | def run(self): | ||
478 | return [self.build_node()] | ||
479 | |||
480 | def build_node(self): | ||
481 | |||
482 | srclang = self.arguments[0].strip() | ||
483 | if srclang not in RENDER_MARKUP_EXT.keys(): | ||
484 | return [self.state_machine.reporter.warning( | ||
485 | 'Unknow source language "%s", use one of: %s.' % ( | ||
486 | srclang, ",".join(RENDER_MARKUP_EXT.keys())), | ||
487 | line=self.lineno)] | ||
488 | |||
489 | code = '\n'.join(self.content) | ||
490 | if not code.strip(): | ||
491 | return [self.state_machine.reporter.warning( | ||
492 | 'Ignoring "%s" directive without content.' % ( | ||
493 | self.name), | ||
494 | line=self.lineno)] | ||
495 | |||
496 | node = kernel_render() | ||
497 | node['alt'] = self.options.get('alt','') | ||
498 | node['srclang'] = srclang | ||
499 | literal_node = nodes.literal_block(code, code) | ||
500 | node += literal_node | ||
501 | |||
502 | caption = self.options.get('caption') | ||
503 | if caption: | ||
504 | # parse caption's content | ||
505 | parsed = nodes.Element() | ||
506 | self.state.nested_parse( | ||
507 | ViewList([caption], source=''), self.content_offset, parsed) | ||
508 | caption_node = nodes.caption( | ||
509 | parsed[0].rawsource, '', *parsed[0].children) | ||
510 | caption_node.source = parsed[0].source | ||
511 | caption_node.line = parsed[0].line | ||
512 | |||
513 | figure_node = nodes.figure('', node) | ||
514 | for k,v in self.options.items(): | ||
515 | figure_node[k] = v | ||
516 | figure_node += caption_node | ||
517 | |||
518 | node = figure_node | ||
519 | |||
520 | return node | ||
521 | |||
522 | def add_kernel_figure_to_std_domain(app, doctree): | ||
523 | """Add kernel-figure anchors to 'std' domain. | ||
524 | |||
525 | The ``StandardDomain.process_doc(..)`` method does not know how to resolve | ||
526 | the caption (label) of ``kernel-figure`` directive (it only knows about | ||
527 | standard nodes, e.g. table, figure etc.). Without any additional handling | ||
528 | this will result in a 'undefined label' for kernel-figures. | ||
529 | |||
530 | This handle adds labels of kernel-figure to the 'std' domain labels. | ||
531 | """ | ||
532 | |||
533 | std = app.env.domains["std"] | ||
534 | docname = app.env.docname | ||
535 | labels = std.data["labels"] | ||
536 | |||
537 | for name, explicit in iteritems(doctree.nametypes): | ||
538 | if not explicit: | ||
539 | continue | ||
540 | labelid = doctree.nameids[name] | ||
541 | if labelid is None: | ||
542 | continue | ||
543 | node = doctree.ids[labelid] | ||
544 | |||
545 | if node.tagname == 'kernel_figure': | ||
546 | for n in node.next_node(): | ||
547 | if n.tagname == 'caption': | ||
548 | sectname = clean_astext(n) | ||
549 | # add label to std domain | ||
550 | labels[name] = docname, labelid, sectname | ||
551 | break | ||
diff --git a/Documentation/sphinx/tmplcvt b/Documentation/sphinx/tmplcvt index 909a73065e0a..6848f0a26fa5 100755 --- a/Documentation/sphinx/tmplcvt +++ b/Documentation/sphinx/tmplcvt | |||
@@ -7,13 +7,22 @@ | |||
7 | # fix \_ | 7 | # fix \_ |
8 | # title line? | 8 | # title line? |
9 | # | 9 | # |
10 | set -eu | ||
11 | |||
12 | if [ "$#" != "2" ]; then | ||
13 | echo "$0 <docbook file> <rst file>" | ||
14 | exit | ||
15 | fi | ||
16 | |||
17 | DIR=$(dirname $0) | ||
10 | 18 | ||
11 | in=$1 | 19 | in=$1 |
12 | rst=$2 | 20 | rst=$2 |
13 | tmp=$rst.tmp | 21 | tmp=$rst.tmp |
14 | 22 | ||
15 | cp $in $tmp | 23 | cp $in $tmp |
16 | sed --in-place -f convert_template.sed $tmp | 24 | sed --in-place -f $DIR/convert_template.sed $tmp |
17 | pandoc -s -S -f docbook -t rst -o $rst $tmp | 25 | pandoc -s -S -f docbook -t rst -o $rst $tmp |
18 | sed --in-place -f post_convert.sed $rst | 26 | sed --in-place -f $DIR/post_convert.sed $rst |
19 | rm $tmp | 27 | rm $tmp |
28 | echo "book writen to $rst" | ||
diff --git a/Documentation/static-keys.txt b/Documentation/static-keys.txt index 32a25fad0c1b..ef419fd0897f 100644 --- a/Documentation/static-keys.txt +++ b/Documentation/static-keys.txt | |||
@@ -118,7 +118,7 @@ Or: | |||
118 | 118 | ||
119 | Keys defined via DEFINE_STATIC_KEY_TRUE(), or DEFINE_STATIC_KEY_FALSE, may | 119 | Keys defined via DEFINE_STATIC_KEY_TRUE(), or DEFINE_STATIC_KEY_FALSE, may |
120 | be used in either static_branch_likely() or static_branch_unlikely() | 120 | be used in either static_branch_likely() or static_branch_unlikely() |
121 | statemnts. | 121 | statements. |
122 | 122 | ||
123 | Branch(es) can be set true via: | 123 | Branch(es) can be set true via: |
124 | 124 | ||
diff --git a/Documentation/sync_file.txt b/Documentation/sync_file.txt index 269681a6faec..c3d033a06e8d 100644 --- a/Documentation/sync_file.txt +++ b/Documentation/sync_file.txt | |||
@@ -37,7 +37,7 @@ dma_fence_signal(), when it has finished using (or processing) that buffer. | |||
37 | Out-fences are fences that the driver creates. | 37 | Out-fences are fences that the driver creates. |
38 | 38 | ||
39 | On the other hand if the driver receives fence(s) through a sync_file from | 39 | On the other hand if the driver receives fence(s) through a sync_file from |
40 | userspace we call these fence(s) 'in-fences'. Receiveing in-fences means that | 40 | userspace we call these fence(s) 'in-fences'. Receiving in-fences means that |
41 | we need to wait for the fence(s) to signal before using any buffer related to | 41 | we need to wait for the fence(s) to signal before using any buffer related to |
42 | the in-fences. | 42 | the in-fences. |
43 | 43 | ||
diff --git a/Documentation/thermal/intel_powerclamp.txt b/Documentation/thermal/intel_powerclamp.txt index 60073dc9f748..b5df21168fbc 100644 --- a/Documentation/thermal/intel_powerclamp.txt +++ b/Documentation/thermal/intel_powerclamp.txt | |||
@@ -268,6 +268,15 @@ cur_state:0 | |||
268 | max_state:50 | 268 | max_state:50 |
269 | type:intel_powerclamp | 269 | type:intel_powerclamp |
270 | 270 | ||
271 | cur_state allows user to set the desired idle percentage. Writing 0 to | ||
272 | cur_state will stop idle injection. Writing a value between 1 and | ||
273 | max_state will start the idle injection. Reading cur_state returns the | ||
274 | actual and current idle percentage. This may not be the same value | ||
275 | set by the user in that current idle percentage depends on workload | ||
276 | and includes natural idle. When idle injection is disabled, reading | ||
277 | cur_state returns value -1 instead of 0 which is to avoid confusing | ||
278 | 100% busy state with the disabled state. | ||
279 | |||
271 | Example usage: | 280 | Example usage: |
272 | - To inject 25% idle time | 281 | - To inject 25% idle time |
273 | $ sudo sh -c "echo 25 > /sys/class/thermal/cooling_device80/cur_state | 282 | $ sudo sh -c "echo 25 > /sys/class/thermal/cooling_device80/cur_state |
@@ -278,11 +287,12 @@ then the powerclamp driver will not start idle injection. Using Top | |||
278 | will not show idle injection kernel threads. | 287 | will not show idle injection kernel threads. |
279 | 288 | ||
280 | If the system is busy (spin test below) and has less than 25% natural | 289 | If the system is busy (spin test below) and has less than 25% natural |
281 | idle time, powerclamp kernel threads will do idle injection, which | 290 | idle time, powerclamp kernel threads will do idle injection. Forced |
282 | appear running to the scheduler. But the overall system idle is still | 291 | idle time is accounted as normal idle in that common code path is |
283 | reflected. In this example, 24.1% idle is shown. This helps the | 292 | taken as the idle task. |
284 | system admin or user determine the cause of slowdown, when a | 293 | |
285 | powerclamp driver is in action. | 294 | In this example, 24.1% idle is shown. This helps the system admin or |
295 | user determine the cause of slowdown, when a powerclamp driver is in action. | ||
286 | 296 | ||
287 | 297 | ||
288 | Tasks: 197 total, 1 running, 196 sleeping, 0 stopped, 0 zombie | 298 | Tasks: 197 total, 1 running, 196 sleeping, 0 stopped, 0 zombie |
diff --git a/Documentation/translations/ja_JP/HOWTO b/Documentation/translations/ja_JP/howto.rst index 4ebd20750ef1..4511eed0fabb 100644 --- a/Documentation/translations/ja_JP/HOWTO +++ b/Documentation/translations/ja_JP/howto.rst | |||
@@ -1,95 +1,81 @@ | |||
1 | NOTE: | 1 | NOTE: |
2 | This is a version of Documentation/HOWTO translated into Japanese. | 2 | This is a version of Documentation/HOWTO translated into Japanese. |
3 | This document is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com> | 3 | This document is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com> |
4 | and the JF Project team <www.linux.or.jp/JF>. | 4 | If you find any difference between this document and the original file or |
5 | If you find any difference between this document and the original file | 5 | a problem with the translation, please contact the maintainer of this file. |
6 | or a problem with the translation, | 6 | |
7 | please contact the maintainer of this file or JF project. | 7 | Please also note that the purpose of this file is to be easier to |
8 | 8 | read for non English (read: Japanese) speakers and is not intended as | |
9 | Please also note that the purpose of this file is to be easier to read | 9 | a fork. So if you have any comments or updates for this file, please |
10 | for non English (read: Japanese) speakers and is not intended as a | 10 | try to update the original English file first. |
11 | fork. So if you have any comments or updates for this file, please try | 11 | |
12 | to update the original English file first. | 12 | ---------------------------------- |
13 | 13 | ||
14 | Last Updated: 2013/07/19 | 14 | ã“ã®æ–‡æ›¸ã¯ã€ |
15 | ================================== | 15 | Documentation/process/howto.rst |
16 | ã“れã¯ã€ | ||
17 | linux-3.10/Documentation/HOWTO | ||
18 | ã®å’Œè¨³ã§ã™ã€‚ | 16 | ã®å’Œè¨³ã§ã™ã€‚ |
19 | 17 | ||
20 | 翻訳団体: JF プãƒã‚¸ã‚§ã‚¯ãƒˆ < http://linuxjf.sourceforge.jp/ > | 18 | 翻訳者: Tsugikazu Shibata <tshibata@ab.jp.nec.com> |
21 | 翻訳日: 2013/7/19 | 19 | |
22 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> | 20 | ---------------------------------- |
23 | æ ¡æ£è€…: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com> | ||
24 | å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> | ||
25 | æ¦äº•伸光ã•ã‚“ã€<takei at webmasters dot gr dot jp> | ||
26 | ã‹ãã“ã•ã‚“ (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp> | ||
27 | 野å£ã•ã‚“ (Kenji Noguchi) <tokyo246 at gmail dot com> | ||
28 | 河内ã•ã‚“ (Takayoshi Kochi) <t-kochi at bq dot jp dot nec dot com> | ||
29 | 岩本ã•ã‚“ (iwamoto) <iwamoto.kn at ncos dot nec dot co dot jp> | ||
30 | 内田ã•ã‚“ (Satoshi Uchida) <s-uchida at ap dot jp dot nec dot com> | ||
31 | ================================== | ||
32 | 21 | ||
33 | Linux カーãƒãƒ«é–‹ç™ºã®ã‚„り方 | 22 | Linux カーãƒãƒ«é–‹ç™ºã®ã‚„り方 |
34 | ------------------------------- | 23 | ========================== |
35 | 24 | ||
36 | ã“れã¯ä¸Šã®ãƒˆãƒ”ック( Linux カーãƒãƒ«é–‹ç™ºã®ã‚„り方)ã®é‡è¦ãªäº‹æŸ„を網羅ã—㟠| 25 | ã“れã¯ä¸Šã®ãƒˆãƒ”ック( Linux カーãƒãƒ«é–‹ç™ºã®ã‚„り方)ã®é‡è¦ãªäº‹æŸ„を網羅ã—㟠|
37 | ドã‚ュメントã§ã™ã€‚ã“ã“ã«ã¯ Linux カーãƒãƒ«é–‹ç™ºè€…ã«ãªã‚‹ãŸã‚ã®æ–¹æ³•㨠| 26 | ドã‚ュメントã§ã™ã€‚ã“ã“ã«ã¯ Linux カーãƒãƒ«é–‹ç™ºè€…ã«ãªã‚‹ãŸã‚ã®æ–¹æ³•ã¨Linux |
38 | Linux カーãƒãƒ«é–‹ç™ºã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨å…±ã«æ´»å‹•ã™ã‚‹ã‚„り方をå¦ã¶æ–¹æ³•ãŒå«ã¾ã‚Œã¦ | 27 | カーãƒãƒ«é–‹ç™ºã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨å…±ã«æ´»å‹•ã™ã‚‹ã‚„り方をå¦ã¶æ–¹æ³•ãŒå«ã¾ã‚Œã¦ã„ã¾ã™ã€‚ |
39 | ã„ã¾ã™ã€‚カーãƒãƒ«ãƒ—ãƒã‚°ãƒ©ãƒŸãƒ³ã‚°ã«é–¢ã™ã‚‹æŠ€è¡“çš„ãªé …ç›®ã«é–¢ã™ã‚‹ã“ã¨ã¯ä½•ã‚‚å« | 28 | カーãƒãƒ«ãƒ—ãƒã‚°ãƒ©ãƒŸãƒ³ã‚°ã«é–¢ã™ã‚‹æŠ€è¡“çš„ãªé …ç›®ã«é–¢ã™ã‚‹ã“ã¨ã¯ä½•ã‚‚å«ã‚ãªã„よ |
40 | ã‚ãªã„よã†ã«ã—ã¦ã„ã¾ã™ãŒã€ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã¨ãªã‚‹ãŸã‚ã®æ£ã—ã„æ–¹å‘ã«å‘ã‹ã† | 29 | ã†ã«ã—ã¦ã„ã¾ã™ãŒã€ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã¨ãªã‚‹ãŸã‚ã®æ£ã—ã„æ–¹å‘ã«å‘ã‹ã†æ‰‹åŠ©ã‘ã« |
41 | 手助ã‘ã«ãªã‚Šã¾ã™ã€‚ | 30 | ãªã‚Šã¾ã™ã€‚ |
42 | 31 | ||
43 | ã‚‚ã—ã€ã“ã®ãƒ‰ã‚ュメントã®ã©ã“ã‹ãŒå¤ããªã£ã¦ã„ãŸå ´åˆã«ã¯ã€ã“ã®ãƒ‰ã‚ュメン | 32 | ã‚‚ã—ã€ã“ã®ãƒ‰ã‚ュメントã®ã©ã“ã‹ãŒå¤ããªã£ã¦ã„ãŸå ´åˆã«ã¯ã€ã“ã®ãƒ‰ã‚ュメント |
44 | ãƒˆã®æœ€å¾Œã«ãƒªã‚¹ãƒˆã—ãŸãƒ¡ãƒ³ãƒ†ãƒŠã«ãƒ‘ッãƒã‚’é€ã£ã¦ãã ã•ã„。 | 33 | ã®æœ€å¾Œã«ãƒªã‚¹ãƒˆã—ãŸãƒ¡ãƒ³ãƒ†ãƒŠã«ãƒ‘ッãƒã‚’é€ã£ã¦ãã ã•ã„。 |
45 | 34 | ||
46 | ã¯ã˜ã‚ã« | 35 | ã¯ã˜ã‚ã« |
47 | --------- | 36 | --------- |
48 | 37 | ||
49 | ã‚ãªãŸã¯ã€€Linux カーãƒãƒ«ã®é–‹ç™ºè€…ã«ãªã‚‹æ–¹æ³•ã‚’å¦ã³ãŸã„ã®ã§ã—ょã†ã‹ï¼Ÿã€€ã | 38 | ã‚ãªãŸã¯ Linux カーãƒãƒ«ã®é–‹ç™ºè€…ã«ãªã‚‹æ–¹æ³•ã‚’å¦ã³ãŸã„ã®ã§ã—ょã†ã‹ï¼Ÿã€€ã |
50 | れã¨ã‚‚ã‚ãªãŸã¯ä¸Šå¸ã‹ã‚‰ã€Œã“ã®ãƒ‡ãƒã‚¤ã‚¹ã® Linux ドライãƒã‚’書ãよã†ã«ã€ã¨ | 39 | れã¨ã‚‚上å¸ã‹ã‚‰ã€Œã“ã®ãƒ‡ãƒã‚¤ã‚¹ã® Linux ドライãƒã‚’書ãよã†ã«ã€ã¨è¨€ã‚れ㟠|
51 | 言ã‚れã¦ã„ã‚‹ã®ã§ã—ょã†ã‹ï¼Ÿã€€ | 40 | ã®ã‹ã‚‚ã—れã¾ã›ã‚“。ã“ã®æ–‡æ›¸ã®ç›®çš„ã¯ã€ã‚ãªãŸãŒè¸ã‚€ã¹ãæ‰‹é †ã¨ã€ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ |
52 | ã“ã®æ–‡æ›¸ã®ç›®çš„ã¯ã€ã‚ãªãŸãŒè¸ã‚€ã¹ãæ‰‹é †ã¨ã€ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¸€ç·’ã«ã†ã¾ãåƒ | 41 | ã¨ä¸€ç·’ã«ã†ã¾ãåƒãヒントを書ã下ã™ã“ã¨ã§ã€ã‚ãªãŸãŒçŸ¥ã‚‹ã¹ãå…¨ã¦ã®ã“ã¨ã‚’ |
53 | ãヒントを書ã下ã™ã“ã¨ã§ã€ã‚ãªãŸãŒçŸ¥ã‚‹ã¹ãå…¨ã¦ã®ã“ã¨ã‚’æ•™ãˆã‚‹ã“ã¨ã§ã™ã€‚ | 42 | æ•™ãˆã‚‹ã“ã¨ã§ã™ã€‚ã¾ãŸã€ã“ã®ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ãŒãªãœä»Šã†ã¾ãã¾ã‚ã£ã¦ã„ã‚‹ã®ã‹ã¨ |
54 | ã¾ãŸã€ã“ã®ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ãŒãªãœä»Šã†ã¾ãã¾ã‚ã£ã¦ã„ã‚‹ã®ã‹ã¨ã„ã†ç†ç”±ã®ä¸€éƒ¨ã‚‚ | 43 | ã„ã†ç†ç”±ã‚‚説明ã—よã†ã¨è©¦ã¿ã¦ã„ã¾ã™ã€‚ |
55 | 説明ã—よã†ã¨è©¦ã¿ã¦ã„ã¾ã™ã€‚ | 44 | |
56 | 45 | カーãƒãƒ«ã¯å°‘é‡ã®ã‚¢ãƒ¼ã‚テクãƒãƒ£ä¾å˜éƒ¨åˆ†ãŒã‚¢ã‚»ãƒ³ãƒ–ãƒªè¨€èªžã§æ›¸ã‹ã‚Œã¦ã„る以 | |
57 | 46 | 外ã®å¤§éƒ¨åˆ†ã¯ C è¨€èªžã§æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚C言語をよãç†è§£ã—ã¦ã„ã‚‹ã“ã¨ã¯ã‚«ãƒ¼ | |
58 | カーãƒãƒ«ã¯ å°‘é‡ã®ã‚¢ãƒ¼ã‚テクãƒãƒ£ä¾å˜éƒ¨åˆ†ãŒã‚¢ã‚»ãƒ³ãƒ–ãƒªè¨€èªžã§æ›¸ã‹ã‚Œã¦ã„ã‚‹ | 47 | ãƒãƒ«é–‹ç™ºã«å¿…è¦ã§ã™ã€‚低レベルã®ã‚¢ãƒ¼ã‚テクãƒãƒ£é–‹ç™ºã‚’ã™ã‚‹ã®ã§ãªã‘れã°ã€ |
59 | 以外ã¯å¤§éƒ¨åˆ†ã¯ C è¨€èªžã§æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚C言語をよãç†è§£ã—ã¦ã„ã‚‹ã“ã¨ã¯ã‚«ãƒ¼ | 48 | (ã©ã‚“ãªã‚¢ãƒ¼ã‚テクãƒãƒ£ã§ã‚‚)アセンブリ(訳注: 言語)ã¯å¿…è¦ã‚りã¾ã›ã‚“。以下 |
60 | ãƒãƒ«é–‹ç™ºè€…ã«ã¯å¿…è¦ã§ã™ã€‚アーã‚テクãƒãƒ£å‘ã‘ã®ä½Žãƒ¬ãƒ™ãƒ«éƒ¨åˆ†ã®é–‹ç™ºã‚’ã™ã‚‹ã® | 49 | ã®æœ¬ã¯ã€C 言語ã®å分ãªçŸ¥è˜ã‚„何年もã®çµŒé¨“ã«å–ã£ã¦ä»£ã‚ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã› |
61 | ã§ãªã‘れã°ã€(ã©ã‚“ãªã‚¢ãƒ¼ã‚テクãƒãƒ£ã§ã‚‚)アセンブリ(訳注: 言語)ã¯å¿…è¦ã‚り | 50 | ã‚“ãŒã€å°‘ãªãã¨ã‚‚リファレンスã¨ã—ã¦ã¯è‰¯ã„本ã§ã™ã€‚ |
62 | ã¾ã›ã‚“ã€‚ä»¥ä¸‹ã®æœ¬ã¯ã€C 言語ã®å分ãªçŸ¥è˜ã‚„何年もã®çµŒé¨“ã«å–ã£ã¦ä»£ã‚ã‚‹ã‚‚ã® | 51 | |
63 | ã§ã¯ã‚りã¾ã›ã‚“ãŒã€å°‘ãªãã¨ã‚‚リファレンスã¨ã—ã¦ã¯è‰¯ã„本ã§ã™ã€‚ | ||
64 | - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] | 52 | - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] |
65 | -『プãƒã‚°ãƒ©ãƒŸãƒ³ã‚°è¨€èªžï¼£ç¬¬2版ã€(B.W. カーニãƒãƒ³/D.M. リッãƒãƒ¼è‘— 石田晴久訳) [共立出版] | 53 | - 『プãƒã‚°ãƒ©ãƒŸãƒ³ã‚°è¨€èªžï¼£ç¬¬2版ã€(B.W. カーニãƒãƒ³/D.M. リッãƒãƒ¼è‘— 石田晴久訳) [共立出版] |
66 | - "Practical C Programming" by Steve Oualline [O'Reilly] | 54 | - "Practical C Programming" by Steve Oualline [O'Reilly] |
67 | - 『C実践プãƒã‚°ãƒ©ãƒŸãƒ³ã‚°ç¬¬3版ã€(Steve Ouallineè‘— 望月康å¸ç›£è¨³ è°·å£åŠŸè¨³) [オライリージャパン] | 55 | - 『C実践プãƒã‚°ãƒ©ãƒŸãƒ³ã‚°ç¬¬3版ã€(Steve Ouallineè‘— 望月康å¸ç›£è¨³ è°·å£åŠŸè¨³) [オライリージャパン] |
68 | - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] | 56 | - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] |
69 | - 『新・詳説 C 言語 H&S リファレンス〠| 57 | - 『新・詳説 C 言語 H&S リファレンス〠(サミュエル P ãƒãƒ¼ãƒ“ソン/ガイ L スティール共著 斉藤 信男監訳)[ソフトãƒãƒ³ã‚¯] |
70 | (サミュエル P ãƒãƒ¼ãƒ“ソン/ガイ L スティール共著 斉藤 信男監訳)[ソフトãƒãƒ³ã‚¯] | ||
71 | 58 | ||
72 | カーãƒãƒ«ã¯ GNU C 㨠GNU ツールãƒã‚§ã‚¤ãƒ³ã‚’使ã£ã¦æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚カーãƒãƒ« | 59 | カーãƒãƒ«ã¯ GNU C 㨠GNU ツールãƒã‚§ã‚¤ãƒ³ã‚’使ã£ã¦æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚カーãƒãƒ« |
73 | 㯠ISO C89 ä»•æ§˜ã«æº–æ‹ ã—ã¦æ›¸ã一方ã§ã€æ¨™æº–ã«ã¯ç„¡ã„言語拡張を多ã使ã£ã¦ | 60 | 㯠ISO C89 ä»•æ§˜ã«æº–æ‹ ã—ã¦æ›¸ã一方ã§ã€æ¨™æº–ã«ã¯ç„¡ã„言語拡張を多ã使ã£ã¦ |
74 | ã„ã¾ã™ã€‚カーãƒãƒ«ã¯æ¨™æº– C ライブラリã¨ã¯é–¢ä¿‚ãŒãªã„ã¨ã„ã£ãŸã€C 言語フリー | 61 | ã„ã¾ã™ã€‚カーãƒãƒ«ã¯æ¨™æº– C ライブラリã«ä¾å˜ã—ãªã„ã€C 言語éžä¾å˜ç’°å¢ƒã§ã™ã€‚ |
75 | スタンディング環境ã§ã™ã€‚ãã®ãŸã‚ã€C ã®æ¨™æº–ã§ä½¿ãˆãªã„ã‚‚ã®ã‚‚ã‚りã¾ã™ã€‚ä»» | 62 | ãã®ãŸã‚ã€C ã®æ¨™æº–ã®ä¸ã§ä½¿ãˆãªã„ã‚‚ã®ã‚‚ã‚りã¾ã™ã€‚特ã«ä»»æ„ã® long long |
76 | æ„ã® long long ã®é™¤ç®—ã‚„æµ®å‹•å°æ•°ç‚¹ã¯ä½¿ãˆã¾ã›ã‚“。 | 63 | ã®é™¤ç®—ã‚„æµ®å‹•å°æ•°ç‚¹ã¯ä½¿ãˆã¾ã›ã‚“。カーãƒãƒ«ãŒãƒ„ールãƒã‚§ã‚¤ãƒ³ã‚„ C 言語拡張 |
77 | ã¨ãã©ãã€ã‚«ãƒ¼ãƒãƒ«ãŒãƒ„ールãƒã‚§ã‚¤ãƒ³ã‚„ C 言語拡張ã«ç½®ã„ã¦ã„ã‚‹å‰æãŒã©ã† | 64 | ã«ç½®ã„ã¦ã„ã‚‹å‰æãŒã©ã†ãªã£ã¦ã„ã‚‹ã®ã‹ã‚ã‹ã‚Šã«ãã„ã“ã¨ãŒæ™‚々ã‚りã€ã¾ãŸã€ |
78 | ãªã£ã¦ã„ã‚‹ã®ã‹ã‚ã‹ã‚Šã«ãã„ã“ã¨ãŒã‚りã€ã¾ãŸã€æ®‹å¿µãªã“ã¨ã«æ±ºå®šçš„ãªãƒªãƒ•ã‚¡ | 65 | 残念ãªã“ã¨ã«æ±ºå®šçš„ãªãƒªãƒ•ァレンスã¯å˜åœ¨ã—ã¾ã›ã‚“ã€‚æƒ…å ±ã‚’å¾—ã‚‹ã«ã¯ã€gcc ã® |
79 | レンスã¯å˜åœ¨ã—ã¾ã›ã‚“ã€‚æƒ…å ±ã‚’å¾—ã‚‹ã«ã¯ã€gcc ã® info ページ( info gcc )ã‚’ | 66 | info ページ( info gcc )を見ã¦ãã ã•ã„。 |
80 | 見ã¦ãã ã•ã„。 | ||
81 | 67 | ||
82 | ã‚ãªãŸã¯æ—¢å˜ã®é–‹ç™ºã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¸€ç·’ã«ä½œæ¥ã™ã‚‹æ–¹æ³•ã‚’å¦ã¼ã†ã¨ã—ã¦ã„ã‚‹ã“ | 68 | ã‚ãªãŸã¯æ—¢å˜ã®é–‹ç™ºã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¸€ç·’ã«ä½œæ¥ã™ã‚‹æ–¹æ³•ã‚’å¦ã¼ã†ã¨ã—ã¦ã„ã‚‹ã“ |
83 | ã¨ã«ç•™æ„ã—ã¦ãã ã•ã„。ãã®ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã€ã‚¹ã‚¿ã‚¤ãƒ«ã€ | 69 | ã¨ã«æ€ã„出ã—ã¦ãã ã•ã„。ãã®ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã€ã‚¹ã‚¿ã‚¤ãƒ«ã€é–‹ |
84 | é–‹ç™ºæ‰‹é †ã«ã¤ã„ã¦é«˜åº¦ãªæ¨™æº–ã‚’æŒã¤ã€å¤šæ§˜ãªäººã®é›†ã¾ã‚Šã§ã™ã€‚ | 70 | ç™ºæ‰‹é †ã«ã¤ã„ã¦é«˜åº¦ãªæ¨™æº–ã‚’æŒã¤ã€å¤šæ§˜ãªäººã®é›†ã¾ã‚Šã§ã™ã€‚地ç†çš„ã«åˆ†æ•£ã—㟠|
85 | 地ç†çš„ã«åˆ†æ•£ã—ãŸå¤§è¦æ¨¡ãªãƒãƒ¼ãƒ ã«å¯¾ã—ã¦ã‚‚ã£ã¨ã‚‚ã†ã¾ãã„ãã¨ã‚ã‹ã£ãŸã“㨠| 71 | å¤§è¦æ¨¡ãªãƒãƒ¼ãƒ ã«å¯¾ã—ã¦ã‚‚ã£ã¨ã‚‚ã†ã¾ãã„ãã¨ã‚ã‹ã£ãŸã“ã¨ã‚’ベースã«ã—ãªãŒ |
86 | をベースã«ã—ãªãŒã‚‰ã€ã“ã‚Œã‚‰ã®æ¨™æº–ã¯é•·ã„時間をã‹ã‘ã¦ç¯‰ã‹ã‚Œã¦ãã¾ã—ãŸã€‚ | 72 | らã€ã“ã‚Œã‚‰ã®æ¨™æº–ã¯é•·ã„時間をã‹ã‘ã¦ç¯‰ã‹ã‚Œã¦ãã¾ã—ãŸã€‚ã“れらã¯ãã¡ã‚“ã¨æ–‡ |
87 | ã“れらã¯ãã¡ã‚“ã¨æ–‡æ›¸åŒ–ã•れã¦ã„ã¾ã™ã‹ã‚‰ã€äº‹å‰ã«ã“ã‚Œã‚‰ã®æ¨™æº–ã«ã¤ã„ã¦ã§ã | 73 | 書化ã•れã¦ã„ã¾ã™ã‹ã‚‰ã€äº‹å‰ã«ã“ã‚Œã‚‰ã®æ¨™æº–ã«ã¤ã„ã¦äº‹å‰ã«ã§ãã‚‹ã ã‘ãŸãã• |
88 | ã‚‹ã ã‘ãŸãã•ã‚“å¦ã‚“ã§ãã ã•ã„。ã¾ãŸçš†ãŒã‚ãªãŸã‚„ã‚ãªãŸã®ä¼šç¤¾ã®ã‚„り方ã«åˆã‚ | 74 | ã‚“å¦ã‚“ã§ãã ã•ã„。ã¾ãŸçš†ãŒã‚ãªãŸã‚„ã‚ãªãŸã®ä¼šç¤¾ã®ã‚„り方ã«åˆã‚ã›ã¦ãれる |
89 | ã›ã¦ãã‚Œã‚‹ã¨æ€ã‚ãªã„ã§ãã ã•ã„。 | 75 | ã¨æ€ã‚ãªã„ã§ãã ã•ã„。 |
90 | 76 | ||
91 | 法的å•題 | 77 | 法的å•題 |
92 | ------------ | 78 | -------- |
93 | 79 | ||
94 | Linux カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã¯ GPL ライセンスã®ä¸‹ã§ãƒªãƒªãƒ¼ã‚¹ã•れã¦ã„ã¾ | 80 | Linux カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã¯ GPL ライセンスã®ä¸‹ã§ãƒªãƒªãƒ¼ã‚¹ã•れã¦ã„ã¾ |
95 | ã™ã€‚ライセンスã®è©³ç´°ã«ã¤ã„ã¦ã¯ã€ã‚½ãƒ¼ã‚¹ãƒ„リーã®ãƒ¡ã‚¤ãƒ³ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«å˜åœ¨ | 81 | ã™ã€‚ライセンスã®è©³ç´°ã«ã¤ã„ã¦ã¯ã€ã‚½ãƒ¼ã‚¹ãƒ„リーã®ãƒ¡ã‚¤ãƒ³ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«å˜åœ¨ |
@@ -98,8 +84,9 @@ Linux カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã¯ GPL ライセンスã®ä¸‹ã§ãƒªãƒªãƒ¼ | |||
98 | 法律家ã«ç›¸è«‡ã—ã¦ãã ã•ã„。メーリングリストã®äººé”ã¯æ³•律家ã§ã¯ãªãã€æ³•çš„ | 84 | 法律家ã«ç›¸è«‡ã—ã¦ãã ã•ã„。メーリングリストã®äººé”ã¯æ³•律家ã§ã¯ãªãã€æ³•çš„ |
99 | å•題ã«ã¤ã„ã¦ã¯å½¼ã‚‰ã®å£°æ˜Žã¯ã‚ã¦ã«ã™ã‚‹ã¹ãã§ã¯ã‚りã¾ã›ã‚“。 | 85 | å•題ã«ã¤ã„ã¦ã¯å½¼ã‚‰ã®å£°æ˜Žã¯ã‚ã¦ã«ã™ã‚‹ã¹ãã§ã¯ã‚りã¾ã›ã‚“。 |
100 | 86 | ||
101 | GPL ã«é–¢ã™ã‚‹å…±é€šã®è³ªå•や回ç”ã«ã¤ã„ã¦ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„。 | 87 | GPL ã«é–¢ã™ã‚‹å…±é€šã®è³ªå•や回ç”ã«ã¤ã„ã¦ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- |
102 | http://www.gnu.org/licenses/gpl-faq.html | 88 | |
89 | https://www.gnu.org/licenses/gpl-faq.html | ||
103 | 90 | ||
104 | ドã‚ュメント | 91 | ドã‚ュメント |
105 | ------------ | 92 | ------------ |
@@ -119,111 +106,129 @@ linux-api@vger.kernel.org ã«é€ã‚‹ã“ã¨ã‚’å‹§ã‚ã¾ã™ã€‚ | |||
119 | README | 106 | README |
120 | ã“ã®ãƒ•ァイル㯠Linuxカーãƒãƒ«ã®ç°¡å˜ãªèƒŒæ™¯ã¨ã‚«ãƒ¼ãƒãƒ«ã‚’è¨å®š(訳注 | 107 | ã“ã®ãƒ•ァイル㯠Linuxカーãƒãƒ«ã®ç°¡å˜ãªèƒŒæ™¯ã¨ã‚«ãƒ¼ãƒãƒ«ã‚’è¨å®š(訳注 |
121 | configure )ã—ã€ç”Ÿæˆ(訳注 build )ã™ã‚‹ãŸã‚ã«å¿…è¦ãªã“ã¨ã¯ä½•ã‹ãŒæ›¸ã‹ã‚Œ | 108 | configure )ã—ã€ç”Ÿæˆ(訳注 build )ã™ã‚‹ãŸã‚ã«å¿…è¦ãªã“ã¨ã¯ä½•ã‹ãŒæ›¸ã‹ã‚Œ |
122 | ã¦ã„ã¾ã™ã€‚カーãƒãƒ«ã«é–¢ã—ã¦åˆã‚ã¦ã®äººã¯ã“ã“ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã™ã‚‹ã¨è‰¯ã„ã§ | 109 | ã¦ã„ã¾ã™ã€‚ カーãƒãƒ«ã«é–¢ã—ã¦åˆã‚ã¦ã®äººã¯ã“ã“ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã™ã‚‹ã¨è‰¯ã„ |
123 | ã—ょã†ã€‚ | 110 | ã§ã—ょã†ã€‚ |
124 | 111 | ||
125 | Documentation/Changes | 112 | :ref:`Documentation/Process/changes.rst <changes>` |
126 | ã“ã®ãƒ•ァイルã¯ã‚«ãƒ¼ãƒãƒ«ã‚’ã†ã¾ã生æˆ(訳注 build )ã—ã€èµ°ã‚‰ã›ã‚‹ã®ã«æœ€ | 113 | ã“ã®ãƒ•ァイルã¯ã‚«ãƒ¼ãƒãƒ«ã‚’ã†ã¾ã生æˆ(訳注 build )ã—ã€èµ°ã‚‰ã›ã‚‹ã®ã«æœ€ |
127 | å°é™ã®ãƒ¬ãƒ™ãƒ«ã§å¿…è¦ãªæ•°ã€…ã®ã‚½ãƒ•トウェアパッケージã®ä¸€è¦§ã‚’示ã—ã¦ã„ | 114 | å°é™ã®ãƒ¬ãƒ™ãƒ«ã§å¿…è¦ãªæ•°ã€…ã®ã‚½ãƒ•トウェアパッケージã®ä¸€è¦§ã‚’示ã—ã¦ã„ |
128 | ã¾ã™ã€‚ | 115 | ã¾ã™ã€‚ |
129 | 116 | ||
130 | Documentation/process/coding-style.rst | 117 | :ref:`Documentation/process/coding-style.rst <codingstyle>` |
131 | ã“れ㯠Linux カーãƒãƒ«ã®ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚¹ã‚¿ã‚¤ãƒ«ã¨èƒŒæ™¯ã«ã‚ã‚‹ç†ç”±ã‚’記述 | 118 | ã“れ㯠Linux カーãƒãƒ«ã®ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚¹ã‚¿ã‚¤ãƒ«ã¨èƒŒæ™¯ã«ã‚ã‚‹ç†ç”±ã‚’記述 |
132 | ã—ã¦ã„ã¾ã™ã€‚å…¨ã¦ã®æ–°ã—ã„コードã¯ã“ã®ãƒ‰ã‚ュメントã«ã‚るガイドライン | 119 | ã—ã¦ã„ã¾ã™ã€‚å…¨ã¦ã®æ–°ã—ã„コードã¯ã“ã®ãƒ‰ã‚ュメントã«ã‚るガイドライン |
133 | ã«å¾“ã£ã¦ã„ã‚‹ã“ã¨ã‚’期待ã•れã¦ã„ã¾ã™ã€‚大部分ã®ãƒ¡ãƒ³ãƒ†ãƒŠã¯ã“れらã®ãƒ«ãƒ¼ | 120 | ã«å¾“ã£ã¦ã„ã‚‹ã“ã¨ã‚’期待ã•れã¦ã„ã¾ã™ã€‚大部分ã®ãƒ¡ãƒ³ãƒ†ãƒŠã¯ã“れらã®ãƒ«ãƒ¼ |
134 | ルã«å¾“ã£ã¦ã„ã‚‹ã‚‚ã®ã ã‘ã‚’å—ã‘付ã‘ã€å¤šãã®äººã¯æ£ã—ã„スタイルã®ã‚³ãƒ¼ãƒ‰ | 121 | ルã«å¾“ã£ã¦ã„ã‚‹ã‚‚ã®ã ã‘ã‚’å—ã‘付ã‘ã€å¤šãã®äººã¯æ£ã—ã„スタイルã®ã‚³ãƒ¼ãƒ‰ |
135 | ã ã‘をレビューã—ã¾ã™ã€‚ | 122 | ã ã‘をレビューã—ã¾ã™ã€‚ |
136 | 123 | ||
137 | Documentation/process/submitting-patches.rst | 124 | :ref:`Documentation/process/submitting-patches.rst <codingstyle>` 㨠:ref:`Documentation/process/submitting-drivers.rst <submittingdrivers>` |
138 | Documentation/process/submitting-drivers.rst | 125 | ã“れらã®ãƒ•ァイルã«ã¯ã€ã©ã†ã‚„ã£ã¦ã†ã¾ãパッãƒã‚’作ã£ã¦æŠ•稿ã™ã‚‹ã‹ã«ã¤ |
139 | ã“れらã®ãƒ•ァイルã«ã¯ã€ã©ã†ã‚„ã£ã¦ã†ã¾ãパッãƒã‚’作ã£ã¦æŠ•稿ã™ã‚‹ã‹ã« | 126 | ã„ã¦éžå¸¸ã«è©³ã—ãæ›¸ã‹ã‚Œã¦ãŠã‚Šã€ä»¥ä¸‹ã‚’å«ã¿ã¾ã™ (ã“れã ã‘ã«é™ã‚‰ãªã„ |
140 | ã¤ã„ã¦éžå¸¸ã«è©³ã—ãæ›¸ã‹ã‚Œã¦ãŠã‚Šã€ä»¥ä¸‹ã‚’å«ã¿ã¾ã™(ã“れã ã‘ã«é™ã‚‰ãªã„ | 127 | ã‘れã©ã‚‚) |
141 | ã‘れã©ã‚‚) | 128 | |
142 | - Email ã«å«ã‚€ã“㨠| 129 | - Email ã«å«ã‚€ã“㨠|
143 | - Email ã®å½¢å¼ | 130 | - Email ã®å½¢å¼ |
144 | - ã れã«é€ã‚‹ã‹ | 131 | - ã れã«é€ã‚‹ã‹ |
145 | ã“れらã®ãƒ«ãƒ¼ãƒ«ã«å¾“ãˆã°ã†ã¾ãã„ãã“ã¨ã‚’ä¿è¨¼ã™ã‚‹ã“ã¨ã§ã¯ã‚りã¾ã›ã‚“ | 132 | |
146 | ㌠(ã™ã¹ã¦ã®ãƒ‘ッãƒã¯å†…容ã¨ã‚¹ã‚¿ã‚¤ãƒ«ã«ã¤ã„ã¦ç²¾æŸ»ã‚’å—ã‘ã‚‹ã®ã§)〠| 133 | ã“れらã®ãƒ«ãƒ¼ãƒ«ã«å¾“ãˆã°ã†ã¾ãã„ãã“ã¨ã‚’ä¿è¨¼ã™ã‚‹ã“ã¨ã§ã¯ã‚りã¾ã›ã‚“ |
147 | ルールã«å¾“ã‚ãªã‘れã°é–“é•ã„ãªãã†ã¾ãã„ã‹ãªã„ã§ã—ょã†ã€‚ | 134 | ㌠(ã™ã¹ã¦ã®ãƒ‘ッãƒã¯å†…容ã¨ã‚¹ã‚¿ã‚¤ãƒ«ã«ã¤ã„ã¦ç²¾æŸ»ã‚’å—ã‘ã‚‹ã®ã§)〠|
148 | 135 | ルールã«å¾“ã‚ãªã‘れã°é–“é•ã„ãªãã†ã¾ãã„ã‹ãªã„ã§ã—ょã†ã€‚ | |
149 | ã“ã®ä»–ã«ãƒ‘ッãƒã‚’作る方法ã«ã¤ã„ã¦ã®ã‚ˆãã§ããŸè¨˜è¿°ã¯- | 136 | |
150 | 137 | ã“ã®ä»–ã«ãƒ‘ッãƒã‚’作る方法ã«ã¤ã„ã¦ã®ã‚ˆãã§ããŸè¨˜è¿°ã¯- | |
151 | "The Perfect Patch" | 138 | |
139 | "The Perfect Patch" | ||
152 | http://www.ozlabs.org/~akpm/stuff/tpp.txt | 140 | http://www.ozlabs.org/~akpm/stuff/tpp.txt |
153 | "Linux kernel patch submission format" | 141 | "Linux kernel patch submission format" |
154 | http://linux.yyz.us/patch-format.html | 142 | http://linux.yyz.us/patch-format.html |
155 | 143 | ||
156 | Documentation/process/stable-api-nonsense.rst | 144 | :ref:`Documentation/process/stable-api-nonsense.rst <stable_api_nonsense>` |
157 | ã“ã®ãƒ•ァイルã¯ã‚«ãƒ¼ãƒãƒ«ã®ä¸ã«ä¸å¤‰ã®APIã‚’æŒãŸãªã„ã“ã¨ã«ã—ãŸæ„è˜çš„㪠| 145 | ã“ã®ãƒ•ァイルã¯ã‚«ãƒ¼ãƒãƒ«ã®ä¸ã«ä¸å¤‰ã® API ã‚’æŒãŸãªã„ã“ã¨ã«ã—ãŸæ„è˜çš„ |
158 | 決æ–ã®èƒŒæ™¯ã«ã‚ã‚‹ç†ç”±ã«ã¤ã„ã¦æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚以下ã®ã‚ˆã†ãªã“ã¨ã‚’å« | 146 | ãªæ±ºæ–ã®èƒŒæ™¯ã«ã‚ã‚‹ç†ç”±ã«ã¤ã„ã¦æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚以下ã®ã‚ˆã†ãªã“ã¨ã‚’å« |
159 | ã‚“ã§ã„ã¾ã™- | 147 | ã‚“ã§ã„ã¾ã™- |
160 | - サブシステムã¨ã®é–“ã«å±¤ã‚’作るã“ã¨(コンパãƒãƒ“リティã®ãŸã‚?) | 148 | |
161 | - オペレーティングシステム間ã®ãƒ‰ãƒ©ã‚¤ãƒã®ç§»æ¤æ€§ | 149 | - サブシステムã¨ã®é–“ã«å±¤ã‚’作るã“ã¨(コンパãƒãƒ“リティã®ãŸã‚?) |
162 | - カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ç´ æ—©ã„変更をé…らã›ã‚‹(ã‚‚ã—ãã¯ç´ æ—©ã„変更 | 150 | - オペレーティングシステム間ã®ãƒ‰ãƒ©ã‚¤ãƒã®ç§»æ¤æ€§ |
163 | を妨ã’ã‚‹) | 151 | - カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ç´ æ—©ã„変更をé…らã›ã‚‹(ã‚‚ã—ãã¯ç´ æ—©ã„変更を妨ã’ã‚‹) |
164 | ã“ã®ãƒ‰ã‚ュメント㯠Linux é–‹ç™ºã®æ€æƒ³ã‚’ç†è§£ã™ã‚‹ã®ã«éžå¸¸ã«é‡è¦ã§ã™ã€‚ | 152 | |
165 | ãã—ã¦ã€ä»–ã®OSã§ã®é–‹ç™ºè€…㌠Linux ã«ç§»ã‚‹æ™‚ã«ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚ | 153 | ã“ã®ãƒ‰ã‚ュメント㯠Linux é–‹ç™ºã®æ€æƒ³ã‚’ç†è§£ã™ã‚‹ã®ã«éžå¸¸ã«é‡è¦ã§ã™ã€‚ |
166 | 154 | ãã—ã¦ã€ä»–ã®OSã§ã®é–‹ç™ºè€…㌠Linux ã«ç§»ã‚‹æ™‚ã«ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚ | |
167 | Documentation/admin-guide/security-bugs.rst | 155 | |
156 | :ref:`Documentation/admin-guide/security-bugs.rst <securitybugs>` | ||
168 | ã‚‚ã— Linux カーãƒãƒ«ã§ã‚»ã‚ュリティå•題を発見ã—ãŸã‚ˆã†ã«æ€ã£ãŸã‚‰ã€ã“ | 157 | ã‚‚ã— Linux カーãƒãƒ«ã§ã‚»ã‚ュリティå•題を発見ã—ãŸã‚ˆã†ã«æ€ã£ãŸã‚‰ã€ã“ |
169 | ã®ãƒ‰ã‚ュメントã®ã‚¹ãƒ†ãƒƒãƒ—ã«å¾“ã£ã¦ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«é€£çµ¡ã—ã€å•題解決を | 158 | ã®ãƒ‰ã‚ュメントã®ã‚¹ãƒ†ãƒƒãƒ—ã«å¾“ã£ã¦ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«é€£çµ¡ã—ã€å•題解決を |
170 | 支æ´ã—ã¦ãã ã•ã„。 | 159 | 支æ´ã—ã¦ãã ã•ã„。 |
171 | 160 | ||
172 | Documentation/process/management-style.rst | 161 | :ref:`Documentation/process/management-style.rst <managementstyle>` |
173 | ã“ã®ãƒ‰ã‚ュメント㯠Linux カーãƒãƒ«ã®ãƒ¡ãƒ³ãƒ†ãƒŠé”ãŒã©ã†è¡Œå‹•ã™ã‚‹ã‹ã€ | 162 | ã“ã®ãƒ‰ã‚ュメント㯠Linux カーãƒãƒ«ã®ãƒ¡ãƒ³ãƒ†ãƒŠé”ãŒã©ã†è¡Œå‹•ã™ã‚‹ã‹ã€ |
174 | å½¼ã‚‰ã®æ‰‹æ³•ã®èƒŒæ™¯ã«ã‚る共有ã•れã¦ã„る精神ã«ã¤ã„ã¦è¨˜è¿°ã—ã¦ã„ã¾ã™ã€‚ã“ | 163 | å½¼ã‚‰ã®æ‰‹æ³•ã®èƒŒæ™¯ã«ã‚る共有ã•れã¦ã„る精神ã«ã¤ã„ã¦è¨˜è¿°ã—ã¦ã„ã¾ã™ã€‚ã“ |
175 | れã¯ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºã®åˆå¿ƒè€…ãªã‚‰ï¼ˆã‚‚ã—ãã¯ã€å˜ã«èˆˆå‘³ãŒã‚ã‚‹ã ã‘ã®äººã§ã‚‚) | 164 | れã¯ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºã®åˆå¿ƒè€…ãªã‚‰ï¼ˆã‚‚ã—ãã¯ã€å˜ã«èˆˆå‘³ãŒã‚ã‚‹ã ã‘ã®äººã§ã‚‚) |
176 | é‡è¦ã§ã™ã€‚ãªãœãªã‚‰ã“ã®ãƒ‰ã‚ュメントã¯ã€ã‚«ãƒ¼ãƒãƒ«ãƒ¡ãƒ³ãƒ†ãƒŠé”ã®ç‹¬ç‰¹ãª | 165 | é‡è¦ã§ã™ã€‚ãªãœãªã‚‰ã“ã®ãƒ‰ã‚ュメントã¯ã€ã‚«ãƒ¼ãƒãƒ«ãƒ¡ãƒ³ãƒ†ãƒŠé”ã®ç‹¬ç‰¹ãª |
177 | 行動ã«ã¤ã„ã¦ã®å¤šãã®èª¤è§£ã‚„混乱を解消ã™ã‚‹ã‹ã‚‰ã§ã™ã€‚ | 166 | 行動ã«ã¤ã„ã¦ã®å¤šãã®èª¤è§£ã‚„混乱を解消ã™ã‚‹ã‹ã‚‰ã§ã™ã€‚ |
178 | 167 | ||
179 | Documentation/process/stable-kernel-rules.rst | 168 | :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` |
180 | ã“ã®ãƒ•ァイルã¯ã©ã®ã‚ˆã†ã« stable カーãƒãƒ«ã®ãƒªãƒªãƒ¼ã‚¹ãŒè¡Œã‚れるã‹ã®ãƒ«ãƒ¼ | 169 | ã“ã®ãƒ•ァイルã¯ã©ã®ã‚ˆã†ã« stable カーãƒãƒ«ã®ãƒªãƒªãƒ¼ã‚¹ãŒè¡Œã‚れるã‹ã®ãƒ«ãƒ¼ |
181 | ルãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ãã—ã¦ã“れらã®ãƒªãƒªãƒ¼ã‚¹ã®ä¸ã®ã©ã“ã‹ã§å¤‰æ›´ã‚’å– | 170 | ルãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ãã—ã¦ã“れらã®ãƒªãƒªãƒ¼ã‚¹ã®ä¸ã®ã©ã“ã‹ã§å¤‰æ›´ã‚’å– |
182 | り入れã¦ã‚‚らã„ãŸã„å ´åˆã«ä½•ã‚’ã™ã‚Œã°è‰¯ã„ã‹ãŒç¤ºã•れã¦ã„ã¾ã™ã€‚ | 171 | り入れã¦ã‚‚らã„ãŸã„å ´åˆã«ä½•ã‚’ã™ã‚Œã°è‰¯ã„ã‹ãŒç¤ºã•れã¦ã„ã¾ã™ã€‚ |
183 | 172 | ||
184 | Documentation/process/kernel-docs.rst | 173 | :Ref:`Documentation/process/kernel-docs.rst <kernel_docs>` |
185 |   カーãƒãƒ«é–‹ç™ºã«ä»˜éšã™ã‚‹å¤–部ドã‚ュメントã®ãƒªã‚¹ãƒˆã§ã™ã€‚ã‚‚ã—ã‚ãªãŸãŒ | 174 | カーãƒãƒ«é–‹ç™ºã«ä»˜éšã™ã‚‹å¤–部ドã‚ュメントã®ãƒªã‚¹ãƒˆã§ã™ã€‚ã‚‚ã—ã‚ãªãŸãŒæŽ¢ |
186 | 探ã—ã¦ã„ã‚‹ã‚‚ã®ãŒã‚«ãƒ¼ãƒãƒ«å†…ã®ãƒ‰ã‚ュメントã§ã¿ã¤ã‹ã‚‰ãªã‹ã£ãŸå ´åˆã€ | 175 | ã—ã¦ã„ã‚‹ã‚‚ã®ãŒã‚«ãƒ¼ãƒãƒ«å†…ã®ãƒ‰ã‚ュメントã§ã¿ã¤ã‹ã‚‰ãªã‹ã£ãŸå ´åˆã€ã“ã® |
187 | ã“ã®ãƒªã‚¹ãƒˆã‚’ã‚ãŸã£ã¦ã¿ã¦ãã ã•ã„。 | 176 | リストをã‚ãŸã£ã¦ã¿ã¦ãã ã•ã„。 |
188 | 177 | ||
189 | Documentation/process/applying-patches.rst | 178 | :ref:`Documentation/process/applying-patches.rst <applying_patches>` |
190 | パッãƒã¨ã¯ãªã«ã‹ã€ãƒ‘ッãƒã‚’ã©ã†ã‚„ã£ã¦æ§˜ã€…ãªã‚«ãƒ¼ãƒãƒ«ã®é–‹ç™ºãƒ–ランãƒã« | 179 | パッãƒã¨ã¯ãªã«ã‹ã€ãƒ‘ッãƒã‚’ã©ã†ã‚„ã£ã¦æ§˜ã€…ãªã‚«ãƒ¼ãƒãƒ«ã®é–‹ç™ºãƒ–ランãƒã« |
191 | é©ç”¨ã™ã‚‹ã®ã‹ã«ã¤ã„ã¦æ£ç¢ºã«è¨˜è¿°ã—ãŸè‰¯ã„入門書ã§ã™ã€‚ | 180 | é©ç”¨ã™ã‚‹ã®ã‹ã«ã¤ã„ã¦æ£ç¢ºã«è¨˜è¿°ã—ãŸè‰¯ã„入門書ã§ã™ã€‚ |
192 | 181 | ||
193 | カーãƒãƒ«ã¯ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã‹ã‚‰è‡ªå‹•çš„ã«ç”Ÿæˆå¯èƒ½ãªå¤šæ•°ã®ãƒ‰ã‚ュメントを自分自 | 182 | カーãƒãƒ«ã¯ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ãã®ã‚‚ã®ã‚„ã€ã“ã®ãƒ•ァイルã®ã‚ˆã†ãªãƒªã‚¹ãƒˆãƒ©ã‚¯ãƒãƒ£ãƒ¼ |
194 | 身ã§ã‚‚ã£ã¦ã„ã¾ã™ã€‚ã“れã«ã¯ã‚«ãƒ¼ãƒãƒ«å†… API ã®ã™ã¹ã¦ã®è¨˜è¿°ã‚„ã€ã©ã†æ£ã—ã | 183 | ドテã‚ストマークアップ(ReST)ã‹ã‚‰è‡ªå‹•çš„ã«ç”Ÿæˆå¯èƒ½ãªå¤šæ•°ã®ãƒ‰ã‚ュメントを |
195 | ãƒãƒƒã‚¯ã‚’ã‹ã‘ã‚‹ã‹ã®è¦å‰‡ãŒå«ã¾ã‚Œã¾ã™ã€‚ã“ã®ãƒ‰ã‚ュメント㯠| 184 | ã‚‚ã£ã¦ã„ã¾ã™ã€‚ã“れã«ã¯ã‚«ãƒ¼ãƒãƒ«å†…APIã®å®Œå…¨ãªè¨˜è¿°ã‚„ã€æ£ã—ããƒãƒƒã‚¯ã‚’ã‹ã‘ |
196 | Documentation/DocBook/ ディレクトリã«ä½œã‚‰ã‚Œã€ä»¥ä¸‹ã®ã‚ˆã†ã« | 185 | ã‚‹ãŸã‚ã®è¦å‰‡ãªã©ãŒå«ã¾ã‚Œã¾ã™ã€‚ |
197 | make pdfdocs | 186 | |
198 | make psdocs | 187 | ã“れら全ã¦ã®ãƒ‰ã‚ュメントを PDF ã‚„ HTML ã§ç”Ÿæˆã™ã‚‹ã«ã¯ä»¥ä¸‹ã‚’実行ã—ã¾ã™ - :: |
199 | make htmldocs | 188 | |
200 | make mandocs | 189 | make pdfdocs |
201 | コマンドを実行ã™ã‚‹ã¨ãƒ¡ã‚¤ãƒ³ã‚«ãƒ¼ãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‹ã‚‰ | 190 | make htmldocs |
202 | ãれãžã‚Œã€PDF, Postscript, HTML, man page ã®å½¢å¼ã§ç”Ÿæˆã•れã¾ã™ã€‚ | 191 | |
192 | ãれãžã‚Œãƒ¡ã‚¤ãƒ³ã‚«ãƒ¼ãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‹ã‚‰å®Ÿè¡Œã—ã¾ã™ã€‚ | ||
193 | |||
194 | ReSTマークアップを使ã£ãŸãƒ‰ã‚ュメント㯠Documentation/outputã«ç”Ÿæˆã•れ | ||
195 | ã¾ã™ã€‚Latex ã¨ePub å½¢å¼ã§ç”Ÿæˆã™ã‚‹ã«ã¯ - :: | ||
196 | |||
197 | make latexdocs | ||
198 | make epubdocs | ||
199 | |||
200 | ç¾åœ¨ã€å¹¾ã¤ã‹ã® DocBookå½¢å¼ã§æ›¸ã‹ã‚ŒãŸãƒ‰ã‚ュメント㯠ReSTå½¢å¼ã«è»¢æ›ä¸ã§ | ||
201 | ã™ã€‚ãれらã®ãƒ‰ã‚ュメントã¯Documentation/DocBook ディレクトリã«ç”Ÿæˆã•れ〠| ||
202 | Postscript ã¾ãŸã¯ man ページã®å½¢å¼ã‚’生æˆã™ã‚‹ã«ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ã—ã¾ã™ - :: | ||
203 | |||
204 | make psdocs | ||
205 | make mandocs | ||
203 | 206 | ||
204 | カーãƒãƒ«é–‹ç™ºè€…ã«ãªã‚‹ã«ã¯ | 207 | カーãƒãƒ«é–‹ç™ºè€…ã«ãªã‚‹ã«ã¯ |
205 | --------------------------- | 208 | ------------------------ |
206 | 209 | ||
207 | ã‚‚ã—ã‚ãªãŸãŒã€Linux カーãƒãƒ«é–‹ç™ºã«ã¤ã„ã¦ä½•も知らãªã„ãªã‚‰ã°ã€ | 210 | ã‚‚ã—ã‚ãªãŸãŒã€Linux カーãƒãƒ«é–‹ç™ºã«ã¤ã„ã¦ä½•も知らãªã„ã®ãªã‚‰ã°ã€ |
208 | KernelNewbies プãƒã‚¸ã‚§ã‚¯ãƒˆã‚’見るã¹ãã§ã™ | 211 | KernelNewbies プãƒã‚¸ã‚§ã‚¯ãƒˆã‚’見るã¹ãã§ã™ |
209 | http://kernelnewbies.org | 212 | |
213 | https://kernelnewbies.org | ||
210 | 214 | ||
211 | ã“ã®ã‚µã‚¤ãƒˆã«ã¯å½¹ã«ç«‹ã¤ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆãŒã‚りã€åŸºæœ¬çš„ãªã‚«ãƒ¼ãƒãƒ«é–‹ç™ºã«é–¢ | 215 | ã“ã®ã‚µã‚¤ãƒˆã«ã¯å½¹ã«ç«‹ã¤ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆãŒã‚りã€åŸºæœ¬çš„ãªã‚«ãƒ¼ãƒãƒ«é–‹ç™ºã«é–¢ |
212 | ã™ã‚‹ã»ã¨ã‚“ã©ã©ã‚“ãªç¨®é¡žã®è³ªå•ã‚‚ã§ãã¾ã™ (æ—¢ã«å›žç”ã•れã¦ã„るよã†ãªã“ã¨ã‚’ | 216 | ã™ã‚‹ã»ã¨ã‚“ã©ã©ã‚“ãªç¨®é¡žã®è³ªå•ã‚‚ã§ãã¾ã™ (æ—¢ã«å›žç”ã•れã¦ã„るよã†ãªã“ã¨ã‚’ |
213 | èžãå‰ã«ã¾ãšã¯ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–を調ã¹ã¦ãã ã•ã„)。 | 217 | èžãå‰ã«ã¾ãšã¯ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–を調ã¹ã¦ãã ã•ã„)。ã¾ãŸã“ã“ã«ã¯ã€ãƒªã‚¢ãƒ«ã‚¿ã‚¤ãƒ |
214 | ã¾ãŸã“ã“ã«ã¯ã€ãƒªã‚¢ãƒ«ã‚¿ã‚¤ãƒ ã§è³ªå•ã‚’èžãã“ã¨ãŒã§ãã‚‹ IRC ãƒãƒ£ãƒãƒ«ã‚„ã€Linux | 218 | ã§è³ªå•ã‚’èžãã“ã¨ãŒã§ãã‚‹ IRC ãƒãƒ£ãƒãƒ«ã‚„ã€Linuxカーãƒãƒ«ã®é–‹ç™ºã«é–¢ã—ã¦å¦ |
215 | カーãƒãƒ«ã®é–‹ç™ºã«é–¢ã—ã¦å¦ã¶ã®ã«ä¾¿åˆ©ãªãŸãã•ã‚“ã®å½¹ã«ç«‹ã¤ãƒ‰ã‚ュメントãŒã‚ | 219 | ã¶ã®ã«ä¾¿åˆ©ãªãŸãã•ã‚“ã®å½¹ã«ç«‹ã¤ãƒ‰ã‚ュメントãŒã‚りã¾ã™ã€‚ |
216 | りã¾ã™ã€‚ | ||
217 | 220 | ||
218 | web サイトã«ã¯ã€ã‚³ãƒ¼ãƒ‰ã®æ§‹æˆã€ã‚µãƒ–システムã€ç¾åœ¨å˜åœ¨ã™ã‚‹ãƒ—ãƒã‚¸ã‚§ã‚¯ãƒˆ(ツ | 221 | Web サイトã«ã¯ã€ã‚³ãƒ¼ãƒ‰ã®æ§‹æˆã€ã‚µãƒ–システムã€ç¾åœ¨å˜åœ¨ã™ã‚‹ãƒ—ãƒã‚¸ã‚§ã‚¯ãƒˆ |
219 | リーã«ã‚ã‚‹ã‚‚ã®ç„¡ã„ã‚‚ã®ã®ä¸¡æ–¹)ã®åŸºæœ¬çš„ãªç®¡ç†æƒ…å ±ãŒã‚りã¾ã™ã€‚ | 222 | (ツリーã«ã‚ã‚‹ã‚‚ã®ç„¡ã„ã‚‚ã®ã®ä¸¡æ–¹)ã®åŸºæœ¬çš„ãªç®¡ç†æƒ…å ±ãŒã‚りã¾ã™ã€‚ã“ã“ã«ã¯ã€ |
220 | ã“ã“ã«ã¯ã€ã¾ãŸã€ã‚«ãƒ¼ãƒãƒ«ã®ã‚³ãƒ³ãƒ‘イルã®ã‚„り方やパッãƒã®å½“ã¦æ–¹ãªã©ã®é–“接 | 223 | ã¾ãŸã€ã‚«ãƒ¼ãƒãƒ«ã®ã‚³ãƒ³ãƒ‘イルã®ã‚„り方やパッãƒã®å½“ã¦æ–¹ãªã©ã®é–“接的ãªåŸºæœ¬æƒ… |
221 | çš„ãªåŸºæœ¬æƒ…å ±ã‚‚è¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ | 224 | å ±ã‚‚è¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ |
222 | 225 | ||
223 | ã‚ãªãŸãŒã©ã“ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã—ã¦è‰¯ã„ã‹ã‚ã‹ã‚‰ãªã„ãŒã€Linux カーãƒãƒ«é–‹ç™ºã‚³ãƒŸãƒ¥ | 226 | ã‚ãªãŸãŒã©ã“ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã—ã¦è‰¯ã„ã‹ã‚ã‹ã‚‰ãªã„ãŒã€Linux カーãƒãƒ«é–‹ç™ºã‚³ãƒŸãƒ¥ |
224 | ニティã«å‚åŠ ã—ã¦ä½•ã‹ã™ã‚‹ã“ã¨ã‚’ã•ãŒã—ã¦ã„ã‚‹å ´åˆã«ã¯ã€Linux kernel | 227 | ニティã«å‚åŠ ã—ã¦ä½•ã‹ã™ã‚‹ã“ã¨ã‚’ã•ãŒã—ã¦ã„ã‚‹ã®ã§ã‚れã°ã€Linux kernel |
225 | Janitor's プãƒã‚¸ã‚§ã‚¯ãƒˆã«ã„ã‘ã°è‰¯ã„ã§ã—ょㆠ- | 228 | Janitor's プãƒã‚¸ã‚§ã‚¯ãƒˆã«ã„ã‘ã°è‰¯ã„ã§ã—ょㆠ- |
226 | http://kernelnewbies.org/KernelJanitors | 229 | |
230 | https://kernelnewbies.org/KernelJanitors | ||
231 | |||
227 | ã“ã“ã¯ãã®ã‚ˆã†ãªã‚¹ã‚¿ãƒ¼ãƒˆã‚’ã™ã‚‹ã®ã«ã†ã£ã¦ã¤ã‘ã®å ´æ‰€ã§ã™ã€‚ã“ã“ã«ã¯ã€ | 232 | ã“ã“ã¯ãã®ã‚ˆã†ãªã‚¹ã‚¿ãƒ¼ãƒˆã‚’ã™ã‚‹ã®ã«ã†ã£ã¦ã¤ã‘ã®å ´æ‰€ã§ã™ã€‚ã“ã“ã«ã¯ã€ |
228 | Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ä¸ã«å«ã¾ã‚Œã‚‹ã€ãれã„ã«ã—ã€ä¿®æ£ã—ãªã‘れã°ãª | 233 | Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ä¸ã«å«ã¾ã‚Œã‚‹ã€ãれã„ã«ã—ã€ä¿®æ£ã—ãªã‘れã°ãª |
229 | らãªã„ã€å˜ç´”ãªå•題ã®ãƒªã‚¹ãƒˆãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ã“ã®ãƒ—ãƒã‚¸ã‚§ã‚¯ãƒˆã«é–¢ã‚ã‚‹ | 234 | らãªã„ã€å˜ç´”ãªå•題ã®ãƒªã‚¹ãƒˆãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ã“ã®ãƒ—ãƒã‚¸ã‚§ã‚¯ãƒˆã«é–¢ã‚ã‚‹ |
@@ -232,10 +237,11 @@ Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ä¸ã«å«ã¾ã‚Œã‚‹ã€ãれã„ã«ã—ã€ä¿ | |||
232 | ã¦ã„ãªã„å ´åˆã«ã¯ã€æ¬¡ã«ã‚„ã‚‹ä»•äº‹ã®æ–¹å‘性ãŒè¦‹ãˆã¦ãã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。 | 237 | ã¦ã„ãªã„å ´åˆã«ã¯ã€æ¬¡ã«ã‚„ã‚‹ä»•äº‹ã®æ–¹å‘性ãŒè¦‹ãˆã¦ãã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。 |
233 | 238 | ||
234 | ã‚‚ã—ã‚ãªãŸãŒã€ã™ã§ã«ã²ã¨ã¾ã¨ã¾ã‚Šã‚³ãƒ¼ãƒ‰ã‚’書ã„ã¦ã„ã¦ã€ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã«å…¥ | 239 | ã‚‚ã—ã‚ãªãŸãŒã€ã™ã§ã«ã²ã¨ã¾ã¨ã¾ã‚Šã‚³ãƒ¼ãƒ‰ã‚’書ã„ã¦ã„ã¦ã€ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã«å…¥ |
235 | れãŸã„ã¨æ€ã£ã¦ã„ãŸã‚Šã€ãれã«é–¢ã™ã‚‹é©åˆ‡ãªæ”¯æ´ã‚’求ã‚ãŸã„å ´åˆã€ã‚«ãƒ¼ãƒãƒ« | 240 | れãŸã„ã¨æ€ã£ã¦ã„ãŸã‚Šã€ãれã«é–¢ã™ã‚‹é©åˆ‡ãªæ”¯æ´ã‚’求ã‚ãŸã„å ´åˆã€ã‚«ãƒ¼ãƒãƒ«ãƒ¡ |
236 | メンターズプãƒã‚¸ã‚§ã‚¯ãƒˆã¯ãã®ã‚ˆã†ãªçš†ã•んを助ã‘ã‚‹ãŸã‚ã«ã§ãã¾ã—ãŸã€‚ | 241 | ンターズプãƒã‚¸ã‚§ã‚¯ãƒˆã¯ãã®ã‚ˆã†ãªçš†ã•んを助ã‘ã‚‹ãŸã‚ã«ã§ãã¾ã—ãŸã€‚ã“ã“ã« |
237 | ã“ã“ã«ã¯ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆãŒã‚りã€ä»¥ä¸‹ã‹ã‚‰å‚ç…§ã§ãã¾ã™ | 242 | ã¯ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆãŒã‚りã€ä»¥ä¸‹ã‹ã‚‰å‚ç…§ã§ãã¾ã™ - |
238 | http://selenic.com/mailman/listinfo/kernel-mentors | 243 | |
244 | https://selenic.com/mailman/listinfo/kernel-mentors | ||
239 | 245 | ||
240 | 実際㫠Linux カーãƒãƒ«ã®ã‚³ãƒ¼ãƒ‰ã«ã¤ã„ã¦ä¿®æ£ã‚’åŠ ãˆã‚‹å‰ã«ã€ã©ã†ã‚„ã£ã¦ãã® | 246 | 実際㫠Linux カーãƒãƒ«ã®ã‚³ãƒ¼ãƒ‰ã«ã¤ã„ã¦ä¿®æ£ã‚’åŠ ãˆã‚‹å‰ã«ã€ã©ã†ã‚„ã£ã¦ãã® |
241 | コードãŒå‹•作ã™ã‚‹ã®ã‹ã‚’ç†è§£ã™ã‚‹ã“ã¨ãŒå¿…è¦ã§ã™ã€‚ãã®ãŸã‚ã«ã¯ã€ç‰¹åˆ¥ãªãƒ„ー | 247 | コードãŒå‹•作ã™ã‚‹ã®ã‹ã‚’ç†è§£ã™ã‚‹ã“ã¨ãŒå¿…è¦ã§ã™ã€‚ãã®ãŸã‚ã«ã¯ã€ç‰¹åˆ¥ãªãƒ„ー |
@@ -244,27 +250,29 @@ Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ä¸ã«å«ã¾ã‚Œã‚‹ã€ãれã„ã«ã—ã€ä¿ | |||
244 | 特ã«ãŠã™ã™ã‚ãªã®ã¯ã€Linux クãƒã‚¹ãƒªãƒ•ァレンスプãƒã‚¸ã‚§ã‚¯ãƒˆã§ã™ã€‚ã“れã¯ã€ | 250 | 特ã«ãŠã™ã™ã‚ãªã®ã¯ã€Linux クãƒã‚¹ãƒªãƒ•ァレンスプãƒã‚¸ã‚§ã‚¯ãƒˆã§ã™ã€‚ã“れã¯ã€ |
245 | 自己å‚ç…§æ–¹å¼ã§ã€ç´¢å¼•ãŒã¤ã„㟠web å½¢å¼ã§ã€ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã‚’å‚ç…§ã™ã‚‹ã“ã¨ãŒ | 251 | 自己å‚ç…§æ–¹å¼ã§ã€ç´¢å¼•ãŒã¤ã„㟠web å½¢å¼ã§ã€ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã‚’å‚ç…§ã™ã‚‹ã“ã¨ãŒ |
246 | ã§ãã¾ã™ã€‚ã“ã®æœ€æ–°ã®ç´ æ™´ã—ã„カーãƒãƒ«ã‚³ãƒ¼ãƒ‰ã®ãƒªãƒã‚¸ãƒˆãƒªã¯ä»¥ä¸‹ã§è¦‹ã¤ã‹ã‚Š | 252 | ã§ãã¾ã™ã€‚ã“ã®æœ€æ–°ã®ç´ æ™´ã—ã„カーãƒãƒ«ã‚³ãƒ¼ãƒ‰ã®ãƒªãƒã‚¸ãƒˆãƒªã¯ä»¥ä¸‹ã§è¦‹ã¤ã‹ã‚Š |
247 | ã¾ã™- | 253 | ã¾ã™ - |
254 | |||
248 | http://lxr.free-electrons.com/ | 255 | http://lxr.free-electrons.com/ |
249 | 256 | ||
250 | 開発プãƒã‚»ã‚¹ | 257 | 開発プãƒã‚»ã‚¹ |
251 | ----------------------- | 258 | ------------ |
252 | 259 | ||
253 | Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ãƒã‚»ã‚¹ã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚«ãƒ¼ãƒãƒ«ã€Œãƒ–ラン | 260 | Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ãƒã‚»ã‚¹ã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚«ãƒ¼ãƒãƒ«ã€Œãƒ–ラン |
254 | ãƒã€ã¨å¤šæ•°ã®ã‚µãƒ–システム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã‹ã‚‰æ§‹æˆã•れã¾ã™ã€‚ | 261 | ãƒã€ã¨å¤šæ•°ã®ã‚µãƒ–システム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã‹ã‚‰æ§‹æˆã•れã¾ã™ã€‚ã“れら㮠|
255 | ã“れらã®ãƒ–ランãƒã¨ã¯- | 262 | ブランãƒã¨ã¯ - |
256 | - メイン㮠3.x カーãƒãƒ«ãƒ„リー | 263 | |
257 | - 3.x.y -stable カーãƒãƒ«ãƒ„リー | 264 | - メイン㮠4.x カーãƒãƒ«ãƒ„リー |
258 | - 3.x -git カーãƒãƒ«ãƒ‘ッム| 265 | - 4.x.y -stable カーãƒãƒ«ãƒ„リー |
266 | - 4.x -git カーãƒãƒ«ãƒ‘ッム| ||
259 | - サブシステム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã¨ãƒ‘ッム| 267 | - サブシステム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã¨ãƒ‘ッム|
260 | - çµ±åˆãƒ†ã‚¹ãƒˆã®ãŸã‚ã® 3.x -next カーãƒãƒ«ãƒ„リー | 268 | - çµ±åˆãƒ†ã‚¹ãƒˆã®ãŸã‚ã® 4.x -next カーãƒãƒ«ãƒ„リー |
261 | 269 | ||
262 | 3.x カーãƒãƒ«ãƒ„リー | 270 | 4.x カーãƒãƒ«ãƒ„リー |
263 | ----------------- | 271 | ~~~~~~~~~~~~~~~~~~ |
264 | 272 | ||
265 | 3.x カーãƒãƒ«ã¯ Linus Torvalds ã«ã‚ˆã£ã¦ãƒ¡ãƒ³ãƒ†ãƒŠãƒ³ã‚¹ã•れã€kernel.org | 273 | 4.x カーãƒãƒ«ã¯ Linus Torvalds ã«ã‚ˆã£ã¦ãƒ¡ãƒ³ãƒ†ãƒŠãƒ³ã‚¹ã•れ〠|
266 | ã® pub/linux/kernel/v3.x/ ディレクトリã«å˜åœ¨ã—ã¾ã™ã€‚ã“ã®é–‹ç™ºãƒ—ãƒã‚»ã‚¹ã¯ | 274 | https://kernel.org ã® pub/linux/kernel/v4.x/ ディレクトリã«å˜åœ¨ã—ã¾ã™ã€‚ |
267 | 以下ã®ã¨ãŠã‚Š- | 275 | ã“ã®é–‹ç™ºãƒ—ãƒã‚»ã‚¹ã¯ä»¥ä¸‹ã®ã¨ãŠã‚Š - |
268 | 276 | ||
269 | - æ–°ã—ã„カーãƒãƒ«ãŒãƒªãƒªãƒ¼ã‚¹ã•れãŸç›´å¾Œã«ã€2週間ã®ç‰¹åˆ¥æœŸé–“ãŒè¨ã‘られ〠| 277 | - æ–°ã—ã„カーãƒãƒ«ãŒãƒªãƒªãƒ¼ã‚¹ã•れãŸç›´å¾Œã«ã€2週間ã®ç‰¹åˆ¥æœŸé–“ãŒè¨ã‘られ〠|
270 | ã“ã®æœŸé–“ä¸ã«ã€ãƒ¡ãƒ³ãƒ†ãƒŠé”㯠Linus ã«å¤§ããªå·®åˆ†ã‚’é€ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ | 278 | ã“ã®æœŸé–“ä¸ã«ã€ãƒ¡ãƒ³ãƒ†ãƒŠé”㯠Linus ã«å¤§ããªå·®åˆ†ã‚’é€ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ |
@@ -272,7 +280,6 @@ Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ãƒã‚»ã‚¹ã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚ | |||
272 | 大ããªå¤‰æ›´ã¯ git(カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ç®¡ç†ãƒ„ールã€è©³ç´°ã¯ | 280 | 大ããªå¤‰æ›´ã¯ git(カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ç®¡ç†ãƒ„ールã€è©³ç´°ã¯ |
273 | http://git-scm.com/ å‚ç…§) を使ã£ã¦é€ã‚‹ã®ãŒå¥½ã¾ã—ã„やり方ã§ã™ãŒã€ãƒ‘ッ | 281 | http://git-scm.com/ å‚ç…§) を使ã£ã¦é€ã‚‹ã®ãŒå¥½ã¾ã—ã„やり方ã§ã™ãŒã€ãƒ‘ッ |
274 | ãƒãƒ•ァイルã®å½¢å¼ã®ã¾ã¾é€ã‚‹ã®ã§ã‚‚å分ã§ã™ã€‚ | 282 | ãƒãƒ•ァイルã®å½¢å¼ã®ã¾ã¾é€ã‚‹ã®ã§ã‚‚å分ã§ã™ã€‚ |
275 | |||
276 | - 2週間後ã€-rc1 カーãƒãƒ«ãŒãƒªãƒªãƒ¼ã‚¹ã•れã€ã“ã®å¾Œã«ã¯ã‚«ãƒ¼ãƒãƒ«å…¨ä½“ã®å®‰å®š | 283 | - 2週間後ã€-rc1 カーãƒãƒ«ãŒãƒªãƒªãƒ¼ã‚¹ã•れã€ã“ã®å¾Œã«ã¯ã‚«ãƒ¼ãƒãƒ«å…¨ä½“ã®å®‰å®š |
277 | 性ã«å½±éŸ¿ã‚’ã‚ãŸãˆã‚‹ã‚ˆã†ãªæ–°æ©Ÿèƒ½ã¯å«ã¾ãªã„類ã®ãƒ‘ッãƒã—ã‹å–り込むã“㨠| 284 | 性ã«å½±éŸ¿ã‚’ã‚ãŸãˆã‚‹ã‚ˆã†ãªæ–°æ©Ÿèƒ½ã¯å«ã¾ãªã„類ã®ãƒ‘ッãƒã—ã‹å–り込むã“㨠|
278 | ã¯ã§ãã¾ã›ã‚“。新ã—ã„ドライãƒ(ã‚‚ã—ãã¯ãƒ•ァイルシステム)ã®ãƒ‘ッãƒã¯ | 285 | ã¯ã§ãã¾ã›ã‚“。新ã—ã„ドライãƒ(ã‚‚ã—ãã¯ãƒ•ァイルシステム)ã®ãƒ‘ッãƒã¯ |
@@ -282,44 +289,45 @@ Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ãƒã‚»ã‚¹ã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚ | |||
282 | Linus ã¸ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹ã®ã« git を使ã†ã“ã¨ã‚‚ã§ãã¾ã™ãŒã€ãƒ‘ッãƒã¯ | 289 | Linus ã¸ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹ã®ã« git を使ã†ã“ã¨ã‚‚ã§ãã¾ã™ãŒã€ãƒ‘ッãƒã¯ |
283 | レビューã®ãŸã‚ã«ã€ãƒ‘ブリックãªãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã¸ã‚‚åŒæ™‚ã«é€ã‚‹å¿…è¦ãŒ | 290 | レビューã®ãŸã‚ã«ã€ãƒ‘ブリックãªãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã¸ã‚‚åŒæ™‚ã«é€ã‚‹å¿…è¦ãŒ |
284 | ã‚りã¾ã™ã€‚ | 291 | ã‚りã¾ã™ã€‚ |
285 | |||
286 | - æ–°ã—ã„ -rc 㯠Linus ãŒã€æœ€æ–°ã® git ツリーãŒãƒ†ã‚¹ãƒˆç›®çš„ã§ã‚れã°å分 | 292 | - æ–°ã—ã„ -rc 㯠Linus ãŒã€æœ€æ–°ã® git ツリーãŒãƒ†ã‚¹ãƒˆç›®çš„ã§ã‚れã°å分 |
287 | ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚ç›®æ¨™ã¯æ¯Žé€±æ–° | 293 | ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚ç›®æ¨™ã¯æ¯Žé€±æ–° |
288 | ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚ | 294 | ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚ |
289 | |||
290 | - ã“ã®ãƒ—ãƒã‚»ã‚¹ã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾ | 295 | - ã“ã®ãƒ—ãƒã‚»ã‚¹ã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾ |
291 | ã™ã€‚ã“ã®ãƒ—ãƒã‚»ã‚¹ã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚ | 296 | ã™ã€‚ã“ã®ãƒ—ãƒã‚»ã‚¹ã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚ |
292 | 297 | ||
293 | Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„ | 298 | Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„ |
294 | ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚りã¾ã™- | 299 | ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚りã¾ã™ - |
295 | 「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•れるã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€ã“れã¯ç¾ | 300 | |
296 | 実ã«èªè˜ã•れãŸãƒã‚°ã®çжæ³ã«ã‚ˆã‚Šãƒªãƒªãƒ¼ã‚¹ã•れるã®ã§ã‚りã€å‰ã‚‚ã£ã¦æ±ºã‚ら | 301 | *「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•れるã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€ |
297 | れãŸè¨ˆç”»ã«ã‚ˆã£ã¦ãƒªãƒªãƒ¼ã‚¹ã•れるもã®ã§ã¯ãªã„ã‹ã‚‰ã§ã™ã€‚〠| 302 | ã“れã¯ç¾å®Ÿã«èªè˜ã•れãŸãƒã‚°ã®çжæ³ã«ã‚ˆã‚Šãƒªãƒªãƒ¼ã‚¹ã•れるã®ã§ã‚り〠|
303 | å‰ã‚‚ã£ã¦æ±ºã‚られãŸè¨ˆç”»ã«ã‚ˆã£ã¦ãƒªãƒªãƒ¼ã‚¹ã•れるもã®ã§ã¯ãªã„ã‹ã‚‰ | ||
304 | ã§ã™ã€‚ã€* | ||
298 | 305 | ||
299 | 3.x.y -stable カーãƒãƒ«ãƒ„リー | 306 | 4.x.y -stable カーãƒãƒ«ãƒ„リー |
300 | --------------------------- | 307 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
301 | 308 | ||
302 | ãƒãƒ¼ã‚¸ãƒ§ãƒ³ç•ªå·ãŒ3ã¤ã®æ•°å—ã«åˆ†ã‹ã‚Œã¦ã„るカーãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚ | 309 | ãƒãƒ¼ã‚¸ãƒ§ãƒ³ç•ªå·ãŒ3ã¤ã®æ•°å—ã«åˆ†ã‹ã‚Œã¦ã„るカーãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚ |
303 | ã“れã«ã¯ã€3.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚ュリティå•題やé‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾ | 310 | ã“れã«ã¯ã€4.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚ュリティå•題やé‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾ã™ |
304 | ã™ã‚‹æ¯”較的å°ã•ã„é‡è¦ãªä¿®æ£ãŒå«ã¾ã‚Œã¾ã™ã€‚ | 311 | る比較的å°ã•ã„é‡è¦ãªä¿®æ£ãŒå«ã¾ã‚Œã¾ã™ã€‚ |
305 | 312 | ||
306 | ã“れã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ã〠| 313 | ã“れã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ãã€æœ€æ–° |
307 | 最新ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ãƒ¦ãƒ¼ã‚¶ã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚ | 314 | ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ãƒ¦ãƒ¼ã‚¶ã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚ |
308 | 315 | ||
309 | ã‚‚ã—ã€3.x.y カーãƒãƒ«ãŒå˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 3.x ㌠| 316 | ã‚‚ã—ã€4.x.y カーãƒãƒ«ãŒå˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 4.x ãŒæœ€æ–° |
310 | 最新ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚ | 317 | ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚ |
311 | 318 | ||
312 | 3.x.y 㯠"stable" ãƒãƒ¼ãƒ <stable@vger.kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•れã¦ãŠã‚Šã€å¿… | 319 | 4.x.y 㯠"stable" ãƒãƒ¼ãƒ <stable@vger.kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•れã¦ãŠã‚Šã€ |
313 | è¦ã«å¿œã˜ã¦ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚通常ã®ãƒªãƒªãƒ¼ã‚¹æœŸé–“㯠2週間毎ã§ã™ãŒã€å·®ã—迫㣠| 320 | å¿…è¦ã«å¿œã˜ã¦ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚通常ã®ãƒªãƒªãƒ¼ã‚¹æœŸé–“㯠2週間毎ã§ã™ãŒã€å·® |
314 | ãŸå•題ãŒãªã‘れã°ã‚‚ã†å°‘ã—é•·ããªã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚ã‚»ã‚ュリティ関連ã®å•題 | 321 | ã—è¿«ã£ãŸå•題ãŒãªã‘れã°ã‚‚ã†å°‘ã—é•·ããªã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚ã‚»ã‚ュリティ関 |
315 | ã®å ´åˆã¯ã“れã«å¯¾ã—ã¦ã ã„ãŸã„ã®å ´åˆã€ã™ãã«ãƒªãƒªãƒ¼ã‚¹ãŒã•れã¾ã™ã€‚ | 322 | 連ã®å•題ã®å ´åˆã¯ã“れã«å¯¾ã—ã¦ã ã„ãŸã„ã®å ´åˆã€ã™ãã«ãƒªãƒªãƒ¼ã‚¹ãŒã•れã¾ã™ã€‚ |
316 | 323 | ||
317 | カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„ã‚‹ã€Documentation/process/stable-kernel-rules.rst ファ | 324 | カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„る〠|
318 | イルã«ã¯ã©ã®ã‚ˆã†ãªç¨®é¡žã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒª | 325 | Documentation/process/stable-kernel-rules.rst ファイルã«ã¯ã©ã®ã‚ˆã†ãªç¨® |
319 | リースプãƒã‚»ã‚¹ãŒã©ã†å‹•ãã‹ãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ | 326 | 類ã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒªãƒªãƒ¼ã‚¹ãƒ—ãƒã‚»ã‚¹ãŒã©ã† |
327 | å‹•ãã‹ãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ | ||
320 | 328 | ||
321 | 3.x -git パッム| 329 | 4.x -git パッム|
322 | ------------------ | 330 | ~~~~~~~~~~~~~~~ |
323 | 331 | ||
324 | git リãƒã‚¸ãƒˆãƒªã§ç®¡ç†ã•れã¦ã„ã‚‹Linus ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„ãƒªãƒ¼ã®æ¯Žæ—¥ã®ã‚¹ãƒŠãƒƒãƒ— | 332 | git リãƒã‚¸ãƒˆãƒªã§ç®¡ç†ã•れã¦ã„ã‚‹Linus ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„ãƒªãƒ¼ã®æ¯Žæ—¥ã®ã‚¹ãƒŠãƒƒãƒ— |
325 | ショットãŒã‚りã¾ã™ã€‚(ã ã‹ã‚‰ -git ã¨ã„ã†åå‰ãŒã¤ã„ã¦ã„ã¾ã™)。ã“れらã®ãƒ‘ッ | 333 | ショットãŒã‚りã¾ã™ã€‚(ã ã‹ã‚‰ -git ã¨ã„ã†åå‰ãŒã¤ã„ã¦ã„ã¾ã™)。ã“れらã®ãƒ‘ッ |
@@ -328,7 +336,7 @@ git リãƒã‚¸ãƒˆãƒªã§ç®¡ç†ã•れã¦ã„ã‚‹Linus ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„ãƒªãƒ¼ã®æ¯Žæ | |||
328 | ã«ç”Ÿæˆã•れるã®ã§ã€ã‚ˆã‚Šå®Ÿé¨“çš„ã§ã™ã€‚ | 336 | ã«ç”Ÿæˆã•れるã®ã§ã€ã‚ˆã‚Šå®Ÿé¨“çš„ã§ã™ã€‚ |
329 | 337 | ||
330 | サブシステム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã¨ãƒ‘ッム| 338 | サブシステム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã¨ãƒ‘ッム|
331 | ------------------------------------------- | 339 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
332 | 340 | ||
333 | ãれãžã‚Œã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムã®ãƒ¡ãƒ³ãƒ†ãƒŠé”㯠--- ãã—ã¦å¤šãã®ã‚«ãƒ¼ãƒãƒ« | 341 | ãれãžã‚Œã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムã®ãƒ¡ãƒ³ãƒ†ãƒŠé”㯠--- ãã—ã¦å¤šãã®ã‚«ãƒ¼ãƒãƒ« |
334 | サブシステムã®é–‹ç™ºè€…é”ã‚‚ --- å„è‡ªã®æœ€æ–°ã®é–‹ç™ºçжæ³ã‚’ソースリãƒã‚¸ãƒˆãƒªã« | 342 | サブシステムã®é–‹ç™ºè€…é”ã‚‚ --- å„è‡ªã®æœ€æ–°ã®é–‹ç™ºçжæ³ã‚’ソースリãƒã‚¸ãƒˆãƒªã« |
@@ -340,42 +348,45 @@ git リãƒã‚¸ãƒˆãƒªã§ç®¡ç†ã•れã¦ã„ã‚‹Linus ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„ãƒªãƒ¼ã®æ¯Žæ | |||
340 | 大部分ã®ã“れらã®ãƒªãƒã‚¸ãƒˆãƒªã¯ git ツリーã§ã™ã€‚ã—ã‹ã—ãã®ä»–ã® SCM ã‚„ | 348 | 大部分ã®ã“れらã®ãƒªãƒã‚¸ãƒˆãƒªã¯ git ツリーã§ã™ã€‚ã—ã‹ã—ãã®ä»–ã® SCM ã‚„ |
341 | quilt シリーズã¨ã—ã¦å…¬é–‹ã•れã¦ã„るパッãƒã‚ューも使ã‚れã¦ã„ã¾ã™ã€‚ã“れら | 349 | quilt シリーズã¨ã—ã¦å…¬é–‹ã•れã¦ã„るパッãƒã‚ューも使ã‚れã¦ã„ã¾ã™ã€‚ã“れら |
342 | ã®ã‚µãƒ–システムリãƒã‚¸ãƒˆãƒªã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã¯ MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆã•れ | 350 | ã®ã‚µãƒ–システムリãƒã‚¸ãƒˆãƒªã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã¯ MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆã•れ |
343 | ã¦ã„ã¾ã™ã€‚ã“れらã®å¤šã㯠http://git.kernel.org/ ã§å‚ç…§ã™ã‚‹ã“ã¨ãŒã§ãã¾ | 351 | ã¦ã„ã¾ã™ã€‚ã“れらã®å¤šã㯠https://git.kernel.org/ ã§å‚ç…§ã™ã‚‹ã“ã¨ãŒã§ãã¾ |
344 | ã™ã€‚ | 352 | ã™ã€‚ |
345 | 353 | ||
346 | ææ¡ˆã•れãŸãƒ‘ッãƒãŒã“ã®ã‚ˆã†ãªã‚µãƒ–システムツリーã«ã‚³ãƒŸãƒƒãƒˆã•れるå‰ã«ã€ãƒ¡ãƒ¼ | 354 | ææ¡ˆã•れãŸãƒ‘ッãƒãŒã“ã®ã‚ˆã†ãªã‚µãƒ–システムツリーã«ã‚³ãƒŸãƒƒãƒˆã•れるå‰ã«ã€ãƒ¡ãƒ¼ |
347 | リングリストã§äº‹å‰ã«ãƒ¬ãƒ“ューã«ã‹ã‘られã¾ã™ï¼ˆä»¥ä¸‹ã®å¯¾å¿œã™ã‚‹ã‚»ã‚¯ã‚·ãƒ§ãƒ³ã‚’ | 355 | リングリストã§äº‹å‰ã«ãƒ¬ãƒ“ューã«ã‹ã‘られã¾ã™ï¼ˆä»¥ä¸‹ã®å¯¾å¿œã™ã‚‹ã‚»ã‚¯ã‚·ãƒ§ãƒ³ã‚’ |
348 | å‚照)。ã„ãã¤ã‹ã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムã§ã¯ã€ã“ã®ãƒ¬ãƒ“ュー㯠patchwork | 356 | å‚照)。ã„ãã¤ã‹ã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムã§ã¯ã€ã“ã®ãƒ¬ãƒ“ュー㯠patchwork㨠|
349 | ã¨ã„ã†ãƒ„ールã«ã‚ˆã£ã¦è¿½è·¡ã•れã¾ã™ã€‚Patchwork 㯠web インターフェイス㫠| 357 | ã„ã†ãƒ„ールã«ã‚ˆã£ã¦è¿½è·¡ã•れã¾ã™ã€‚Patchwork 㯠web インターフェイスã«ã‚ˆã£ |
350 | よã£ã¦ãƒ‘ãƒƒãƒæŠ•ç¨¿ã®è¡¨ç¤ºã€ãƒ‘ッãƒã¸ã®ã‚³ãƒ¡ãƒ³ãƒˆä»˜ã‘や改訂ãªã©ãŒã§ãã€ãã—㦠| 358 | ã¦ãƒ‘ãƒƒãƒæŠ•ç¨¿ã®è¡¨ç¤ºã€ãƒ‘ッãƒã¸ã®ã‚³ãƒ¡ãƒ³ãƒˆä»˜ã‘や改訂ãªã©ãŒã§ãã€ãã—ã¦ãƒ¡ãƒ³ |
351 | メンテナã¯ãƒ‘ッãƒã«å¯¾ã—ã¦ã€ãƒ¬ãƒ“ューä¸ã€å—付済ã¿ã€æ‹’å¦ã¨ã„ã†ã‚ˆã†ãªãƒžãƒ¼ã‚¯ | 359 | テナã¯ãƒ‘ッãƒã«å¯¾ã—ã¦ã€ãƒ¬ãƒ“ューä¸ã€å—付済ã¿ã€æ‹’å¦ã¨ã„ã†ã‚ˆã†ãªãƒžãƒ¼ã‚¯ã‚’㤠|
352 | ã‚’ã¤ã‘ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚大部分ã®ã“れら㮠patchwork ã®ã‚µã‚¤ãƒˆã¯ | 360 | ã‘ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚大部分ã®ã“れら㮠patchwork ã®ã‚µã‚¤ãƒˆã¯ |
353 | http://patchwork.kernel.org/ ã§ãƒªã‚¹ãƒˆã•れã¦ã„ã¾ã™ã€‚ | 361 | https://patchwork.kernel.org/ ã§ãƒªã‚¹ãƒˆã•れã¦ã„ã¾ã™ã€‚ |
354 | 362 | ||
355 | çµ±åˆãƒ†ã‚¹ãƒˆã®ãŸã‚ã® 3.x -next カーãƒãƒ«ãƒ„リー | 363 | çµ±åˆãƒ†ã‚¹ãƒˆã®ãŸã‚ã® 4.x -next カーãƒãƒ«ãƒ„リー |
356 | --------------------------------------------- | 364 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
357 | 365 | ||
358 | ã‚µãƒ–ã‚·ã‚¹ãƒ†ãƒ ãƒ„ãƒªãƒ¼ã®æ›´æ–°å†…容ãŒãƒ¡ã‚¤ãƒ³ãƒ©ã‚¤ãƒ³ã® 3.x ツリーã«ãƒžãƒ¼ã‚¸ã•れ | 366 | ã‚µãƒ–ã‚·ã‚¹ãƒ†ãƒ ãƒ„ãƒªãƒ¼ã®æ›´æ–°å†…容ãŒãƒ¡ã‚¤ãƒ³ãƒ©ã‚¤ãƒ³ã® 4.x ツリーã«ãƒžãƒ¼ã‚¸ã•れる |
359 | ã‚‹å‰ã«ã€ãれらã¯çµ±åˆãƒ†ã‚¹ãƒˆã•れる必è¦ãŒã‚りã¾ã™ã€‚ã“ã®ç›®çš„ã®ãŸã‚ã€å®Ÿè³ªçš„ | 367 | å‰ã«ã€ãれらã¯çµ±åˆãƒ†ã‚¹ãƒˆã•れる必è¦ãŒã‚りã¾ã™ã€‚ã“ã®ç›®çš„ã®ãŸã‚ã€å®Ÿè³ªçš„ã« |
360 | ã«å…¨ã‚µãƒ–システムツリーã‹ã‚‰ã»ã¼æ¯Žæ—¥ãƒ—ルã•れã¦ã§ãる特別ãªãƒ†ã‚¹ãƒˆç”¨ã®ãƒª | 368 | 全サブシステムツリーã‹ã‚‰ã»ã¼æ¯Žæ—¥ãƒ—ルã•れã¦ã§ãる特別ãªãƒ†ã‚¹ãƒˆç”¨ã®ãƒªãƒã‚¸ |
361 | ãƒã‚¸ãƒˆãƒªãŒå˜åœ¨ã—ã¾ã™- | 369 | トリãŒå˜åœ¨ã—ã¾ã™- |
362 | http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git | 370 | |
371 | https://git.kernel.org/?p=linux/kernel/git/next/linux-next.git | ||
363 | 372 | ||
364 | ã“ã®ã‚„り方ã«ã‚ˆã£ã¦ã€-next カーãƒãƒ«ã¯æ¬¡ã®ãƒžãƒ¼ã‚¸æ©Ÿä¼šã§ã©ã‚“ãªã‚‚ã®ãŒãƒ¡ã‚¤ãƒ³ | 373 | ã“ã®ã‚„り方ã«ã‚ˆã£ã¦ã€-next カーãƒãƒ«ã¯æ¬¡ã®ãƒžãƒ¼ã‚¸æ©Ÿä¼šã§ã©ã‚“ãªã‚‚ã®ãŒãƒ¡ã‚¤ãƒ³ |
365 | ラインカーãƒãƒ«ã«ãƒžãƒ¼ã‚¸ã•れるã‹ã€ãŠãŠã¾ã‹ãªã®å±•望をæä¾›ã—ã¾ã™ã€‚-next | 374 | ラインカーãƒãƒ«ã«ãƒžãƒ¼ã‚¸ã•れるã‹ã€ãŠãŠã¾ã‹ãªã®å±•望をæä¾›ã—ã¾ã™ã€‚-next カー |
366 | カーãƒãƒ«ã®å®Ÿè¡Œãƒ†ã‚¹ãƒˆã‚’行ã†å†’険好ããªãƒ†ã‚¹ã‚¿ãƒ¼ã¯å¤§ã„ã«æ“迎ã•れã¾ã™ | 375 | ãƒãƒ«ã®å®Ÿè¡Œãƒ†ã‚¹ãƒˆã‚’行ã†å†’険好ããªãƒ†ã‚¹ã‚¿ãƒ¼ã¯å¤§ã„ã«æ“迎ã•れã¾ã™ã€‚ |
367 | 376 | ||
368 | ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆ | 377 | ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆ |
369 | ------------- | 378 | ------------- |
370 | 379 | ||
371 | bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹ | 380 | https://bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹ |
372 | å ´æ‰€ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚ | 381 | å ´æ‰€ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚ã©ã† |
373 | ã©ã† kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- | 382 | kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„ - |
374 | http://bugzilla.kernel.org/page.cgi?id=faq.html | 383 | |
375 | メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル admin-guide/reporting-bugs.rst ã¯ã‚«ãƒ¼ãƒ | 384 | https://bugzilla.kernel.org/page.cgi?id=faq.html |
376 | ルãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼ãƒˆã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚りã€å• | 385 | |
377 | 題ã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³ | 386 | メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル |
378 | ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚ | 387 | admin-guide/reporting-bugs.rstã¯ã‚«ãƒ¼ãƒãƒ«ãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼ |
388 | トã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚りã€å•題ã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™º | ||
389 | 者ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚ | ||
379 | 390 | ||
380 | ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã®ç®¡ç† | 391 | ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã®ç®¡ç† |
381 | ------------------- | 392 | ------------------- |
@@ -383,74 +394,78 @@ bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’è¿ | |||
383 | ã‚ãªãŸã®ãƒãƒƒã‚ングã®ã‚¹ã‚ルを訓練ã™ã‚‹æœ€é«˜ã®æ–¹æ³•ã®ã²ã¨ã¤ã«ã€ä»–人ãŒãƒ¬ãƒãƒ¼ | 394 | ã‚ãªãŸã®ãƒãƒƒã‚ングã®ã‚¹ã‚ルを訓練ã™ã‚‹æœ€é«˜ã®æ–¹æ³•ã®ã²ã¨ã¤ã«ã€ä»–人ãŒãƒ¬ãƒãƒ¼ |
384 | トã—ãŸãƒã‚°ã‚’ä¿®æ£ã™ã‚‹ã“ã¨ãŒã‚りã¾ã™ã€‚ã‚ãªãŸãŒã‚«ãƒ¼ãƒãƒ«ã‚’より安定化ã•ã›ã‚‹ | 395 | トã—ãŸãƒã‚°ã‚’ä¿®æ£ã™ã‚‹ã“ã¨ãŒã‚りã¾ã™ã€‚ã‚ãªãŸãŒã‚«ãƒ¼ãƒãƒ«ã‚’より安定化ã•ã›ã‚‹ |
385 | ã“ã«å¯„与ã™ã‚‹ã¨ã„ã†ã“ã¨ã ã‘ã§ãªãã€ã‚ãªãŸã¯ ç¾å®Ÿã®å•題を修æ£ã™ã‚‹ã“ã¨ã‚’ | 396 | ã“ã«å¯„与ã™ã‚‹ã¨ã„ã†ã“ã¨ã ã‘ã§ãªãã€ã‚ãªãŸã¯ ç¾å®Ÿã®å•題を修æ£ã™ã‚‹ã“ã¨ã‚’ |
386 | å¦ã³ã€è‡ªåˆ†ã®ã‚¹ã‚ルも強化ã§ãã€ã¾ãŸä»–ã®é–‹ç™ºè€…ãŒã‚ãªãŸã®å˜åœ¨ã«æ°—ãŒã¤ã | 397 | å¦ã³ã€è‡ªåˆ†ã®ã‚¹ã‚ルも強化ã§ãã€ã¾ãŸä»–ã®é–‹ç™ºè€…ãŒã‚ãªãŸã®å˜åœ¨ã«æ°—ãŒã¤ãã¾ |
387 | ã¾ã™ã€‚ãƒã‚°ã‚’ä¿®æ£ã™ã‚‹ã“ã¨ã¯ã€å¤šãã®é–‹ç™ºè€…ã®ä¸ã‹ã‚‰è‡ªåˆ†ãŒåŠŸç¸¾ã‚’ã‚ã’る最善 | 398 | ã™ã€‚ãƒã‚°ã‚’ä¿®æ£ã™ã‚‹ã“ã¨ã¯ã€å¤šãã®é–‹ç™ºè€…ã®ä¸ã‹ã‚‰è‡ªåˆ†ãŒåŠŸç¸¾ã‚’ã‚ã’る最善㮠|
388 | ã®é“ã§ã™ã€ãªãœãªã‚‰å¤šãã®äººã¯ä»–人ã®ãƒã‚°ã®ä¿®æ£ã«æ™‚間を浪費ã™ã‚‹ã“ã¨ã‚’好㾠| 399 | é“ã§ã™ã€ãªãœãªã‚‰å¤šãã®äººã¯ä»–人ã®ãƒã‚°ã®ä¿®æ£ã«æ™‚間を浪費ã™ã‚‹ã“ã¨ã‚’好ã¾ãª |
389 | ãªã„ã‹ã‚‰ã§ã™ã€‚ | 400 | ã„ã‹ã‚‰ã§ã™ã€‚ |
390 | 401 | ||
391 | ã™ã§ã«ãƒ¬ãƒãƒ¼ãƒˆã•れãŸãƒã‚°ã®ãŸã‚ã«ä»•事をã™ã‚‹ãŸã‚ã«ã¯ã€ | 402 | ã™ã§ã«ãƒ¬ãƒãƒ¼ãƒˆã•れãŸãƒã‚°ã®ãŸã‚ã«ä»•事をã™ã‚‹ãŸã‚ã«ã¯ã€ |
392 | http://bugzilla.kernel.org ã«è¡Œã£ã¦ãã ã•ã„。もã—今後ã®ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã« | 403 | https://bugzilla.kernel.org ã«è¡Œã£ã¦ãã ã•ã„。もã—今後ã®ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã« |
393 | ã¤ã„ã¦ã‚¢ãƒ‰ãƒã‚¤ã‚¹ã‚’å—ã‘ãŸã„ã®ã§ã‚れã°ã€bugme-new メーリングリスト(æ–°ã— | 404 | ã¤ã„ã¦ã‚¢ãƒ‰ãƒã‚¤ã‚¹ã‚’å—ã‘ãŸã„ã®ã§ã‚れã°ã€bugme-new メーリングリスト(æ–°ã— |
394 | ã„ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã ã‘ãŒã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•れる) ã¾ãŸã¯ bugme-janitor メーリン | 405 | ã„ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã ã‘ãŒã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•れる) ã¾ãŸã¯ bugme-janitor メーリン |
395 | グリスト(bugzilla ã®å¤‰æ›´æ¯Žã«ã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•れる)ã‚’è³¼èªã§ãã¾ã™ã€‚ | 406 | グリスト(bugzilla ã®å¤‰æ›´æ¯Žã«ã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•れる)ã‚’è³¼èªã§ãã¾ã™ã€‚ |
396 | 407 | ||
397 | http://lists.linux-foundation.org/mailman/listinfo/bugme-new | 408 | https://lists.linux-foundation.org/mailman/listinfo/bugme-new |
398 | http://lists.linux-foundation.org/mailman/listinfo/bugme-janitors | 409 | |
410 | https://lists.linux-foundation.org/mailman/listinfo/bugme-janitors | ||
399 | 411 | ||
400 | メーリングリスト | 412 | メーリングリスト |
401 | ------------- | 413 | ---------------- |
402 | 414 | ||
403 | 上ã®ã„ãã¤ã‹ã®ãƒ‰ã‚ュメントã§è¿°ã¹ã¦ã„ã¾ã™ãŒã€ã‚³ã‚¢ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã®å¤§éƒ¨åˆ† | 415 | 上ã®ã„ãã¤ã‹ã®ãƒ‰ã‚ュメントã§è¿°ã¹ã¦ã„ã¾ã™ãŒã€ã‚³ã‚¢ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã®å¤§éƒ¨åˆ† |
404 | 㯠Linux kernel メーリングリストã«å‚åŠ ã—ã¦ã„ã¾ã™ã€‚ã“ã®ãƒªã‚¹ãƒˆã®ç™»éŒ²/脱 | 416 | 㯠Linux kernel メーリングリストã«å‚åŠ ã—ã¦ã„ã¾ã™ã€‚ã“ã®ãƒªã‚¹ãƒˆã®ç™»éŒ²/脱 |
405 | é€€ã®æ–¹æ³•ã«ã¤ã„ã¦ã¯ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- | 417 | é€€ã®æ–¹æ³•ã«ã¤ã„ã¦ã¯ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- |
418 | |||
406 | http://vger.kernel.org/vger-lists.html#linux-kernel | 419 | http://vger.kernel.org/vger-lists.html#linux-kernel |
407 | 420 | ||
408 | ã“ã®ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–㯠web 上ã®å¤šæ•°ã®å ´æ‰€ã«å˜åœ¨ã—ã¾ã™ã€‚ã“ | 421 | ã“ã®ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–㯠web 上ã®å¤šæ•°ã®å ´æ‰€ã«å˜åœ¨ã—ã¾ã™ã€‚ã“ |
409 | れらã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–を探ã™ã«ã¯ã‚µãƒ¼ãƒã‚¨ãƒ³ã‚¸ãƒ³ã‚’使ã„ã¾ã—ょã†ã€‚例ãˆã°- | 422 | れらã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–を探ã™ã«ã¯ã‚µãƒ¼ãƒã‚¨ãƒ³ã‚¸ãƒ³ã‚’使ã„ã¾ã—ょã†ã€‚例ãˆã°- |
423 | |||
410 | http://dir.gmane.org/gmane.linux.kernel | 424 | http://dir.gmane.org/gmane.linux.kernel |
411 | 425 | ||
412 | ãƒªã‚¹ãƒˆã«æŠ•ç¨¿ã™ã‚‹å‰ã«ã™ã§ã«ãã®è©±é¡ŒãŒã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã«å˜åœ¨ã™ã‚‹ã‹ã©ã†ã‹ã‚’検索 | 426 | ãƒªã‚¹ãƒˆã«æŠ•ç¨¿ã™ã‚‹å‰ã«ã™ã§ã«ãã®è©±é¡ŒãŒã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã«å˜åœ¨ã™ã‚‹ã‹ã©ã†ã‹ã‚’検索 |
413 | ã™ã‚‹ã“ã¨ã‚’是éžã‚„ã£ã¦ãã ã•ã„。多数ã®äº‹ãŒã™ã§ã«è©³ç´°ã«æ¸¡ã£ã¦è°è«–ã•れ㦠| 427 | ã™ã‚‹ã“ã¨ã‚’是éžã‚„ã£ã¦ãã ã•ã„。多数ã®äº‹ãŒã™ã§ã«è©³ç´°ã«æ¸¡ã£ã¦è°è«–ã•れã¦ãŠ |
414 | ãŠã‚Šã€ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã«ã®ã¿è¨˜éŒ²ã•れã¦ã„ã¾ã™ã€‚ | 428 | りã€ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã«ã®ã¿è¨˜éŒ²ã•れã¦ã„ã¾ã™ã€‚ |
415 | 429 | ||
416 | 大部分ã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムも自分ã®å€‹åˆ¥ã®é–‹ç™ºã‚’実施ã™ã‚‹ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ | 430 | 大部分ã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムも自分ã®å€‹åˆ¥ã®é–‹ç™ºã‚’実施ã™ã‚‹ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ |
417 | トをæŒã£ã¦ã„ã¾ã™ã€‚個々ã®ã‚°ãƒ«ãƒ¼ãƒ—ãŒã©ã‚“ãªãƒªã‚¹ãƒˆã‚’æŒã£ã¦ã„ã‚‹ã‹ã¯ã€ | 431 | トをæŒã£ã¦ã„ã¾ã™ã€‚個々ã®ã‚°ãƒ«ãƒ¼ãƒ—ãŒã©ã‚“ãªãƒªã‚¹ãƒˆã‚’æŒã£ã¦ã„ã‚‹ã‹ã¯ã€ |
418 | MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆãŒã‚りã¾ã™ã®ã§å‚ç…§ã—ã¦ãã ã•ã„。 | 432 | MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆãŒã‚りã¾ã™ã®ã§å‚ç…§ã—ã¦ãã ã•ã„。 |
419 | 433 | ||
420 | 多ãã®ãƒªã‚¹ãƒˆã¯ kernel.org ã§ãƒ›ã‚¹ãƒˆã•れã¦ã„ã¾ã™ã€‚ã“ã‚Œã‚‰ã®æƒ…å ±ã¯ä»¥ä¸‹ã«ã‚ | 434 | 多ãã®ãƒªã‚¹ãƒˆã¯ kernel.org ã§ãƒ›ã‚¹ãƒˆã•れã¦ã„ã¾ã™ã€‚ã“ã‚Œã‚‰ã®æƒ…å ±ã¯ä»¥ä¸‹ã«ã‚ |
421 | りã¾ã™- | 435 | りã¾ã™ - |
436 | |||
422 | http://vger.kernel.org/vger-lists.html | 437 | http://vger.kernel.org/vger-lists.html |
423 | 438 | ||
424 | メーリングリストを使ã†å ´åˆã€è‰¯ã„行動習慣ã«å¾“ã†ã‚ˆã†ã«ã—ã¾ã—ょã†ã€‚ | 439 | メーリングリストを使ã†å ´åˆã€è‰¯ã„行動習慣ã«å¾“ã†ã‚ˆã†ã«ã—ã¾ã—ょã†ã€‚å°‘ã—安㣠|
425 | å°‘ã—安ã£ã½ã„ãŒã€ä»¥ä¸‹ã® URL ã¯ä¸Šã®ãƒªã‚¹ãƒˆ(ã‚„ä»–ã®ãƒªã‚¹ãƒˆ)ã§ä¼šè©±ã™ã‚‹å ´åˆã® | 440 | ã½ã„ãŒã€ä»¥ä¸‹ã® URL ã¯ä¸Šã®ãƒªã‚¹ãƒˆ(ã‚„ä»–ã®ãƒªã‚¹ãƒˆ)ã§ä¼šè©±ã™ã‚‹å ´åˆã®ã‚·ãƒ³ãƒ—ル |
426 | シンプルãªã‚¬ã‚¤ãƒ‰ãƒ©ã‚¤ãƒ³ã‚’示ã—ã¦ã„ã¾ã™- | 441 | ãªã‚¬ã‚¤ãƒ‰ãƒ©ã‚¤ãƒ³ã‚’示ã—ã¦ã„ã¾ã™ - |
442 | |||
427 | http://www.albion.com/netiquette/ | 443 | http://www.albion.com/netiquette/ |
428 | 444 | ||
429 | ã‚‚ã—複数ã®äººãŒã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ã«è¿”事をã—ãŸå ´åˆã€CC: ã§å—ã‘る人ã®ãƒªã‚¹ãƒˆã¯ | 445 | ã‚‚ã—複数ã®äººãŒã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ã«è¿”事をã—ãŸå ´åˆã€CC: ã§å—ã‘る人ã®ãƒªã‚¹ãƒˆã¯ |
430 | ã ã„ã¶å¤šããªã‚‹ã§ã—ょã†ã€‚良ã„ç†ç”±ãŒãªã„å ´åˆã€CC: リストã‹ã‚‰èª°ã‹ã‚’削除を | 446 | ã ã„ã¶å¤šããªã‚‹ã§ã—ょã†ã€‚æ£å½“ãªç†ç”±ãŒãªã„é™ã‚Šã€CC: リストã‹ã‚‰èª°ã‹ã‚’削除 |
431 | ã—ãªã„よã†ã«ã€ã¾ãŸã€ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã ã‘ã«ãƒªãƒ—ライã™ã‚‹ã“ã¨ã® | 447 | ã‚’ã—ãªã„よã†ã«ã€ã¾ãŸã€ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã ã‘ã«ãƒªãƒ—ライã™ã‚‹ã“㨠|
432 | ãªã„よã†ã«ã—ã¾ã—ょã†ã€‚1ã¤ã¯é€ä¿¡è€…ã‹ã‚‰ã€ã‚‚ã†1ã¤ã¯ãƒªã‚¹ãƒˆã‹ã‚‰ã®ã‚ˆã†ã«ã€ãƒ¡ãƒ¼ | 448 | ã®ãªã„よã†ã«ã—ã¾ã—ょã†ã€‚1ã¤ã¯é€ä¿¡è€…ã‹ã‚‰ã€ã‚‚ã†1ã¤ã¯ãƒªã‚¹ãƒˆã‹ã‚‰ã®ã‚ˆã†ã«ã€ |
433 | ルを2回å—ã‘ã‚‹ã“ã¨ã«ãªã£ã¦ã‚‚ãã‚Œã«æ…£ã‚Œã€ã—ゃれãŸãƒ¡ãƒ¼ãƒ«ãƒ˜ãƒƒãƒ€ãƒ¼ã‚’è¿½åŠ ã— | 449 | メールを2回å—ã‘ã‚‹ã“ã¨ã«ãªã£ã¦ã‚‚ãã‚Œã«æ…£ã‚Œã€ã—ゃれãŸãƒ¡ãƒ¼ãƒ«ãƒ˜ãƒƒãƒ€ãƒ¼ã‚’追 |
434 | ã¦ã“ã®çŠ¶æ…‹ã‚’å¤‰ãˆã‚ˆã†ã¨ã—ãªã„よã†ã«ã€‚人々ã¯ãã®ã‚ˆã†ãªã“ã¨ã¯å¥½ã¿ã¾ã›ã‚“。 | 450 | åŠ ã—ã¦ã“ã®çŠ¶æ…‹ã‚’å¤‰ãˆã‚ˆã†ã¨ã—ãªã„よã†ã«ã€‚人々ã¯ãã®ã‚ˆã†ãªã“ã¨ã¯å¥½ã¿ã¾ã› |
451 | ん。 | ||
435 | 452 | ||
436 | 今ã¾ã§ã®ãƒ¡ãƒ¼ãƒ«ã§ã®ã‚„りã¨ã‚Šã¨ãã®é–“ã®ã‚ãªãŸã®ç™ºè¨€ã¯ãã®ã¾ã¾æ®‹ã—〠| 453 | 今ã¾ã§ã®ãƒ¡ãƒ¼ãƒ«ã§ã®ã‚„りã¨ã‚Šã¨ãã®é–“ã®ã‚ãªãŸã®ç™ºè¨€ã¯ãã®ã¾ã¾æ®‹ã—〠|
437 | "John Kernelhacker wrote ...:" ã®è¡Œã‚’ã‚ãªãŸã®ãƒªãƒ—ライã®å…ˆé 行ã«ã—ã¦ã€ | 454 | "John Kernelhacker wrote ...:" ã®è¡Œã‚’ã‚ãªãŸã®ãƒªãƒ—ライã®å…ˆé 行ã«ã—ã¦ã€ |
438 | メールã®å…ˆé ã§ãªãã€å„引用行ã®é–“ã«ã‚ãªãŸã®è¨€ã„ãŸã„ã“ã¨ã‚’è¿½åŠ ã™ã‚‹ã¹ãã§ | 455 | メールã®å…ˆé ã§ãªãã€å„引用行ã®é–“ã«ã‚ãªãŸã®è¨€ã„ãŸã„ã“ã¨ã‚’è¿½åŠ ã™ã‚‹ã¹ãã§ |
439 | ã™ã€‚ | 456 | ã™ã€‚ |
440 | 457 | ||
441 | ã‚‚ã—パッãƒã‚’メールã«ä»˜ã‘ã‚‹å ´åˆã¯ã€Documentation/process/submitting-patches.rst ã«æ | 458 | ã‚‚ã—パッãƒã‚’メールã«ä»˜ã‘ã‚‹å ´åˆã¯ã€ |
442 | 示ã•れã¦ã„るよã†ã«ã€ãれ㯠プレーンãªå¯èªãƒ†ã‚ストã«ã™ã‚‹ã“ã¨ã‚’忘れãªã„ | 459 | Documentation/process/submitting-patches.rst ã«æç¤ºã•れã¦ã„るよã†ã«ã€ã |
443 | よã†ã«ã—ã¾ã—ょã†ã€‚カーãƒãƒ«é–‹ç™ºè€…㯠添付や圧縮ã—ãŸãƒ‘ッãƒã‚’扱ã„ãŸãŒã‚Šã¾ | 460 | れ㯠プレーンãªå¯èªãƒ†ã‚ストã«ã™ã‚‹ã“ã¨ã‚’忘れãªã„よã†ã«ã—ã¾ã—ょã†ã€‚カー |
444 | ã›ã‚“- | 461 | ãƒãƒ«é–‹ç™ºè€…㯠添付や圧縮ã—ãŸãƒ‘ッãƒã‚’扱ã„ãŸãŒã‚Šã¾ã›ã‚“。彼らã¯ã‚ãªãŸã®ãƒ‘ッ |
445 | 彼らã¯ã‚ãªãŸã®ãƒ‘ッãƒã®è¡Œæ¯Žã«ã‚³ãƒ¡ãƒ³ãƒˆã‚’入れãŸã„ã®ã§ã€ãã®ãŸã‚ã«ã¯ãã†ã™ | 462 | ãƒã®è¡Œæ¯Žã«ã‚³ãƒ¡ãƒ³ãƒˆã‚’入れãŸã„ã®ã§ã€ãã†ã™ã‚‹ã—ã‹ã‚りã¾ã›ã‚“。ã‚ãªãŸã®ãƒ¡ãƒ¼ |
446 | ã‚‹ã—ã‹ã‚りã¾ã›ã‚“。ã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ãƒ—ãƒã‚°ãƒ©ãƒ ãŒç©ºç™½ã‚„タブを圧縮ã—ãªã„よㆠ| 463 | ルプãƒã‚°ãƒ©ãƒ ãŒç©ºç™½ã‚„タブを圧縮ã—ãªã„よã†ã«ç¢ºèªã—ã¾ã—ょã†ã€‚最åˆã®è‰¯ã„テ |
447 | ã«ç¢ºèªã—ãŸæ–¹ãŒè‰¯ã„ã§ã™ã€‚最åˆã®è‰¯ã„テストã¨ã—ã¦ã¯ã€è‡ªåˆ†ã«ãƒ¡ãƒ¼ãƒ«ã‚’é€ã£ã¦ | 464 | ストã¨ã—ã¦ã¯ã€è‡ªåˆ†ã«ãƒ¡ãƒ¼ãƒ«ã‚’é€ã£ã¦ã¿ã¦ã€ãã®ãƒ‘ッãƒã‚’自分ã§å½“ã¦ã¦ã¿ã‚‹ã“ |
448 | ã¿ã¦ã€ãã®ãƒ‘ッãƒã‚’自分ã§å½“ã¦ã¦ã¿ã‚‹ã“ã¨ã§ã™ã€‚ã‚‚ã—ãれãŒã†ã¾ã行ã‹ãªã„㪠| 465 | ã¨ã§ã™ã€‚ã‚‚ã—ãれãŒã†ã¾ã行ã‹ãªã„ãªã‚‰ã€ã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ãƒ—ãƒã‚°ãƒ©ãƒ ã‚’ç›´ã—㦠|
449 | らã€ã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ãƒ—ãƒã‚°ãƒ©ãƒ ã‚’ç›´ã—ã¦ã‚‚らã†ã‹ã€æ£ã—ãå‹•ãよã†ã«å¤‰ãˆã‚‹ã¹ | 466 | もらã†ã‹ã€æ£ã—ãå‹•ãよã†ã«å¤‰ãˆã‚‹ã¹ãã§ã™ã€‚ |
450 | ãã§ã™ã€‚ | ||
451 | 467 | ||
452 | ã¨ã‚Šã‚ã‘ã€ä»–ã®ç™»éŒ²è€…ã«å¯¾ã™ã‚‹å°Šæ•¬ã‚’表ã™ã‚ˆã†ã«ã™ã‚‹ã“ã¨ã‚’覚ãˆã¦ãŠã„ã¦ãã | 468 | 何をãŠã„ã¦ã‚‚ã€ä»–ã®è³¼èªè€…ã«å¯¾ã™ã‚‹æ•¬æ„を表ã™ã“ã¨ã‚’忘れãªã„ã§ãã ã•ã„。 |
453 | ã•ã„。 | ||
454 | 469 | ||
455 | コミュニティã¨å…±ã«åƒãã“㨠| 470 | コミュニティã¨å…±ã«åƒãã“㨠|
456 | -------------------------- | 471 | -------------------------- |
@@ -459,21 +474,22 @@ MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆãŒã‚りã¾ã™ã®ã§å‚ç…§ã—ã¦ãã ã•ã | |||
459 | ã§ã™ã€‚ã‚ãªãŸãŒãƒ‘ッãƒã‚’å—ã‘入れã¦ã‚‚らã†ãŸã‚ã«æŠ•ç¨¿ã—ãŸå ´åˆã€ãれã¯ã€æŠ€è¡“ | 474 | ã§ã™ã€‚ã‚ãªãŸãŒãƒ‘ッãƒã‚’å—ã‘入れã¦ã‚‚らã†ãŸã‚ã«æŠ•ç¨¿ã—ãŸå ´åˆã€ãれã¯ã€æŠ€è¡“ |
460 | 的メリットã ã‘ãŒãƒ¬ãƒ“ューã•れã¾ã™ã€‚ãã®éš›ã€ã‚ãªãŸã¯ä½•を予想ã™ã¹ãã§ã—ょ | 475 | 的メリットã ã‘ãŒãƒ¬ãƒ“ューã•れã¾ã™ã€‚ãã®éš›ã€ã‚ãªãŸã¯ä½•を予想ã™ã¹ãã§ã—ょ |
461 | ã†ã‹? | 476 | ã†ã‹? |
477 | |||
462 | - 批判 | 478 | - 批判 |
463 | - コメント | 479 | - コメント |
464 | - 変更ã®è¦æ±‚ | 480 | - 変更ã®è¦æ±‚ |
465 | - パッãƒã®æ£å½“性ã®è¨¼æ˜Žè¦æ±‚ | 481 | - パッãƒã®æ£å½“性ã®è¨¼æ˜Žè¦æ±‚ |
466 | - 沈黙 | 482 | - 沈黙 |
467 | 483 | ||
468 | æ€ã„出ã—ã¦ãã ã•ã„ã€ã“ã“ã¯ã‚ãªãŸã®ãƒ‘ッãƒã‚’カーãƒãƒ«ã«å…¥ã‚Œã‚‹è©±ã§ã™ã€‚ã‚ | 484 | æ€ã„出ã—ã¦ãã ã•ã„ã€ã“れã¯ã‚ãªãŸã®ãƒ‘ッãƒã‚’カーãƒãƒ«ã«å…¥ã‚Œã‚‹è©±ã§ã™ã€‚ã‚㪠|
469 | ãªãŸã¯ã€ã‚ãªãŸã®ãƒ‘ッãƒã«å¯¾ã™ã‚‹æ‰¹åˆ¤ã¨ã‚³ãƒ¡ãƒ³ãƒˆã‚’å—ã‘入れるã¹ãã§ã€ãれら | 485 | ãŸã¯ã€ã‚ãªãŸã®ãƒ‘ッãƒã«å¯¾ã™ã‚‹æ‰¹åˆ¤ã¨ã‚³ãƒ¡ãƒ³ãƒˆã‚’å—ã‘入れるã¹ãã§ã€ãれらを |
470 | を技術的レベルã§è©•価ã—ã¦ã€ãƒ‘ッãƒã‚’å†ä½œæˆã™ã‚‹ã‹ã€ãªãœãれらã®å¤‰æ›´ã‚’ã™ã¹ | 486 | 技術的レベルã§è©•価ã—ã¦ã€ãƒ‘ッãƒã‚’å†ä½œæˆã™ã‚‹ã‹ã€ãªãœãれらã®å¤‰æ›´ã‚’ã™ã¹ã |
471 | ãã§ãªã„ã‹ã‚’明確ã§ç°¡æ½”ãªç†ç”±ã®èª¬æ˜Žã‚’æä¾›ã—ã¦ãã ã•ã„。 | 487 | ã§ãªã„ã‹ã‚’明確ã§ç°¡æ½”ãªç†ç”±ã®èª¬æ˜Žã‚’æä¾›ã—ã¦ãã ã•ã„。もã—ã€ã‚ãªãŸã®ãƒ‘ッ |
472 | ã‚‚ã—ã€ã‚ãªãŸã®ãƒ‘ッãƒã«ä½•ã‚‚å応ãŒãªã„å ´åˆã€ãŸã¾ã«ã¯ãƒ¡ãƒ¼ãƒ«ã®å±±ã«åŸ‹ã‚‚れ㦠| 488 | ãƒã«ä½•ã‚‚å応ãŒãªã„å ´åˆã€ãŸã¾ã«ã¯ãƒ¡ãƒ¼ãƒ«ã®å±±ã«åŸ‹ã‚‚れã¦è¦‹é€ƒã•れã€ã‚ãªãŸã® |
473 | 見逃ã•れã€ã‚ãªãŸã®æŠ•稿ãŒå¿˜ã‚Œã‚‰ã‚Œã¦ã—ã¾ã†ã“ã¨ã‚‚ã‚ã‚‹ã®ã§ã€æ•°æ—¥å¾…ã£ã¦å†åº¦ | 489 | 投稿ãŒå¿˜ã‚Œã‚‰ã‚Œã¦ã—ã¾ã†ã“ã¨ã‚‚ã‚ã‚‹ã®ã§ã€æ•°æ—¥å¾…ã£ã¦å†åº¦æŠ•稿ã—ã¦ãã ã•ã„。 |
474 | 投稿ã—ã¦ãã ã•ã„。 | 490 | |
491 | ã‚ãªãŸãŒã‚„ã‚‹ã¹ãã§ãªã„ã“ã¨ã¯? | ||
475 | 492 | ||
476 | ã‚ãªãŸãŒã‚„ã‚‹ã¹ãã§ãªã„ã‚‚ã®ã¯? | ||
477 | - 質å•ãªã—ã«ã‚ãªãŸã®ãƒ‘ッãƒãŒå—ã‘å…¥ã‚Œã‚‰ã‚Œã‚‹ã¨æƒ³åƒã™ã‚‹ã“㨠| 493 | - 質å•ãªã—ã«ã‚ãªãŸã®ãƒ‘ッãƒãŒå—ã‘å…¥ã‚Œã‚‰ã‚Œã‚‹ã¨æƒ³åƒã™ã‚‹ã“㨠|
478 | - 守りã«å…¥ã‚‹ã“㨠| 494 | - 守りã«å…¥ã‚‹ã“㨠|
479 | - コメントを無視ã™ã‚‹ã“㨠| 495 | - コメントを無視ã™ã‚‹ã“㨠|
@@ -489,37 +505,37 @@ MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆãŒã‚りã¾ã™ã®ã§å‚ç…§ã—ã¦ãã ã•ã | |||
489 | 505 | ||
490 | ã‚ãªãŸã®æœ€åˆã®ãƒ‘ッãƒã«å˜ã« 1ダースもã®ä¿®æ£ã‚’求ã‚るリストã®è¿”ç”ã«ãªã‚‹ã“ | 506 | ã‚ãªãŸã®æœ€åˆã®ãƒ‘ッãƒã«å˜ã« 1ダースもã®ä¿®æ£ã‚’求ã‚るリストã®è¿”ç”ã«ãªã‚‹ã“ |
491 | ã¨ã‚‚普通ã®ã“ã¨ã§ã™ã€‚ã“れã¯ã‚ãªãŸã®ãƒ‘ッãƒãŒå—ã‘入れられãªã„ã¨ã„ã†ã“ã¨ã§ | 507 | ã¨ã‚‚普通ã®ã“ã¨ã§ã™ã€‚ã“れã¯ã‚ãªãŸã®ãƒ‘ッãƒãŒå—ã‘入れられãªã„ã¨ã„ã†ã“ã¨ã§ |
492 | 㯠*ã‚りã¾ã›ã‚“*ã€ãã—ã¦ã‚ãªãŸè‡ªèº«ã«å対ã™ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ã®ã§ã‚‚ *ã‚り㾠| 508 | 㯠**ã‚りã¾ã›ã‚“**ã€ãã—ã¦ã‚ãªãŸè‡ªèº«ã«å対ã™ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ã®ã§ã‚‚ **ã‚ |
493 | ã›ã‚“*。å˜ã«è‡ªåˆ†ã®ãƒ‘ッãƒã«å¯¾ã—ã¦æŒ‡æ‘˜ã•れãŸå•題を全ã¦ä¿®æ£ã—ã¦å†é€ã™ã‚Œã° | 509 | りã¾ã›ã‚“**。å˜ã«è‡ªåˆ†ã®ãƒ‘ッãƒã«å¯¾ã—ã¦æŒ‡æ‘˜ã•れãŸå•題を全ã¦ä¿®æ£ã—ã¦å†é€ã™ |
494 | 良ã„ã®ã§ã™ã€‚ | 510 | れã°è‰¯ã„ã®ã§ã™ã€‚ |
495 | 511 | ||
496 | 512 | ||
497 | カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¼æ¥çµ„ç¹”ã®ã¡ãŒã„ | 513 | カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¼æ¥çµ„ç¹”ã®ã¡ãŒã„ |
498 | ----------------------------------------------------------------- | 514 | ----------------------------------------------------------------- |
499 | 515 | ||
500 | カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯å¤§éƒ¨åˆ†ã®ä¼çµ±çš„ãªä¼šç¤¾ã®é–‹ç™ºç’°å¢ƒã¨ã¯ç•°ã£ãŸã‚„り方㧠| 516 | カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯å¤§éƒ¨åˆ†ã®ä¼çµ±çš„ãªä¼šç¤¾ã®é–‹ç™ºç’°å¢ƒã¨ã¯ç•°ã£ãŸã‚„り方㧠|
501 | å‹•ã„ã¦ã„ã¾ã™ã€‚以下ã¯å•題をé¿ã‘ã‚‹ãŸã‚ã«ã§ãã‚‹ã¨è‰¯ã„ã“ã¨ã®ãƒªã‚¹ãƒˆã§ã™- | 517 | å‹•ã„ã¦ã„ã¾ã™ã€‚以下ã¯å•題をé¿ã‘ã‚‹ãŸã‚ã«ã§ãã‚‹ã¨è‰¯ã„ã“ã¨ã®ãƒªã‚¹ãƒˆã§ã™ã€‚ |
502 | 518 | ||
503 | ã‚ãªãŸã®ææ¡ˆã™ã‚‹å¤‰æ›´ã«ã¤ã„ã¦è¨€ã†ã¨ãã®ã†ã¾ã„è¨€ã„æ–¹ï¼š | 519 | ã‚ãªãŸã®ææ¡ˆã™ã‚‹å¤‰æ›´ã«ã¤ã„ã¦è¨€ã†ã¨ãã®ã†ã¾ã„è¨€ã„æ–¹ - |
504 | 520 | ||
505 | - "ã“れã¯è¤‡æ•°ã®å•題を解決ã—ã¾ã™" | 521 | - "ã“れã¯è¤‡æ•°ã®å•題を解決ã—ã¾ã™" |
506 | - "ã“れã¯2000行ã®ã‚³ãƒ¼ãƒ‰ã‚’削除ã—ã¾ã™" | 522 | - "ã“れã¯2000行ã®ã‚³ãƒ¼ãƒ‰ã‚’削除ã—ã¾ã™" |
507 | - "以下ã®ãƒ‘ッãƒã¯ã€ç§ãŒè¨€ãŠã†ã¨ã—ã¦ã„ã‚‹ã“ã¨ã‚’説明ã™ã‚‹ã‚‚ã®ã§ã™" | 523 | - "以下ã®ãƒ‘ッãƒã¯ã€ç§ãŒè¨€ãŠã†ã¨ã—ã¦ã„ã‚‹ã“ã¨ã‚’説明ã™ã‚‹ã‚‚ã®ã§ã™" |
508 | - "ç§ã¯ã“れを5ã¤ã®ç•°ãªã‚‹ã‚¢ãƒ¼ã‚テクãƒãƒ£ã§ãƒ†ã‚¹ãƒˆã—ãŸã®ã§ã™ãŒ..." | 524 | - "ç§ã¯ã“れを5ã¤ã®ç•°ãªã‚‹ã‚¢ãƒ¼ã‚テクãƒãƒ£ã§ãƒ†ã‚¹ãƒˆã—ãŸã®ã§ã™ãŒ..." |
509 | - "以下ã¯ä¸€é€£ã®å°ã•ãªãƒ‘ッãƒç¾¤ã§ã™ãŒ..." | 525 | - "以下ã¯ä¸€é€£ã®å°ã•ãªãƒ‘ッãƒç¾¤ã§ã™ãŒ..." |
510 | - "ã“れã¯å…¸åž‹çš„ãªãƒžã‚·ãƒ³ã§ã®æ€§èƒ½ã‚’å‘上ã•ã›ã¾ã™.." | 526 | - "ã“れã¯å…¸åž‹çš„ãªãƒžã‚·ãƒ³ã§ã®æ€§èƒ½ã‚’å‘上ã•ã›ã¾ã™..." |
511 | 527 | ||
512 | ã‚„ã‚ãŸæ–¹ãŒè‰¯ã„悪ã„è¨€ã„æ–¹ï¼š | 528 | ã‚„ã‚ãŸæ–¹ãŒè‰¯ã„悪ã„è¨€ã„æ–¹ - |
513 | 529 | ||
514 | - ã“ã®ã‚„り方㧠AIX/ptx/Solaris ã§ã¯ã§ããŸã®ã§ã€ã§ãã‚‹ã¯ãšã | 530 | - "ã“ã®ã‚„り方㧠AIX/ptx/Solaris ã§ã¯ã§ããŸã®ã§ã€ã§ãã‚‹ã¯ãšã ..." |
515 | - ç§ã¯ã“れを20å¹´ã‚‚ã®é–“ã‚„ã£ã¦ããŸã€ã ã‹ã‚‰ | 531 | - "ç§ã¯ã“れを20å¹´ã‚‚ã®é–“ã‚„ã£ã¦ããŸã€ã ã‹ã‚‰..." |
516 | - ã“れã¯ã€ç§ã®ä¼šç¤¾ãŒé‡‘儲ã‘ã‚’ã™ã‚‹ãŸã‚ã«å¿…è¦ã | 532 | - "ã“れã¯ç§ã®ä¼šç¤¾ãŒé‡‘儲ã‘ã‚’ã™ã‚‹ãŸã‚ã«å¿…è¦ã " |
517 | - ã“ã‚Œã¯æˆ‘々ã®ã‚¨ãƒ³ã‚¿ãƒ¼ãƒ—ライズå‘ã‘商å“ラインã®ãŸã‚ã§ã‚ã‚‹ | 533 | - "ã“ã‚Œã¯æˆ‘々ã®ã‚¨ãƒ³ã‚¿ãƒ¼ãƒ—ライズå‘ã‘商å“ラインã®ãŸã‚ã§ã‚ã‚‹" |
518 | - ã“れ㯠ç§ãŒè‡ªåˆ†ã®ã‚¢ã‚¤ãƒ‡ã‚£ã‚¢ã‚’記述ã—ãŸã€1000ページã®è¨è¨ˆè³‡æ–™ã§ã‚ã‚‹ | 534 | - "ã“れã¯ç§ãŒè‡ªåˆ†ã®ã‚¢ã‚¤ãƒ‡ã‚£ã‚¢ã‚’記述ã—ãŸã€1000ページã®è¨è¨ˆè³‡æ–™ã§ã‚ã‚‹" |
519 | - ç§ã¯ã“れã«ã¤ã„ã¦ã€6ケ月作æ¥ã—ã¦ã„る。 | 535 | - "ç§ã¯ã“れã«ã¤ã„ã¦ã€6ケ月作æ¥ã—ã¦ã„ã‚‹..." |
520 | - 以下㯠... ã«é–¢ã™ã‚‹5000行ã®ãƒ‘ッãƒã§ã™ | 536 | - "以下㯠... ã«é–¢ã™ã‚‹5000行ã®ãƒ‘ッãƒã§ã™" |
521 | - ç§ã¯ç¾åœ¨ã®ãã¡ã‚ƒãã¡ã‚ƒã‚’全部書ãç›´ã—ãŸã€ãれãŒä»¥ä¸‹ã§ã™... | 537 | - "ç§ã¯ç¾åœ¨ã®ãã¡ã‚ƒãã¡ã‚ƒã‚’全部書ãç›´ã—ãŸã€ãれãŒä»¥ä¸‹ã§ã™..." |
522 | - ç§ã¯ã€†åˆ‡ãŒã‚ã‚‹ã€ãã®ãŸã‚ã“ã®ãƒ‘ッãƒã¯ä»Šã™ãé©ç”¨ã•れる必è¦ãŒã‚ã‚‹ | 538 | - "ç§ã¯ã€†åˆ‡ãŒã‚ã‚‹ã€ãã®ãŸã‚ã“ã®ãƒ‘ッãƒã¯ä»Šã™ãé©ç”¨ã•れる必è¦ãŒã‚ã‚‹" |
523 | 539 | ||
524 | カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ãŒå¤§éƒ¨åˆ†ã®ä¼çµ±çš„ãªã‚½ãƒ•トウェアエンジニアリングã®åŠ´ | 540 | カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ãŒå¤§éƒ¨åˆ†ã®ä¼çµ±çš„ãªã‚½ãƒ•トウェアエンジニアリングã®åŠ´ |
525 | åƒç’°å¢ƒã¨ç•°ãªã‚‹ã‚‚ã†ä¸€ã¤ã®ç‚¹ã¯ã€ã‚„りã¨ã‚Šã«é¡”ã‚’åˆã‚ã›ãªã„ã¨ã„ã†ã“ã¨ã§ã™ã€‚ | 541 | åƒç’°å¢ƒã¨ç•°ãªã‚‹ã‚‚ã†ä¸€ã¤ã®ç‚¹ã¯ã€ã‚„りã¨ã‚Šã«é¡”ã‚’åˆã‚ã›ãªã„ã¨ã„ã†ã“ã¨ã§ã™ã€‚ |
@@ -535,13 +551,13 @@ Patricia (主ã«å¥³æ€§å)ã‚„ Patrick (主ã«ç”·æ€§å)ã®ç•¥ç§°)。 | |||
535 | Linux カーãƒãƒ«ã®æ´»å‹•ã‚’ã—ã¦ã€æ„見を表明ã—ãŸã“ã¨ãŒã‚る大部分ã®å¥³æ€§ã¯ã€å‰ | 551 | Linux カーãƒãƒ«ã®æ´»å‹•ã‚’ã—ã¦ã€æ„見を表明ã—ãŸã“ã¨ãŒã‚る大部分ã®å¥³æ€§ã¯ã€å‰ |
536 | å‘ããªçµŒé¨“ã‚’ã‚‚ã£ã¦ã„ã¾ã™ã€‚ | 552 | å‘ããªçµŒé¨“ã‚’ã‚‚ã£ã¦ã„ã¾ã™ã€‚ |
537 | 553 | ||
538 | 言葉ã®å£ã¯è‹±èªžãŒå¾—æ„ã§ãªã„一部ã®äººã«ã¯å•題ã«ãªã‚Šã¾ã™ã€‚ | 554 | 言葉ã®å£ã¯è‹±èªžãŒå¾—æ„ã§ãªã„一部ã®äººã«ã¯å•題ã«ãªã‚Šã¾ã™ã€‚メーリングリスト |
539 | メーリングリストã®ä¸ã§ãã¡ã‚“ã¨ã‚¢ã‚¤ãƒ‡ã‚£ã‚¢ã‚’交æ›ã™ã‚‹ã«ã¯ã€ç›¸å½“ã†ã¾ã英語 | 555 | ã®ä¸ã§ã€ãã¡ã‚“ã¨ã‚¢ã‚¤ãƒ‡ã‚£ã‚¢ã‚’交æ›ã™ã‚‹ã«ã¯ã€ç›¸å½“ã†ã¾ã英語をæ“れる必è¦ãŒ |
540 | ã‚’æ“れる必è¦ãŒã‚ã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚ãã®ãŸã‚ã€ã‚ãªãŸã¯è‡ªåˆ†ã®ãƒ¡ãƒ¼ãƒ« | 556 | ã‚ã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚ãã®ãŸã‚ã€è‡ªåˆ†ã®ãƒ¡ãƒ¼ãƒ«ã‚’é€ã‚‹å‰ã«è‹±èªžã§æ„味ãŒé€šã˜ã¦ |
541 | ã‚’é€ã‚‹å‰ã«è‹±èªžã§æ„味ãŒé€šã˜ã¦ã„ã‚‹ã‹ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ã“ã¨ã‚’ãŠè–¦ã‚ã—ã¾ã™ã€‚ | 557 | ã„ã‚‹ã‹ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ã“ã¨ã‚’ãŠè–¦ã‚ã—ã¾ã™ã€‚ |
542 | 558 | ||
543 | 変更を分割ã™ã‚‹ | 559 | 変更を分割ã™ã‚‹ |
544 | --------------------- | 560 | -------------- |
545 | 561 | ||
546 | Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’喜んã§å—容ã™ã‚‹ã“ | 562 | Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’喜んã§å—容ã™ã‚‹ã“ |
547 | ã¨ã¯ã‚りã¾ã›ã‚“ã€‚å¤‰æ›´ã¯æ£ç¢ºã«èª¬æ˜Žã•れる必è¦ãŒã‚りã€è°è«–ã•れã€å°ã•ã„ã€å€‹ | 563 | ã¨ã¯ã‚りã¾ã›ã‚“ã€‚å¤‰æ›´ã¯æ£ç¢ºã«èª¬æ˜Žã•れる必è¦ãŒã‚りã€è°è«–ã•れã€å°ã•ã„ã€å€‹ |
@@ -555,7 +571,7 @@ Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’å– | |||
555 | ã‚„ã£ã¦ã¯ã„ã‘ã¾ã›ã‚“ã€ã‚ãªãŸã®ãƒ‘ッãƒç¾¤ã¯ã„ã¤ã‚‚ã©ã‚“ãªæ™‚ã§ã‚‚ãれよりã¯å°ã• | 571 | ã‚„ã£ã¦ã¯ã„ã‘ã¾ã›ã‚“ã€ã‚ãªãŸã®ãƒ‘ッãƒç¾¤ã¯ã„ã¤ã‚‚ã©ã‚“ãªæ™‚ã§ã‚‚ãれよりã¯å°ã• |
556 | ããªã‘れã°ãªã‚Šã¾ã›ã‚“。 | 572 | ããªã‘れã°ãªã‚Šã¾ã›ã‚“。 |
557 | 573 | ||
558 | パッãƒã‚’分割ã™ã‚‹ç†ç”±ã¯ä»¥ä¸‹ã§ã™- | 574 | パッãƒã‚’分割ã™ã‚‹ç†ç”±ã¯ä»¥ä¸‹ - |
559 | 575 | ||
560 | 1) å°ã•ã„パッãƒã¯ã‚ãªãŸã®ãƒ‘ッãƒãŒé©ç”¨ã•れる見込ã¿ã‚’大ããã—ã¾ã™ã€ã‚«ãƒ¼ | 576 | 1) å°ã•ã„パッãƒã¯ã‚ãªãŸã®ãƒ‘ッãƒãŒé©ç”¨ã•れる見込ã¿ã‚’大ããã—ã¾ã™ã€ã‚«ãƒ¼ |
561 | ãƒãƒ«ã®äººé”ã¯ãƒ‘ッãƒãŒæ£ã—ã„ã‹ã©ã†ã‹ã‚’確èªã™ã‚‹æ™‚間や労力をã‹ã‘ãªã„ã‹ | 577 | ãƒãƒ«ã®äººé”ã¯ãƒ‘ッãƒãŒæ£ã—ã„ã‹ã©ã†ã‹ã‚’確èªã™ã‚‹æ™‚間や労力をã‹ã‘ãªã„ã‹ |
@@ -571,41 +587,41 @@ Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’å– | |||
571 | 2) å°ã•ã„パッãƒã‚’é€ã‚‹ã ã‘ã§ãªãã€é€ã‚‹ã¾ãˆã«ã€æ›¸ãç›´ã—ã¦ã€ã‚·ãƒ³ãƒ—ルã«ã™ | 587 | 2) å°ã•ã„パッãƒã‚’é€ã‚‹ã ã‘ã§ãªãã€é€ã‚‹ã¾ãˆã«ã€æ›¸ãç›´ã—ã¦ã€ã‚·ãƒ³ãƒ—ルã«ã™ |
572 | ã‚‹(ã‚‚ã—ãã¯ã€å˜ã«é †ç•ªã‚’変ãˆã‚‹ã ã‘ã§ã‚‚)ã“ã¨ã‚‚ã€ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚ | 588 | ã‚‹(ã‚‚ã—ãã¯ã€å˜ã«é †ç•ªã‚’変ãˆã‚‹ã ã‘ã§ã‚‚)ã“ã¨ã‚‚ã€ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚ |
573 | 589 | ||
574 | 以下ã¯ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã® Al Viro ã®ãŸã¨ãˆè©±ã§ã™ï¼š | 590 | 以下ã¯ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã® Al Viro ã®ãŸã¨ãˆè©±ã§ã™ - |
575 | 591 | ||
576 | "ç”Ÿå¾’ã®æ•°å¦ã®å®¿é¡Œã‚’採点ã™ã‚‹å…ˆç”Ÿã®ã“ã¨ã‚’考ãˆã¦ã¿ã¦ãã ã•ã„ã€å…ˆ | 592 | *"ç”Ÿå¾’ã®æ•°å¦ã®å®¿é¡Œã‚’採点ã™ã‚‹å…ˆç”Ÿã®ã“ã¨ã‚’考ãˆã¦ã¿ã¦ãã ã•ã„〠|
577 | 生ã¯ç”Ÿå¾’ãŒè§£ã«åˆ°é”ã™ã‚‹ã¾ã§ã®è©¦è¡ŒéŒ¯èª¤ã‚’見ãŸã„ã¨ã¯æ€ã‚ãªã„ã§ã—ょ | 593 | 先生ã¯ç”Ÿå¾’ãŒè§£ã«åˆ°é”ã™ã‚‹ã¾ã§ã®è©¦è¡ŒéŒ¯èª¤ã‚’見ãŸã„ã¨ã¯æ€ã‚ãªã„ã§ã— |
578 | ã†ã€‚先生ã¯ç°¡æ½”ãªæœ€é«˜ã®è§£ã‚’見ãŸã„ã®ã§ã™ã€‚良ã„生徒ã¯ã“れを知ã£ã¦ | 594 | ょã†ã€‚先生ã¯ç°¡æ½”ãªæœ€é«˜ã®è§£ã‚’見ãŸã„ã®ã§ã™ã€‚良ã„生徒ã¯ã“れを知㣠|
579 | ãŠã‚Šã€ãã—ã¦æœ€çµ‚è§£ã®å‰ã®ä¸é–“作æ¥ã‚’æå‡ºã™ã‚‹ã“ã¨ã¯æ±ºã—ã¦ãªã„ã®ã§ | 595 | ã¦ãŠã‚Šã€ãã—ã¦æœ€çµ‚è§£ã®å‰ã®ä¸é–“作æ¥ã‚’æå‡ºã™ã‚‹ã“ã¨ã¯æ±ºã—ã¦ãªã„ã® |
580 | ã™" | 596 | ã§ã™* |
581 | 597 | ||
582 | カーãƒãƒ«é–‹ç™ºã§ã‚‚ã“れã¯åŒã˜ã§ã™ã€‚メンテナé”ã¨ãƒ¬ãƒ“ューアé”ã¯ã€ | 598 | *カーãƒãƒ«é–‹ç™ºã§ã‚‚ã“れã¯åŒã˜ã§ã™ã€‚メンテナé”ã¨ãƒ¬ãƒ“ューアé”ã¯ã€ |
583 | å•題を解決ã™ã‚‹è§£ã®èƒŒå¾Œã«ãªã‚‹æ€è€ƒãƒ—ãƒã‚»ã‚¹ã‚’見ãŸã„ã¨ã¯æ€ã„ã¾ã›ã‚“。 | 599 | å•題を解決ã™ã‚‹è§£ã®èƒŒå¾Œã«ãªã‚‹æ€è€ƒãƒ—ãƒã‚»ã‚¹ã‚’見ãŸã„ã¨ã¯æ€ã„ã¾ã›ã‚“。 |
584 | 彼らã¯å˜ç´”ã§ã‚ã–ã‚„ã‹ãªè§£æ±ºæ–¹æ³•を見ãŸã„ã®ã§ã™ã€‚ | 600 | 彼らã¯å˜ç´”ã§ã‚ã–ã‚„ã‹ãªè§£æ±ºæ–¹æ³•を見ãŸã„ã®ã§ã™ã€‚"* |
585 | 601 | ||
586 | ã‚ã–ã‚„ã‹ãªè§£ã‚’説明ã™ã‚‹ã®ã¨ã€ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨å…±ã«ä»•事をã—ã€æœªè§£æ±ºã®ä»•事を | 602 | ã‚ã–ã‚„ã‹ãªè§£ã‚’説明ã™ã‚‹ã®ã¨ã€ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨å…±ã«ä»•事をã—ã€æœªè§£æ±ºã®ä»•事を |
587 | è°è«–ã™ã‚‹ã“ã¨ã®ãƒãƒ©ãƒ³ã‚¹ã‚’ã‚ープã™ã‚‹ã®ã¯é›£ã—ã„ã‹ã‚‚ã—れã¾ã›ã‚“。 | 603 | è°è«–ã™ã‚‹ã“ã¨ã®ãƒãƒ©ãƒ³ã‚¹ã‚’ã‚ープã™ã‚‹ã®ã¯é›£ã—ã„ã‹ã‚‚ã—れã¾ã›ã‚“。ã§ã™ã‹ã‚‰ã€ |
588 | ã§ã™ã‹ã‚‰ã€é–‹ç™ºãƒ—ãƒã‚»ã‚¹ã®æ—©æœŸæ®µéšŽã§æ”¹å–„ã®ãŸã‚ã®ãƒ•ィードãƒãƒƒã‚¯ã‚’もらã†ã‚ˆ | 604 | 開発プãƒã‚»ã‚¹ã®æ—©æœŸæ®µéšŽã§æ”¹å–„ã®ãŸã‚ã®ãƒ•ィードãƒãƒƒã‚¯ã‚’もらã†ã‚ˆã†ã«ã™ã‚‹ã® |
589 | ã†ã«ã™ã‚‹ã®ã‚‚良ã„ã§ã™ãŒã€å¤‰æ›´ç‚¹ã‚’å°ã•ã„部分ã«åˆ†å‰²ã—ã¦å…¨ä½“ã§ã¯ã¾ã 完æˆã— | 605 | も良ã„ã§ã™ãŒã€å¤‰æ›´ç‚¹ã‚’å°ã•ã„部分ã«åˆ†å‰²ã—ã¦å…¨ä½“ã§ã¯ã¾ã 完æˆã—ã¦ã„ãªã„仕 |
590 | ã¦ã„ãªã„仕事を(部分的ã«)å–り込んã§ã‚‚らãˆã‚‹ã‚ˆã†ã«ã™ã‚‹ã“ã¨ã‚‚良ã„ã“ã¨ã§ã™ã€‚ | 606 | 事を(部分的ã«)å–り込んã§ã‚‚らãˆã‚‹ã‚ˆã†ã«ã™ã‚‹ã“ã¨ã‚‚良ã„ã“ã¨ã§ã™ã€‚ |
591 | 607 | ||
592 | ã¾ãŸã€ã§ã上ãŒã£ã¦ã„ãªã„ã‚‚ã®ã‚„ã€"å°†æ¥ç›´ã™" よã†ãªãƒ‘ッãƒã‚’ã€æœ¬æµã«å«ã‚ | 608 | ã¾ãŸã€ã§ã上ãŒã£ã¦ã„ãªã„ã‚‚ã®ã‚„ã€"å°†æ¥ç›´ã™" よã†ãªãƒ‘ッãƒã‚’ã€æœ¬æµã«å«ã‚ |
593 | ã¦ã‚‚らã†ã‚ˆã†ã«é€ã£ã¦ã‚‚ã€ãれã¯å—ã‘付ã‘られãªã„ã“ã¨ã‚’ç†è§£ã—ã¦ãã ã•ã„。 | 609 | ã¦ã‚‚らã†ã‚ˆã†ã«é€ã£ã¦ã‚‚ã€ãれã¯å—ã‘付ã‘られãªã„ã“ã¨ã‚’ç†è§£ã—ã¦ãã ã•ã„。 |
594 | 610 | ||
595 | ã‚ãªãŸã®å¤‰æ›´ã‚’æ£å½“化ã™ã‚‹ | 611 | ã‚ãªãŸã®å¤‰æ›´ã‚’æ£å½“化ã™ã‚‹ |
596 | ------------------- | 612 | ------------------------ |
597 | 613 | ||
598 | ã‚ãªãŸã®ãƒ‘ッãƒã‚’分割ã™ã‚‹ã®ã¨åŒæ™‚ã«ã€ãªãœãã®å¤‰æ›´ã‚’è¿½åŠ ã—ãªã‘れã°ãªã‚‰ãª | 614 | ã‚ãªãŸã®ãƒ‘ッãƒã‚’分割ã™ã‚‹ã®ã¨åŒæ™‚ã«ã€ãªãœãã®å¤‰æ›´ã‚’è¿½åŠ ã—ãªã‘れã°ãªã‚‰ãª |
599 | ã„ã‹ã‚’ Linux コミュニティã«çŸ¥ã‚‰ã›ã‚‹ã“ã¨ã¯ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚新機能ã¯å¿…è¦ | 615 | ã„ã‹ã‚’ Linux コミュニティã«çŸ¥ã‚‰ã›ã‚‹ã“ã¨ã¯ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚新機能ã¯å¿…è¦ |
600 | æ€§ã¨æœ‰ç”¨æ€§ã§æ£å½“化ã•れãªã‘れã°ãªã‚Šã¾ã›ã‚“。 | 616 | æ€§ã¨æœ‰ç”¨æ€§ã§æ£å½“化ã•れãªã‘れã°ãªã‚Šã¾ã›ã‚“。 |
601 | 617 | ||
602 | ã‚ãªãŸã®å¤‰æ›´ã®èª¬æ˜Ž | 618 | ã‚ãªãŸã®å¤‰æ›´ã‚’説明ã™ã‚‹ |
603 | -------------------- | 619 | ---------------------- |
604 | 620 | ||
605 | ã‚ãªãŸã®ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹å ´åˆã«ã¯ã€ãƒ¡ãƒ¼ãƒ«ã®ä¸ã®ãƒ†ã‚ストã§ä½•を言ã†ã‹ã«ã¤ | 621 | ã‚ãªãŸã®ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹å ´åˆã«ã¯ã€ãƒ¡ãƒ¼ãƒ«ã®ä¸ã®ãƒ†ã‚ストã§ä½•を言ã†ã‹ã«ã¤ |
606 | ã„ã¦ã€ç‰¹åˆ¥ã«æ³¨æ„を払ã£ã¦ãã ã•ã„。ã“ã®æƒ…å ±ã¯ãƒ‘ッãƒã® ChangeLog ã«ä½¿ã‚ | 622 | ã„ã¦ã€ç‰¹åˆ¥ã«æ³¨æ„を払ã£ã¦ãã ã•ã„。ã“ã®æƒ…å ±ã¯ãƒ‘ッãƒã® ChangeLog ã«ä½¿ã‚ |
607 | れã€ã„ã¤ã‚‚皆ãŒã¿ã‚‰ã‚Œã‚‹ã‚ˆã†ã«ä¿ç®¡ã•れã¾ã™ã€‚ã“ã‚Œã¯æ¬¡ã®ã‚ˆã†ãªé …目をå«ã‚〠| 623 | れã€ã„ã¤ã‚‚皆ãŒã¿ã‚‰ã‚Œã‚‹ã‚ˆã†ã«ä¿ç®¡ã•れã¾ã™ã€‚ã“ã‚Œã¯æ¬¡ã®ã‚ˆã†ãªé …目をå«ã‚〠|
608 | パッãƒã‚’完全ã«è¨˜è¿°ã™ã‚‹ã¹ãã§ã™- | 624 | パッãƒã‚’完全ã«è¨˜è¿°ã™ã‚‹ã¹ãã§ã™ - |
609 | 625 | ||
610 | - ãªãœå¤‰æ›´ãŒå¿…è¦ã‹ | 626 | - ãªãœå¤‰æ›´ãŒå¿…è¦ã‹ |
611 | - パッãƒå…¨ä½“ã®è¨è¨ˆã‚¢ãƒ—ãƒãƒ¼ãƒ | 627 | - パッãƒå…¨ä½“ã®è¨è¨ˆã‚¢ãƒ—ãƒãƒ¼ãƒ |
@@ -613,18 +629,24 @@ Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’å– | |||
613 | - ãƒ†ã‚¹ãƒˆçµæžœ | 629 | - ãƒ†ã‚¹ãƒˆçµæžœ |
614 | 630 | ||
615 | ã“れã«ã¤ã„ã¦å…¨ã¦ãŒã©ã®ã‚ˆã†ã«ã‚ã‚‹ã¹ãã‹ã«ã¤ã„ã¦ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã®ãƒ‰ã‚ュメ | 631 | ã“れã«ã¤ã„ã¦å…¨ã¦ãŒã©ã®ã‚ˆã†ã«ã‚ã‚‹ã¹ãã‹ã«ã¤ã„ã¦ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã®ãƒ‰ã‚ュメ |
616 | ント㮠ChangeLog セクションを見ã¦ãã ã•ã„- | 632 | ント㮠ChangeLog セクションを見ã¦ãã ã•ã„ - |
633 | |||
617 | "The Perfect Patch" | 634 | "The Perfect Patch" |
618 | http://www.ozlabs.org/~akpm/stuff/tpp.txt | 635 | http://www.ozlabs.org/~akpm/stuff/tpp.txt |
619 | 636 | ||
620 | ã“れらã®ã©ã‚Œã‚‚ãŒã€æ™‚ã«ã¯ã¨ã¦ã‚‚困難ã§ã™ã€‚ã“ã‚Œã‚‰ã®æ…£ä¾‹ã‚’完璧ã«å®Ÿæ–½ã™ã‚‹ã« | 637 | ã“れらã¯ã©ã‚Œã‚‚ã€å®Ÿè¡Œã™ã‚‹ã“ã¨ãŒæ™‚ã«ã¯ã¨ã¦ã‚‚困難ã§ã™ã€‚ã“れらã®ä¾‹ã‚’完璧㫠|
621 | ã¯æ•°å¹´ã‹ã‹ã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。ã“れã¯ç¶™ç¶šçš„ãªæ”¹å–„ã®ãƒ—ãƒã‚»ã‚¹ã§ã‚りã€ãã®ãŸ | 638 | 実施ã™ã‚‹ã«ã¯æ•°å¹´ã‹ã‹ã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。ã“れã¯ç¶™ç¶šçš„ãªæ”¹å–„ã®ãƒ—ãƒã‚»ã‚¹ã§ã‚ |
622 | ã‚ã«ã¯å¤šæ•°ã®å¿è€ã¨æ±ºæ„ã‚’å¿…è¦ã¨ã™ã‚‹ã‚‚ã®ã§ã™ã€‚ã§ã‚‚ã€è«¦ã‚ãªã„ã§ã€ã“れã¯å¯ | 639 | りã€å¤šãã®å¿è€ã¨æ±ºæ„ã‚’å¿…è¦ã¨ã™ã‚‹ã‚‚ã®ã§ã™ã€‚ã§ã‚‚諦ã‚ãªã„ã§ã€å®Ÿç¾ã¯å¯èƒ½ã§ |
623 | 能ãªã“ã¨ã§ã™ã€‚多数ã®äººãŒã™ã§ã«ã§ãã¦ã„ã¾ã™ã—ã€å½¼ã‚‰ã‚‚皆最åˆã¯ã‚ãªãŸã¨åŒ | 640 | ã™ã€‚多数ã®äººãŒã™ã§ã«ã§ãã¦ã„ã¾ã™ã—ã€å½¼ã‚‰ã‚‚最åˆã¯ã‚ãªãŸã¨åŒã˜ã¨ã“ã‚ã‹ã‚‰ |
624 | ã˜ã¨ã“ã‚ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã—ãŸã®ã§ã™ã‹ã‚‰ã€‚ | 641 | スタートã—ãŸã®ã§ã™ã‹ã‚‰ã€‚ |
642 | |||
643 | |||
644 | |||
645 | |||
646 | ---------- | ||
625 | 647 | ||
626 | Paolo Ciarrocchi ã«æ„Ÿè¬ã€å½¼ã¯å½¼ã®æ›¸ã„㟠"Development Process" | 648 | Paolo Ciarrocchi ã«æ„Ÿè¬ã€å½¼ã¯å½¼ã®æ›¸ã„㟠"Development Process" |
627 | (http://lwn.net/Articles/94386/) セクションをã“ã®ãƒ†ã‚ストã®åŽŸåž‹ã«ã™ã‚‹ | 649 | (https://lwn.net/Articles/94386/) セクションをã“ã®ãƒ†ã‚ストã®åŽŸåž‹ã«ã™ã‚‹ |
628 | ã“ã¨ã‚’許å¯ã—ã¦ãれã¾ã—ãŸã€‚Rundy Dunlap 㨠Gerrit Huizenga ã¯ãƒ¡ãƒ¼ãƒªãƒ³ã‚° | 650 | ã“ã¨ã‚’許å¯ã—ã¦ãれã¾ã—ãŸã€‚Rundy Dunlap 㨠Gerrit Huizenga ã¯ãƒ¡ãƒ¼ãƒªãƒ³ã‚° |
629 | リストã§ã‚„ã‚‹ã¹ãã“ã¨ã¨ã‚„ã£ã¦ã¯ã„ã‘ãªã„ã“ã¨ã®ãƒªã‚¹ãƒˆã‚’æä¾›ã—ã¦ãれã¾ã—ãŸã€‚ | 651 | リストã§ã‚„ã‚‹ã¹ãã“ã¨ã¨ã‚„ã£ã¦ã¯ã„ã‘ãªã„ã“ã¨ã®ãƒªã‚¹ãƒˆã‚’æä¾›ã—ã¦ãれã¾ã—ãŸã€‚ |
630 | 以下ã®äººã€…ã®ãƒ¬ãƒ“ューã€ã‚³ãƒ¡ãƒ³ãƒˆã€è²¢çŒ®ã«æ„Ÿè¬ã€‚ | 652 | 以下ã®äººã€…ã®ãƒ¬ãƒ“ューã€ã‚³ãƒ¡ãƒ³ãƒˆã€è²¢çŒ®ã«æ„Ÿè¬ã€‚ |
@@ -634,4 +656,6 @@ Kleen, Vadim Lobanov, Jesper Juhl, Adrian Bunk, Keri Harris, Frans Pop, | |||
634 | David A. Wheeler, Junio Hamano, Michael Kerrisk, 㨠Alex Shepard | 656 | David A. Wheeler, Junio Hamano, Michael Kerrisk, 㨠Alex Shepard |
635 | å½¼ã‚‰ã®æ”¯æ´ãªã—ã§ã¯ã€ã“ã®ãƒ‰ã‚ュメントã¯ã§ããªã‹ã£ãŸã§ã—ょã†ã€‚ | 657 | å½¼ã‚‰ã®æ”¯æ´ãªã—ã§ã¯ã€ã“ã®ãƒ‰ã‚ュメントã¯ã§ããªã‹ã£ãŸã§ã—ょã†ã€‚ |
636 | 658 | ||
659 | |||
660 | |||
637 | Maintainer: Greg Kroah-Hartman <greg@kroah.com> | 661 | Maintainer: Greg Kroah-Hartman <greg@kroah.com> |
diff --git a/Documentation/translations/ja_JP/index.rst b/Documentation/translations/ja_JP/index.rst new file mode 100644 index 000000000000..2f91b895e3c2 --- /dev/null +++ b/Documentation/translations/ja_JP/index.rst | |||
@@ -0,0 +1,12 @@ | |||
1 | .. raw:: latex | ||
2 | |||
3 | \renewcommand\thesection* | ||
4 | \renewcommand\thesubsection* | ||
5 | |||
6 | Japanese translations | ||
7 | ===================== | ||
8 | |||
9 | .. toctree:: | ||
10 | :maxdepth: 1 | ||
11 | |||
12 | howto | ||
diff --git a/Documentation/translations/zh_CN/sparse.txt b/Documentation/translations/zh_CN/sparse.txt index e41dc940e162..2f728962a8e2 100644 --- a/Documentation/translations/zh_CN/sparse.txt +++ b/Documentation/translations/zh_CN/sparse.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | Chinese translated version of Documentation/sparse.txt | 1 | Chinese translated version of Documentation/dev-tools/sparse.rst |
2 | 2 | ||
3 | If you have any comment or update to the content, please contact the | 3 | If you have any comment or update to the content, please contact the |
4 | original document maintainer directly. However, if you have a problem | 4 | original document maintainer directly. However, if you have a problem |
@@ -8,7 +8,7 @@ or if there is a problem with the translation. | |||
8 | 8 | ||
9 | Chinese maintainer: Li Yang <leo@zh-kernel.org> | 9 | Chinese maintainer: Li Yang <leo@zh-kernel.org> |
10 | --------------------------------------------------------------------- | 10 | --------------------------------------------------------------------- |
11 | Documentation/sparse.txt çš„ä¸æ–‡ç¿»è¯‘ | 11 | Documentation/dev-tools/sparse.rst çš„ä¸æ–‡ç¿»è¯‘ |
12 | 12 | ||
13 | 如果想评论或更新本文的内容,请直接è”ç³»åŽŸæ–‡æ¡£çš„ç»´æŠ¤è€…ã€‚å¦‚æžœä½ ä½¿ç”¨è‹±æ–‡ | 13 | 如果想评论或更新本文的内容,请直接è”ç³»åŽŸæ–‡æ¡£çš„ç»´æŠ¤è€…ã€‚å¦‚æžœä½ ä½¿ç”¨è‹±æ–‡ |
14 | äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘䏿–‡ç‰ˆç»´æŠ¤è€…求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻 | 14 | äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘䏿–‡ç‰ˆç»´æŠ¤è€…求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻 |
diff --git a/Documentation/usb/acm.txt b/Documentation/usb/acm.txt index 17f5c2e1a570..903abca10517 100644 --- a/Documentation/usb/acm.txt +++ b/Documentation/usb/acm.txt | |||
@@ -64,7 +64,7 @@ minicom, ppp and mgetty with them. | |||
64 | 64 | ||
65 | 2. Verifying that it works | 65 | 2. Verifying that it works |
66 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | 66 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
67 | The first step would be to check /proc/bus/usb/devices, it should look | 67 | The first step would be to check /sys/kernel/debug/usb/devices, it should look |
68 | like this: | 68 | like this: |
69 | 69 | ||
70 | T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 | 70 | T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 |
diff --git a/Documentation/usb/error-codes.txt b/Documentation/usb/error-codes.txt deleted file mode 100644 index 9c3eb845ebe5..000000000000 --- a/Documentation/usb/error-codes.txt +++ /dev/null | |||
@@ -1,175 +0,0 @@ | |||
1 | Revised: 2004-Oct-21 | ||
2 | |||
3 | This is the documentation of (hopefully) all possible error codes (and | ||
4 | their interpretation) that can be returned from usbcore. | ||
5 | |||
6 | Some of them are returned by the Host Controller Drivers (HCDs), which | ||
7 | device drivers only see through usbcore. As a rule, all the HCDs should | ||
8 | behave the same except for transfer speed dependent behaviors and the | ||
9 | way certain faults are reported. | ||
10 | |||
11 | |||
12 | ************************************************************************** | ||
13 | * Error codes returned by usb_submit_urb * | ||
14 | ************************************************************************** | ||
15 | |||
16 | Non-USB-specific: | ||
17 | |||
18 | 0 URB submission went fine | ||
19 | |||
20 | -ENOMEM no memory for allocation of internal structures | ||
21 | |||
22 | USB-specific: | ||
23 | |||
24 | -EBUSY The URB is already active. | ||
25 | |||
26 | -ENODEV specified USB-device or bus doesn't exist | ||
27 | |||
28 | -ENOENT specified interface or endpoint does not exist or | ||
29 | is not enabled | ||
30 | |||
31 | -ENXIO host controller driver does not support queuing of this type | ||
32 | of urb. (treat as a host controller bug.) | ||
33 | |||
34 | -EINVAL a) Invalid transfer type specified (or not supported) | ||
35 | b) Invalid or unsupported periodic transfer interval | ||
36 | c) ISO: attempted to change transfer interval | ||
37 | d) ISO: number_of_packets is < 0 | ||
38 | e) various other cases | ||
39 | |||
40 | -EXDEV ISO: URB_ISO_ASAP wasn't specified and all the frames | ||
41 | the URB would be scheduled in have already expired. | ||
42 | |||
43 | -EFBIG Host controller driver can't schedule that many ISO frames. | ||
44 | |||
45 | -EPIPE The pipe type specified in the URB doesn't match the | ||
46 | endpoint's actual type. | ||
47 | |||
48 | -EMSGSIZE (a) endpoint maxpacket size is zero; it is not usable | ||
49 | in the current interface altsetting. | ||
50 | (b) ISO packet is larger than the endpoint maxpacket. | ||
51 | (c) requested data transfer length is invalid: negative | ||
52 | or too large for the host controller. | ||
53 | |||
54 | -ENOSPC This request would overcommit the usb bandwidth reserved | ||
55 | for periodic transfers (interrupt, isochronous). | ||
56 | |||
57 | -ESHUTDOWN The device or host controller has been disabled due to some | ||
58 | problem that could not be worked around. | ||
59 | |||
60 | -EPERM Submission failed because urb->reject was set. | ||
61 | |||
62 | -EHOSTUNREACH URB was rejected because the device is suspended. | ||
63 | |||
64 | -ENOEXEC A control URB doesn't contain a Setup packet. | ||
65 | |||
66 | |||
67 | ************************************************************************** | ||
68 | * Error codes returned by in urb->status * | ||
69 | * or in iso_frame_desc[n].status (for ISO) * | ||
70 | ************************************************************************** | ||
71 | |||
72 | USB device drivers may only test urb status values in completion handlers. | ||
73 | This is because otherwise there would be a race between HCDs updating | ||
74 | these values on one CPU, and device drivers testing them on another CPU. | ||
75 | |||
76 | A transfer's actual_length may be positive even when an error has been | ||
77 | reported. That's because transfers often involve several packets, so that | ||
78 | one or more packets could finish before an error stops further endpoint I/O. | ||
79 | |||
80 | For isochronous URBs, the urb status value is non-zero only if the URB is | ||
81 | unlinked, the device is removed, the host controller is disabled, or the total | ||
82 | transferred length is less than the requested length and the URB_SHORT_NOT_OK | ||
83 | flag is set. Completion handlers for isochronous URBs should only see | ||
84 | urb->status set to zero, -ENOENT, -ECONNRESET, -ESHUTDOWN, or -EREMOTEIO. | ||
85 | Individual frame descriptor status fields may report more status codes. | ||
86 | |||
87 | |||
88 | 0 Transfer completed successfully | ||
89 | |||
90 | -ENOENT URB was synchronously unlinked by usb_unlink_urb | ||
91 | |||
92 | -EINPROGRESS URB still pending, no results yet | ||
93 | (That is, if drivers see this it's a bug.) | ||
94 | |||
95 | -EPROTO (*, **) a) bitstuff error | ||
96 | b) no response packet received within the | ||
97 | prescribed bus turn-around time | ||
98 | c) unknown USB error | ||
99 | |||
100 | -EILSEQ (*, **) a) CRC mismatch | ||
101 | b) no response packet received within the | ||
102 | prescribed bus turn-around time | ||
103 | c) unknown USB error | ||
104 | |||
105 | Note that often the controller hardware does not | ||
106 | distinguish among cases a), b), and c), so a | ||
107 | driver cannot tell whether there was a protocol | ||
108 | error, a failure to respond (often caused by | ||
109 | device disconnect), or some other fault. | ||
110 | |||
111 | -ETIME (**) No response packet received within the prescribed | ||
112 | bus turn-around time. This error may instead be | ||
113 | reported as -EPROTO or -EILSEQ. | ||
114 | |||
115 | -ETIMEDOUT Synchronous USB message functions use this code | ||
116 | to indicate timeout expired before the transfer | ||
117 | completed, and no other error was reported by HC. | ||
118 | |||
119 | -EPIPE (**) Endpoint stalled. For non-control endpoints, | ||
120 | reset this status with usb_clear_halt(). | ||
121 | |||
122 | -ECOMM During an IN transfer, the host controller | ||
123 | received data from an endpoint faster than it | ||
124 | could be written to system memory | ||
125 | |||
126 | -ENOSR During an OUT transfer, the host controller | ||
127 | could not retrieve data from system memory fast | ||
128 | enough to keep up with the USB data rate | ||
129 | |||
130 | -EOVERFLOW (*) The amount of data returned by the endpoint was | ||
131 | greater than either the max packet size of the | ||
132 | endpoint or the remaining buffer size. "Babble". | ||
133 | |||
134 | -EREMOTEIO The data read from the endpoint did not fill the | ||
135 | specified buffer, and URB_SHORT_NOT_OK was set in | ||
136 | urb->transfer_flags. | ||
137 | |||
138 | -ENODEV Device was removed. Often preceded by a burst of | ||
139 | other errors, since the hub driver doesn't detect | ||
140 | device removal events immediately. | ||
141 | |||
142 | -EXDEV ISO transfer only partially completed | ||
143 | (only set in iso_frame_desc[n].status, not urb->status) | ||
144 | |||
145 | -EINVAL ISO madness, if this happens: Log off and go home | ||
146 | |||
147 | -ECONNRESET URB was asynchronously unlinked by usb_unlink_urb | ||
148 | |||
149 | -ESHUTDOWN The device or host controller has been disabled due | ||
150 | to some problem that could not be worked around, | ||
151 | such as a physical disconnect. | ||
152 | |||
153 | |||
154 | (*) Error codes like -EPROTO, -EILSEQ and -EOVERFLOW normally indicate | ||
155 | hardware problems such as bad devices (including firmware) or cables. | ||
156 | |||
157 | (**) This is also one of several codes that different kinds of host | ||
158 | controller use to indicate a transfer has failed because of device | ||
159 | disconnect. In the interval before the hub driver starts disconnect | ||
160 | processing, devices may receive such fault reports for every request. | ||
161 | |||
162 | |||
163 | |||
164 | ************************************************************************** | ||
165 | * Error codes returned by usbcore-functions * | ||
166 | * (expect also other submit and transfer status codes) * | ||
167 | ************************************************************************** | ||
168 | |||
169 | usb_register(): | ||
170 | -EINVAL error during registering new driver | ||
171 | |||
172 | usb_get_*/usb_set_*(): | ||
173 | usb_control_msg(): | ||
174 | usb_bulk_msg(): | ||
175 | -ETIMEDOUT Timeout expired before the transfer completed. | ||
diff --git a/Documentation/usb/gadget_serial.txt b/Documentation/usb/gadget_serial.txt index 6b4a88a8c8e3..d1def3186782 100644 --- a/Documentation/usb/gadget_serial.txt +++ b/Documentation/usb/gadget_serial.txt | |||
@@ -189,7 +189,7 @@ Once the gadget serial driver is loaded and the USB device connected | |||
189 | to the Linux host with a USB cable, the host system should recognize | 189 | to the Linux host with a USB cable, the host system should recognize |
190 | the gadget serial device. For example, the command | 190 | the gadget serial device. For example, the command |
191 | 191 | ||
192 | cat /proc/bus/usb/devices | 192 | cat /sys/kernel/debug/usb/devices |
193 | 193 | ||
194 | should show something like this: | 194 | should show something like this: |
195 | 195 | ||
@@ -221,7 +221,7 @@ Once the gadget serial driver is loaded and the USB device connected | |||
221 | to the Linux host with a USB cable, the host system should recognize | 221 | to the Linux host with a USB cable, the host system should recognize |
222 | the gadget serial device. For example, the command | 222 | the gadget serial device. For example, the command |
223 | 223 | ||
224 | cat /proc/bus/usb/devices | 224 | cat /sys/kernel/debug/usb/devices |
225 | 225 | ||
226 | should show something like this: | 226 | should show something like this: |
227 | 227 | ||
diff --git a/Documentation/usb/proc_usb_info.txt b/Documentation/usb/proc_usb_info.txt deleted file mode 100644 index 98be91982677..000000000000 --- a/Documentation/usb/proc_usb_info.txt +++ /dev/null | |||
@@ -1,390 +0,0 @@ | |||
1 | /proc/bus/usb filesystem output | ||
2 | =============================== | ||
3 | (version 2010.09.13) | ||
4 | |||
5 | |||
6 | The usbfs filesystem for USB devices is traditionally mounted at | ||
7 | /proc/bus/usb. It provides the /proc/bus/usb/devices file, as well as | ||
8 | the /proc/bus/usb/BBB/DDD files. | ||
9 | |||
10 | In many modern systems the usbfs filesystem isn't used at all. Instead | ||
11 | USB device nodes are created under /dev/usb/ or someplace similar. The | ||
12 | "devices" file is available in debugfs, typically as | ||
13 | /sys/kernel/debug/usb/devices. | ||
14 | |||
15 | |||
16 | **NOTE**: If /proc/bus/usb appears empty, and a host controller | ||
17 | driver has been linked, then you need to mount the | ||
18 | filesystem. Issue the command (as root): | ||
19 | |||
20 | mount -t usbfs none /proc/bus/usb | ||
21 | |||
22 | An alternative and more permanent method would be to add | ||
23 | |||
24 | none /proc/bus/usb usbfs defaults 0 0 | ||
25 | |||
26 | to /etc/fstab. This will mount usbfs at each reboot. | ||
27 | You can then issue `cat /proc/bus/usb/devices` to extract | ||
28 | USB device information, and user mode drivers can use usbfs | ||
29 | to interact with USB devices. | ||
30 | |||
31 | There are a number of mount options supported by usbfs. | ||
32 | Consult the source code (linux/drivers/usb/core/inode.c) for | ||
33 | information about those options. | ||
34 | |||
35 | **NOTE**: The filesystem has been renamed from "usbdevfs" to | ||
36 | "usbfs", to reduce confusion with "devfs". You may | ||
37 | still see references to the older "usbdevfs" name. | ||
38 | |||
39 | For more information on mounting the usbfs file system, see the | ||
40 | "USB Device Filesystem" section of the USB Guide. The latest copy | ||
41 | of the USB Guide can be found at http://www.linux-usb.org/ | ||
42 | |||
43 | |||
44 | THE /proc/bus/usb/BBB/DDD FILES: | ||
45 | -------------------------------- | ||
46 | Each connected USB device has one file. The BBB indicates the bus | ||
47 | number. The DDD indicates the device address on that bus. Both | ||
48 | of these numbers are assigned sequentially, and can be reused, so | ||
49 | you can't rely on them for stable access to devices. For example, | ||
50 | it's relatively common for devices to re-enumerate while they are | ||
51 | still connected (perhaps someone jostled their power supply, hub, | ||
52 | or USB cable), so a device might be 002/027 when you first connect | ||
53 | it and 002/048 sometime later. | ||
54 | |||
55 | These files can be read as binary data. The binary data consists | ||
56 | of first the device descriptor, then the descriptors for each | ||
57 | configuration of the device. Multi-byte fields in the device descriptor | ||
58 | are converted to host endianness by the kernel. The configuration | ||
59 | descriptors are in bus endian format! The configuration descriptor | ||
60 | are wTotalLength bytes apart. If a device returns less configuration | ||
61 | descriptor data than indicated by wTotalLength there will be a hole in | ||
62 | the file for the missing bytes. This information is also shown | ||
63 | in text form by the /proc/bus/usb/devices file, described later. | ||
64 | |||
65 | These files may also be used to write user-level drivers for the USB | ||
66 | devices. You would open the /proc/bus/usb/BBB/DDD file read/write, | ||
67 | read its descriptors to make sure it's the device you expect, and then | ||
68 | bind to an interface (or perhaps several) using an ioctl call. You | ||
69 | would issue more ioctls to the device to communicate to it using | ||
70 | control, bulk, or other kinds of USB transfers. The IOCTLs are | ||
71 | listed in the <linux/usbdevice_fs.h> file, and at this writing the | ||
72 | source code (linux/drivers/usb/core/devio.c) is the primary reference | ||
73 | for how to access devices through those files. | ||
74 | |||
75 | Note that since by default these BBB/DDD files are writable only by | ||
76 | root, only root can write such user mode drivers. You can selectively | ||
77 | grant read/write permissions to other users by using "chmod". Also, | ||
78 | usbfs mount options such as "devmode=0666" may be helpful. | ||
79 | |||
80 | |||
81 | |||
82 | THE /proc/bus/usb/devices FILE: | ||
83 | ------------------------------- | ||
84 | In /proc/bus/usb/devices, each device's output has multiple | ||
85 | lines of ASCII output. | ||
86 | I made it ASCII instead of binary on purpose, so that someone | ||
87 | can obtain some useful data from it without the use of an | ||
88 | auxiliary program. However, with an auxiliary program, the numbers | ||
89 | in the first 4 columns of each "T:" line (topology info: | ||
90 | Lev, Prnt, Port, Cnt) can be used to build a USB topology diagram. | ||
91 | |||
92 | Each line is tagged with a one-character ID for that line: | ||
93 | |||
94 | T = Topology (etc.) | ||
95 | B = Bandwidth (applies only to USB host controllers, which are | ||
96 | virtualized as root hubs) | ||
97 | D = Device descriptor info. | ||
98 | P = Product ID info. (from Device descriptor, but they won't fit | ||
99 | together on one line) | ||
100 | S = String descriptors. | ||
101 | C = Configuration descriptor info. (* = active configuration) | ||
102 | I = Interface descriptor info. | ||
103 | E = Endpoint descriptor info. | ||
104 | |||
105 | ======================================================================= | ||
106 | |||
107 | /proc/bus/usb/devices output format: | ||
108 | |||
109 | Legend: | ||
110 | d = decimal number (may have leading spaces or 0's) | ||
111 | x = hexadecimal number (may have leading spaces or 0's) | ||
112 | s = string | ||
113 | |||
114 | |||
115 | Topology info: | ||
116 | |||
117 | T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=dddd MxCh=dd | ||
118 | | | | | | | | | |__MaxChildren | ||
119 | | | | | | | | |__Device Speed in Mbps | ||
120 | | | | | | | |__DeviceNumber | ||
121 | | | | | | |__Count of devices at this level | ||
122 | | | | | |__Connector/Port on Parent for this device | ||
123 | | | | |__Parent DeviceNumber | ||
124 | | | |__Level in topology for this bus | ||
125 | | |__Bus number | ||
126 | |__Topology info tag | ||
127 | |||
128 | Speed may be: | ||
129 | 1.5 Mbit/s for low speed USB | ||
130 | 12 Mbit/s for full speed USB | ||
131 | 480 Mbit/s for high speed USB (added for USB 2.0); | ||
132 | also used for Wireless USB, which has no fixed speed | ||
133 | 5000 Mbit/s for SuperSpeed USB (added for USB 3.0) | ||
134 | |||
135 | For reasons lost in the mists of time, the Port number is always | ||
136 | too low by 1. For example, a device plugged into port 4 will | ||
137 | show up with "Port=03". | ||
138 | |||
139 | Bandwidth info: | ||
140 | B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd | ||
141 | | | | |__Number of isochronous requests | ||
142 | | | |__Number of interrupt requests | ||
143 | | |__Total Bandwidth allocated to this bus | ||
144 | |__Bandwidth info tag | ||
145 | |||
146 | Bandwidth allocation is an approximation of how much of one frame | ||
147 | (millisecond) is in use. It reflects only periodic transfers, which | ||
148 | are the only transfers that reserve bandwidth. Control and bulk | ||
149 | transfers use all other bandwidth, including reserved bandwidth that | ||
150 | is not used for transfers (such as for short packets). | ||
151 | |||
152 | The percentage is how much of the "reserved" bandwidth is scheduled by | ||
153 | those transfers. For a low or full speed bus (loosely, "USB 1.1"), | ||
154 | 90% of the bus bandwidth is reserved. For a high speed bus (loosely, | ||
155 | "USB 2.0") 80% is reserved. | ||
156 | |||
157 | |||
158 | Device descriptor info & Product ID info: | ||
159 | |||
160 | D: Ver=x.xx Cls=xx(s) Sub=xx Prot=xx MxPS=dd #Cfgs=dd | ||
161 | P: Vendor=xxxx ProdID=xxxx Rev=xx.xx | ||
162 | |||
163 | where | ||
164 | D: Ver=x.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd | ||
165 | | | | | | | |__NumberConfigurations | ||
166 | | | | | | |__MaxPacketSize of Default Endpoint | ||
167 | | | | | |__DeviceProtocol | ||
168 | | | | |__DeviceSubClass | ||
169 | | | |__DeviceClass | ||
170 | | |__Device USB version | ||
171 | |__Device info tag #1 | ||
172 | |||
173 | where | ||
174 | P: Vendor=xxxx ProdID=xxxx Rev=xx.xx | ||
175 | | | | |__Product revision number | ||
176 | | | |__Product ID code | ||
177 | | |__Vendor ID code | ||
178 | |__Device info tag #2 | ||
179 | |||
180 | |||
181 | String descriptor info: | ||
182 | |||
183 | S: Manufacturer=ssss | ||
184 | | |__Manufacturer of this device as read from the device. | ||
185 | | For USB host controller drivers (virtual root hubs) this may | ||
186 | | be omitted, or (for newer drivers) will identify the kernel | ||
187 | | version and the driver which provides this hub emulation. | ||
188 | |__String info tag | ||
189 | |||
190 | S: Product=ssss | ||
191 | | |__Product description of this device as read from the device. | ||
192 | | For older USB host controller drivers (virtual root hubs) this | ||
193 | | indicates the driver; for newer ones, it's a product (and vendor) | ||
194 | | description that often comes from the kernel's PCI ID database. | ||
195 | |__String info tag | ||
196 | |||
197 | S: SerialNumber=ssss | ||
198 | | |__Serial Number of this device as read from the device. | ||
199 | | For USB host controller drivers (virtual root hubs) this is | ||
200 | | some unique ID, normally a bus ID (address or slot name) that | ||
201 | | can't be shared with any other device. | ||
202 | |__String info tag | ||
203 | |||
204 | |||
205 | |||
206 | Configuration descriptor info: | ||
207 | |||
208 | C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA | ||
209 | | | | | | |__MaxPower in mA | ||
210 | | | | | |__Attributes | ||
211 | | | | |__ConfiguratioNumber | ||
212 | | | |__NumberOfInterfaces | ||
213 | | |__ "*" indicates the active configuration (others are " ") | ||
214 | |__Config info tag | ||
215 | |||
216 | USB devices may have multiple configurations, each of which act | ||
217 | rather differently. For example, a bus-powered configuration | ||
218 | might be much less capable than one that is self-powered. Only | ||
219 | one device configuration can be active at a time; most devices | ||
220 | have only one configuration. | ||
221 | |||
222 | Each configuration consists of one or more interfaces. Each | ||
223 | interface serves a distinct "function", which is typically bound | ||
224 | to a different USB device driver. One common example is a USB | ||
225 | speaker with an audio interface for playback, and a HID interface | ||
226 | for use with software volume control. | ||
227 | |||
228 | |||
229 | Interface descriptor info (can be multiple per Config): | ||
230 | |||
231 | I:* If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss | ||
232 | | | | | | | | | |__Driver name | ||
233 | | | | | | | | | or "(none)" | ||
234 | | | | | | | | |__InterfaceProtocol | ||
235 | | | | | | | |__InterfaceSubClass | ||
236 | | | | | | |__InterfaceClass | ||
237 | | | | | |__NumberOfEndpoints | ||
238 | | | | |__AlternateSettingNumber | ||
239 | | | |__InterfaceNumber | ||
240 | | |__ "*" indicates the active altsetting (others are " ") | ||
241 | |__Interface info tag | ||
242 | |||
243 | A given interface may have one or more "alternate" settings. | ||
244 | For example, default settings may not use more than a small | ||
245 | amount of periodic bandwidth. To use significant fractions | ||
246 | of bus bandwidth, drivers must select a non-default altsetting. | ||
247 | |||
248 | Only one setting for an interface may be active at a time, and | ||
249 | only one driver may bind to an interface at a time. Most devices | ||
250 | have only one alternate setting per interface. | ||
251 | |||
252 | |||
253 | Endpoint descriptor info (can be multiple per Interface): | ||
254 | |||
255 | E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=dddss | ||
256 | | | | | |__Interval (max) between transfers | ||
257 | | | | |__EndpointMaxPacketSize | ||
258 | | | |__Attributes(EndpointType) | ||
259 | | |__EndpointAddress(I=In,O=Out) | ||
260 | |__Endpoint info tag | ||
261 | |||
262 | The interval is nonzero for all periodic (interrupt or isochronous) | ||
263 | endpoints. For high speed endpoints the transfer interval may be | ||
264 | measured in microseconds rather than milliseconds. | ||
265 | |||
266 | For high speed periodic endpoints, the "MaxPacketSize" reflects | ||
267 | the per-microframe data transfer size. For "high bandwidth" | ||
268 | endpoints, that can reflect two or three packets (for up to | ||
269 | 3KBytes every 125 usec) per endpoint. | ||
270 | |||
271 | With the Linux-USB stack, periodic bandwidth reservations use the | ||
272 | transfer intervals and sizes provided by URBs, which can be less | ||
273 | than those found in endpoint descriptor. | ||
274 | |||
275 | |||
276 | ======================================================================= | ||
277 | |||
278 | |||
279 | If a user or script is interested only in Topology info, for | ||
280 | example, use something like "grep ^T: /proc/bus/usb/devices" | ||
281 | for only the Topology lines. A command like | ||
282 | "grep -i ^[tdp]: /proc/bus/usb/devices" can be used to list | ||
283 | only the lines that begin with the characters in square brackets, | ||
284 | where the valid characters are TDPCIE. With a slightly more able | ||
285 | script, it can display any selected lines (for example, only T, D, | ||
286 | and P lines) and change their output format. (The "procusb" | ||
287 | Perl script is the beginning of this idea. It will list only | ||
288 | selected lines [selected from TBDPSCIE] or "All" lines from | ||
289 | /proc/bus/usb/devices.) | ||
290 | |||
291 | The Topology lines can be used to generate a graphic/pictorial | ||
292 | of the USB devices on a system's root hub. (See more below | ||
293 | on how to do this.) | ||
294 | |||
295 | The Interface lines can be used to determine what driver is | ||
296 | being used for each device, and which altsetting it activated. | ||
297 | |||
298 | The Configuration lines could be used to list maximum power | ||
299 | (in milliamps) that a system's USB devices are using. | ||
300 | For example, "grep ^C: /proc/bus/usb/devices". | ||
301 | |||
302 | |||
303 | Here's an example, from a system which has a UHCI root hub, | ||
304 | an external hub connected to the root hub, and a mouse and | ||
305 | a serial converter connected to the external hub. | ||
306 | |||
307 | T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 | ||
308 | B: Alloc= 28/900 us ( 3%), #Int= 2, #Iso= 0 | ||
309 | D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | ||
310 | P: Vendor=0000 ProdID=0000 Rev= 0.00 | ||
311 | S: Product=USB UHCI Root Hub | ||
312 | S: SerialNumber=dce0 | ||
313 | C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA | ||
314 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub | ||
315 | E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms | ||
316 | |||
317 | T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4 | ||
318 | D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | ||
319 | P: Vendor=0451 ProdID=1446 Rev= 1.00 | ||
320 | C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA | ||
321 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub | ||
322 | E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms | ||
323 | |||
324 | T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0 | ||
325 | D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | ||
326 | P: Vendor=04b4 ProdID=0001 Rev= 0.00 | ||
327 | C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA | ||
328 | I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse | ||
329 | E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms | ||
330 | |||
331 | T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0 | ||
332 | D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | ||
333 | P: Vendor=0565 ProdID=0001 Rev= 1.08 | ||
334 | S: Manufacturer=Peracom Networks, Inc. | ||
335 | S: Product=Peracom USB to Serial Converter | ||
336 | C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA | ||
337 | I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial | ||
338 | E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl= 16ms | ||
339 | E: Ad=01(O) Atr=02(Bulk) MxPS= 16 Ivl= 16ms | ||
340 | E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl= 8ms | ||
341 | |||
342 | |||
343 | Selecting only the "T:" and "I:" lines from this (for example, by using | ||
344 | "procusb ti"), we have: | ||
345 | |||
346 | T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 | ||
347 | T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4 | ||
348 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub | ||
349 | T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0 | ||
350 | I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse | ||
351 | T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0 | ||
352 | I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial | ||
353 | |||
354 | |||
355 | Physically this looks like (or could be converted to): | ||
356 | |||
357 | +------------------+ | ||
358 | | PC/root_hub (12)| Dev# = 1 | ||
359 | +------------------+ (nn) is Mbps. | ||
360 | Level 0 | CN.0 | CN.1 | [CN = connector/port #] | ||
361 | +------------------+ | ||
362 | / | ||
363 | / | ||
364 | +-----------------------+ | ||
365 | Level 1 | Dev#2: 4-port hub (12)| | ||
366 | +-----------------------+ | ||
367 | |CN.0 |CN.1 |CN.2 |CN.3 | | ||
368 | +-----------------------+ | ||
369 | \ \____________________ | ||
370 | \_____ \ | ||
371 | \ \ | ||
372 | +--------------------+ +--------------------+ | ||
373 | Level 2 | Dev# 3: mouse (1.5)| | Dev# 4: serial (12)| | ||
374 | +--------------------+ +--------------------+ | ||
375 | |||
376 | |||
377 | |||
378 | Or, in a more tree-like structure (ports [Connectors] without | ||
379 | connections could be omitted): | ||
380 | |||
381 | PC: Dev# 1, root hub, 2 ports, 12 Mbps | ||
382 | |_ CN.0: Dev# 2, hub, 4 ports, 12 Mbps | ||
383 | |_ CN.0: Dev #3, mouse, 1.5 Mbps | ||
384 | |_ CN.1: | ||
385 | |_ CN.2: Dev #4, serial, 12 Mbps | ||
386 | |_ CN.3: | ||
387 | |_ CN.1: | ||
388 | |||
389 | |||
390 | ### END ### | ||
diff --git a/Documentation/userspace-api/conf.py b/Documentation/userspace-api/conf.py new file mode 100644 index 000000000000..2eaf59f844e5 --- /dev/null +++ b/Documentation/userspace-api/conf.py | |||
@@ -0,0 +1,10 @@ | |||
1 | # -*- coding: utf-8; mode: python -*- | ||
2 | |||
3 | project = "The Linux kernel user-space API guide" | ||
4 | |||
5 | tags.add("subproject") | ||
6 | |||
7 | latex_documents = [ | ||
8 | ('index', 'userspace-api.tex', project, | ||
9 | 'The kernel development community', 'manual'), | ||
10 | ] | ||
diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst new file mode 100644 index 000000000000..a9d01b44a659 --- /dev/null +++ b/Documentation/userspace-api/index.rst | |||
@@ -0,0 +1,26 @@ | |||
1 | ===================================== | ||
2 | The Linux kernel user-space API guide | ||
3 | ===================================== | ||
4 | |||
5 | .. _man-pages: https://www.kernel.org/doc/man-pages/ | ||
6 | |||
7 | While much of the kernel's user-space API is documented elsewhere | ||
8 | (particularly in the man-pages_ project), some user-space information can | ||
9 | also be found in the kernel tree itself. This manual is intended to be the | ||
10 | place where this information is gathered. | ||
11 | |||
12 | .. class:: toc-title | ||
13 | |||
14 | Table of contents | ||
15 | |||
16 | .. toctree:: | ||
17 | :maxdepth: 2 | ||
18 | |||
19 | unshare | ||
20 | |||
21 | .. only:: subproject and html | ||
22 | |||
23 | Indices | ||
24 | ======= | ||
25 | |||
26 | * :ref:`genindex` | ||
diff --git a/Documentation/unshare.txt b/Documentation/userspace-api/unshare.rst index a8643513a5f6..737c192cf4e7 100644 --- a/Documentation/unshare.txt +++ b/Documentation/userspace-api/unshare.rst | |||
@@ -1,17 +1,17 @@ | |||
1 | unshare system call | ||
2 | =================== | ||
1 | 3 | ||
2 | unshare system call: | 4 | This document describes the new system call, unshare(). The document |
3 | -------------------- | ||
4 | This document describes the new system call, unshare. The document | ||
5 | provides an overview of the feature, why it is needed, how it can | 5 | provides an overview of the feature, why it is needed, how it can |
6 | be used, its interface specification, design, implementation and | 6 | be used, its interface specification, design, implementation and |
7 | how it can be tested. | 7 | how it can be tested. |
8 | 8 | ||
9 | Change Log: | 9 | Change Log |
10 | ----------- | 10 | ---------- |
11 | version 0.1 Initial document, Janak Desai (janak@us.ibm.com), Jan 11, 2006 | 11 | version 0.1 Initial document, Janak Desai (janak@us.ibm.com), Jan 11, 2006 |
12 | 12 | ||
13 | Contents: | 13 | Contents |
14 | --------- | 14 | -------- |
15 | 1) Overview | 15 | 1) Overview |
16 | 2) Benefits | 16 | 2) Benefits |
17 | 3) Cost | 17 | 3) Cost |
@@ -24,6 +24,7 @@ Contents: | |||
24 | 24 | ||
25 | 1) Overview | 25 | 1) Overview |
26 | ----------- | 26 | ----------- |
27 | |||
27 | Most legacy operating system kernels support an abstraction of threads | 28 | Most legacy operating system kernels support an abstraction of threads |
28 | as multiple execution contexts within a process. These kernels provide | 29 | as multiple execution contexts within a process. These kernels provide |
29 | special resources and mechanisms to maintain these "threads". The Linux | 30 | special resources and mechanisms to maintain these "threads". The Linux |
@@ -38,33 +39,35 @@ threads. On Linux, at the time of thread creation using the clone system | |||
38 | call, applications can selectively choose which resources to share | 39 | call, applications can selectively choose which resources to share |
39 | between threads. | 40 | between threads. |
40 | 41 | ||
41 | unshare system call adds a primitive to the Linux thread model that | 42 | unshare() system call adds a primitive to the Linux thread model that |
42 | allows threads to selectively 'unshare' any resources that were being | 43 | allows threads to selectively 'unshare' any resources that were being |
43 | shared at the time of their creation. unshare was conceptualized by | 44 | shared at the time of their creation. unshare() was conceptualized by |
44 | Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part | 45 | Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part |
45 | of the discussion on POSIX threads on Linux. unshare augments the | 46 | of the discussion on POSIX threads on Linux. unshare() augments the |
46 | usefulness of Linux threads for applications that would like to control | 47 | usefulness of Linux threads for applications that would like to control |
47 | shared resources without creating a new process. unshare is a natural | 48 | shared resources without creating a new process. unshare() is a natural |
48 | addition to the set of available primitives on Linux that implement | 49 | addition to the set of available primitives on Linux that implement |
49 | the concept of process/thread as a virtual machine. | 50 | the concept of process/thread as a virtual machine. |
50 | 51 | ||
51 | 2) Benefits | 52 | 2) Benefits |
52 | ----------- | 53 | ----------- |
53 | unshare would be useful to large application frameworks such as PAM | 54 | |
55 | unshare() would be useful to large application frameworks such as PAM | ||
54 | where creating a new process to control sharing/unsharing of process | 56 | where creating a new process to control sharing/unsharing of process |
55 | resources is not possible. Since namespaces are shared by default | 57 | resources is not possible. Since namespaces are shared by default |
56 | when creating a new process using fork or clone, unshare can benefit | 58 | when creating a new process using fork or clone, unshare() can benefit |
57 | even non-threaded applications if they have a need to disassociate | 59 | even non-threaded applications if they have a need to disassociate |
58 | from default shared namespace. The following lists two use-cases | 60 | from default shared namespace. The following lists two use-cases |
59 | where unshare can be used. | 61 | where unshare() can be used. |
60 | 62 | ||
61 | 2.1 Per-security context namespaces | 63 | 2.1 Per-security context namespaces |
62 | ----------------------------------- | 64 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
63 | unshare can be used to implement polyinstantiated directories using | 65 | |
66 | unshare() can be used to implement polyinstantiated directories using | ||
64 | the kernel's per-process namespace mechanism. Polyinstantiated directories, | 67 | the kernel's per-process namespace mechanism. Polyinstantiated directories, |
65 | such as per-user and/or per-security context instance of /tmp, /var/tmp or | 68 | such as per-user and/or per-security context instance of /tmp, /var/tmp or |
66 | per-security context instance of a user's home directory, isolate user | 69 | per-security context instance of a user's home directory, isolate user |
67 | processes when working with these directories. Using unshare, a PAM | 70 | processes when working with these directories. Using unshare(), a PAM |
68 | module can easily setup a private namespace for a user at login. | 71 | module can easily setup a private namespace for a user at login. |
69 | Polyinstantiated directories are required for Common Criteria certification | 72 | Polyinstantiated directories are required for Common Criteria certification |
70 | with Labeled System Protection Profile, however, with the availability | 73 | with Labeled System Protection Profile, however, with the availability |
@@ -74,33 +77,36 @@ polyinstantiating /tmp, /var/tmp and other directories deemed | |||
74 | appropriate by system administrators. | 77 | appropriate by system administrators. |
75 | 78 | ||
76 | 2.2 unsharing of virtual memory and/or open files | 79 | 2.2 unsharing of virtual memory and/or open files |
77 | ------------------------------------------------- | 80 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
81 | |||
78 | Consider a client/server application where the server is processing | 82 | Consider a client/server application where the server is processing |
79 | client requests by creating processes that share resources such as | 83 | client requests by creating processes that share resources such as |
80 | virtual memory and open files. Without unshare, the server has to | 84 | virtual memory and open files. Without unshare(), the server has to |
81 | decide what needs to be shared at the time of creating the process | 85 | decide what needs to be shared at the time of creating the process |
82 | which services the request. unshare allows the server an ability to | 86 | which services the request. unshare() allows the server an ability to |
83 | disassociate parts of the context during the servicing of the | 87 | disassociate parts of the context during the servicing of the |
84 | request. For large and complex middleware application frameworks, this | 88 | request. For large and complex middleware application frameworks, this |
85 | ability to unshare after the process was created can be very | 89 | ability to unshare() after the process was created can be very |
86 | useful. | 90 | useful. |
87 | 91 | ||
88 | 3) Cost | 92 | 3) Cost |
89 | ------- | 93 | ------- |
90 | In order to not duplicate code and to handle the fact that unshare | 94 | |
95 | In order to not duplicate code and to handle the fact that unshare() | ||
91 | works on an active task (as opposed to clone/fork working on a newly | 96 | works on an active task (as opposed to clone/fork working on a newly |
92 | allocated inactive task) unshare had to make minor reorganizational | 97 | allocated inactive task) unshare() had to make minor reorganizational |
93 | changes to copy_* functions utilized by clone/fork system call. | 98 | changes to copy_* functions utilized by clone/fork system call. |
94 | There is a cost associated with altering existing, well tested and | 99 | There is a cost associated with altering existing, well tested and |
95 | stable code to implement a new feature that may not get exercised | 100 | stable code to implement a new feature that may not get exercised |
96 | extensively in the beginning. However, with proper design and code | 101 | extensively in the beginning. However, with proper design and code |
97 | review of the changes and creation of an unshare test for the LTP | 102 | review of the changes and creation of an unshare() test for the LTP |
98 | the benefits of this new feature can exceed its cost. | 103 | the benefits of this new feature can exceed its cost. |
99 | 104 | ||
100 | 4) Requirements | 105 | 4) Requirements |
101 | --------------- | 106 | --------------- |
102 | unshare reverses sharing that was done using clone(2) system call, | 107 | |
103 | so unshare should have a similar interface as clone(2). That is, | 108 | unshare() reverses sharing that was done using clone(2) system call, |
109 | so unshare() should have a similar interface as clone(2). That is, | ||
104 | since flags in clone(int flags, void *stack) specifies what should | 110 | since flags in clone(int flags, void *stack) specifies what should |
105 | be shared, similar flags in unshare(int flags) should specify | 111 | be shared, similar flags in unshare(int flags) should specify |
106 | what should be unshared. Unfortunately, this may appear to invert | 112 | what should be unshared. Unfortunately, this may appear to invert |
@@ -108,13 +114,14 @@ the meaning of the flags from the way they are used in clone(2). | |||
108 | However, there was no easy solution that was less confusing and that | 114 | However, there was no easy solution that was less confusing and that |
109 | allowed incremental context unsharing in future without an ABI change. | 115 | allowed incremental context unsharing in future without an ABI change. |
110 | 116 | ||
111 | unshare interface should accommodate possible future addition of | 117 | unshare() interface should accommodate possible future addition of |
112 | new context flags without requiring a rebuild of old applications. | 118 | new context flags without requiring a rebuild of old applications. |
113 | If and when new context flags are added, unshare design should allow | 119 | If and when new context flags are added, unshare() design should allow |
114 | incremental unsharing of those resources on an as needed basis. | 120 | incremental unsharing of those resources on an as needed basis. |
115 | 121 | ||
116 | 5) Functional Specification | 122 | 5) Functional Specification |
117 | --------------------------- | 123 | --------------------------- |
124 | |||
118 | NAME | 125 | NAME |
119 | unshare - disassociate parts of the process execution context | 126 | unshare - disassociate parts of the process execution context |
120 | 127 | ||
@@ -124,7 +131,7 @@ SYNOPSIS | |||
124 | int unshare(int flags); | 131 | int unshare(int flags); |
125 | 132 | ||
126 | DESCRIPTION | 133 | DESCRIPTION |
127 | unshare allows a process to disassociate parts of its execution | 134 | unshare() allows a process to disassociate parts of its execution |
128 | context that are currently being shared with other processes. Part | 135 | context that are currently being shared with other processes. Part |
129 | of execution context, such as the namespace, is shared by default | 136 | of execution context, such as the namespace, is shared by default |
130 | when a new process is created using fork(2), while other parts, | 137 | when a new process is created using fork(2), while other parts, |
@@ -132,7 +139,7 @@ DESCRIPTION | |||
132 | shared by explicit request to share them when creating a process | 139 | shared by explicit request to share them when creating a process |
133 | using clone(2). | 140 | using clone(2). |
134 | 141 | ||
135 | The main use of unshare is to allow a process to control its | 142 | The main use of unshare() is to allow a process to control its |
136 | shared execution context without creating a new process. | 143 | shared execution context without creating a new process. |
137 | 144 | ||
138 | The flags argument specifies one or bitwise-or'ed of several of | 145 | The flags argument specifies one or bitwise-or'ed of several of |
@@ -176,17 +183,20 @@ SEE ALSO | |||
176 | 183 | ||
177 | 6) High Level Design | 184 | 6) High Level Design |
178 | -------------------- | 185 | -------------------- |
179 | Depending on the flags argument, the unshare system call allocates | 186 | |
187 | Depending on the flags argument, the unshare() system call allocates | ||
180 | appropriate process context structures, populates it with values from | 188 | appropriate process context structures, populates it with values from |
181 | the current shared version, associates newly duplicated structures | 189 | the current shared version, associates newly duplicated structures |
182 | with the current task structure and releases corresponding shared | 190 | with the current task structure and releases corresponding shared |
183 | versions. Helper functions of clone (copy_*) could not be used | 191 | versions. Helper functions of clone (copy_*) could not be used |
184 | directly by unshare because of the following two reasons. | 192 | directly by unshare() because of the following two reasons. |
193 | |||
185 | 1) clone operates on a newly allocated not-yet-active task | 194 | 1) clone operates on a newly allocated not-yet-active task |
186 | structure, where as unshare operates on the current active | 195 | structure, where as unshare() operates on the current active |
187 | task. Therefore unshare has to take appropriate task_lock() | 196 | task. Therefore unshare() has to take appropriate task_lock() |
188 | before associating newly duplicated context structures | 197 | before associating newly duplicated context structures |
189 | 2) unshare has to allocate and duplicate all context structures | 198 | |
199 | 2) unshare() has to allocate and duplicate all context structures | ||
190 | that are being unshared, before associating them with the | 200 | that are being unshared, before associating them with the |
191 | current task and releasing older shared structures. Failure | 201 | current task and releasing older shared structures. Failure |
192 | do so will create race conditions and/or oops when trying | 202 | do so will create race conditions and/or oops when trying |
@@ -202,94 +212,121 @@ Therefore code from copy_* functions that allocated and duplicated | |||
202 | current context structure was moved into new dup_* functions. Now, | 212 | current context structure was moved into new dup_* functions. Now, |
203 | copy_* functions call dup_* functions to allocate and duplicate | 213 | copy_* functions call dup_* functions to allocate and duplicate |
204 | appropriate context structures and then associate them with the | 214 | appropriate context structures and then associate them with the |
205 | task structure that is being constructed. unshare system call on | 215 | task structure that is being constructed. unshare() system call on |
206 | the other hand performs the following: | 216 | the other hand performs the following: |
217 | |||
207 | 1) Check flags to force missing, but implied, flags | 218 | 1) Check flags to force missing, but implied, flags |
208 | 2) For each context structure, call the corresponding unshare | 219 | |
220 | 2) For each context structure, call the corresponding unshare() | ||
209 | helper function to allocate and duplicate a new context | 221 | helper function to allocate and duplicate a new context |
210 | structure, if the appropriate bit is set in the flags argument. | 222 | structure, if the appropriate bit is set in the flags argument. |
223 | |||
211 | 3) If there is no error in allocation and duplication and there | 224 | 3) If there is no error in allocation and duplication and there |
212 | are new context structures then lock the current task structure, | 225 | are new context structures then lock the current task structure, |
213 | associate new context structures with the current task structure, | 226 | associate new context structures with the current task structure, |
214 | and release the lock on the current task structure. | 227 | and release the lock on the current task structure. |
228 | |||
215 | 4) Appropriately release older, shared, context structures. | 229 | 4) Appropriately release older, shared, context structures. |
216 | 230 | ||
217 | 7) Low Level Design | 231 | 7) Low Level Design |
218 | ------------------- | 232 | ------------------- |
219 | Implementation of unshare can be grouped in the following 4 different | 233 | |
234 | Implementation of unshare() can be grouped in the following 4 different | ||
220 | items: | 235 | items: |
236 | |||
221 | a) Reorganization of existing copy_* functions | 237 | a) Reorganization of existing copy_* functions |
222 | b) unshare system call service function | 238 | |
223 | c) unshare helper functions for each different process context | 239 | b) unshare() system call service function |
240 | |||
241 | c) unshare() helper functions for each different process context | ||
242 | |||
224 | d) Registration of system call number for different architectures | 243 | d) Registration of system call number for different architectures |
225 | 244 | ||
226 | 7.1) Reorganization of copy_* functions | 245 | 7.1) Reorganization of copy_* functions |
227 | Each copy function such as copy_mm, copy_namespace, copy_files, | 246 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
228 | etc, had roughly two components. The first component allocated | 247 | |
229 | and duplicated the appropriate structure and the second component | 248 | Each copy function such as copy_mm, copy_namespace, copy_files, |
230 | linked it to the task structure passed in as an argument to the copy | 249 | etc, had roughly two components. The first component allocated |
231 | function. The first component was split into its own function. | 250 | and duplicated the appropriate structure and the second component |
232 | These dup_* functions allocated and duplicated the appropriate | 251 | linked it to the task structure passed in as an argument to the copy |
233 | context structure. The reorganized copy_* functions invoked | 252 | function. The first component was split into its own function. |
234 | their corresponding dup_* functions and then linked the newly | 253 | These dup_* functions allocated and duplicated the appropriate |
235 | duplicated structures to the task structure with which the | 254 | context structure. The reorganized copy_* functions invoked |
236 | copy function was called. | 255 | their corresponding dup_* functions and then linked the newly |
237 | 256 | duplicated structures to the task structure with which the | |
238 | 7.2) unshare system call service function | 257 | copy function was called. |
258 | |||
259 | 7.2) unshare() system call service function | ||
260 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
261 | |||
239 | * Check flags | 262 | * Check flags |
240 | Force implied flags. If CLONE_THREAD is set force CLONE_VM. | 263 | Force implied flags. If CLONE_THREAD is set force CLONE_VM. |
241 | If CLONE_VM is set, force CLONE_SIGHAND. If CLONE_SIGHAND is | 264 | If CLONE_VM is set, force CLONE_SIGHAND. If CLONE_SIGHAND is |
242 | set and signals are also being shared, force CLONE_THREAD. If | 265 | set and signals are also being shared, force CLONE_THREAD. If |
243 | CLONE_NEWNS is set, force CLONE_FS. | 266 | CLONE_NEWNS is set, force CLONE_FS. |
267 | |||
244 | * For each context flag, invoke the corresponding unshare_* | 268 | * For each context flag, invoke the corresponding unshare_* |
245 | helper routine with flags passed into the system call and a | 269 | helper routine with flags passed into the system call and a |
246 | reference to pointer pointing the new unshared structure | 270 | reference to pointer pointing the new unshared structure |
271 | |||
247 | * If any new structures are created by unshare_* helper | 272 | * If any new structures are created by unshare_* helper |
248 | functions, take the task_lock() on the current task, | 273 | functions, take the task_lock() on the current task, |
249 | modify appropriate context pointers, and release the | 274 | modify appropriate context pointers, and release the |
250 | task lock. | 275 | task lock. |
276 | |||
251 | * For all newly unshared structures, release the corresponding | 277 | * For all newly unshared structures, release the corresponding |
252 | older, shared, structures. | 278 | older, shared, structures. |
253 | 279 | ||
254 | 7.3) unshare_* helper functions | 280 | 7.3) unshare_* helper functions |
255 | For unshare_* helpers corresponding to CLONE_SYSVSEM, CLONE_SIGHAND, | 281 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
256 | and CLONE_THREAD, return -EINVAL since they are not implemented yet. | ||
257 | For others, check the flag value to see if the unsharing is | ||
258 | required for that structure. If it is, invoke the corresponding | ||
259 | dup_* function to allocate and duplicate the structure and return | ||
260 | a pointer to it. | ||
261 | 282 | ||
262 | 7.4) Appropriately modify architecture specific code to register the | 283 | For unshare_* helpers corresponding to CLONE_SYSVSEM, CLONE_SIGHAND, |
263 | new system call. | 284 | and CLONE_THREAD, return -EINVAL since they are not implemented yet. |
285 | For others, check the flag value to see if the unsharing is | ||
286 | required for that structure. If it is, invoke the corresponding | ||
287 | dup_* function to allocate and duplicate the structure and return | ||
288 | a pointer to it. | ||
289 | |||
290 | 7.4) Finally | ||
291 | ~~~~~~~~~~~~ | ||
292 | |||
293 | Appropriately modify architecture specific code to register the | ||
294 | new system call. | ||
264 | 295 | ||
265 | 8) Test Specification | 296 | 8) Test Specification |
266 | --------------------- | 297 | --------------------- |
267 | The test for unshare should test the following: | 298 | |
299 | The test for unshare() should test the following: | ||
300 | |||
268 | 1) Valid flags: Test to check that clone flags for signal and | 301 | 1) Valid flags: Test to check that clone flags for signal and |
269 | signal handlers, for which unsharing is not implemented | 302 | signal handlers, for which unsharing is not implemented |
270 | yet, return -EINVAL. | 303 | yet, return -EINVAL. |
304 | |||
271 | 2) Missing/implied flags: Test to make sure that if unsharing | 305 | 2) Missing/implied flags: Test to make sure that if unsharing |
272 | namespace without specifying unsharing of filesystem, correctly | 306 | namespace without specifying unsharing of filesystem, correctly |
273 | unshares both namespace and filesystem information. | 307 | unshares both namespace and filesystem information. |
308 | |||
274 | 3) For each of the four (namespace, filesystem, files and vm) | 309 | 3) For each of the four (namespace, filesystem, files and vm) |
275 | supported unsharing, verify that the system call correctly | 310 | supported unsharing, verify that the system call correctly |
276 | unshares the appropriate structure. Verify that unsharing | 311 | unshares the appropriate structure. Verify that unsharing |
277 | them individually as well as in combination with each | 312 | them individually as well as in combination with each |
278 | other works as expected. | 313 | other works as expected. |
314 | |||
279 | 4) Concurrent execution: Use shared memory segments and futex on | 315 | 4) Concurrent execution: Use shared memory segments and futex on |
280 | an address in the shm segment to synchronize execution of | 316 | an address in the shm segment to synchronize execution of |
281 | about 10 threads. Have a couple of threads execute execve, | 317 | about 10 threads. Have a couple of threads execute execve, |
282 | a couple _exit and the rest unshare with different combination | 318 | a couple _exit and the rest unshare with different combination |
283 | of flags. Verify that unsharing is performed as expected and | 319 | of flags. Verify that unsharing is performed as expected and |
284 | that there are no oops or hangs. | 320 | that there are no oops or hangs. |
285 | 321 | ||
286 | 9) Future Work | 322 | 9) Future Work |
287 | -------------- | 323 | -------------- |
288 | The current implementation of unshare does not allow unsharing of | 324 | |
325 | The current implementation of unshare() does not allow unsharing of | ||
289 | signals and signal handlers. Signals are complex to begin with and | 326 | signals and signal handlers. Signals are complex to begin with and |
290 | to unshare signals and/or signal handlers of a currently running | 327 | to unshare signals and/or signal handlers of a currently running |
291 | process is even more complex. If in the future there is a specific | 328 | process is even more complex. If in the future there is a specific |
292 | need to allow unsharing of signals and/or signal handlers, it can | 329 | need to allow unsharing of signals and/or signal handlers, it can |
293 | be incrementally added to unshare without affecting legacy | 330 | be incrementally added to unshare() without affecting legacy |
294 | applications using unshare. | 331 | applications using unshare(). |
295 | 332 | ||
diff --git a/Documentation/vfio-mediated-device.txt b/Documentation/vfio-mediated-device.txt index d226c7a5ba8b..e5e57b40f8af 100644 --- a/Documentation/vfio-mediated-device.txt +++ b/Documentation/vfio-mediated-device.txt | |||
@@ -217,9 +217,9 @@ Directories and files under the sysfs for Each Physical Device | |||
217 | 217 | ||
218 | * [<type-id>] | 218 | * [<type-id>] |
219 | 219 | ||
220 | The [<type-id>] name is created by adding the the device driver string as a | 220 | The [<type-id>] name is created by adding the device driver string as a prefix |
221 | prefix to the string provided by the vendor driver. This format of this name | 221 | to the string provided by the vendor driver. This format of this name is as |
222 | is as follows: | 222 | follows: |
223 | 223 | ||
224 | sprintf(buf, "%s-%s", dev_driver_string(parent->dev), group->name); | 224 | sprintf(buf, "%s-%s", dev_driver_string(parent->dev), group->name); |
225 | 225 | ||
@@ -380,7 +380,7 @@ card. | |||
380 | /dev/ttyS1, UART: 16550A, Port: 0xc150, IRQ: 10 | 380 | /dev/ttyS1, UART: 16550A, Port: 0xc150, IRQ: 10 |
381 | /dev/ttyS2, UART: 16550A, Port: 0xc158, IRQ: 10 | 381 | /dev/ttyS2, UART: 16550A, Port: 0xc158, IRQ: 10 |
382 | 382 | ||
383 | 6. Using a minicom or any terminal enulation program, open port /dev/ttyS1 or | 383 | 6. Using minicom or any terminal emulation program, open port /dev/ttyS1 or |
384 | /dev/ttyS2 with hardware flow control disabled. | 384 | /dev/ttyS2 with hardware flow control disabled. |
385 | 385 | ||
386 | 7. Type data on the minicom terminal or send data to the terminal emulation | 386 | 7. Type data on the minicom terminal or send data to the terminal emulation |
diff --git a/Documentation/zorro.txt b/Documentation/zorro.txt index 90a64d52bea2..d530971beb00 100644 --- a/Documentation/zorro.txt +++ b/Documentation/zorro.txt | |||
@@ -11,7 +11,7 @@ Last revised: September 5, 2003 | |||
11 | The Zorro bus is the bus used in the Amiga family of computers. Thanks to | 11 | The Zorro bus is the bus used in the Amiga family of computers. Thanks to |
12 | AutoConfig(tm), it's 100% Plug-and-Play. | 12 | AutoConfig(tm), it's 100% Plug-and-Play. |
13 | 13 | ||
14 | There are two types of Zorro busses, Zorro II and Zorro III: | 14 | There are two types of Zorro buses, Zorro II and Zorro III: |
15 | 15 | ||
16 | - The Zorro II address space is 24-bit and lies within the first 16 MB of the | 16 | - The Zorro II address space is 24-bit and lies within the first 16 MB of the |
17 | Amiga's address map. | 17 | Amiga's address map. |
diff --git a/MAINTAINERS b/MAINTAINERS index 5f91365ebc0d..24f894eb2a7f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -6036,7 +6036,7 @@ M: Sebastian Reichel <sre@kernel.org> | |||
6036 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git | 6036 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git |
6037 | S: Maintained | 6037 | S: Maintained |
6038 | F: Documentation/ABI/testing/sysfs-bus-hsi | 6038 | F: Documentation/ABI/testing/sysfs-bus-hsi |
6039 | F: Documentation/device-drivers/serial-interfaces.rst | 6039 | F: Documentation/driver-api/hsi.rst |
6040 | F: drivers/hsi/ | 6040 | F: drivers/hsi/ |
6041 | F: include/linux/hsi/ | 6041 | F: include/linux/hsi/ |
6042 | F: include/uapi/linux/hsi/ | 6042 | F: include/uapi/linux/hsi/ |
@@ -172,8 +172,8 @@ MAKEFLAGS += --no-print-directory | |||
172 | # Use 'make C=2' to enable checking of *all* source files, regardless | 172 | # Use 'make C=2' to enable checking of *all* source files, regardless |
173 | # of whether they are re-compiled or not. | 173 | # of whether they are re-compiled or not. |
174 | # | 174 | # |
175 | # See the file "Documentation/sparse.txt" for more details, including | 175 | # See the file "Documentation/dev-tools/sparse.rst" for more details, |
176 | # where to get the "sparse" utility. | 176 | # including where to get the "sparse" utility. |
177 | 177 | ||
178 | ifeq ("$(origin C)", "command line") | 178 | ifeq ("$(origin C)", "command line") |
179 | KBUILD_CHECKSRC = $(C) | 179 | KBUILD_CHECKSRC = $(C) |
diff --git a/block/genhd.c b/block/genhd.c index 9a2d01abfa3b..d252d29fe837 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -271,16 +271,17 @@ void blkdev_show(struct seq_file *seqf, off_t offset) | |||
271 | /** | 271 | /** |
272 | * register_blkdev - register a new block device | 272 | * register_blkdev - register a new block device |
273 | * | 273 | * |
274 | * @major: the requested major device number [1..255]. If @major=0, try to | 274 | * @major: the requested major device number [1..255]. If @major = 0, try to |
275 | * allocate any unused major number. | 275 | * allocate any unused major number. |
276 | * @name: the name of the new block device as a zero terminated string | 276 | * @name: the name of the new block device as a zero terminated string |
277 | * | 277 | * |
278 | * The @name must be unique within the system. | 278 | * The @name must be unique within the system. |
279 | * | 279 | * |
280 | * The return value depends on the @major input parameter. | 280 | * The return value depends on the @major input parameter: |
281 | * | ||
281 | * - if a major device number was requested in range [1..255] then the | 282 | * - if a major device number was requested in range [1..255] then the |
282 | * function returns zero on success, or a negative error code | 283 | * function returns zero on success, or a negative error code |
283 | * - if any unused major number was requested with @major=0 parameter | 284 | * - if any unused major number was requested with @major = 0 parameter |
284 | * then the return value is the allocated major number in range | 285 | * then the return value is the allocated major number in range |
285 | * [1..255] or a negative error code otherwise | 286 | * [1..255] or a negative error code otherwise |
286 | */ | 287 | */ |
diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c index 6684f153ab57..f9f2a0324ecc 100644 --- a/drivers/pci/irq.c +++ b/drivers/pci/irq.c | |||
@@ -31,7 +31,7 @@ static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason) | |||
31 | * driver). | 31 | * driver). |
32 | * | 32 | * |
33 | * Returns: | 33 | * Returns: |
34 | * a suggestion for fixing it (although the driver is not required to | 34 | * a suggestion for fixing it (although the driver is not required to |
35 | * act on this). | 35 | * act on this). |
36 | */ | 36 | */ |
37 | enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev) | 37 | enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev) |
diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c index 65211d1824b7..2bfea9b48366 100644 --- a/drivers/staging/most/hdm-usb/hdm_usb.c +++ b/drivers/staging/most/hdm-usb/hdm_usb.c | |||
@@ -490,7 +490,7 @@ static void hdm_write_completion(struct urb *urb) | |||
490 | * disconnect. In the interval before the hub driver starts disconnect | 490 | * disconnect. In the interval before the hub driver starts disconnect |
491 | * processing, devices may receive such fault reports for every request. | 491 | * processing, devices may receive such fault reports for every request. |
492 | * | 492 | * |
493 | * See <https://www.kernel.org/doc/Documentation/usb/error-codes.txt> | 493 | * See <https://www.kernel.org/doc/Documentation/driver-api/usb/error-codes.rst> |
494 | */ | 494 | */ |
495 | static void hdm_read_completion(struct urb *urb) | 495 | static void hdm_read_completion(struct urb *urb) |
496 | { | 496 | { |
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index 0e5a889742b3..4d75d9a80001 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -26,7 +26,7 @@ config USB_DEFAULT_PERSIST | |||
26 | unplugged, causing any mounted filesystems to be lost. The | 26 | unplugged, causing any mounted filesystems to be lost. The |
27 | persist feature can still be enabled for individual devices | 27 | persist feature can still be enabled for individual devices |
28 | through the power/persist sysfs node. See | 28 | through the power/persist sysfs node. See |
29 | Documentation/usb/persist.txt for more info. | 29 | Documentation/driver-api/usb/persist.rst for more info. |
30 | 30 | ||
31 | If you have any questions about this, say Y here, only say N | 31 | If you have any questions about this, say Y here, only say N |
32 | if you know exactly what you are doing. | 32 | if you know exactly what you are doing. |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 2184ef40a82a..4c38ea41ae96 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -474,6 +474,7 @@ EXPORT_SYMBOL_GPL(usb_sg_init); | |||
474 | * significantly improve USB throughput. | 474 | * significantly improve USB throughput. |
475 | * | 475 | * |
476 | * There are three kinds of completion for this function. | 476 | * There are three kinds of completion for this function. |
477 | * | ||
477 | * (1) success, where io->status is zero. The number of io->bytes | 478 | * (1) success, where io->status is zero. The number of io->bytes |
478 | * transferred is as requested. | 479 | * transferred is as requested. |
479 | * (2) error, where io->status is a negative errno value. The number | 480 | * (2) error, where io->status is a negative errno value. The number |
diff --git a/include/linux/clk.h b/include/linux/clk.h index e9d36b3e49de..024cd07870d0 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
@@ -132,8 +132,8 @@ int clk_get_phase(struct clk *clk); | |||
132 | * @q: clk compared against p | 132 | * @q: clk compared against p |
133 | * | 133 | * |
134 | * Returns true if the two struct clk pointers both point to the same hardware | 134 | * Returns true if the two struct clk pointers both point to the same hardware |
135 | * clock node. Put differently, returns true if struct clk *p and struct clk *q | 135 | * clock node. Put differently, returns true if @p and @q |
136 | * share the same struct clk_core object. | 136 | * share the same &struct clk_core object. |
137 | * | 137 | * |
138 | * Returns false otherwise. Note that two NULL clks are treated as matching. | 138 | * Returns false otherwise. Note that two NULL clks are treated as matching. |
139 | */ | 139 | */ |
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h index b6efb0c64408..11366b3ff0b4 100644 --- a/include/linux/flex_array.h +++ b/include/linux/flex_array.h | |||
@@ -61,16 +61,83 @@ struct flex_array { | |||
61 | FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \ | 61 | FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \ |
62 | } | 62 | } |
63 | 63 | ||
64 | /** | ||
65 | * flex_array_alloc() - Creates a flexible array. | ||
66 | * @element_size: individual object size. | ||
67 | * @total: maximum number of objects which can be stored. | ||
68 | * @flags: GFP flags | ||
69 | * | ||
70 | * Return: Returns an object of structure flex_array. | ||
71 | */ | ||
64 | struct flex_array *flex_array_alloc(int element_size, unsigned int total, | 72 | struct flex_array *flex_array_alloc(int element_size, unsigned int total, |
65 | gfp_t flags); | 73 | gfp_t flags); |
74 | |||
75 | /** | ||
76 | * flex_array_prealloc() - Ensures that memory for the elements indexed in the | ||
77 | * range defined by start and nr_elements has been allocated. | ||
78 | * @fa: array to allocate memory to. | ||
79 | * @start: start address | ||
80 | * @nr_elements: number of elements to be allocated. | ||
81 | * @flags: GFP flags | ||
82 | * | ||
83 | */ | ||
66 | int flex_array_prealloc(struct flex_array *fa, unsigned int start, | 84 | int flex_array_prealloc(struct flex_array *fa, unsigned int start, |
67 | unsigned int nr_elements, gfp_t flags); | 85 | unsigned int nr_elements, gfp_t flags); |
86 | |||
87 | /** | ||
88 | * flex_array_free() - Removes all elements of a flexible array. | ||
89 | * @fa: array to be freed. | ||
90 | */ | ||
68 | void flex_array_free(struct flex_array *fa); | 91 | void flex_array_free(struct flex_array *fa); |
92 | |||
93 | /** | ||
94 | * flex_array_free_parts() - Removes all elements of a flexible array, but | ||
95 | * leaves the array itself in place. | ||
96 | * @fa: array to be emptied. | ||
97 | */ | ||
69 | void flex_array_free_parts(struct flex_array *fa); | 98 | void flex_array_free_parts(struct flex_array *fa); |
99 | |||
100 | /** | ||
101 | * flex_array_put() - Stores data into a flexible array. | ||
102 | * @fa: array where element is to be stored. | ||
103 | * @element_nr: position to copy, must be less than the maximum specified when | ||
104 | * the array was created. | ||
105 | * @src: data source to be copied into the array. | ||
106 | * @flags: GFP flags | ||
107 | * | ||
108 | * Return: Returns zero on success, a negative error code otherwise. | ||
109 | */ | ||
70 | int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, | 110 | int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, |
71 | gfp_t flags); | 111 | gfp_t flags); |
112 | |||
113 | /** | ||
114 | * flex_array_clear() - Clears an individual element in the array, sets the | ||
115 | * given element to FLEX_ARRAY_FREE. | ||
116 | * @element_nr: element position to clear. | ||
117 | * @fa: array to which element to be cleared belongs. | ||
118 | * | ||
119 | * Return: Returns zero on success, -EINVAL otherwise. | ||
120 | */ | ||
72 | int flex_array_clear(struct flex_array *fa, unsigned int element_nr); | 121 | int flex_array_clear(struct flex_array *fa, unsigned int element_nr); |
122 | |||
123 | /** | ||
124 | * flex_array_get() - Retrieves data into a flexible array. | ||
125 | * | ||
126 | * @element_nr: Element position to retrieve data from. | ||
127 | * @fa: array from which data is to be retrieved. | ||
128 | * | ||
129 | * Return: Returns a pointer to the data element, or NULL if that | ||
130 | * particular element has never been allocated. | ||
131 | */ | ||
73 | void *flex_array_get(struct flex_array *fa, unsigned int element_nr); | 132 | void *flex_array_get(struct flex_array *fa, unsigned int element_nr); |
133 | |||
134 | /** | ||
135 | * flex_array_shrink() - Reduces the allocated size of an array. | ||
136 | * @fa: array to shrink. | ||
137 | * | ||
138 | * Return: Returns number of pages of memory actually freed. | ||
139 | * | ||
140 | */ | ||
74 | int flex_array_shrink(struct flex_array *fa); | 141 | int flex_array_shrink(struct flex_array *fa); |
75 | 142 | ||
76 | #define flex_array_put_ptr(fa, nr, src, gfp) \ | 143 | #define flex_array_put_ptr(fa, nr, src, gfp) \ |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 4616a49a1c2e..f665d2ceac20 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -451,6 +451,7 @@ static inline struct usb_composite_driver *to_cdriver( | |||
451 | * sure doing that won't hurt too much. | 451 | * sure doing that won't hurt too much. |
452 | * | 452 | * |
453 | * One notion for how to handle Wireless USB devices involves: | 453 | * One notion for how to handle Wireless USB devices involves: |
454 | * | ||
454 | * (a) a second gadget here, discovery mechanism TBD, but likely | 455 | * (a) a second gadget here, discovery mechanism TBD, but likely |
455 | * needing separate "register/unregister WUSB gadget" calls; | 456 | * needing separate "register/unregister WUSB gadget" calls; |
456 | * (b) updates to usb_gadget to include flags "is it wireless", | 457 | * (b) updates to usb_gadget to include flags "is it wireless", |
@@ -503,8 +504,9 @@ struct usb_composite_dev { | |||
503 | /* protects deactivations and delayed_status counts*/ | 504 | /* protects deactivations and delayed_status counts*/ |
504 | spinlock_t lock; | 505 | spinlock_t lock; |
505 | 506 | ||
506 | unsigned setup_pending:1; | 507 | /* public: */ |
507 | unsigned os_desc_pending:1; | 508 | unsigned int setup_pending:1; |
509 | unsigned int os_desc_pending:1; | ||
508 | }; | 510 | }; |
509 | 511 | ||
510 | extern int usb_string_id(struct usb_composite_dev *c); | 512 | extern int usb_string_id(struct usb_composite_dev *c); |
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index e4516e9ded0f..fbc22a39e7bc 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -188,7 +188,7 @@ struct usb_ep_caps { | |||
188 | * @caps:The structure describing types and directions supported by endoint. | 188 | * @caps:The structure describing types and directions supported by endoint. |
189 | * @maxpacket:The maximum packet size used on this endpoint. The initial | 189 | * @maxpacket:The maximum packet size used on this endpoint. The initial |
190 | * value can sometimes be reduced (hardware allowing), according to | 190 | * value can sometimes be reduced (hardware allowing), according to |
191 | * the endpoint descriptor used to configure the endpoint. | 191 | * the endpoint descriptor used to configure the endpoint. |
192 | * @maxpacket_limit:The maximum packet size value which can be handled by this | 192 | * @maxpacket_limit:The maximum packet size value which can be handled by this |
193 | * endpoint. It's set once by UDC driver when endpoint is initialized, and | 193 | * endpoint. It's set once by UDC driver when endpoint is initialized, and |
194 | * should not be changed. Should not be confused with maxpacket. | 194 | * should not be changed. Should not be confused with maxpacket. |
diff --git a/ipc/util.c b/ipc/util.c index 798cad18dd87..3459a16a9df9 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -474,7 +474,7 @@ void ipc_rcu_free(struct rcu_head *head) | |||
474 | * Check user, group, other permissions for access | 474 | * Check user, group, other permissions for access |
475 | * to ipc resources. return 0 if allowed | 475 | * to ipc resources. return 0 if allowed |
476 | * | 476 | * |
477 | * @flag will most probably be 0 or S_...UGO from <linux/stat.h> | 477 | * @flag will most probably be 0 or ``S_...UGO`` from <linux/stat.h> |
478 | */ | 478 | */ |
479 | int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flag) | 479 | int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flag) |
480 | { | 480 | { |
@@ -672,10 +672,12 @@ int ipc_update_perm(struct ipc64_perm *in, struct kern_ipc_perm *out) | |||
672 | * | 672 | * |
673 | * This function does some common audit and permissions check for some IPC_XXX | 673 | * This function does some common audit and permissions check for some IPC_XXX |
674 | * cmd and is called from semctl_down, shmctl_down and msgctl_down. | 674 | * cmd and is called from semctl_down, shmctl_down and msgctl_down. |
675 | * It must be called without any lock held and | 675 | * It must be called without any lock held and: |
676 | * - retrieves the ipc with the given id in the given table. | 676 | * |
677 | * - performs some audit and permission check, depending on the given cmd | 677 | * - retrieves the ipc with the given id in the given table. |
678 | * - returns a pointer to the ipc object or otherwise, the corresponding error. | 678 | * - performs some audit and permission check, depending on the given cmd |
679 | * - returns a pointer to the ipc object or otherwise, the corresponding | ||
680 | * error. | ||
679 | * | 681 | * |
680 | * Call holding the both the rwsem and the rcu read lock. | 682 | * Call holding the both the rwsem and the rcu read lock. |
681 | */ | 683 | */ |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 2598a32d2db1..e2a617e09ab7 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -130,7 +130,8 @@ config DYNAMIC_DEBUG | |||
130 | nullarbor:~ # echo -n 'func svc_process -p' > | 130 | nullarbor:~ # echo -n 'func svc_process -p' > |
131 | <debugfs>/dynamic_debug/control | 131 | <debugfs>/dynamic_debug/control |
132 | 132 | ||
133 | See Documentation/dynamic-debug-howto.txt for additional information. | 133 | See Documentation/admin-guide/dynamic-debug-howto.rst for additional |
134 | information. | ||
134 | 135 | ||
135 | endmenu # "printk and dmesg options" | 136 | endmenu # "printk and dmesg options" |
136 | 137 | ||
@@ -404,8 +405,8 @@ config MAGIC_SYSRQ | |||
404 | by pressing various keys while holding SysRq (Alt+PrintScreen). It | 405 | by pressing various keys while holding SysRq (Alt+PrintScreen). It |
405 | also works on a serial console (on PC hardware at least), if you | 406 | also works on a serial console (on PC hardware at least), if you |
406 | send a BREAK and then within 5 seconds a command keypress. The | 407 | send a BREAK and then within 5 seconds a command keypress. The |
407 | keys are documented in <file:Documentation/sysrq.txt>. Don't say Y | 408 | keys are documented in <file:Documentation/admin-guide/sysrq.rst>. |
408 | unless you really know what this hack does. | 409 | Don't say Y unless you really know what this hack does. |
409 | 410 | ||
410 | config MAGIC_SYSRQ_DEFAULT_ENABLE | 411 | config MAGIC_SYSRQ_DEFAULT_ENABLE |
411 | hex "Enable magic SysRq key functions by default" | 412 | hex "Enable magic SysRq key functions by default" |
@@ -414,7 +415,7 @@ config MAGIC_SYSRQ_DEFAULT_ENABLE | |||
414 | help | 415 | help |
415 | Specifies which SysRq key functions are enabled by default. | 416 | Specifies which SysRq key functions are enabled by default. |
416 | This may be set to 1 or 0 to enable or disable them all, or | 417 | This may be set to 1 or 0 to enable or disable them all, or |
417 | to a bitmask as described in Documentation/sysrq.txt. | 418 | to a bitmask as described in Documentation/admin-guide/sysrq.rst. |
418 | 419 | ||
419 | config MAGIC_SYSRQ_SERIAL | 420 | config MAGIC_SYSRQ_SERIAL |
420 | bool "Enable magic SysRq key over serial" | 421 | bool "Enable magic SysRq key over serial" |
diff --git a/lib/bitmap.c b/lib/bitmap.c index 0b66f0e5eb6b..08c6ef3a2b6f 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -502,11 +502,11 @@ EXPORT_SYMBOL(bitmap_print_to_pagebuf); | |||
502 | * Syntax: range:used_size/group_size | 502 | * Syntax: range:used_size/group_size |
503 | * Example: 0-1023:2/256 ==> 0,1,256,257,512,513,768,769 | 503 | * Example: 0-1023:2/256 ==> 0,1,256,257,512,513,768,769 |
504 | * | 504 | * |
505 | * Returns 0 on success, -errno on invalid input strings. | 505 | * Returns: 0 on success, -errno on invalid input strings. Error values: |
506 | * Error values: | 506 | * |
507 | * %-EINVAL: second number in range smaller than first | 507 | * - ``-EINVAL``: second number in range smaller than first |
508 | * %-EINVAL: invalid character in string | 508 | * - ``-EINVAL``: invalid character in string |
509 | * %-ERANGE: bit number specified too large for mask | 509 | * - ``-ERANGE``: bit number specified too large for mask |
510 | */ | 510 | */ |
511 | static int __bitmap_parselist(const char *buf, unsigned int buflen, | 511 | static int __bitmap_parselist(const char *buf, unsigned int buflen, |
512 | int is_user, unsigned long *maskp, | 512 | int is_user, unsigned long *maskp, |
@@ -864,14 +864,16 @@ EXPORT_SYMBOL(bitmap_bitremap); | |||
864 | * 11 was set in @orig had no affect on @dst. | 864 | * 11 was set in @orig had no affect on @dst. |
865 | * | 865 | * |
866 | * Example [2] for bitmap_fold() + bitmap_onto(): | 866 | * Example [2] for bitmap_fold() + bitmap_onto(): |
867 | * Let's say @relmap has these ten bits set: | 867 | * Let's say @relmap has these ten bits set:: |
868 | * | ||
868 | * 40 41 42 43 45 48 53 61 74 95 | 869 | * 40 41 42 43 45 48 53 61 74 95 |
870 | * | ||
869 | * (for the curious, that's 40 plus the first ten terms of the | 871 | * (for the curious, that's 40 plus the first ten terms of the |
870 | * Fibonacci sequence.) | 872 | * Fibonacci sequence.) |
871 | * | 873 | * |
872 | * Further lets say we use the following code, invoking | 874 | * Further lets say we use the following code, invoking |
873 | * bitmap_fold() then bitmap_onto, as suggested above to | 875 | * bitmap_fold() then bitmap_onto, as suggested above to |
874 | * avoid the possibility of an empty @dst result: | 876 | * avoid the possibility of an empty @dst result:: |
875 | * | 877 | * |
876 | * unsigned long *tmp; // a temporary bitmap's bits | 878 | * unsigned long *tmp; // a temporary bitmap's bits |
877 | * | 879 | * |
@@ -882,22 +884,26 @@ EXPORT_SYMBOL(bitmap_bitremap); | |||
882 | * various @orig's. I list the zero-based positions of each set bit. | 884 | * various @orig's. I list the zero-based positions of each set bit. |
883 | * The tmp column shows the intermediate result, as computed by | 885 | * The tmp column shows the intermediate result, as computed by |
884 | * using bitmap_fold() to fold the @orig bitmap modulo ten | 886 | * using bitmap_fold() to fold the @orig bitmap modulo ten |
885 | * (the weight of @relmap). | 887 | * (the weight of @relmap): |
886 | * | 888 | * |
889 | * =============== ============== ================= | ||
887 | * @orig tmp @dst | 890 | * @orig tmp @dst |
888 | * 0 0 40 | 891 | * 0 0 40 |
889 | * 1 1 41 | 892 | * 1 1 41 |
890 | * 9 9 95 | 893 | * 9 9 95 |
891 | * 10 0 40 (*) | 894 | * 10 0 40 [#f1]_ |
892 | * 1 3 5 7 1 3 5 7 41 43 48 61 | 895 | * 1 3 5 7 1 3 5 7 41 43 48 61 |
893 | * 0 1 2 3 4 0 1 2 3 4 40 41 42 43 45 | 896 | * 0 1 2 3 4 0 1 2 3 4 40 41 42 43 45 |
894 | * 0 9 18 27 0 9 8 7 40 61 74 95 | 897 | * 0 9 18 27 0 9 8 7 40 61 74 95 |
895 | * 0 10 20 30 0 40 | 898 | * 0 10 20 30 0 40 |
896 | * 0 11 22 33 0 1 2 3 40 41 42 43 | 899 | * 0 11 22 33 0 1 2 3 40 41 42 43 |
897 | * 0 12 24 36 0 2 4 6 40 42 45 53 | 900 | * 0 12 24 36 0 2 4 6 40 42 45 53 |
898 | * 78 102 211 1 2 8 41 42 74 (*) | 901 | * 78 102 211 1 2 8 41 42 74 [#f1]_ |
902 | * =============== ============== ================= | ||
903 | * | ||
904 | * .. [#f1] | ||
899 | * | 905 | * |
900 | * (*) For these marked lines, if we hadn't first done bitmap_fold() | 906 | * For these marked lines, if we hadn't first done bitmap_fold() |
901 | * into tmp, then the @dst result would have been empty. | 907 | * into tmp, then the @dst result would have been empty. |
902 | * | 908 | * |
903 | * If either of @orig or @relmap is empty (no set bits), then @dst | 909 | * If either of @orig or @relmap is empty (no set bits), then @dst |
diff --git a/lib/string.c b/lib/string.c index ed83562a53ae..b5c9a1168d3a 100644 --- a/lib/string.c +++ b/lib/string.c | |||
@@ -131,7 +131,7 @@ EXPORT_SYMBOL(strncpy); | |||
131 | * @src: Where to copy the string from | 131 | * @src: Where to copy the string from |
132 | * @size: size of destination buffer | 132 | * @size: size of destination buffer |
133 | * | 133 | * |
134 | * Compatible with *BSD: the result is always a valid | 134 | * Compatible with ``*BSD``: the result is always a valid |
135 | * NUL-terminated string that fits in the buffer (unless, | 135 | * NUL-terminated string that fits in the buffer (unless, |
136 | * of course, the buffer size is zero). It does not pad | 136 | * of course, the buffer size is zero). It does not pad |
137 | * out the result like strncpy() does. | 137 | * out the result like strncpy() does. |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index e3bf4e0f10b5..176641cc549d 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -1954,13 +1954,13 @@ set_precision(struct printf_spec *spec, int prec) | |||
1954 | * This function generally follows C99 vsnprintf, but has some | 1954 | * This function generally follows C99 vsnprintf, but has some |
1955 | * extensions and a few limitations: | 1955 | * extensions and a few limitations: |
1956 | * | 1956 | * |
1957 | * %n is unsupported | 1957 | * - ``%n`` is unsupported |
1958 | * %p* is handled by pointer() | 1958 | * - ``%p*`` is handled by pointer() |
1959 | * | 1959 | * |
1960 | * See pointer() or Documentation/printk-formats.txt for more | 1960 | * See pointer() or Documentation/printk-formats.txt for more |
1961 | * extensive description. | 1961 | * extensive description. |
1962 | * | 1962 | * |
1963 | * ** Please update the documentation in both places when making changes ** | 1963 | * **Please update the documentation in both places when making changes** |
1964 | * | 1964 | * |
1965 | * The return value is the number of characters which would | 1965 | * The return value is the number of characters which would |
1966 | * be generated for the given input, excluding the trailing | 1966 | * be generated for the given input, excluding the trailing |
diff --git a/mm/filemap.c b/mm/filemap.c index 1694623a6289..c5808b7a5fb1 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -519,7 +519,7 @@ EXPORT_SYMBOL(filemap_write_and_wait); | |||
519 | * | 519 | * |
520 | * Write out and wait upon file offsets lstart->lend, inclusive. | 520 | * Write out and wait upon file offsets lstart->lend, inclusive. |
521 | * | 521 | * |
522 | * Note that `lend' is inclusive (describes the last byte to be written) so | 522 | * Note that @lend is inclusive (describes the last byte to be written) so |
523 | * that this function can be used to write to the very end-of-file (end = -1). | 523 | * that this function can be used to write to the very end-of-file (end = -1). |
524 | */ | 524 | */ |
525 | int filemap_write_and_wait_range(struct address_space *mapping, | 525 | int filemap_write_and_wait_range(struct address_space *mapping, |
@@ -1277,12 +1277,14 @@ EXPORT_SYMBOL(find_lock_entry); | |||
1277 | * | 1277 | * |
1278 | * PCG flags modify how the page is returned. | 1278 | * PCG flags modify how the page is returned. |
1279 | * | 1279 | * |
1280 | * FGP_ACCESSED: the page will be marked accessed | 1280 | * @fgp_flags can be: |
1281 | * FGP_LOCK: Page is return locked | 1281 | * |
1282 | * FGP_CREAT: If page is not present then a new page is allocated using | 1282 | * - FGP_ACCESSED: the page will be marked accessed |
1283 | * @gfp_mask and added to the page cache and the VM's LRU | 1283 | * - FGP_LOCK: Page is return locked |
1284 | * list. The page is returned locked and with an increased | 1284 | * - FGP_CREAT: If page is not present then a new page is allocated using |
1285 | * refcount. Otherwise, %NULL is returned. | 1285 | * @gfp_mask and added to the page cache and the VM's LRU |
1286 | * list. The page is returned locked and with an increased | ||
1287 | * refcount. Otherwise, NULL is returned. | ||
1286 | * | 1288 | * |
1287 | * If FGP_LOCK or FGP_CREAT are specified then the function may sleep even | 1289 | * If FGP_LOCK or FGP_CREAT are specified then the function may sleep even |
1288 | * if the GFP flags specified for FGP_CREAT are atomic. | 1290 | * if the GFP flags specified for FGP_CREAT are atomic. |
@@ -3001,7 +3003,7 @@ EXPORT_SYMBOL(generic_file_write_iter); | |||
3001 | * @gfp_mask: memory allocation flags (and I/O mode) | 3003 | * @gfp_mask: memory allocation flags (and I/O mode) |
3002 | * | 3004 | * |
3003 | * The address_space is to try to release any data against the page | 3005 | * The address_space is to try to release any data against the page |
3004 | * (presumably at page->private). If the release was successful, return `1'. | 3006 | * (presumably at page->private). If the release was successful, return '1'. |
3005 | * Otherwise return zero. | 3007 | * Otherwise return zero. |
3006 | * | 3008 | * |
3007 | * This may also be called if PG_fscache is set on a page, indicating that the | 3009 | * This may also be called if PG_fscache is set on a page, indicating that the |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 07efbc3a8656..bd01501efab9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -4247,7 +4247,8 @@ EXPORT_SYMBOL(free_pages_exact); | |||
4247 | * nr_free_zone_pages() counts the number of counts pages which are beyond the | 4247 | * nr_free_zone_pages() counts the number of counts pages which are beyond the |
4248 | * high watermark within all zones at or below a given zone index. For each | 4248 | * high watermark within all zones at or below a given zone index. For each |
4249 | * zone, the number of pages is calculated as: | 4249 | * zone, the number of pages is calculated as: |
4250 | * managed_pages - high_pages | 4250 | * |
4251 | * nr_free_zone_pages = managed_pages - high_pages | ||
4251 | */ | 4252 | */ |
4252 | static unsigned long nr_free_zone_pages(int offset) | 4253 | static unsigned long nr_free_zone_pages(int offset) |
4253 | { | 4254 | { |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 0b057628a7ba..b52aeed3f58e 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -1579,7 +1579,7 @@ void vfree_atomic(const void *addr) | |||
1579 | * have CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG, but making the calling | 1579 | * have CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG, but making the calling |
1580 | * conventions for vfree() arch-depenedent would be a really bad idea) | 1580 | * conventions for vfree() arch-depenedent would be a really bad idea) |
1581 | * | 1581 | * |
1582 | * NOTE: assumes that the object at *addr has a size >= sizeof(llist_node) | 1582 | * NOTE: assumes that the object at @addr has a size >= sizeof(llist_node) |
1583 | */ | 1583 | */ |
1584 | void vfree(const void *addr) | 1584 | void vfree(const void *addr) |
1585 | { | 1585 | { |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 33c85dfdfce9..a26a5f2dce39 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -202,6 +202,7 @@ EOF | |||
202 | # '&struct_name.member' - name of a structure member | 202 | # '&struct_name.member' - name of a structure member |
203 | # '@parameter' - name of a parameter | 203 | # '@parameter' - name of a parameter |
204 | # '%CONST' - name of a constant. | 204 | # '%CONST' - name of a constant. |
205 | # '``LITERAL``' - literal string without any spaces on it. | ||
205 | 206 | ||
206 | ## init lots of data | 207 | ## init lots of data |
207 | 208 | ||
@@ -210,7 +211,8 @@ my $warnings = 0; | |||
210 | my $anon_struct_union = 0; | 211 | my $anon_struct_union = 0; |
211 | 212 | ||
212 | # match expressions used to find embedded type information | 213 | # match expressions used to find embedded type information |
213 | my $type_constant = '\%([-_\w]+)'; | 214 | my $type_constant = '\b``([^\`]+)``\b'; |
215 | my $type_constant2 = '\%([-_\w]+)'; | ||
214 | my $type_func = '(\w+)\(\)'; | 216 | my $type_func = '(\w+)\(\)'; |
215 | my $type_param = '\@(\w+(\.\.\.)?)'; | 217 | my $type_param = '\@(\w+(\.\.\.)?)'; |
216 | my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params | 218 | my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params |
@@ -235,6 +237,7 @@ my $type_member_func = $type_member . '\(\)'; | |||
235 | # these work fairly well | 237 | # these work fairly well |
236 | my @highlights_html = ( | 238 | my @highlights_html = ( |
237 | [$type_constant, "<i>\$1</i>"], | 239 | [$type_constant, "<i>\$1</i>"], |
240 | [$type_constant2, "<i>\$1</i>"], | ||
238 | [$type_func, "<b>\$1</b>"], | 241 | [$type_func, "<b>\$1</b>"], |
239 | [$type_enum_xml, "<i>\$1</i>"], | 242 | [$type_enum_xml, "<i>\$1</i>"], |
240 | [$type_struct_xml, "<i>\$1</i>"], | 243 | [$type_struct_xml, "<i>\$1</i>"], |
@@ -252,6 +255,7 @@ my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" | |||
252 | # html version 5 | 255 | # html version 5 |
253 | my @highlights_html5 = ( | 256 | my @highlights_html5 = ( |
254 | [$type_constant, "<span class=\"const\">\$1</span>"], | 257 | [$type_constant, "<span class=\"const\">\$1</span>"], |
258 | [$type_constant2, "<span class=\"const\">\$1</span>"], | ||
255 | [$type_func, "<span class=\"func\">\$1</span>"], | 259 | [$type_func, "<span class=\"func\">\$1</span>"], |
256 | [$type_enum_xml, "<span class=\"enum\">\$1</span>"], | 260 | [$type_enum_xml, "<span class=\"enum\">\$1</span>"], |
257 | [$type_struct_xml, "<span class=\"struct\">\$1</span>"], | 261 | [$type_struct_xml, "<span class=\"struct\">\$1</span>"], |
@@ -268,6 +272,7 @@ my $blankline_html5 = $local_lt . "br /" . $local_gt; | |||
268 | my @highlights_xml = ( | 272 | my @highlights_xml = ( |
269 | ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"], | 273 | ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"], |
270 | [$type_constant, "<constant>\$1</constant>"], | 274 | [$type_constant, "<constant>\$1</constant>"], |
275 | [$type_constant2, "<constant>\$1</constant>"], | ||
271 | [$type_enum_xml, "<type>\$1</type>"], | 276 | [$type_enum_xml, "<type>\$1</type>"], |
272 | [$type_struct_xml, "<structname>\$1</structname>"], | 277 | [$type_struct_xml, "<structname>\$1</structname>"], |
273 | [$type_typedef_xml, "<type>\$1</type>"], | 278 | [$type_typedef_xml, "<type>\$1</type>"], |
@@ -283,6 +288,7 @@ my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $loca | |||
283 | # gnome, docbook format | 288 | # gnome, docbook format |
284 | my @highlights_gnome = ( | 289 | my @highlights_gnome = ( |
285 | [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"], | 290 | [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"], |
291 | [$type_constant2, "<replaceable class=\"option\">\$1</replaceable>"], | ||
286 | [$type_func, "<function>\$1</function>"], | 292 | [$type_func, "<function>\$1</function>"], |
287 | [$type_enum, "<type>\$1</type>"], | 293 | [$type_enum, "<type>\$1</type>"], |
288 | [$type_struct, "<structname>\$1</structname>"], | 294 | [$type_struct, "<structname>\$1</structname>"], |
@@ -298,6 +304,7 @@ my $blankline_gnome = "</para><para>\n"; | |||
298 | # these are pretty rough | 304 | # these are pretty rough |
299 | my @highlights_man = ( | 305 | my @highlights_man = ( |
300 | [$type_constant, "\$1"], | 306 | [$type_constant, "\$1"], |
307 | [$type_constant2, "\$1"], | ||
301 | [$type_func, "\\\\fB\$1\\\\fP"], | 308 | [$type_func, "\\\\fB\$1\\\\fP"], |
302 | [$type_enum, "\\\\fI\$1\\\\fP"], | 309 | [$type_enum, "\\\\fI\$1\\\\fP"], |
303 | [$type_struct, "\\\\fI\$1\\\\fP"], | 310 | [$type_struct, "\\\\fI\$1\\\\fP"], |
@@ -312,6 +319,7 @@ my $blankline_man = ""; | |||
312 | # text-mode | 319 | # text-mode |
313 | my @highlights_text = ( | 320 | my @highlights_text = ( |
314 | [$type_constant, "\$1"], | 321 | [$type_constant, "\$1"], |
322 | [$type_constant2, "\$1"], | ||
315 | [$type_func, "\$1"], | 323 | [$type_func, "\$1"], |
316 | [$type_enum, "\$1"], | 324 | [$type_enum, "\$1"], |
317 | [$type_struct, "\$1"], | 325 | [$type_struct, "\$1"], |
@@ -326,6 +334,7 @@ my $blankline_text = ""; | |||
326 | # rst-mode | 334 | # rst-mode |
327 | my @highlights_rst = ( | 335 | my @highlights_rst = ( |
328 | [$type_constant, "``\$1``"], | 336 | [$type_constant, "``\$1``"], |
337 | [$type_constant2, "``\$1``"], | ||
329 | # Note: need to escape () to avoid func matching later | 338 | # Note: need to escape () to avoid func matching later |
330 | [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], | 339 | [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], |
331 | [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], | 340 | [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], |
@@ -344,6 +353,7 @@ my $blankline_rst = "\n"; | |||
344 | # list mode | 353 | # list mode |
345 | my @highlights_list = ( | 354 | my @highlights_list = ( |
346 | [$type_constant, "\$1"], | 355 | [$type_constant, "\$1"], |
356 | [$type_constant2, "\$1"], | ||
347 | [$type_func, "\$1"], | 357 | [$type_func, "\$1"], |
348 | [$type_enum, "\$1"], | 358 | [$type_enum, "\$1"], |
349 | [$type_struct, "\$1"], | 359 | [$type_struct, "\$1"], |
@@ -2392,8 +2402,7 @@ sub push_parameter($$$) { | |||
2392 | } | 2402 | } |
2393 | 2403 | ||
2394 | $anon_struct_union = 0; | 2404 | $anon_struct_union = 0; |
2395 | my $param_name = $param; | 2405 | $param =~ s/[\[\)].*//; |
2396 | $param_name =~ s/\[.*//; | ||
2397 | 2406 | ||
2398 | if ($type eq "" && $param =~ /\.\.\.$/) | 2407 | if ($type eq "" && $param =~ /\.\.\.$/) |
2399 | { | 2408 | { |
@@ -2424,9 +2433,9 @@ sub push_parameter($$$) { | |||
2424 | # but inline preprocessor statements); | 2433 | # but inline preprocessor statements); |
2425 | # also ignore unnamed structs/unions; | 2434 | # also ignore unnamed structs/unions; |
2426 | if (!$anon_struct_union) { | 2435 | if (!$anon_struct_union) { |
2427 | if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) { | 2436 | if (!defined $parameterdescs{$param} && $param !~ /^#/) { |
2428 | 2437 | ||
2429 | $parameterdescs{$param_name} = $undescribed; | 2438 | $parameterdescs{$param} = $undescribed; |
2430 | 2439 | ||
2431 | if (($type eq 'function') || ($type eq 'enum')) { | 2440 | if (($type eq 'function') || ($type eq 'enum')) { |
2432 | print STDERR "${file}:$.: warning: Function parameter ". | 2441 | print STDERR "${file}:$.: warning: Function parameter ". |
diff --git a/security/security.c b/security/security.c index d0e07f269b2d..23555c5504f6 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -103,10 +103,14 @@ static int lsm_append(char *new, char **result) | |||
103 | * to avoid security registration races. This method may also be used | 103 | * to avoid security registration races. This method may also be used |
104 | * to check if your LSM is currently loaded during kernel initialization. | 104 | * to check if your LSM is currently loaded during kernel initialization. |
105 | * | 105 | * |
106 | * Return true if: | 106 | * Returns: |
107 | * -The passed LSM is the one chosen by user at boot time, | 107 | * |
108 | * -or the passed LSM is configured as the default and the user did not | 108 | * true if: |
109 | * choose an alternate LSM at boot time. | 109 | * |
110 | * - The passed LSM is the one chosen by user at boot time, | ||
111 | * - or the passed LSM is configured as the default and the user did not | ||
112 | * choose an alternate LSM at boot time. | ||
113 | * | ||
110 | * Otherwise, return false. | 114 | * Otherwise, return false. |
111 | */ | 115 | */ |
112 | int __init security_module_enable(const char *module) | 116 | int __init security_module_enable(const char *module) |